mrc-ide / covid-sim

This is the COVID-19 CovidSim microsimulation model developed by the MRC Centre for Global Infectious Disease Analysis hosted at Imperial College, London.
GNU General Public License v3.0
1.23k stars 257 forks source link

Refactor DigitalContactTracingSweep #417

Open DavidVernest opened 4 years ago

DavidVernest commented 4 years ago

Refactor the DigitalContactTracingSweep function in Sweep.cpp.

Specifically, extract four functions:

  1. static void GetDctStartEndTimes(int infector, int contact, unsigned short contact_time, unsigned short& dct_start_time, unsigned short& dct_end_time);

  2. void AddToDctQueue(int tn, int ad, int i3, int ci, unsigned short ts);

  3. static void RemoveFromDctQueue(int j, int i, int k, int contact, int infector, unsigned short contact_time);

  4. static void RemoveContactFromDctQueue(int contact);

zlatanvasovic commented 4 years ago

Maybe this should be moved out of Sweep.cpp? The file is quite large, so it may be useful to break it down.

DavidVernest commented 4 years ago

@zdroid Yes - plans are afoot to break both Sweep.cpp and Update.cpp into separate files/classes. But not in this PR - to keep things simpler for the reviewers, I have not broken up these files.

DavidVernest commented 4 years ago

@weshinsley @dlaydon @matt-gretton-dann Is Digital Contact Tracing actively used? If so, do we have any regression tests for it? It might not be worth refactoring otherwise - and I'll move on to something else. Thanks.

DavidVernest commented 4 years ago

@weshinsley Hi - can I just confirm if Digital Contact Tracing is actively used? I can unit test and simplify the code - just looking to see if it is active before asking for a merge request.

dlaydon commented 4 years ago

Hi @mstevens-uk, thanks for asking. We are using this code right now, but it isn't added to the formal regression tests. Therefore if you could refrain from changing or refactoring it for now that would be helpful. Thanks.

DavidVernest commented 4 years ago

Understood.