From cecd10981a72874c3847808b54818f6eef8929c1 Mon Sep 17 00:00:00 2001 From: Matthew Gretton-Dann Date: Thu, 18 Jun 2020 11:43:24 +0100 Subject: [PATCH] Tidy up some comments The clangformat auto-applied patch produced some untidily formatted comments. This commit tidies up the ones I spotted. --- src/Bitmap.cpp | 4 +- src/CalcInfSusc.cpp | 20 ++-- src/Constants.h | 5 +- src/CovidSim.cpp | 205 ++++++++++++++++++-------------------- src/Dist.cpp | 2 +- src/InfStat.h | 6 +- src/Kernels.cpp | 2 +- src/Model.h | 18 ++-- src/Models/Cell.h | 2 +- src/Models/Person.h | 14 +-- src/Param.h | 77 ++++++++------- src/Rand.cpp | 6 +- src/SetupModel.cpp | 9 +- src/Sweep.cpp | 235 ++++++++++++++++++++++---------------------- src/Update.cpp | 164 ++++++++++++++++--------------- src/Update.h | 2 +- 16 files changed, 378 insertions(+), 393 deletions(-) diff --git a/src/Bitmap.cpp b/src/Bitmap.cpp index 505f0dd42..aa866c3e1 100644 --- a/src/Bitmap.cpp +++ b/src/Bitmap.cpp @@ -10,9 +10,7 @@ #include "Model.h" #include "Param.h" -//// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** -/////// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** / **** BITMAP -///stuff. +//// **** BITMAP stuff #ifdef _WIN32 // HAVI avi; diff --git a/src/CalcInfSusc.cpp b/src/CalcInfSusc.cpp index cbcd5a86b..3f3e9270b 100644 --- a/src/CalcInfSusc.cpp +++ b/src/CalcInfSusc.cpp @@ -7,11 +7,11 @@ #include "ModelMacros.h" #include "Param.h" -//// Infectiousness functions (House, Place, Spatial, Person). Idea is that in addition to a -///person's personal infectiousness, they have separate "infectiousnesses" for their house, place -///and on other cells (spatial). / These functions consider one person only. A person has an -///infectiousness that is independent of other people. Slightly different therefore than -///susceptibility functions. +/// Infectiousness functions (House, Place, Spatial, Person). Idea is that in addition to a +/// person's personal infectiousness, they have separate "infectiousnesses" for their house, place +/// and on other cells (spatial). / These functions consider one person only. A person has an +/// infectiousness that is independent of other people. Slightly different therefore than +/// susceptibility functions. double CalcHouseInf(int j, unsigned short int ts) { return ((HOST_ISOLATED(j) && (Hosts[j].digitalContactTraced != 1)) @@ -54,11 +54,11 @@ double CalcPersonInf(int j, unsigned short int ts) fabs(Hosts[j].infectiousness) * P.infectiousness[ts - Hosts[j].latent_time - 1]; } -//// Susceptibility functions (House, Place, Spatial, Person). Similarly, idea is that in addition -///to a person's personal susceptibility, they have separate "susceptibilities" for their house, -///place and on other cells (spatial) / These functions consider two people. A person has a -///susceptibility TO ANOTHER PERSON/infector. Slightly different therefore than infectiousness -///functions. +/// Susceptibility functions (House, Place, Spatial, Person). Similarly, idea is that in addition +/// to a person's personal susceptibility, they have separate "susceptibilities" for their house, +/// place and on other cells (spatial) / These functions consider two people. A person has a +/// susceptibility TO ANOTHER PERSON/infector. Slightly different therefore than infectiousness +/// functions. double CalcHouseSusc(int ai, unsigned short int ts, int infector, int tn) { return CalcPersonSusc(ai, ts, infector, tn) * diff --git a/src/Constants.h b/src/Constants.h index 08b936bd9..0f9a96116 100644 --- a/src/Constants.h +++ b/src/Constants.h @@ -97,7 +97,8 @@ const int NNA = 10; const int MIN_HOTELS_PER_AIRPORT = 20; const int HOTELS_PER_1000PASSENGER = 10; -const int MAX_NUM_INTERVENTION_CHANGE_TIMES = - 100; // may want to make this intervention-specifc, but keep simple for now. +/// Max number of intervention changes possible. May want to make this +/// intervention-specific, but keep simple for now. +const int MAX_NUM_INTERVENTION_CHANGE_TIMES = 100; #endif // COVIDSIM_CONSTANTS_H_INCLUDED_ diff --git a/src/CovidSim.cpp b/src/CovidSim.cpp index 97784ea89..ad5a19f07 100644 --- a/src/CovidSim.cpp +++ b/src/CovidSim.cpp @@ -40,26 +40,27 @@ void ReadInterventions(char *); int GetXMLNode(FILE *, const char *, const char *, char *, int); void ReadAirTravel(char *); void InitModel(int); // adding run number as a parameter for event log: ggilani - 15/10/2014 -void SeedInfection(double, int *, int, - int); // adding run number as a parameter for event log: ggilani - 15/10/2014 -int RunModel(int); // adding run number as a parameter for event log: ggilani - 15/10/2014 + +/// adding run number as a parameter for event log: ggilani - 15/10/2014 +void SeedInfection(double, int *, int, int); +int RunModel(int); // adding run number as a parameter for event log: ggilani - 15/10/2014 void SaveDistribs(void); void SaveOriginDestMatrix(void); // added function to save origin destination matrix so it can be // done separately to the main results: ggilani - 13/02/15 void SaveResults(void); void SaveSummaryResults(void); -void SaveRandomSeeds( - void); // added this function to save random seeds for each run: ggilani - 09/03/17 -void SaveEvents( - void); // added this function to save infection events from all realisations: ggilani - 15/10/14 +// added this function to save random seeds for each run: ggilani - 09/03/17 +void SaveRandomSeeds(void); +// added this function to save infection events from all realisations: ggilani - 15/10/14 +void SaveEvents(void); void LoadSnapshot(void); void SaveSnapshot(void); void RecordInfTypes(void); void RecordSample(double, int); -void CalcOriginDestMatrix_adunit( - void); // added function to calculate origin destination matrix: ggilani 28/01/15 +// added function to calculate origin destination matrix: ggilani 28/01/15 +void CalcOriginDestMatrix_adunit(void); int GetInputParameter(FILE *, FILE *, const char *, const char *, void *, int, int, int); int GetInputParameter2(FILE *, FILE *, const char *, const char *, void *, int, int, int); @@ -69,12 +70,8 @@ int GetInputParameter3(FILE *, const char *, const char *, void *, int, int, int void SetICDF(double *icdf, double startValue); -///// ***** ///// ***** ///// ***** ///// ***** ///// ***** ///// ***** ///// ***** ///// ***** -//////// ***** ///// ***** ///// ***** ///// ***** ///// -///// ***** ///// ***** ///// ***** ///// ***** ///// ***** GLOBAL VARIABLES (some structures in -///CovidSim.h file and some containers) - memory allocated later. -///// ***** ///// ***** ///// ***** ///// ***** ///// ***** ///// ***** ///// ***** ///// ***** -//////// ***** ///// ***** ///// ***** ///// ***** ///// +//// ***** GLOBAL VARIABLES (some structures in CovidSim.h file and some containers) +//// ***** - memory allocated later. Param P; Person *Hosts; @@ -85,11 +82,11 @@ Cell **CellLookup; // CellLookup[i] is a pointer to the i'th populated cell Microcell *Mcells, **McellLookup; Place **Places; AdminUnit AdUnits[MAX_ADUNITS]; -//// Time Series defs: -//// TimeSeries is an array of type results, used to store (unsurprisingly) a time series of every -///quantity in results. Mostly used in RecordSample. / TSMeanNE and TSVarNE are the mean and -///variance of non-extinct time series. TSMeanE and TSVarE are the mean and variance of extinct time -///series. TSMean and TSVar are pointers that point to either extinct or non-extinct. +/// Time Series defs: +/// TimeSeries is an array of type results, used to store (unsurprisingly) a time series of every +/// quantity in results. Mostly used in RecordSample. / TSMeanNE and TSVarNE are the mean and +/// variance of non-extinct time series. TSMeanE and TSVarE are the mean and variance of extinct +/// time series. TSMean and TSVar are pointers that point to either extinct or non-extinct. Results *TimeSeries, *TSMean, *TSVar, *TSMeanNE, *TSVarNE, *TSMeanE, *TSVarE; //// TimeSeries used in RecordSample, RecordInfTypes, SaveResults. TSMean and TSVar Airport *Airports; @@ -112,8 +109,8 @@ double PropPlacesC[NUM_AGE_GROUPS * AGE_GROUP_WIDTH][NUM_PLACE_TYPES], AirTravel double PeakHeightSum, PeakHeightSS, PeakTimeSum, PeakTimeSS; // These allow up to about 2 billion people per pixel, which should be ample. -int32_t - *bmPopulation; // The population in each bitmap pixel. Special value -1 means "country boundary" +// The population in each bitmap pixel. Special value -1 means "country boundary" +int32_t *bmPopulation; int32_t *bmInfected; // The number of infected people in each bitmap pixel. int32_t *bmRecovered; // The number of recovered people in each bitmap pixel. int32_t *bmTreated; // The number of treated people in each bitmap pixel. @@ -155,8 +152,8 @@ int main(int argc, char *argv[]) P.BitmapFormat = BitmapFormats::BMP; #endif - ///// Read in command line arguments - lots of things, e.g. random number seeds; (pre)parameter - ///files; binary files; population data; output directory? etc. + /// Read in command line arguments - lots of things, e.g. random number seeds; (pre)parameter + /// files; binary files; population data; output directory? etc. if (argc < 7) Perr = 1; @@ -175,13 +172,13 @@ int main(int argc, char *argv[]) P.DoInterventionFile = 0; P.CaseOrDeathThresholdBeforeAlert = 0; P.R0scale = 1.0; - P.KernelOffsetScale = P.KernelPowerScale = - 1.0; // added this so that kernel parameters are only changed if input from the command - // line: ggilani - 15/10/2014 + // added this so that kernel parameters are only changed if input from the command + // line: ggilani - 15/10/2014 + P.KernelOffsetScale = P.KernelPowerScale = 1.0; P.DoSaveSnapshot = P.DoLoadSnapshot = 0; - //// scroll through command line arguments, anticipating what they can be using various if - ///statements. + /// scroll through command line arguments, anticipating what they can be using various if + /// statements. for (i = 1; i < argc - 4; i++) { if ((argv[i][0] != '/') && ((argv[i][2] != ':') && (argv[i][3] != ':'))) @@ -368,7 +365,7 @@ int main(int argc, char *argv[]) Perr = 1; } - ///// END Read in command line arguments + /// END Read in command line arguments sprintf(OutFile, "%s", OutFileBase); @@ -381,10 +378,7 @@ int main(int argc, char *argv[]) "SetupSeed1 SetupSeed2 RunSeed1 RunSeed2\n", argv[0]); - //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** - /////// **** //// **** //// **** //// **** //// **** / **** SET UP OMP / THREADS / **** //// - ///**** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// - ///**** //// **** //// **** //// **** + //// **** SET UP OMP / THREADS #ifdef _OPENMP P.NumThreads = omp_get_max_threads(); @@ -413,10 +407,7 @@ int main(int argc, char *argv[]) sprintf(PreParamFile, ".." DIRECTORY_SEPARATOR "Pre_%s", ParamFile); } - //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// - ///**** //// **** //// **** //// **** //// **** / **** READ IN PARAMETERS, DATA ETC. / **** //// - ///**** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// - ///**** //// **** //// **** //// **** + //// **** READ IN PARAMETERS, DATA ETC. P.NumRealisations = GotNR; ReadParams(ParamFile, PreParamFile); @@ -433,11 +424,8 @@ int main(int argc, char *argv[]) ReadAirTravel(AirTravelFile); } - //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// - ///**** //// **** //// **** //// **** //// **** / **** INITIALIZE / **** //// **** //// **** - /////// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** - /////// **** //// **** - + //// **** INITIALIZE + // ///// initialize model (for all realisations). SetupModel(DensityFile, NetworkFile, SchoolFile, RegDemogFile); @@ -451,10 +439,7 @@ int main(int argc, char *argv[]) // print out number of calls to random number generator - //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// - ///**** //// **** //// **** //// **** //// **** / **** RUN MODEL / **** //// **** //// **** //// - ///**** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// - ///**** //// **** + //// **** RUN MODEL P.NRactE = P.NRactNE = 0; for (i = 0; (i < P.NumRealisations) && (P.NRactNE < P.NumNonExtinctRealisations); i++) @@ -1359,8 +1344,8 @@ void ReadParams(char *ParamFile, char *PreParamFile) for (i = 0; i < P.NumSeedLocations; i++) P.InitialInfectionsAdminUnitWeight[i] /= s; // for (i = 0; i < P.NumSeedLocations; i++) fprintf(stderr, "## %i %s %i %i %lf\n",i, - //AdUnits[P.InitialInfectionsAdminUnitId[i]].ad_name, P.InitialInfectionsAdminUnitId[i], - //P.InitialInfectionsAdminUnit[i], P.InitialInfectionsAdminUnitWeight[i]); + // AdUnits[P.InitialInfectionsAdminUnitId[i]].ad_name, P.InitialInfectionsAdminUnitId[i], + // P.InitialInfectionsAdminUnit[i], P.InitialInfectionsAdminUnitWeight[i]); } else { @@ -2274,11 +2259,7 @@ void ReadParams(char *ParamFile, char *PreParamFile) } } - ///// **** ///// **** ///// **** ///// **** ///// **** ///// **** ///// **** ///// **** ///// - ///**** ///// **** ///// **** ///// **** - ///// **** DIGITAL CONTACT TRACING - ///// **** ///// **** ///// **** ///// **** ///// **** ///// **** ///// **** ///// **** ///// - ///**** ///// **** ///// **** ///// **** + //// **** DIGITAL CONTACT TRACING // New code for digital contact tracing - ggilani: 09/03/20 if (!GetInputParameter2(ParamFile_dat, PreParamFile_dat, "Include digital contact tracing", @@ -2360,11 +2341,11 @@ void ReadParams(char *ParamFile, char *PreParamFile) P.OutputDigitalContactDist = 0; // if (!GetInputParameter2(ParamFile_dat, PreParamFile_dat, "Include household contacts in - // digital contact tracing", "%i", (void*) & (P.IncludeHouseholdDigitalContactTracing), 1, 1, - // 0)) P.IncludeHouseholdDigitalContactTracing = 1; if (!GetInputParameter2(ParamFile_dat, - // PreParamFile_dat, "Include place group contacts in digital contact tracing", "%i", (void*) - // & (P.IncludePlaceGroupDigitalContactTracing), 1, 1, 0)) - // P.IncludePlaceGroupDigitalContactTracing = 1; + // digital contact tracing", "%i", (void*) & (P.IncludeHouseholdDigitalContactTracing), 1, + // 1, 0)) P.IncludeHouseholdDigitalContactTracing = 1; if + // (!GetInputParameter2(ParamFile_dat, PreParamFile_dat, "Include place group contacts in + // digital contact tracing", "%i", (void*) & (P.IncludePlaceGroupDigitalContactTracing), 1, + // 1, 0)) P.IncludePlaceGroupDigitalContactTracing = 1; // added admin unit specific delays by admin unit if (P.DoInterventionDelaysByAdUnit) @@ -2580,11 +2561,7 @@ void ReadParams(char *ParamFile, char *PreParamFile) P.PlaceCloseByAdminUnit = 0; } - ///// **** ///// **** ///// **** ///// **** ///// **** ///// **** ///// **** ///// **** ///// - ///**** ///// **** ///// **** ///// **** ///// **** SOCIAL DISTANCING - ///// **** ///// **** ///// **** ///// **** ///// **** ///// **** ///// **** ///// **** ///// - ///**** ///// **** ///// **** ///// **** if (!GetInputParameter2(ParamFile_dat, PreParamFile_dat, "Trigger incidence per cell for social distancing", "%i", @@ -2839,7 +2816,7 @@ void ReadParams(char *ParamFile, char *PreParamFile) //// **** change times: //// By default, initialize first change time to zero and all subsequent change times to occur - ///after simulation time, i.e. single value of efficacy for social distancing. + /// after simulation time, i.e. single value of efficacy for social distancing. P.SD_ChangeTimes[0] = 0; P.CI_ChangeTimes[0] = 0; P.HQ_ChangeTimes[0] = 0; @@ -2916,7 +2893,7 @@ void ReadParams(char *ParamFile, char *PreParamFile) for (int ChangeTime = 0; ChangeTime < P.Num_SD_ChangeTimes; ChangeTime++) P.SD_SpatialEffects_OverTime[ChangeTime] = P.SocDistSpatialEffect; //// by default, initialize to Relative spatial contact rate - ///given social distancing + /// given social distancing //// enhanced soc dist if (!P.VaryEfficaciesOverTime || !GetInputParameter2( @@ -2926,7 +2903,7 @@ void ReadParams(char *ParamFile, char *PreParamFile) for (int ChangeTime = 0; ChangeTime < P.Num_SD_ChangeTimes; ChangeTime++) P.Enhanced_SD_SpatialEffects_OverTime[ChangeTime] = P.EnhancedSocDistSpatialEffect; //// by default, initialize to Relative spatial - ///contact rate given enhanced social distancing + /// contact rate given enhanced social distancing //// case isolation if (!P.VaryEfficaciesOverTime || !GetInputParameter2( @@ -3486,7 +3463,7 @@ void ReadParams(char *ParamFile, char *PreParamFile) */ //// Make unsigned short versions of various intervention variables. And scaled them by number - ///of timesteps per day + /// of timesteps per day P.usHQuarantineHouseDuration = ((unsigned short int)(P.HQuarantineHouseDuration * P.TimeStepsPerDay)); P.usVaccTimeToEfficacy = ((unsigned short int)(P.VaccTimeToEfficacy * P.TimeStepsPerDay)); @@ -4218,7 +4195,7 @@ void InitModel(int run) // passing run number so we can save run number in the i { Hosts[k].SARI_time = USHRT_MAX - 1; //// think better to set to initialize to maximum possible value, - ///but keep this way for now. + /// but keep this way for now. Hosts[k].Critical_time = USHRT_MAX - 1; Hosts[k].RecoveringFromCritical_time = USHRT_MAX - 1; Hosts[k].Severity_Current = Severity_Asymptomatic; @@ -4456,7 +4433,7 @@ void SeedInfection(double t, int *NumSeedingInfections_byLocation, int rf, if ((!P.DoRandomInitialInfectionLoc) || ((P.DoAllInitialInfectioninSameLoc) && (rf))) //// either non-random locations, doing all initial infections in same location, - ///and not initializing. + /// and not initializing. { k = (int)(P.LocationInitialInfection[i][0] / P.in_microcells_.width); l = (int)(P.LocationInitialInfection[i][1] / P.in_microcells_.height); @@ -4466,7 +4443,7 @@ void SeedInfection(double t, int *NumSeedingInfections_byLocation, int rf, { l = Mcells[j].members[( int)(ranf() * ((double)Mcells[j].n))]; //// randomly choose member of microcell - ///j. Name this member l + /// j. Name this member l if (Hosts[l].inf == InfStat_Susceptible) //// If Host l is uninfected. { if (CalcPersonSusc(l, 0, 0, 0) > 0) @@ -4481,7 +4458,7 @@ void SeedInfection(double t, int *NumSeedingInfections_byLocation, int rf, Hosts[l].infector = -2; Hosts[l].infect_type = INFECT_TYPE_MASK - 1; DoInfect(l, t, 0, run); ///// guessing this updates a number of things about - ///person l at time t in thread 0 for this run. + /// person l at time t in thread 0 for this run. m = 0; } } @@ -4490,8 +4467,8 @@ void SeedInfection(double t, int *NumSeedingInfections_byLocation, int rf, k--; m++; } //// k-- means if person l chosen is already infected, go again. The m < 10000 is - ///a guard against a) too many infections; b) an infinite loop if no more - ///uninfected people left. + /// a guard against a) too many infections; b) an infinite loop if no more + /// uninfected people left. } } else if (P.DoAllInitialInfectioninSameLoc) @@ -4700,7 +4677,7 @@ int RunModel(int run) // added run number as parameter (NumSeedingInfections_byLocation[k] = (int)ignpoi( P.TimeStep * ir * P.InitialInfectionsAdminUnitWeight[k] * P.SeedingScaling)); //// sample number imported infections from - ///Poisson distribution. + /// Poisson distribution. if (NumSeedingInfections > 0) SeedInfection(t, NumSeedingInfections_byLocation, 1, run); } @@ -4716,8 +4693,8 @@ int RunModel(int run) // added run number as parameter { l = (int)(((double)P.PopSize) * ranf()); //// choose person l randomly from entire - ///population. (but change l if while - ///condition not satisfied?) + /// population. (but change l if while + /// condition not satisfied?) } while ((abs(Hosts[l].inf) == InfStat_Dead) || (ranf() > P.FalsePositiveAgeRate[HOST_AGE_GROUP(l)])); DoFalseCase(l, t, ts, 0); @@ -4732,9 +4709,10 @@ int RunModel(int run) // added run number as parameter // using DoInfect function. adding run number as a parameter to // infect sweep so we can track run number: ggilani - 15/10/14 //// IncubRecoverySweep loops over all infecteds (either latent or infectious). - ///If t is the right time, latent people moved to being infected, and infectious - ///people moved to being clinical cases. Possibly also add them to recoveries or - ///deaths. Add them to hospitalisation & hospitalisation discharge queues. + /// If t is the right time, latent people moved to being infected, and + /// infectious people moved to being clinical cases. Possibly also add them to + /// recoveries or deaths. Add them to hospitalisation & hospitalisation + /// discharge queues. if (!P.DoSI) IncubRecoverySweep(t, run); // If doing new contact tracing, update numbers of people under contact tracing @@ -4746,9 +4724,9 @@ int RunModel(int run) // added run number as parameter fs2 = ((P.DoDeath) || (State.L + State.I > 0) || (ir > 0) || (P.FalsePositivePerCapitaIncidence > 0)); ///// TreatSweep loops over microcells to decide which cells are treated (either - ///with treatment, vaccine, social distancing, movement restrictions etc.). - ///Calls DoVacc, DoPlaceClose, DoProphNoDelay etc. to change (threaded) State - ///variables + /// with treatment, vaccine, social distancing, movement restrictions etc.). + /// Calls DoVacc, DoPlaceClose, DoProphNoDelay etc. to change (threaded) State + /// variables if (!TreatSweep(t)) { if ((!fs2) && (State.L + State.I == 0) && @@ -5379,7 +5357,7 @@ void SaveResults(void) } void SaveSummaryResults(void) //// calculates and saves summary results (called for average of - ///extinct and non-extinct realisation time series - look in main) + /// extinct and non-extinct realisation time series - look in main) { int i, j; double c, t; @@ -6622,14 +6600,14 @@ int ChooseTriggerVariableAndValue(int AdUnit) else VariableAndValue = INT_MAX; //// i.e. if not doing triggering (at either admin or global level) then set - ///value to be arbitrarily large so that it will surpass any trigger threshold. - ///Probably other ways around this if anybody wants to correct? + /// value to be arbitrarily large so that it will surpass any trigger + /// threshold. Probably other ways around this if anybody wants to correct? return VariableAndValue; } double ChooseThreshold(int AdUnit, double WhichThreshold) //// point is that this threshold needs to be - ///generalised, so this is likely insufficient. + /// generalised, so this is likely insufficient. { double Threshold = 0; if (P.DoGlobalTriggers) @@ -6713,13 +6691,14 @@ void UpdateEfficaciesAndComplianceProportions(double t) if (t == P.PC_ChangeTimes[ChangeTime]) { //// First open all the places - keep commented out in case becomes necessary but - ///avoid if possible to avoid runtime costs. + /// avoid if possible to avoid runtime costs. // unsigned short int ts = (unsigned short int) (P.TimeStepsPerDay * t); // for (int PlaceType = 0; PlaceType < P.PlaceTypeNum; PlaceType++) //#pragma omp parallel for schedule(static,1) // for (int ThreadNum = 0; ThreadNum < P.NumThreads; ThreadNum++) // for (int PlaceNum = ThreadNum; PlaceNum < P.Nplace[PlaceType]; - //PlaceNum += P.NumThreads) DoPlaceOpen(PlaceType, PlaceNum, ts, ThreadNum); + // PlaceNum += P.NumThreads) DoPlaceOpen(PlaceType, PlaceNum, ts, + // ThreadNum); P.PlaceCloseSpatialRelContact = P.PC_SpatialEffects_OverTime[ChangeTime]; //// spatial @@ -7059,7 +7038,7 @@ void RecordSample(double t, int n) for (int i = 0; i < NUM_AGE_GROUPS; i++) { //// Record incidence. Need new total minus old total (same as minus old total plus new - ///total). / First subtract old total while unchanged. + /// total). / First subtract old total while unchanged. TimeSeries[n].incMild_age[i] = (double)(-State.cumMild_age[i]); TimeSeries[n].incILI_age[i] = (double)(-State.cumILI_age[i]); TimeSeries[n].incSARI_age[i] = (double)(-State.cumSARI_age[i]); @@ -7130,7 +7109,7 @@ void RecordSample(double t, int n) for (int i = 0; i <= P.NumAdunits; i++) { //// Record incidence. Need new total minus old total (same as minus old total plus - ///new total). / First subtract old total while unchanged. + /// new total). / First subtract old total while unchanged. TimeSeries[n].incMild_adunit[i] = (double)(-State.cumMild_adunit[i]); TimeSeries[n].incILI_adunit[i] = (double)(-State.cumILI_adunit[i]); TimeSeries[n].incSARI_adunit[i] = (double)(-State.cumSARI_adunit[i]); @@ -7143,8 +7122,8 @@ void RecordSample(double t, int n) (double)(-State.cumDeath_Critical_adunit[i]); //// reset State (not StateT) to zero. Don't need to do this with non-admin unit as - ///local variables Mild, cumSARI etc. initialized to zero at beginning of function. - ///Check with Gemma + /// local variables Mild, cumSARI etc. initialized to zero at beginning of function. + /// Check with Gemma State.Mild_adunit[i] = 0; State.ILI_adunit[i] = 0; State.SARI_adunit[i] = 0; @@ -7456,9 +7435,9 @@ void RecordSample(double t, int n) ChooseThreshold( i, P.CaseIsolation_CellIncThresh)) //// a little wasteful if doing Global trigs as - ///function called more times than necessary, - ///but worth it for much simpler code. Also this - ///function is small portion of runtime. + /// function called more times than necessary, + /// but worth it for much simpler code. Also + /// this function is small portion of runtime. DO_OR_DONT_AMEND_START_TIME(AdUnits[i].CaseIsolationTimeStart, t + ((P.DoInterventionDelaysByAdUnit) ? AdUnits[i].CaseIsolationDelay @@ -7468,9 +7447,9 @@ void RecordSample(double t, int n) if (ChooseTriggerVariableAndValue(i) > ChooseThreshold( i, P.HHQuar_CellIncThresh)) //// a little wasteful if doing Global trigs as - ///function called more times than necessary, but - ///worth it for much simpler code. Also this - ///function is small portion of runtime. + /// function called more times than necessary, but + /// worth it for much simpler code. Also this + /// function is small portion of runtime. DO_OR_DONT_AMEND_START_TIME(AdUnits[i].HQuarantineTimeStart, t + ((P.DoInterventionDelaysByAdUnit) ? AdUnits[i].HQuarantineDelay @@ -7483,11 +7462,11 @@ void RecordSample(double t, int n) ChooseThreshold( i, P.DigitalContactTracing_CellIncThresh)) //// a little wasteful if doing - ///Global trigs as function called - ///more times than necessary, but - ///worth it for much simpler code. - ///Also this function is small - ///portion of runtime. + /// Global trigs as function called + /// more times than necessary, but + /// worth it for much simpler code. + /// Also this function is small + /// portion of runtime. DO_OR_DONT_AMEND_START_TIME(AdUnits[i].DigitalContactTracingTimeStart, t + ((P.DoInterventionDelaysByAdUnit) ? AdUnits[i].DCTDelay @@ -7566,13 +7545,14 @@ void RecordSample(double t, int n) { if ((P.PlaceCloseTimeStart2 > P.PlaceCloseTimeStartPrevious) && //// if second place closure start time after - ///previous start time AND + /// previous start time AND (t >= P.PlaceCloseTimeStartPrevious + P.PlaceCloseDuration) && //// if now after previous place closure period has - ///finished AND - (t >= P.PlaceCloseTimeStartPrevious + P.PlaceCloseTimeStartBase2 - - P.PlaceCloseTimeStartBase)) //// if now after previous start time + plus - ///difference between 1st and 2nd base start times + /// finished AND + (t >= + P.PlaceCloseTimeStartPrevious + P.PlaceCloseTimeStartBase2 - + P.PlaceCloseTimeStartBase)) //// if now after previous start time + plus + /// difference between 1st and 2nd base start times { fprintf(stderr, "\nSecond place closure period (t=%lg)\n", t); P.PlaceCloseTimeStartPrevious = P.PlaceCloseTimeStart2 = P.PlaceCloseTimeStart = t; @@ -8151,10 +8131,11 @@ int GetInputParameter3(FILE *dat, const char *SItemName, const char *ItemType, v { FindFlag++; if (n == 1) - sscanf(match, "%lf", - ((double **)ItemPtr)[j + Offset] + i + - Offset); // changed from [j+Offset]+i+Offset to +j+Offset+i, - // as ItemPtr isn't an array - 01/10: changed it back + sscanf( + match, "%lf", + ((double **)ItemPtr)[j + Offset] + i + + Offset); // changed from [j+Offset]+i+Offset to +j+Offset+i, + // as ItemPtr isn't an array - 01/10: changed it back else sscanf(match, "%i", ((int **)ItemPtr)[j + Offset] + i + Offset); } diff --git a/src/Dist.cpp b/src/Dist.cpp index d0b8fb9cb..35dce3330 100644 --- a/src/Dist.cpp +++ b/src/Dist.cpp @@ -11,7 +11,7 @@ double sinx[361], cosx[361], asin2sqx[1001]; //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** /////// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** / **** DISTANCE -///FUNCTIONS (return distance-squared, which is input for every Kernel function) / **** //// **** +/// FUNCTIONS (return distance-squared, which is input for every Kernel function) / **** //// **** /////// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// ///**** //// **** //// **** //// **** //// **** //// **** //// **** diff --git a/src/InfStat.h b/src/InfStat.h index d6b9c7e0f..abe8cd00a 100644 --- a/src/InfStat.h +++ b/src/InfStat.h @@ -2,14 +2,14 @@ #define COVIDSIM_INFSTAT_H_INCLUDED_ //// Infection Status definitions / labels (generally positive value indicates asymptomatic -///infection, / negative value indicates symptomatic infection). +/// infection, / negative value indicates symptomatic infection). enum InfStat { //// Note - DO NOT CHANGE these definitions without accounting for "Quarantined not Infected" / //// "Quarantined not symptomatic" calculation: relies on value below being negative for - ///symptomatic people. + /// symptomatic people. //// Susceptible InfStat_Susceptible = 0, @@ -28,7 +28,7 @@ enum InfStat //// InfStat_Recovered (will use this for abs() values) so code reads correctly InfStat_Recovered = 3, //// Immune at start of epidemic - used to model partially immune population. Distinct from - ///recovered, who recovered during runtime. Doesn't take negative values. + /// recovered, who recovered during runtime. Doesn't take negative values. InfStat_ImmuneAtStart = 4, //// Dead was asymptomatic InfStat_Dead_WasAsymp = 5, diff --git a/src/Kernels.cpp b/src/Kernels.cpp index e38e0f334..18203260f 100644 --- a/src/Kernels.cpp +++ b/src/Kernels.cpp @@ -70,7 +70,7 @@ void InitKernel(double norm) //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** /////// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** / **** KERNEL -///DEFINITIONS +/// DEFINITIONS double ExpKernel(double r2) { diff --git a/src/Model.h b/src/Model.h index ab527ee06..ce4464ec8 100644 --- a/src/Model.h +++ b/src/Model.h @@ -16,7 +16,7 @@ #include "Models/Person.h" //// need to test that inequalities in IncubRecoverySweep can be replaced if you initialize to -///USHRT_MAX, rather than zero. / need to output quantities by admin unit +/// USHRT_MAX, rather than zero. / need to output quantities by admin unit #pragma pack(push, 2) @@ -62,7 +62,7 @@ struct PopVar int cumC_country[MAX_COUNTRIES]; // added cumulative cases by country: ggilani 12/11/14 int cumHQ, cumAC, cumAA, cumAH, cumACS, cumAPC, cumAPA, cumAPCS; //// age specific versions of above variables. e.g. cumI is cumulative infections. cumIa is - ///cumulative infections by age group. + /// cumulative infections by age group. int cumIa[NUM_AGE_GROUPS], cumCa[NUM_AGE_GROUPS], cumDa[NUM_AGE_GROUPS]; int cumI_adunit[MAX_ADUNITS], cumC_adunit[MAX_ADUNITS], cumD_adunit[MAX_ADUNITS], cumT_adunit[MAX_ADUNITS], cumH_adunit[MAX_ADUNITS], @@ -94,9 +94,9 @@ struct PopVar ContactEvent *dct_queue[MAX_ADUNITS]; // queues for digital contact tracing: ggilani 14/04/20 int ndct_queue[MAX_ADUNITS]; // queues for digital contact tracing: ggilani 10/03/20 int contact_dist[MAX_CONTACTS + 1]; // added this to store contact distribution: ggilani - // 13/04/20 - double *origin_dest[MAX_ADUNITS]; // added intermediate storage for calculation of - // origin-destination matrix: ggilani 02/02/15 + // 13/04/20 + double *origin_dest[MAX_ADUNITS]; // added intermediate storage for calculation of + // origin-destination matrix: ggilani 02/02/15 ///// Prevalence quantities (+ by admin unit) int Mild, ILI, SARI, Critical, CritRecov, /*cumulative incidence*/ cumMild, cumILI, cumSARI, @@ -232,7 +232,7 @@ struct Results //// ii) RecordSample: add to incidence / Timeseries). //// iii) SaveResults and SaveSummary results. ///// need to update these quantities in InitModel (DONE), Record Sample (DONE) (and of course - ///places where you need to increment, decrement). + /// places where you need to increment, decrement). }; // The offset (in number of doubles) of the first double field in Results. @@ -356,9 +356,9 @@ extern AdminUnit AdUnits[MAX_ADUNITS]; //// Time Series defs: //// TimeSeries is an array of type results, used to store (unsurprisingly) a time series of every -///quantity in results. Mostly used in RecordSample. / TSMeanNE and TSVarNE are the mean and -///variance of non-extinct time series. TSMeanE and TSVarE are the mean and variance of extinct time -///series. TSMean and TSVar are pointers that point to either extinct or non-extinct. +/// quantity in results. Mostly used in RecordSample. / TSMeanNE and TSVarNE are the mean and +/// variance of non-extinct time series. TSMeanE and TSVarE are the mean and variance of extinct +/// time series. TSMean and TSVar are pointers that point to either extinct or non-extinct. extern Results *TimeSeries, *TSMean, *TSVar, *TSMeanNE, *TSVarNE, *TSMeanE, *TSVarE; //// TimeSeries used in RecordSample, RecordInfTypes, SaveResults. TSMean and TSVar diff --git a/src/Models/Cell.h b/src/Models/Cell.h index d2fae8eff..c8ee4dafd 100644 --- a/src/Models/Cell.h +++ b/src/Models/Cell.h @@ -14,7 +14,7 @@ struct Cell int n, S, L, I, R, D, cumTC, S0, tot_treat, tot_vacc; int *members, *susceptible, *latent, *infected; //// pointers to people in cell. e.g. *susceptible identifies where the final - ///susceptible member of cel is. + /// susceptible member of cel is. int *InvCDF; float tot_prob, *cum_trans, *max_trans; short int CurInterv[MAX_INTERVENTION_TYPES]; diff --git a/src/Models/Person.h b/src/Models/Person.h index b90a8b867..e95b05ce4 100644 --- a/src/Models/Person.h +++ b/src/Models/Person.h @@ -12,8 +12,8 @@ struct Person int listpos; // Goes up to at least MAX_SEC_REC, also used as a temp variable? int PlaceLinks[NUM_PLACE_TYPES]; //// indexed by i) place type. Value is the number of that - ///place type (e.g. school no. 17; office no. 310 etc.) - ///Place[i][person->PlaceLinks[i]], can be up to P.Nplace[i] + /// place type (e.g. school no. 17; office no. 310 etc.) + /// Place[i][person->PlaceLinks[i]], can be up to P.Nplace[i] float infectiousness, susc, ProbAbsent, ProbCare; unsigned int esocdist_comply : 1; @@ -28,8 +28,8 @@ struct Person unsigned char num_treats; // set to 0 and tested < 2. but never modified? Severity Severity_Current, Severity_Final; //// Note we allow Severity_Final to take values: Severity_Mild, - ///Severity_ILI, Severity_SARI, Severity_Critical (not e.g. Severity_Dead or - ///Severity_RecoveringFromCritical) + /// Severity_ILI, Severity_SARI, Severity_Critical (not e.g. Severity_Dead + /// or Severity_RecoveringFromCritical) unsigned short int PlaceGroupLinks[NUM_PLACE_TYPES]; // These can definitely get > 255 short int infect_type; // INFECT_TYPE_MASK @@ -48,8 +48,8 @@ struct Person unsigned short int recovery_or_death_time; // set in DoIncub function unsigned short int SARI_time, Critical_time, RecoveringFromCritical_time; //// /*mild_time, ILI_time,*/ Time of infectiousness onset same - ///for asymptomatic, Mild, and ILI infection so don't need - ///mild_time etc. + /// for asymptomatic, Mild, and ILI infection so don't need + /// mild_time etc. unsigned short int treat_start_time, treat_stop_time, vacc_start_time; //// set in TreatSweep function. unsigned int digitalContactTraced : 1; @@ -58,5 +58,5 @@ struct Person unsigned short int dct_start_time, dct_end_time, dct_trigger_time, dct_test_time; // digital contact tracing start and end time: ggilani 10/03/20 int ncontacts; // added this in to record total number of contacts each index case records: - // ggilani 13/04/20 + // ggilani 13/04/20 }; diff --git a/src/Param.h b/src/Param.h index e1b33e286..17d097bf3 100644 --- a/src/Param.h +++ b/src/Param.h @@ -267,29 +267,29 @@ struct Param (enhanced) social distancing */ double SD_SpatialEffects_OverTime [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///SocDistSpatialEffectCurrent + /// SocDistSpatialEffectCurrent double SD_HouseholdEffects_OverTime [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///SocDistHouseholdEffectCurrent + /// SocDistHouseholdEffectCurrent double SD_PlaceEffects_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES] [NUM_PLACE_TYPES]; //// indexed by i) change time; ii) place - ///type; //// time-varying equivalent of - ///SocDistPlaceEffectCurrent + /// type; //// time-varying equivalent of + /// SocDistPlaceEffectCurrent int SD_CellIncThresh_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent - ///of SocDistCellIncThresh + /// of SocDistCellIncThresh /**< enhanced */ double Enhanced_SD_SpatialEffects_OverTime [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///EnhancedSocDistSpatialEffectCurrent + /// EnhancedSocDistSpatialEffectCurrent double Enhanced_SD_HouseholdEffects_OverTime [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///EnhancedSocDistHouseholdEffectCurrent + /// EnhancedSocDistHouseholdEffectCurrent double Enhanced_SD_PlaceEffects_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES] [NUM_PLACE_TYPES]; //// indexed by i) change time; ii) - ///place type; time-varying equivalent - ///of EnhancedSocDistPlaceEffectCurrent + /// place type; time-varying equivalent + /// of EnhancedSocDistPlaceEffectCurrent int Num_CI_ChangeTimes; //// must be at most MAX_NUM_INTERVENTION_CHANGE_TIMES int Num_HQ_ChangeTimes; //// must be at most MAX_NUM_INTERVENTION_CHANGE_TIMES @@ -301,76 +301,77 @@ struct Param case isolation */ double CI_SpatialAndPlaceEffects_OverTime [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///CaseIsolationEffectiveness + /// CaseIsolationEffectiveness double CI_HouseholdEffects_OverTime [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///CaseIsolationHouseEffectiveness + /// CaseIsolationHouseEffectiveness double CI_Prop_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///CaseIsolationProp - double - CI_CellIncThresh_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent - ///of - ///CaseIsolation_CellIncThresh + /// CaseIsolationProp + double CI_CellIncThresh_OverTime + [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent + /// of + /// CaseIsolation_CellIncThresh /**< HOUSEHOLD QUARANTINE */ double HQ_ChangeTimes[MAX_NUM_INTERVENTION_CHANGE_TIMES]; /**< change times for intensity of household quarantine */ double HQ_SpatialEffects_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent - ///of - ///HQuarantineSpatialEffect + /// of + /// HQuarantineSpatialEffect double HQ_HouseholdEffects_OverTime [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of HQuarantineHouseEffect double HQ_PlaceEffects_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES] [NUM_PLACE_TYPES]; //// indexed by i) change time; ii) place - ///type; time-varying equivalent of - ///HQuarantinePlaceEffect + /// type; time-varying equivalent of + /// HQuarantinePlaceEffect double HQ_Individual_PropComply_OverTime [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///HQuarantinePropIndivCompliant + /// HQuarantinePropIndivCompliant double HQ_Household_PropComply_OverTime [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///HQuarantinePropHouseCompliant + /// HQuarantinePropHouseCompliant double HQ_CellIncThresh_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent - ///of HHQuar_CellIncThresh + /// of HHQuar_CellIncThresh /**< PLACE CLOSURE */ double PC_ChangeTimes[MAX_NUM_INTERVENTION_CHANGE_TIMES]; /**< change times for intensity of place closure */ double PC_SpatialEffects_OverTime [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///PlaceCloseSpatialRelContact + /// PlaceCloseSpatialRelContact double PC_HouseholdEffects_OverTime [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///PlaceCloseHouseholdRelContact + /// PlaceCloseHouseholdRelContact double PC_PlaceEffects_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES] [NUM_PLACE_TYPES]; //// indexed by i) change time; ii) place - ///type; //// time-varying equivalent of - ///PlaceCloseEffect + /// type; //// time-varying equivalent of + /// PlaceCloseEffect double PC_PropAttending_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES][NUM_PLACE_TYPES]; int PC_IncThresh_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///PlaceCloseIncTrig / - ///PlaceCloseIncTrig1 + /// PlaceCloseIncTrig / + /// PlaceCloseIncTrig1 double PC_FracIncThresh_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent - ///of PlaceCloseFracIncTrig + /// of PlaceCloseFracIncTrig int PC_CellIncThresh_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent - ///of PlaceCloseCellIncThresh + /// of PlaceCloseCellIncThresh double PC_Durs_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///PlaceCloseDuration + /// PlaceCloseDuration /**< DIGITAL CONTACT TRACING */ double DCT_ChangeTimes[MAX_NUM_INTERVENTION_CHANGE_TIMES]; /**< change times for intensity of digital contact tracing */ double DCT_SpatialAndPlaceEffects_OverTime [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///DCTCaseIsolationEffectiveness + /// DCTCaseIsolationEffectiveness double DCT_HouseholdEffects_OverTime [MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///DCTCaseIsolationHouseEffectiveness - double DCT_Prop_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of - ///ProportionDigitalContactsIsolate + /// DCTCaseIsolationHouseEffectiveness + double + DCT_Prop_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES]; //// time-varying equivalent of + /// ProportionDigitalContactsIsolate int DCT_MaxToTrace_OverTime[MAX_NUM_INTERVENTION_CHANGE_TIMES]; double KeyWorkerProphTimeStart, KeyWorkerProphDuration, @@ -431,7 +432,7 @@ struct Param int WindowToEvaluateTriggerAlert; // Number of days to accummulate cases/deaths before alert int DoAlertTriggerAfterInterv; // Alert trigger starts after interventions, i.e. were there // interventions before date specified in - // DateTriggerReached_CalTime / "Day of year trigger is reached"? + // DateTriggerReached_CalTime / "Day of year trigger is reached"? int AlertTriggerAfterIntervThreshold; // initialized to CaseOrDeathThresholdBeforeAlert (i.e. // number cases or deaths accumulated before alert). @@ -465,7 +466,7 @@ struct Param int DoRecordInfEvents, MaxInfEvents, RecordInfEventsPerRun; unsigned short int usHQuarantineHouseDuration, usVaccTimeToEfficacy, usVaccTimeEfficacySwitch; //// us = unsigned short versions of their namesakes, multiplied - ///by P.TimeStepsPerDay + /// by P.TimeStepsPerDay unsigned short int usCaseIsolationDuration, usCaseIsolationDelay, usCaseAbsenteeismDuration, usCaseAbsenteeismDelay, usAlignDum; // last is for 8 byte alignment diff --git a/src/Rand.cpp b/src/Rand.cpp index f47793ee8..2bde21447 100644 --- a/src/Rand.cpp +++ b/src/Rand.cpp @@ -16,11 +16,7 @@ int32_t *Xcg1, *Xcg2; int **SamplingQueue = nullptr; -///////////// ********* ///////////// ********* ///////////// ********* ///////////// ********* -//////////////// ********* ///////////// ********* -/////////////////////// NEIL rand_lib code (with some Gemma rand lib also) -///////////// ********* ///////////// ********* ///////////// ********* ///////////// ********* -//////////////// ********* ///////////// ********* +//// **** NEIL rand_lib code (with some Gemma rand lib also) double ranf(void) { diff --git a/src/SetupModel.cpp b/src/SetupModel.cpp index 72abad0d2..4835fe80b 100644 --- a/src/SetupModel.cpp +++ b/src/SetupModel.cpp @@ -45,8 +45,9 @@ void SetupModel(char *DensityFile, char *NetworkFile, char *SchoolFile, char *Re ERR_CRITICAL("Unable to open density file\n"); unsigned int density_file_header; fread_big(&density_file_header, sizeof(unsigned int), 1, dat); - if (density_file_header == 0xf0f0f0f0) // code for first 4 bytes of binary file ## NOTE - - // SHOULD BE LONG LONG TO COPE WITH BIGGER POPULATIONS + if (density_file_header == + 0xf0f0f0f0) // code for first 4 bytes of binary file ## NOTE - + // SHOULD BE LONG LONG TO COPE WITH BIGGER POPULATIONS { P.DoBin = 1; fread_big(&(P.BinFileLen), sizeof(unsigned int), 1, dat); @@ -1396,8 +1397,8 @@ void SetupPopulation(char *SchoolFile, char *RegDemogFile) } // output problematic adjustments (these should be 0.0f) // fprintf(stderr, "AgeDistCorrB[%i][0] = %f\n", i, AgeDistCorrB[i][0]); // push down - // from youngest age group fprintf(stderr, "AgeDistCorrF[%i][NUM_AGE_GROUPS - 1] = %f\n", - // i, AgeDistCorrF[i][NUM_AGE_GROUPS - 1]); // push up from oldest age group + // from youngest age group fprintf(stderr, "AgeDistCorrF[%i][NUM_AGE_GROUPS - 1] = + // %f\n", i, AgeDistCorrF[i][NUM_AGE_GROUPS - 1]); // push up from oldest age group // fprintf(stderr, "AgeDistCorrB[%i][NUM_AGE_GROUPS] = %f\n", i, // AgeDistCorrB[i][NUM_AGE_GROUPS]); // push down from oldest age group + 1 } diff --git a/src/Sweep.cpp b/src/Sweep.cpp index 16f4ac577..759882a81 100644 --- a/src/Sweep.cpp +++ b/src/Sweep.cpp @@ -305,23 +305,24 @@ void InfectSweep(double t, int run) // added run number as argument in order to record it in event log { //// This function takes the day number (t) and run number (run) as inputs. It loops over - ///infected people, and decides whom to infect. Structure is 1) #pragma loop over all cells then - ///1a) infectious people, which chooses who they will infect, adds them to a queue / Next 2) - ///#pragma loop infects those people from queue (using DoInfect function). This is to avoid race - ///conditions. / Loop 1a) calculates the force of infection exerted by each infected person on - ///(and therefore number of new infections to) i) their house; ii) their place(s); iii) other - ///spatial cells. / Each force of infection includes infectiousness and susceptibility - ///components. / Infectiousness is (broadly) a function of 1 person (their age, treatment - ///status, places, no. people in their household etc.) / Susceptibility is (broadly) a function - ///of 2 people (a person's susceptibility TO ANOTHER PERSON / potential infector) / After loop - ///1a) over infectious people, spatial infections are doled out. + /// infected people, and decides whom to infect. Structure is 1) #pragma loop over all cells + /// then 1a) infectious people, which chooses who they will infect, adds them to a queue / Next + /// 2) #pragma loop infects those people from queue (using DoInfect function). This is to avoid + /// race conditions. / Loop 1a) calculates the force of infection exerted by each infected + /// person + /// on (and therefore number of new infections to) i) their house; ii) their place(s); iii) + /// other spatial cells. / Each force of infection includes infectiousness and susceptibility + /// components. / Infectiousness is (broadly) a function of 1 person (their age, treatment + /// status, places, no. people in their household etc.) / Susceptibility is (broadly) a function + /// of 2 people (a person's susceptibility TO ANOTHER PERSON / potential infector) / After loop + /// 1a) over infectious people, spatial infections are doled out. int n; //// number of people you could potentially infect in your place group, then number of - ///potential spatial infections doled out by cell on other cells. + /// potential spatial infections doled out by cell on other cells. int f, f2, cq /*cell queue*/, bm /*movement restrictions in place*/, ci /*person index*/; double seasonality, sbeta, hbeta; //// various quantities of force of infection, including "infectiousness" and "susceptibility" - ///components + /// components double s; // household Force Of Infection (FOI) on fellow household member, then place // susceptibility, then random number for spatial infections allocation* / ; double s2; // spatial infectiousness, then distance in spatial infections allocation @@ -378,7 +379,7 @@ void InfectSweep(double t, //// get person index ci of j'th infected person in cell ci = c->infected[j]; //// get person si from Hosts (array of people) corresponding to ci, using pointer - ///arithmetic. + /// arithmetic. Person *si = Hosts + ci; // evaluate flag for digital contact tracing (fct) here at the beginning for each @@ -443,24 +444,24 @@ void InfectSweep(double t, { s3 *= P.PlaceCloseHouseholdRelContact; } /* NumPCD++;}*/ //// if people in your household are absent from places, - ///person si/ci is more infectious to them, as they spend - ///more time at home. + /// person si/ci is more infectious to them, as they spend + /// more time at home. // Loop from l (the index of the first person in the household) to m-1 (the // index of the last person in the household) ie. loop over everyone in the // household for (int i3 = l; i3 < m; i3++) //// loop over all people in household (note - ///goes from l to m - 1) + /// goes from l to m - 1) { if ((Hosts[i3].inf == InfStat_Susceptible) && (!Hosts[i3] .Travelling)) //// if people in household - ///uninfected/susceptible and not travelling + /// uninfected/susceptible and not travelling { s = s3 * CalcHouseSusc( i3, ts, ci, tn); //// FOI ( = infectiousness x susceptibility) from - ///person ci/si on fellow household member i3 + /// person ci/si on fellow household member i3 // Force of Infection (s) > random value between 0 and 1 if (ranf_mt(tn) < s) @@ -483,9 +484,9 @@ void InfectSweep(double t, // infect_type: first 4 bits store type of infection // 1= household // 2..NUM_PLACE_TYPES+1 = within-class/work-group - //place based transmission + // place based transmission // NUM_PLACE_TYPES+2..2*NUM_PLACE_TYPES+1 = - //between-class/work-group place based transmission + // between-class/work-group place based transmission // 2*NUM_PLACE_TYPES+2 = "spatial" transmission //(spatially local random mixing) // bits >4 store the generation of infection @@ -602,15 +603,15 @@ void InfectSweep(double t, // else if infectiousness == 1 (should never be more than 1 due // to capping above) else if (s4_scaled >= 1) //// if place infectiousness above - ///threshold, consider everyone in - ///group a potential infectee... + /// threshold, consider everyone in + /// group a potential infectee... { // set n to be number of people in group in place k,l n = Places[k][l].group_size[i2]; } else //// ... otherwise randomly sample (from binomial - ///distribution) number of potential infectees in this - ///place. + /// distribution) number of potential infectees in this + /// place. { n = (int)ignbin_mt((int32_t)Places[k][l].group_size[i2], s4_scaled, tn); @@ -625,7 +626,7 @@ void InfectSweep(double t, tn, n, Places[k][l] .group_size[i2]); //// changes thread-specific - ///SamplingQueue. + /// SamplingQueue. } // loop over sampling queue of potential infectees @@ -663,8 +664,8 @@ void InfectSweep(double t, if ((StateT[tn].ndct_queue[ad] < AdUnits[ad].n)) { // find adunit for contact and add both contact - // and infectious host to lists - storing both so - // I can set times later. + // and infectious host to lists - storing both + // so I can set times later. StateT[tn] .dct_queue[ad] [StateT[tn].ndct_queue[ad]++] = { @@ -821,8 +822,8 @@ void InfectSweep(double t, if ((StateT[tn].ndct_queue[ad] < AdUnits[ad].n)) { // find adunit for contact and add both contact - // and infectious host to lists - storing both so - // I can set times later. + // and infectious host to lists - storing both + // so I can set times later. StateT[tn] .dct_queue[ad] [StateT[tn].ndct_queue[ad]++] = { @@ -931,11 +932,11 @@ void InfectSweep(double t, // if seasonality beta > 0 // do spatial infections //// ie sum spatial infectiousness over all infected people, the infections from - ///which are allocated after loop over infected people. + /// which are allocated after loop over infected people. if (sbeta > 0) { if (si->Travelling) //// if host currently away from their cell, they cannot add - ///to their cell's spatial infectiousness. + /// to their cell's spatial infectiousness. { s2 = 0; f = 0; @@ -966,7 +967,7 @@ void InfectSweep(double t, // if place is closed set f=1 f = PLACE_CLOSED(i3, si->PlaceLinks[i3]); //// find out if that place of - ///type i3 is closed. + /// type i3 is closed. } } } // if doing places @@ -974,8 +975,8 @@ void InfectSweep(double t, if ((f) && (HOST_ABSENT( ci))) //// if place is closed and person is absent then adjust the - ///spatial infectiousness (similar logic to household - ///infectiousness: place closure affects spatial infectiousness + /// spatial infectiousness (similar logic to household + /// infectiousness: place closure affects spatial infectiousness { s2 *= P.PlaceCloseSpatialRelContact; /* NumPCD++; */ @@ -998,27 +999,27 @@ void InfectSweep(double t, n = (int)ignpoi_mt( s5 * sbeta * ((double)c->tot_prob), tn); //// number people this cell's population might infect elsewhere. poisson - ///random number based on spatial infectiousness s5, sbeta (seasonality) - ///and this cell's "probability" (guessing this is a function of its - ///population and geographical size). + /// random number based on spatial infectiousness s5, sbeta (seasonality) + /// and this cell's "probability" (guessing this is a function of its + /// population and geographical size). // i2 = number of infectious people in cell c int i2 = c->I; - if (n > - 0) //// this block normalises cumulative infectiousness cell_inf by person. s5 - ///is the total cumulative spatial infectiousness. Reason is so that infector - ///can be chosen using ranf_mt, which returns random number between 0 and 1. + if (n > 0) //// this block normalises cumulative infectiousness cell_inf by person. + /// s5 is the total cumulative spatial infectiousness. Reason is so that + /// infector can be chosen using ranf_mt, which returns random number + /// between 0 and 1. { //// normalise by cumulative spatial infectiousness. for (int j = 0; j < i2 - 1; j++) StateT[tn].cell_inf[j] /= ((float)s5); //// does same as the above loop just a slightly faster calculation. i.e. - ///StateT[tn].cell_inf[i2 - 1] / s5 would equal 1 or -1 anyway. + /// StateT[tn].cell_inf[i2 - 1] / s5 would equal 1 or -1 anyway. StateT[tn].cell_inf[i2 - 1] = (StateT[tn].cell_inf[i2 - 1] < 0) ? -1.0f : 1.0f; } //// loop over infections to dole out. roughly speaking, this determines which - ///infectious person in cell c infects which person elsewhere. + /// infectious person in cell c infects which person elsewhere. for (int k = 0; k < n; k++) { //// decide on infector ci/si from cell c. @@ -1031,22 +1032,22 @@ void InfectSweep(double t, // if more than one infectious person in cell pick an infectious person (given // by index j) //// roughly speaking, this determines which infectious person in cell c infects - ///which person elsewhere + /// which person elsewhere else { int m; s = ranf_mt(tn); ///// choose random number between 0 and 1 j = m = i2 / 2; ///// assign j and m to be halfway between zero and number - ///of infected people i2 = c->I. + /// of infected people i2 = c->I. f = 1; do { if (m > 1) m /= 2; //// amount m to change j by reduced by half. Looks like a - ///binary search. Basically saying, keep amending potential - ///infector j until either j less than zero or more than - ///number of infected people until you find j s.t. spatial - ///infectiousness "matches" s. + /// binary search. Basically saying, keep amending potential + /// infector j until either j less than zero or more than + /// number of infected people until you find j s.t. spatial + /// infectiousness "matches" s. if ((j > 0) && (fabs(StateT[tn].cell_inf[j - 1]) >= s)) { j -= m; @@ -1065,8 +1066,8 @@ void InfectSweep(double t, } f = (StateT[tn].cell_inf[j] < 0); //// flag for whether infector j had their place(s) closed. <0 (true) = - ///place closed / >=0 (false) = place not closed. Set in if (sbeta > 0) - ///part of loop over infectious people. + /// place closed / >=0 (false) = place not closed. Set in if (sbeta > + /// 0) part of loop over infectious people. // ci is the index of the jth infectious person in the cell ci = c->infected[j]; // si is the jth selected person in the cell @@ -1100,7 +1101,7 @@ void InfectSweep(double t, Cell *ct = CellLookup[l]; ///// pick random person m within susceptibles of cell ct (S0 initial number - ///susceptibles within cell). + /// susceptibles within cell). int m = (int)(ranf_mt(tn) * ((double)ct->S0)); int i3 = ct->susceptible[m]; @@ -1116,8 +1117,8 @@ void InfectSweep(double t, if ((ranf_mt(tn) >= s) || (abs(Hosts[i3].inf) == InfStat_Dead)) //// if rejected, or infectee i3/m already dead, ensure - ///do-while evaluated again (i.e. choose a new - ///infectee). + /// do-while evaluated again (i.e. choose a new + /// infectee). { // set f2=1 so loop continues f2 = 1; @@ -1125,7 +1126,7 @@ void InfectSweep(double t, else { //// if potential infectee not travelling, and either is not part of - ///cell c or doesn't share a household with infector. + /// cell c or doesn't share a household with infector. if ((!Hosts[i3].Travelling) && ((c != ct) || (Hosts[i3].hh != si->hh))) { // pick microcell of infector (mi) @@ -1186,9 +1187,9 @@ void InfectSweep(double t, if ((!f) && (HOST_ABSENT( i3))) //// if infector did not have place closed, loop - ///over place types of infectee i3 to see if their - ///places had closed. If they had, amend their - ///susceptibility. + /// over place types of infectee i3 to see if + /// their places had closed. If they had, amend + /// their susceptibility. { for (m = f2 = 0; (m < P.PlaceTypeNum) && (!f2); m++) if (Hosts[i3].PlaceLinks[m] >= 0) @@ -1305,23 +1306,23 @@ void IncubRecoverySweep(double t, int run) Cell *c = CellLookup[b]; //// find (pointer-to) cell. for (int j = ((int)c->L - 1); j >= 0; j--) //// loop backwards over latently infected people, hence it starts from L - 1 - ///and goes to zero. Runs backwards because of pointer swapping? + /// and goes to zero. Runs backwards because of pointer swapping? if (ts >= Hosts[c->latent[j]].latent_time) //// if now after time at which person became - ///infectious (latent_time a slight misnomer). + /// infectious (latent_time a slight misnomer). DoIncub(c->latent[j], ts, tn, run); //// move infected person from latently infected (L) to infectious ///(I), but not symptomatic // StateT[tn].n_queue[0] = StateT[tn].n_queue[1] = 0; for (int j = c->I - 1; j >= 0; j--) ///// loop backwards over Infectious people. Runs - ///backwards because of pointer swapping? + /// backwards because of pointer swapping? { int ci = c->infected[j]; //// person index Person *si = Hosts + ci; //// person unsigned short int tc; //// time at which person becomes case (i.e. moves from infectious and - ///asymptomatic to infectious and symptomatic). + /// asymptomatic to infectious and symptomatic). /* Following line not 100% consistent with DoIncub. All severity time points (e.g. * SARI time) are added to latent_time, not latent_time + * ((int)(P.LatentToSymptDelay / P.TimeStep))*/ @@ -1332,13 +1333,13 @@ void IncubRecoverySweep(double t, int run) DoCase( ci, t, ts, tn); //// ... change infectious (but asymptomatic) person to infectious and - ///symptomatic. If doing severity, this contains DoMild and DoILI. + /// symptomatic. If doing severity, this contains DoMild and DoILI. if (P.DoSeverity) { if (ts >= si->SARI_time) DoSARI(ci, tn); //// see if you can dispense with inequalities by - ///initializing SARI_time, Critical_time etc. to USHRT_MAX + /// initializing SARI_time, Critical_time etc. to USHRT_MAX if (ts >= si->Critical_time) DoCritical(ci, tn); if (ts >= si->RecoveringFromCritical_time) @@ -1357,7 +1358,7 @@ void IncubRecoverySweep(double t, int run) if (ts >= si->recovery_or_death_time) { if (!si->to_die) //// if person si recovers and this timestep is after they've - ///recovered + /// recovered { DoRecover(ci, tn, run); // StateT[tn].inf_queue[0][StateT[tn].n_queue[0]++] = ci; //// add them to @@ -1432,8 +1433,9 @@ void DigitalContactTracingSweep(double t) unsigned short int dct_start_time, dct_end_time; // this condition is only ever met when a symptomatic case is detected in - // DoDetectedCase and is not already an index case. If they have already been - // made an index case due to testing, then this won't occur again for them. + // DoDetectedCase and is not already an index case. If they have already + // been made an index case due to testing, then this won't occur again for + // them. if (infector == -1) { // i.e. this is an index case that has been detected by becoming @@ -1452,9 +1454,9 @@ void DigitalContactTracingSweep(double t) { // trigger times are either set in DoDetectedCase or in the loop below // (for asymptomatic and presymptomatic cases that are picked up via - // testing If the contact's index case has a trigger time that means that - // they have been detected, and we can calculate start and end isolation - // times for the contact. + // testing If the contact's index case has a trigger time that means + // that they have been detected, and we can calculate start and end + // isolation times for the contact. if (Hosts[infector].dct_trigger_time < (USHRT_MAX - 1)) { if (contact_time > Hosts[infector].dct_trigger_time) @@ -1526,13 +1528,13 @@ void DigitalContactTracingSweep(double t) // picked up on symptoms alone, in order to figure out whether // and when to remove their contacts (if // P.RemoveContactsOfNegativeIndexCase). It's much harder to do - // it in the next loop as we don't have all the information about - // the contact event there and would need to loop over all + // it in the next loop as we don't have all the information + // about the contact event there and would need to loop over all // contacts again to look for their index case This would cause // race conditions due to having a loop over adunits within // threaded loop over admin units Only set test times if - // P.DoDCTTest. If P.DoDCTTest==0, but we are finding contacts of - // contacts, we check to see if contacts should become index + // P.DoDCTTest. If P.DoDCTTest==0, but we are finding contacts + // of contacts, we check to see if contacts should become index // cases every day they are in isolation. if (P.DoDCTTest) { @@ -1560,8 +1562,9 @@ void DigitalContactTracingSweep(double t) Hosts[contact].dct_end_time = Hosts[contact].dct_test_time; // set index_dct_flag to 2 to indicate that - // contacts should be removed, if we are removing - // based on negative test result of index case + // contacts should be removed, if we are + // removing based on negative test result of + // index case if (P.RemoveContactsOfNegativeIndexCase) Hosts[contact].index_case_dct = 2; } @@ -1638,10 +1641,11 @@ void DigitalContactTracingSweep(double t) if (P.DoDCTTest) { // if case has been detected due to being symptomatic, then we - // will update their testing time if they would be tested earlier - // based on being an index case as opposed to being a contact of - // another case If they are already being contact traced and - // testing is on, they should have been set a test_time + // will update their testing time if they would be tested + // earlier based on being an index case as opposed to being a + // contact of another case If they are already being contact + // traced and testing is on, they should have been set a + // test_time if ((Hosts[contact].index_case_dct == 1) && (Hosts[contact].dct_test_time > (dct_start_time + @@ -1715,8 +1719,8 @@ void DigitalContactTracingSweep(double t) else { // just extend the isolation end time, but we're not going to - // update testing time or as we still want the testing time to be - // dependent on the earlier contact. + // update testing time or as we still want the testing time to + // be dependent on the earlier contact. Hosts[contact].dct_end_time = dct_end_time; // we could choose to not extend the time for // cases who are index cases. If they are @@ -1733,8 +1737,8 @@ void DigitalContactTracingSweep(double t) } } // if contact of an asymptomatic host has passed the recovery time of their - // asymptomatic index, they would no longer be identified by testing of their - // index case - remove from the queue so they don't stay here forever + // asymptomatic index, they would no longer be identified by testing of + // their index case - remove from the queue so they don't stay here forever else if ((dct_start_time == (USHRT_MAX - 1)) && (dct_end_time == ts)) { // now remove this case from the queue @@ -1794,7 +1798,8 @@ void DigitalContactTracingSweep(double t) ts + 1; // added the +1 here so that if there are no delays, // the contacts will still get picked up correctly // if they are asymptomatic, i.e. specifically if they have inf - // flag 2, call DoDetectedCase in order to trigger HQ and PC too. + // flag 2, call DoDetectedCase in order to trigger HQ and PC + // too. if (Hosts[contact].inf == 2) { DoDetectedCase(contact, t, ts, tn); @@ -1825,8 +1830,8 @@ void DigitalContactTracingSweep(double t) if ((Hosts[contact].index_case_dct == 0) && ((abs(Hosts[contact].inf) == 2) || (Hosts[contact].inf == -1))) // if ((Hosts[contact].dct_test_time == ts) && - // (Hosts[contact].index_case_dct == 0) && ((abs(Hosts[contact].inf) == 2) || - // (Hosts[contact].inf == -1))) + // (Hosts[contact].index_case_dct == 0) && ((abs(Hosts[contact].inf) == 2) + // || (Hosts[contact].inf == -1))) { // set them to be an index case Hosts[contact].index_case_dct = 1; @@ -1876,7 +1881,7 @@ void DigitalContactTracingSweep(double t) int TreatSweep(double t) { ///// function loops over microcells to decide which cells are treated (either with treatment, - ///vaccine, social distancing, movement restrictions etc.) + /// vaccine, social distancing, movement restrictions etc.) int f, f1, f2, f3, f4; //// various fail conditions. Used for other things int nckwp; @@ -2006,10 +2011,10 @@ int TreatSweep(double t) //// Code block goes through various types of treatments/interventions ///(vaccination/movement restrictions etc.), / assesses whether various triggers ///(counts) are over a certain threshold, (specified in ReadParams) / and then - ///implements those treatments by setting various flags (i.e. .treat/ .vacc etc.) by - ///microcell. / Further, this block assigns all microcells that are within this - ///admin unit (and around this microcell) to be treated, using the flags set to - ///avoid duplication. + /// implements those treatments by setting various flags (i.e. .treat/ .vacc etc.) + /// by microcell. / Further, this block assigns all microcells that are within this + /// admin unit (and around this microcell) to be treated, using the flags set to + /// avoid duplication. //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// ///**** //// **** //// **** //// **** / **** //// **** //// **** //// **** TREATMENT @@ -2108,11 +2113,11 @@ int TreatSweep(double t) //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// ///**** //// **** //// **** //// **** / **** //// **** //// **** //// **** - ///VACCINATION / **** //// **** //// **** //// **** //// **** //// **** //// **** + /// VACCINATION / **** //// **** //// **** //// **** //// **** //// **** //// **** /////// **** //// vaccinates proportion VaccProp of people in microcell (or at least adds them to - ///geovacc_queue). + /// geovacc_queue). if ((Mcells[b].vacc == 1) && (ts >= Mcells[b].vacc_start_time)) { f = 1; @@ -2211,12 +2216,12 @@ int TreatSweep(double t) //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// ///**** //// **** //// **** //// **** / **** //// **** //// **** //// **** PLACE - ///CLOSURE / **** //// **** //// **** //// **** //// **** //// **** //// **** //// + /// CLOSURE / **** //// **** //// **** //// **** //// **** //// **** //// **** //// ///**** ///// note that here f2 bool asks whether trigger lower than stop threshold. A few - ///blocks down meaning changes to almost the opposite: asking whether trigger has - ///exceeded threshold in order to close places for first time. + /// blocks down meaning changes to almost the opposite: asking whether trigger has + /// exceeded threshold in order to close places for first time. if (P.DoGlobalTriggers) f2 = (global_trig < P.PlaceCloseCellIncStopThresh); else if (P.DoAdminTriggers) @@ -2241,9 +2246,9 @@ int TreatSweep(double t) ((f2) || (ts >= Mcells[b].place_end_time))) //// if place closure has started, the places in - ///this microcell are closed, and either stop - ///threshold has been reached or place_end_time - ///has passed, go through block + /// this microcell are closed, and either stop + /// threshold has been reached or place_end_time + /// has passed, go through block { f = 1; Mcells[b].placeclose = P.DoPlaceCloseOnceOnly; @@ -2261,8 +2266,8 @@ int TreatSweep(double t) if ((P.DoPlaces) && (t >= P.PlaceCloseTimeStart) && (Mcells[b].placeclose == 0)) { ///// note that here f2 bool asks whether trigger has exceeded threshold in - ///order to close places for first time.A few blocks up meaning was almost the - ///opposite: asking whether trigger lower than stop threshold. + /// order to close places for first time.A few blocks up meaning was almost the + /// opposite: asking whether trigger lower than stop threshold. if (P.DoGlobalTriggers) { @@ -2294,8 +2299,8 @@ int TreatSweep(double t) ((!P.PlaceCloseByAdminUnit) && (f2))) { // if(P.PlaceCloseByAdminUnit) - //AdUnits[Mcells[b].adunit].place_close_trig=USHRT_MAX-1; // This means - //schools only close once + // AdUnits[Mcells[b].adunit].place_close_trig=USHRT_MAX-1; // This means + // schools only close once int interventionFlag; // added this as a way to help filter out when // interventions start interventionFlag = 1; @@ -2331,7 +2336,7 @@ int TreatSweep(double t) //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// ///**** //// **** //// **** //// **** / **** //// **** //// **** //// **** MOVEMENT - ///RESTRICTIONS / **** //// **** //// **** //// **** //// **** //// **** //// **** + /// RESTRICTIONS / **** //// **** //// **** //// **** //// **** //// **** //// **** /////// **** if ((Mcells[b].moverest == 2) && (ts >= Mcells[b].move_end_time)) @@ -2420,7 +2425,7 @@ int TreatSweep(double t) //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// ///**** //// **** //// **** //// **** / **** //// **** //// **** //// **** SOCIAL - ///DISTANCING / **** //// **** //// **** //// **** //// **** //// **** //// **** + /// DISTANCING / **** //// **** //// **** //// **** //// **** //// **** //// **** /////// **** if (P.DoGlobalTriggers) @@ -2445,17 +2450,17 @@ int TreatSweep(double t) } //// if: policy of social distancing has started AND this microcell cell has been - ///labelled to as undergoing social distancing, AND either trigger not reached (note - ///definition of f2 changes in next few lines) or end time has passed. + /// labelled to as undergoing social distancing, AND either trigger not reached + /// (note definition of f2 changes in next few lines) or end time has passed. if ((t >= P.SocDistTimeStart) && (Mcells[b].socdist == 2) && ((f2) || (ts >= Mcells[b].socdist_end_time))) { f = 1; Mcells[b].socdist = P.DoSocDistOnceOnly; //// i.e. if P.DoSocDistOnceOnly set to false, socdist - ///set to 0 here, hence will be picked up upon some - ///subsequent call to TreatSweep if required trigger - ///passes threshold. + /// set to 0 here, hence will be picked up upon some + /// subsequent call to TreatSweep if required trigger + /// passes threshold. Mcells[b].socdist_trig = 0; //// reset trigger Mcells[b].socdist_end_time = ts; //// record end time. } @@ -2493,16 +2498,16 @@ int TreatSweep(double t) (AdUnits[Mcells[b].adunit].SocialDistanceTimeStart + AdUnits[Mcells[b].adunit] .SocialDistanceDuration))) //// i.e. if outside window of social - ///distancing for this admin unit. + /// distancing for this admin unit. interventionFlag = 0; if (interventionFlag == 1) if ((Mcells[b].n > 0) && (Mcells[b].socdist == 0)) //// if microcell populated and not currently - ///undergoing social distancing + /// undergoing social distancing { Mcells[b].socdist = 2; //// update flag to denote that cell is - ///undergoing social distancing + /// undergoing social distancing Mcells[b].socdist_trig = 0; /// reset trigger //// set (admin-specific) social distancing end time. if (P.DoInterventionDelaysByAdUnit) @@ -2516,7 +2521,7 @@ int TreatSweep(double t) //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// **** //// ///**** //// **** //// **** //// **** / **** //// **** //// **** //// **** - ///KEY-WORKER PROPHYLAXIS / **** //// **** //// **** //// **** //// **** //// **** + /// KEY-WORKER PROPHYLAXIS / **** //// **** //// **** //// **** //// **** //// **** /////// **** //// **** if ((Mcells[b].keyworkerproph == 2) && (ts >= Mcells[b].keyworkerproph_end_time)) diff --git a/src/Update.cpp b/src/Update.cpp index d275b5fb2..ce77250ac 100644 --- a/src/Update.cpp +++ b/src/Update.cpp @@ -84,17 +84,17 @@ void DoInfect(int ai, double t, int tn, // argument to DoInfect to record run number: ggilani - 15/10/14 { ///// This updates a number of things concerning person ai (and their contacts/infectors/places - ///etc.) at time t in thread tn for this run. + /// etc.) at time t in thread tn for this run. int i; unsigned short int ts; //// time step double q, x, y; //// q radius squared, x and y coords. q later changed to be quantile of inverse - ///CDF to choose latent period. + /// CDF to choose latent period. Person *a; a = Hosts + ai; //// pointer arithmetic. a = pointer to person. ai = int person index. if (a->inf == InfStat_Susceptible) //// Only change anything if person a/ai uninfected at start - ///of this function. + /// of this function. { ts = (unsigned short int)(P.TimeStepsPerDay * t); a->inf = InfStat_Latent; //// set person a to be infected @@ -120,7 +120,7 @@ void DoInfect(int ai, double t, int tn, Cells[a->pcell].susceptible[Cells[a->pcell].S]; Hosts[Cells[a->pcell].susceptible[a->listpos]].listpos = a->listpos; a->listpos = Cells[a->pcell].S; //// person a's position with cell.members now equal - ///to number of susceptibles in cell. + /// to number of susceptibles in cell. Cells[a->pcell].latent[0] = ai; //// person ai joins front of latent queue. } } @@ -346,7 +346,7 @@ void DoRecoveringFromCritical(int ai, int tn) //// note function different from DoRecover_FromSeverity. //// DoRecover_FromSeverity assigns people to state Recovered (and bookkeeps accordingly). //// DoRecoveringFromCritical assigns people to intermediate state "recovering from critical - ///condition" (and bookkeeps accordingly). + /// condition" (and bookkeeps accordingly). if (P.DoSeverity) //// shouldn't need this but best be careful. { Person *a = Hosts + ai; @@ -386,8 +386,8 @@ void DoDeath_FromCriticalorSARIorILI(int ai, int tn) StateT[tn].cumDeath_Critical_adunit[Mcells[a->mcell].adunit]++; } //// change current status (so that flags work if function called again for same - ///person). Don't move this outside of this if statement, even though it looks like it - ///can be moved safely. It can't. + /// person). Don't move this outside of this if statement, even though it looks like it + /// can be moved safely. It can't. a->Severity_Current = Severity_Dead; } else if (a->Severity_Current == Severity_SARI) @@ -402,8 +402,8 @@ void DoDeath_FromCriticalorSARIorILI(int ai, int tn) StateT[tn].cumDeath_SARI_adunit[Mcells[a->mcell].adunit]++; } //// change current status (so that flags work if function called again for same - ///person). Don't move this outside of this if statement, even though it looks like it - ///can be moved safely. It can't. + /// person). Don't move this outside of this if statement, even though it looks like it + /// can be moved safely. It can't. a->Severity_Current = Severity_Dead; } else if (a->Severity_Current == Severity_ILI) @@ -418,8 +418,8 @@ void DoDeath_FromCriticalorSARIorILI(int ai, int tn) StateT[tn].cumDeath_ILI_adunit[Mcells[a->mcell].adunit]++; } //// change current status (so that flags work if function called again for same - ///person). Don't move this outside of this if statement, even though it looks like it - ///can be moved safely. It can't. + /// person). Don't move this outside of this if statement, even though it looks like it + /// can be moved safely. It can't. a->Severity_Current = Severity_Dead; } } @@ -429,7 +429,7 @@ void DoRecover_FromSeverity(int ai, int tn) //// note function different from DoRecoveringFromCritical. //// DoRecover_FromSeverity assigns people to state Recovered (and bookkeeps accordingly). //// DoRecoveringFromCritical assigns people to intermediate state "recovering from critical - ///condition" (and bookkeeps accordingly). + /// condition" (and bookkeeps accordingly). //// moved this from DoRecover Person *a = Hosts + ai; @@ -437,7 +437,7 @@ void DoRecover_FromSeverity(int ai, int tn) if (P.DoSeverity) if (a->inf == InfStat_InfectiousAsymptomaticNotCase || a->inf == InfStat_Case) ///// i.e same condition in DoRecover (make sure you don't - ///recover people twice). + /// recover people twice). { if (a->Severity_Current == Severity_Mild) { @@ -446,8 +446,8 @@ void DoRecover_FromSeverity(int ai, int tn) if (P.DoAdUnits) StateT[tn].Mild_adunit[Mcells[a->mcell].adunit]--; //// change current status (so that flags work if function called again for same - ///person). Don't move this outside of this if statement, even though it looks like - ///it can be moved safely. It can't. + /// person). Don't move this outside of this if statement, even though it looks like + /// it can be moved safely. It can't. a->Severity_Current = Severity_Recovered; } else if (a->Severity_Current == Severity_ILI) @@ -457,8 +457,8 @@ void DoRecover_FromSeverity(int ai, int tn) if (P.DoAdUnits) StateT[tn].ILI_adunit[Mcells[a->mcell].adunit]--; //// change current status (so that flags work if function called again for same - ///person). Don't move this outside of this if statement, even though it looks like - ///it can be moved safely. It can't. + /// person). Don't move this outside of this if statement, even though it looks like + /// it can be moved safely. It can't. a->Severity_Current = Severity_Recovered; } else if (a->Severity_Current == Severity_SARI) @@ -468,8 +468,8 @@ void DoRecover_FromSeverity(int ai, int tn) if (P.DoAdUnits) StateT[tn].SARI_adunit[Mcells[a->mcell].adunit]--; //// change current status (so that flags work if function called again for same - ///person). Don't move this outside of this if statement, even though it looks like - ///it can be moved safely. It can't. + /// person). Don't move this outside of this if statement, even though it looks like + /// it can be moved safely. It can't. a->Severity_Current = Severity_Recovered; } else if (a->Severity_Current == Severity_RecoveringFromCritical) @@ -479,8 +479,8 @@ void DoRecover_FromSeverity(int ai, int tn) if (P.DoAdUnits) StateT[tn].CritRecov_adunit[Mcells[a->mcell].adunit]--; //// change current status (so that flags work if function called again for same - ///person). Don't move this outside of this if statement, even though it looks like - ///it can be moved safely. It can't. + /// person). Don't move this outside of this if statement, even though it looks like + /// it can be moved safely. It can't. a->Severity_Current = Severity_Recovered; } } @@ -517,7 +517,7 @@ void DoIncub(int ai, unsigned short int ts, int tn, int run) if (!P.DoSeverity || a->inf == InfStat_InfectiousAsymptomaticNotCase) //// if not doing severity or if person - ///asymptomatic. + /// asymptomatic. { if (P.DoInfectiousnessProfile) a->recovery_or_death_time = @@ -532,13 +532,13 @@ void DoIncub(int ai, unsigned short int ts, int tn, int run) a->latent_time + ((int)(P.LatentToSymptDelay / P.TimeStep)); //// base severity times on CaseTime, not latent time. - ///Otherwise there are edge cases where recovery time is zero - ///days after latent_time and therefore before DoCase called in - ///IncubRecoverySweep (i.e. people can recover before they've - ///become a case!). + /// Otherwise there are edge cases where recovery time is zero + /// days after latent_time and therefore before DoCase called + /// in IncubRecoverySweep (i.e. people can recover before + /// they've become a case!). //// choose final disease severity (either mild, ILI, SARI, Critical, not asymptomatic - ///as covered above) by age + /// as covered above) by age a->Severity_Final = ChooseFinalDiseaseSeverity(age, tn); /// choose outcome recovery or death @@ -640,11 +640,11 @@ void DoIncub(int ai, unsigned short int ts, int tn, int run) Hosts[Cells[a->pcell].susceptible[a->listpos]].listpos = a->listpos; a->listpos = Cells[a->pcell].S + Cells[a->pcell].L; //// change person a's listpos, which will now refer to - ///their position among infectious people, not latent. + /// their position among infectious people, not latent. Cells[a->pcell].infected[0] = ai; //// this person is now first infectious person in the array. Pointer was moved - ///back one so now that memory address refers to person ai. Alternative would be - ///to move everyone back one which would take longer. + /// back one so now that memory address refers to person ai. Alternative would + /// be to move everyone back one which would take longer. } } } @@ -654,13 +654,14 @@ void DoDetectedCase(int ai, double t, unsigned short int ts, int tn) //// Function DoDetectedCase does many things associated with various interventions. //// Enacts Household quarantine, case isolation, place closure. //// and therefore changes lots of quantities (e.g. quar_comply and isolation_start_time) - ///associated with model macros e.g. HOST_ABSENT / HOST_ISOLATED + /// associated with model macros e.g. HOST_ABSENT / HOST_ISOLATED int j, k, f, j1, j2, ad; // m, h, ad; Person *a = Hosts + ai; //// Increment triggers (Based on numbers of detected cases) for interventions. Used in - ///TreatSweep function when not doing Global or Admin triggers. And not when doing ICU triggers. + /// TreatSweep function when not doing Global or Admin triggers. And not when doing ICU + /// triggers. if (Mcells[a->mcell].treat_trig < USHRT_MAX - 1) Mcells[a->mcell].treat_trig++; if (Mcells[a->mcell].vacc_trig < USHRT_MAX - 1) @@ -768,8 +769,8 @@ void DoDetectedCase(int ai, double t, unsigned short int ts, int tn) } //// Giant compound if statement. If doing delays by admin unit, then window of HQuarantine - ///dependent on admin unit-specific duration. This if statement ensures that this timepoint - ///within window, regardless of how window defined. + /// dependent on admin unit-specific duration. This if statement ensures that this timepoint + /// within window, regardless of how window defined. if ((P.DoInterventionDelaysByAdUnit && (t >= AdUnits[Mcells[a->mcell].adunit].HQuarantineTimeStart && (t < AdUnits[Mcells[a->mcell].adunit].HQuarantineTimeStart + @@ -789,9 +790,9 @@ void DoDetectedCase(int ai, double t, unsigned short int ts, int tn) : 0; //// Is household compliant? True or false if (k) StateT[tn].cumHQ++; //// if compliant, increment cumulative numbers of - ///households under quarantine. + /// households under quarantine. //// if household not compliant then neither is first person. Otheswise ask whether - ///first person is compliant? + /// first person is compliant? ///// cycle through remaining household members and repeat the above steps for (j = j1; j < j2; j++) { @@ -815,8 +816,8 @@ void DoDetectedCase(int ai, double t, unsigned short int ts, int tn) } //// Giant compound if statement. If doing delays by admin unit, then window of case isolation - ///dependent on admin unit-specific duration. This if statement ensures that this timepoint - ///within window, regardless of how window defined. + /// dependent on admin unit-specific duration. This if statement ensures that this timepoint + /// within window, regardless of how window defined. if ((P.DoInterventionDelaysByAdUnit && (t >= AdUnits[Mcells[a->mcell].adunit].CaseIsolationTimeStart && (t < AdUnits[Mcells[a->mcell].adunit].CaseIsolationTimeStart + @@ -851,23 +852,23 @@ void DoDetectedCase(int ai, double t, unsigned short int ts, int tn) if ((P.DoHouseholds) && (P.DoPlaces) && (HOST_AGE_YEAR(ai) < P.CaseAbsentChildAgeCutoff)) //// if host is a child who requires adult to stay - ///at home. + /// at home. { if (!HOST_QUARANTINED(ai)) StateT[tn].cumACS++; if (Hosts[ai].ProbCare < P.CaseAbsentChildPropAdultCarers) //// if adult needs to stay at home (i.e. - ///if Proportion of children at home for - ///whom one adult also stays at home = 1 - ///or coinflip satisfied.) + /// if Proportion of children at home for + /// whom one adult also stays at home = 1 + /// or coinflip satisfied.) { j1 = Households[Hosts[ai].hh].FirstPerson; j2 = j1 + Households[Hosts[ai].hh].nh; f = 0; //// in loop below, f true if any household member a) alive AND b) not a - ///child AND c) has no links to workplace (or is absent from work or - ///quarantined). + /// child AND c) has no links to workplace (or is absent from work or + /// quarantined). for (j = j1; (j < j2) && (!f); j++) f = ((abs(Hosts[j].inf) != InfStat_Dead) && (HOST_AGE_YEAR(j) >= P.CaseAbsentChildAgeCutoff) && @@ -875,10 +876,10 @@ void DoDetectedCase(int ai, double t, unsigned short int ts, int tn) (HOST_ABSENT(j)) || (HOST_QUARANTINED(j)))); //// so !f true if any household member EITHER: a) dead; b) a child; c) has - ///a link to an office and not currently absent or quarantined. + /// a link to an office and not currently absent or quarantined. if (!f) //// so if either a) a household member is dead; b) a household - ///member is a child requiring adult to stay home; c) a household - ///member has links to office. + /// member is a child requiring adult to stay home; c) a household + /// member has links to office. { for (j = j1; (j < j2) & (!f); j++) /// loop again, checking whether household members not @@ -890,8 +891,8 @@ void DoDetectedCase(int ai, double t, unsigned short int ts, int tn) f = 1; } if (f) //// so finally, if at least one member of household is alive and - ///does not need supervision by an adult, amend absent start and - ///stop times + /// does not need supervision by an adult, amend absent start and + /// stop times { Hosts[k].absent_start_time = ts + P.usCaseIsolationDelay; Hosts[k].absent_stop_time = @@ -917,8 +918,8 @@ void DoDetectedCase(int ai, double t, unsigned short int ts, int tn) if ((P.DCTIsolateIndexCases) && (Hosts[ai].index_case_dct == 0)) //(Hosts[ai].digitalContactTraced == 0)&& - currently removed this condition as it - //would mean that someone already under isolation wouldn't have their isolation - //extended + // would mean that someone already under isolation wouldn't have their isolation + // extended { ad = Mcells[Hosts[ai].mcell].adunit; // if (AdUnits[j].ndct < AdUnits[j].n) @@ -943,13 +944,13 @@ void DoDetectedCase(int ai, double t, unsigned short int ts, int tn) // if(P.IncludeHouseholdDigitalContactTracing) //{ // //Then we want to find all their household and place group contacts to add to the - //contact tracing queue + // contact tracing queue // //Start with household contacts // j1 = Households[Hosts[ai].hh].FirstPerson; j2 = j1 + Households[Hosts[ai].hh].nh; // for (j = j1; j < j2; j++) // { // //if host is dead or the detected case, no need to add them to the list. They also - //need to be a user themselves if ((abs(Hosts[j].inf) != 5) && (j != ai) && + // need to be a user themselves if ((abs(Hosts[j].inf) != 5) && (j != ai) && //(Hosts[j].digitalContactTracingUser) && (ranf_mt(tn)inf == InfStat_InfectiousAlmostSymptomatic) //// if person latent/asymptomatically - ///infected, but infectious + /// infected, but infectious { a->inf = InfStat_Case; //// make person symptomatic and infectious (i.e. a case) if (HOST_ABSENT(ai)) @@ -1127,7 +1128,7 @@ void DoCase(int ai, double t, unsigned short int ts, DoMild(ai, tn); else DoILI(ai, tn); //// symptomatic cases either mild or ILI at symptom onset. SARI and - ///Critical cases still onset with ILI. + /// Critical cases still onset with ILI. } if (P.DoAdUnits) StateT[tn].cumC_adunit[Mcells[a->mcell].adunit]++; @@ -1285,8 +1286,8 @@ void DoTreatCase(int ai, unsigned short int ts, int tn) void DoProph(int ai, unsigned short int ts, int tn) { //// almost identical to DoProphNoDelay, except unsurprisingly this function includes delay - ///between timestep and start of treatment. Also increments StateT[tn].cumT_keyworker by 1 every - ///time. + /// between timestep and start of treatment. Also increments StateT[tn].cumT_keyworker by 1 + /// every time. if (State.cumT < P.TreatMaxCourses) { @@ -1353,10 +1354,11 @@ void DoProphNoDelay(int ai, unsigned short int ts, int tn, int nc) void DoPlaceClose(int i, int j, unsigned short int ts, int tn, int DoAnyway) { //// DoPlaceClose function called in TreatSweep (with arg DoAnyway = 1) and DoDetectedCase (with - ///arg DoAnyway = 0). / Basic pupose of this function is to change Places[i][j].close_start_time - ///and Places[i][j].close_end_time, so that macro PLACE_CLOSED will return true. / This will - ///then scale peoples household, place, and spatial infectiousness and susceptibilities in - ///function InfectSweep (but not in functions ini CalcInfSusc.cpp) + /// arg DoAnyway = 0). / Basic pupose of this function is to change + /// Places[i][j].close_start_time and Places[i][j].close_end_time, so that macro PLACE_CLOSED + /// will return true. / This will then scale peoples household, place, and spatial + /// infectiousness and susceptibilities in function InfectSweep (but not in functions ini + /// CalcInfSusc.cpp) int k, ai, j1, j2, l, f, f2; unsigned short trig; @@ -1386,7 +1388,7 @@ void DoPlaceClose(int i, int j, unsigned short int ts, int tn, int DoAnyway) { //// close_start_time initialized to USHRT_MAX - 1. //// close_end_time initialized to zero in InitModel (so will pass this check on at least - ///first call of this function). + /// first call of this function). if (Places[i][j].close_end_time < t_stop) { @@ -1447,7 +1449,7 @@ void DoPlaceClose(int i, int j, unsigned short int ts, int tn, int DoAnyway) if (P.DoPlaceCloseOnceOnly) Places[i][j].control_trig = USHRT_MAX - 1; //// Places only close once, and so this code block would - ///not be entered again. + /// not be entered again. else Places[i][j].control_trig = 0; //// otherwise reset the trigger. @@ -1455,8 +1457,8 @@ void DoPlaceClose(int i, int j, unsigned short int ts, int tn, int DoAnyway) if (Places[i][j].ProbClose >= P.PlaceCloseEffect[i]) //// if proportion of places of type i remaining open - ///is 0 or if place is closed with prob 1 - - ///PlaceCloseEffect[i]... + /// is 0 or if place is closed with prob 1 - + /// PlaceCloseEffect[i]... { if (Places[i][j].close_start_time > t_start) Places[i][j].close_start_time = t_start; @@ -1466,7 +1468,7 @@ void DoPlaceClose(int i, int j, unsigned short int ts, int tn, int DoAnyway) else Places[i][j].close_start_time = Places[i][j].close_end_time = t_stop; //// ... otherwise set start and end of closure to be the same, - ///which will cause macro PLACE_CLOSED to always return false. + /// which will cause macro PLACE_CLOSED to always return false. } } } @@ -1484,7 +1486,7 @@ void DoPlaceClose(int i, int j, unsigned short int ts, int tn, int DoAnyway) if ((!HOST_ABSENT(ai)) && (!HOST_QUARANTINED(ai)) && (HOST_AGE_YEAR(ai) < P.CaseAbsentChildAgeCutoff)) //// if person is a child and neither absent - ///nor quarantined + /// nor quarantined { StateT[tn].cumAPCS++; if (Hosts[ai].ProbCare < @@ -1497,19 +1499,19 @@ void DoPlaceClose(int i, int j, unsigned short int ts, int tn, int DoAnyway) f = 0; //// in loop below, f true if any household member a) alive AND b) not a - ///child AND c) has no links to workplace (or is absent from work or - ///quarantined). + /// child AND c) has no links to workplace (or is absent from work or + /// quarantined). for (l = j1; (l < j2) && (!f); l++) f = ((abs(Hosts[l].inf) != InfStat_Dead) && (HOST_AGE_YEAR(l) >= P.CaseAbsentChildAgeCutoff) && ((Hosts[l].PlaceLinks[P.PlaceTypeNoAirNum - 1] < 0) || (HOST_QUARANTINED(l)))); if (!f) //// so !f true if there's no living adult household member who - ///is not quarantined already or isn't a home-worker. + /// is not quarantined already or isn't a home-worker. { for (l = j1; (l < j2) && (!f); l++) //// loop over all household members of child this place: - ///find the adults and ensure they're not dead... + /// find the adults and ensure they're not dead... if ((HOST_AGE_YEAR(l) >= P.CaseAbsentChildAgeCutoff) && (abs(Hosts[l].inf) != InfStat_Dead)) { @@ -1526,7 +1528,7 @@ void DoPlaceClose(int i, int j, unsigned short int ts, int tn, int DoAnyway) //#pragma omp critical (closeplace3) { ///// finally amend absent start and stop times if they contradict place - ///start and stop times. + /// start and stop times. if (Hosts[ai].absent_start_time > t_start) Hosts[ai].absent_start_time = t_start; if (Hosts[ai].absent_stop_time < t_stop) @@ -1696,12 +1698,12 @@ unsigned short int ChooseFromICDF(double *ICDF, double Mean, int tn) i = (int)floor(q = ranf_mt(tn) * CDF_RES); //// note q defined here as well as i. q -= ((double)i); //// remainder - ti = - -Mean * - log(q * ICDF[i + 1] + - (1.0 - q) * ICDF[i]); //// weighted average (sort of) between quartile values from - ///CDF_RES. logged as it was previously exponentiated in - ///ReadParams. Minus as exp(-cdf) was done in ReadParaams. Sort of + ti = -Mean * + log(q * ICDF[i + 1] + + (1.0 - q) * + ICDF[i]); //// weighted average (sort of) between quartile values from + /// CDF_RES. logged as it was previously exponentiated in + /// ReadParams. Minus as exp(-cdf) was done in ReadParaams. Sort of Value = (unsigned short int)floor(0.5 + (ti * P.TimeStepsPerDay)); return Value; diff --git a/src/Update.h b/src/Update.h index 93b5be202..7d6631a24 100644 --- a/src/Update.h +++ b/src/Update.h @@ -11,7 +11,7 @@ void DoCase(int, double, unsigned short int, int); void DoFalseCase(int, double, unsigned short int, int); void DoRecover(int, int, int); // added int as argument to record run number: ggilani - 23/10/14. // Added thread number to record Severity categories in StateT. -void DoDeath(int, int, int); // added int as argument to record run number: ggilani - 23/10/14 +void DoDeath(int, int, int); // added int as argument to record run number: ggilani - 23/10/14 void DoPlaceClose(int, int, unsigned short int, int, int); void DoPlaceOpen(int, int, unsigned short int, int); void DoTreatCase(int, unsigned short int, int);