7 #include "ModelMacros.h" 14 void RecordEvent(
double,
int,
int,
int,
int);
16 unsigned short int ChooseFromICDF(
double *,
double,
int);
17 Severity ChooseFinalDiseaseSeverity(
int,
int);
27 if (a->inf == InfStat_Susceptible)
30 a->inf = InfStat_ImmuneAtStart;
32 if (a->listpos < Cells[c].S)
34 Cells[c].susceptible[a->listpos] = Cells[c].susceptible[Cells[c].S];
35 Hosts[Cells[c].susceptible[a->listpos]].listpos = a->listpos;
39 Cells[c].susceptible[Cells[c].S] = Cells[c].susceptible[Cells[c].S + Cells[c].L];
40 Hosts[Cells[c].susceptible[Cells[c].S]].listpos = Cells[c].S;
44 Cells[c].susceptible[Cells[c].S + Cells[c].L] = Cells[c].susceptible[Cells[c].S + Cells[c].L + Cells[c].I];
45 Hosts[Cells[c].susceptible[Cells[c].S + Cells[c].L]].listpos = Cells[c].S + Cells[c].L;
47 if (a->listpos < Cells[c].S + Cells[c].L + Cells[c].I)
49 Cells[c].susceptible[Cells[c].S + Cells[c].L + Cells[c].I] = ai;
50 a->listpos = Cells[c].S + Cells[c].L + Cells[c].I;
57 x = ((int)(Households[a->hh].loc_x * P.scalex)) - P.bminx;
58 y = ((
int)(Households[a->hh].loc_y * P.scaley)) - P.bminy;
59 if ((x >= 0) && (x < P.bwidth) && (y >= 0) && (y < P.bheight))
61 unsigned j = y * bmh->width + x;
62 if (j < bmh->imagesize)
71 void DoInfect(
int ai,
double t,
int tn,
int run)
75 unsigned short int ts;
81 if (a->inf == InfStat_Susceptible)
83 ts = (
unsigned short int) (P.TimeStepsPerDay * t);
84 a->inf = InfStat_Latent;
85 a->infection_time = (
unsigned short int) ts;
88 StateT[tn].cumItype[a->infect_type % INFECT_TYPE_MASK]++;
89 StateT[tn].cumIa[HOST_AGE_GROUP(ai)]++;
91 x = (Households[a->hh].loc_x - P.LocationInitialInfection[0][0]);
92 y = (Households[a->hh].loc_y - P.LocationInitialInfection[0][1]);
94 StateT[tn].sumRad2 += q;
96 if (q > StateT[tn].maxRad2) StateT[tn].maxRad2 = q;
100 Cells[a->pcell].latent--;
101 if (a->listpos < Cells[a->pcell].S)
103 Cells[a->pcell].susceptible[a->listpos] = Cells[a->pcell].susceptible[Cells[a->pcell].S];
104 Hosts[Cells[a->pcell].susceptible[a->listpos]].listpos = a->listpos;
105 a->listpos = Cells[a->pcell].S;
106 Cells[a->pcell].latent[0] = ai;
109 StateT[tn].cumI_keyworker[a->keyworker]++;
113 i = (int)floor((q = ranf_mt(tn) * CDF_RES));
115 a->latent_time = (
unsigned short int) floor(0.5 + (t - P.LatentPeriod * log(q * P.latent_icdf[i + 1] + (1.0 - q) * P.latent_icdf[i])) * P.TimeStepsPerDay);
118 a->latent_time = (
unsigned short int) (t * P.TimeStepsPerDay);
123 if (P.DoAdUnits) StateT[tn].cumI_adunit[Mcells[a->mcell].adunit]++;
127 if ((P.OutputBitmapDetected == 0) || ((P.OutputBitmapDetected == 1) && (Hosts[ai].detected == 1)))
129 int ix = ((int)(Households[a->hh].loc_x * P.scalex)) - P.bminx;
130 int iy = ((
int)(Households[a->hh].loc_y * P.scaley)) - P.bminy;
131 if ((ix >= 0) && (ix < P.bwidth) && (iy >= 0) && (iy < P.bheight))
133 unsigned j = iy * bmh->width + ix;
134 if (j < bmh->imagesize)
143 if (P.DoRecordInfEvents)
145 RecordEvent(t, ai, run, 0, tn);
147 if ((t > 0) && (P.DoOneGen))
149 DoIncub(ai, ts, tn, run);
150 DoCase(ai, t, ts, tn);
151 DoRecover(ai, tn, run);
156 void RecordEvent(
double t,
int ai,
int run,
int type,
int tn)
172 bi = Hosts[ai].infector;
175 #pragma omp critical (inf_event) 176 if (nEvents < P.MaxInfEvents)
178 InfEventLog[nEvents].run = run;
179 InfEventLog[nEvents].type = type;
180 InfEventLog[nEvents].t = t;
181 InfEventLog[nEvents].infectee_ind = ai;
182 InfEventLog[nEvents].infectee_adunit = Mcells[Hosts[ai].mcell].adunit;
183 InfEventLog[nEvents].infectee_x = Households[Hosts[ai].hh].loc_x + P.SpatialBoundingBox[0];
184 InfEventLog[nEvents].infectee_y = Households[Hosts[ai].hh].loc_y + P.SpatialBoundingBox[1];
185 InfEventLog[nEvents].listpos = Hosts[ai].listpos;
186 InfEventLog[nEvents].infectee_cell = Hosts[ai].pcell;
187 InfEventLog[nEvents].thread = tn;
190 InfEventLog[nEvents].infector_ind = bi;
193 InfEventLog[nEvents].t_infector = -1;
194 InfEventLog[nEvents].infector_cell = -1;
198 InfEventLog[nEvents].t_infector = (int)(Hosts[bi].infection_time / P.TimeStepsPerDay);
199 InfEventLog[nEvents].infector_cell = Hosts[bi].pcell;
204 InfEventLog[nEvents].t_infector = (int)(Hosts[ai].infection_time / P.TimeStepsPerDay);
206 else if ((type == 2) || (type == 3))
208 InfEventLog[nEvents].t_infector = (int)(Hosts[ai].latent_time / P.TimeStepsPerDay);
217 void DoMild(
int ai,
int tn)
222 if (a->Severity_Current == Severity_Asymptomatic)
224 a->Severity_Current = Severity_Mild;
226 StateT[tn].cumMild++;
227 StateT[tn].Mild_age[HOST_AGE_GROUP(ai)]++;
231 StateT[tn].Mild_adunit[Mcells[a->mcell].adunit]++;
237 void DoILI(
int ai,
int tn)
242 if (a->Severity_Current == Severity_Asymptomatic)
244 a->Severity_Current = Severity_ILI;
247 StateT[tn].ILI_age[HOST_AGE_GROUP(ai)]++;
248 StateT[tn].cumILI_age[HOST_AGE_GROUP(ai)]++;
251 StateT[tn].ILI_adunit [Mcells[a->mcell].adunit]++;
252 StateT[tn].cumILI_adunit[Mcells[a->mcell].adunit]++;
257 void DoSARI(
int ai,
int tn)
262 if (a->Severity_Current == Severity_ILI)
264 a->Severity_Current = Severity_SARI;
266 StateT[tn].ILI_age[HOST_AGE_GROUP(ai)]--;
268 StateT[tn].cumSARI++;
269 StateT[tn].SARI_age[HOST_AGE_GROUP(ai)]++;
270 StateT[tn].cumSARI_age[HOST_AGE_GROUP(ai)]++;
273 StateT[tn].ILI_adunit [Mcells[a->mcell].adunit]--;
274 StateT[tn].SARI_adunit [Mcells[a->mcell].adunit]++;
275 StateT[tn].cumSARI_adunit [Mcells[a->mcell].adunit]++;
280 void DoCritical(
int ai,
int tn)
285 if (a->Severity_Current == Severity_SARI)
287 a->Severity_Current = Severity_Critical;
289 StateT[tn].SARI_age[HOST_AGE_GROUP(ai)]--;
290 StateT[tn].Critical++;
291 StateT[tn].cumCritical++;
292 StateT[tn].Critical_age[HOST_AGE_GROUP(ai)]++;
293 StateT[tn].cumCritical_age[HOST_AGE_GROUP(ai)]++;
296 StateT[tn].SARI_adunit [Mcells[a->mcell].adunit]--;
297 StateT[tn].Critical_adunit [Mcells[a->mcell].adunit]++;
298 StateT[tn].cumCritical_adunit [Mcells[a->mcell].adunit]++;
303 void DoRecoveringFromCritical(
int ai,
int tn)
311 if (a->Severity_Current == Severity_Critical && (!a->to_die))
313 a->Severity_Current = Severity_RecoveringFromCritical;
314 StateT[tn].Critical--;
315 StateT[tn].Critical_age[HOST_AGE_GROUP(ai)]--;
316 StateT[tn].CritRecov++;
317 StateT[tn].cumCritRecov++;
318 StateT[tn].CritRecov_age[HOST_AGE_GROUP(ai)]++;
319 StateT[tn].cumCritRecov_age[HOST_AGE_GROUP(ai)]++;
322 StateT[tn].Critical_adunit[Mcells[a->mcell].adunit]--;
323 StateT[tn].CritRecov_adunit[Mcells[a->mcell].adunit]++;
324 StateT[tn].cumCritRecov_adunit[Mcells[a->mcell].adunit]++;
329 void DoDeath_FromCriticalorSARIorILI(
int ai,
int tn)
334 if (a->Severity_Current == Severity_Critical)
336 StateT[tn].Critical--;
337 StateT[tn].Critical_age[HOST_AGE_GROUP(ai)]--;
338 StateT[tn].cumDeath_Critical++;
339 StateT[tn].cumDeath_Critical_age[HOST_AGE_GROUP(ai)]++;
342 StateT[tn].Critical_adunit [Mcells[a->mcell].adunit]--;
343 StateT[tn].cumDeath_Critical_adunit [Mcells[a->mcell].adunit]++;
346 a->Severity_Current = Severity_Dead;
348 else if (a->Severity_Current == Severity_SARI)
351 StateT[tn].SARI_age[HOST_AGE_GROUP(ai)]--;
352 StateT[tn].cumDeath_SARI++;
353 StateT[tn].cumDeath_SARI_age[HOST_AGE_GROUP(ai)]++;
356 StateT[tn].SARI_adunit [Mcells[a->mcell].adunit]--;
357 StateT[tn].cumDeath_SARI_adunit [Mcells[a->mcell].adunit]++;
360 a->Severity_Current = Severity_Dead;
362 else if (a->Severity_Current == Severity_ILI)
365 StateT[tn].ILI_age[HOST_AGE_GROUP(ai)]--;
366 StateT[tn].cumDeath_ILI++;
367 StateT[tn].cumDeath_ILI_age[HOST_AGE_GROUP(ai)]++;
370 StateT[tn].ILI_adunit [Mcells[a->mcell].adunit]--;
371 StateT[tn].cumDeath_ILI_adunit [Mcells[a->mcell].adunit]++;
374 a->Severity_Current = Severity_Dead;
378 void DoRecover_FromSeverity(
int ai,
int tn)
388 if (a->inf == InfStat_InfectiousAsymptomaticNotCase || a->inf == InfStat_Case)
390 if (a->Severity_Current == Severity_Mild)
393 StateT[tn].Mild_age[HOST_AGE_GROUP(ai)]--;
394 if (P.DoAdUnits) StateT[tn].Mild_adunit[Mcells[a->mcell].adunit]--;
396 a->Severity_Current = Severity_Recovered;
398 else if (a->Severity_Current == Severity_ILI)
401 StateT[tn].ILI_age[HOST_AGE_GROUP(ai)]--;
402 if (P.DoAdUnits) StateT[tn].ILI_adunit[Mcells[a->mcell].adunit]--;
404 a->Severity_Current = Severity_Recovered;
406 else if (a->Severity_Current == Severity_SARI)
409 StateT[tn].SARI_age[HOST_AGE_GROUP(ai)]--;
410 if (P.DoAdUnits) StateT[tn].SARI_adunit[Mcells[a->mcell].adunit]--;
412 a->Severity_Current = Severity_Recovered;
414 else if (a->Severity_Current == Severity_RecoveringFromCritical)
416 StateT[tn].CritRecov--;
417 StateT[tn].CritRecov_age[HOST_AGE_GROUP(ai)]--;
418 if (P.DoAdUnits) StateT[tn].CritRecov_adunit[Mcells[a->mcell].adunit]--;
420 a->Severity_Current = Severity_Recovered;
425 void DoIncub(
int ai,
unsigned short int ts,
int tn,
int run)
431 age = HOST_AGE_GROUP(ai);
432 if (age >= NUM_AGE_GROUPS) age = NUM_AGE_GROUPS - 1;
435 if (a->inf == InfStat_Latent)
437 a->infectiousness = (float)P.AgeInfectiousness[age];
438 if (P.InfectiousnessSD > 0) a->infectiousness *= (float) gen_gamma_mt(1 / (P.InfectiousnessSD * P.InfectiousnessSD), 1 / (P.InfectiousnessSD * P.InfectiousnessSD), tn);
439 q = P.ProportionSymptomatic[age]
440 * (HOST_TREATED(ai) ? (1 - P.TreatSympDrop) : 1)
441 * (HOST_VACCED(ai) ? (1 - P.VaccSympDrop) : 1);
445 a->inf = InfStat_InfectiousAlmostSymptomatic;
446 a->infectiousness *= (float)(-P.SymptInfectiousness);
449 a->inf = InfStat_InfectiousAsymptomaticNotCase;
451 if (!P.DoSeverity || a->inf == InfStat_InfectiousAsymptomaticNotCase)
453 if (P.DoInfectiousnessProfile) a->recovery_or_death_time = a->latent_time + (
unsigned short int) (P.InfectiousPeriod * P.TimeStepsPerDay);
454 else a->recovery_or_death_time = a->latent_time + ChooseFromICDF(P.infectious_icdf, P.InfectiousPeriod, tn);
458 int CaseTime = a->latent_time + ((int)(P.LatentToSymptDelay / P.TimeStep));
461 a->Severity_Final = ChooseFinalDiseaseSeverity(age, tn);
464 if ( ((a->Severity_Final == Severity_Critical) && (ranf_mt(tn) < P.CFR_Critical_ByAge [age])) ||
465 ((a->Severity_Final == Severity_SARI ) && (ranf_mt(tn) < P.CFR_SARI_ByAge [age])) ||
466 ((a->Severity_Final == Severity_ILI ) && (ranf_mt(tn) < P.CFR_ILI_ByAge [age])) )
470 if (a->Severity_Final == Severity_Mild)
471 a->recovery_or_death_time = CaseTime + ChooseFromICDF(P.MildToRecovery_icdf, P.
Mean_MildToRecovery[age], tn);
472 else if (a->Severity_Final == Severity_Critical)
474 a->SARI_time = CaseTime + ChooseFromICDF(P.ILIToSARI_icdf , P.Mean_ILIToSARI[age], tn);
475 a->Critical_time = a->SARI_time + ChooseFromICDF(P.SARIToCritical_icdf , P.Mean_SARIToCritical[age], tn);
477 a->recovery_or_death_time = a->Critical_time + ChooseFromICDF(P.CriticalToDeath_icdf , P.Mean_CriticalToDeath[age], tn);
480 a->RecoveringFromCritical_time = a->Critical_time + ChooseFromICDF(P.CriticalToCritRecov_icdf , P.Mean_CriticalToCritRecov[age], tn);
481 a->recovery_or_death_time = a->RecoveringFromCritical_time + ChooseFromICDF(P.CritRecovToRecov_icdf , P.Mean_CritRecovToRecov[age], tn);
484 else if (a->Severity_Final == Severity_SARI)
486 a->SARI_time = CaseTime + ChooseFromICDF(P.ILIToSARI_icdf, P.Mean_ILIToSARI[age], tn);
488 a->recovery_or_death_time = a->SARI_time + ChooseFromICDF(P.SARIToDeath_icdf , P.Mean_SARIToDeath[age], tn);
490 a->recovery_or_death_time = a->SARI_time + ChooseFromICDF(P.SARIToRecovery_icdf , P.Mean_SARIToRecovery[age], tn);
495 a->recovery_or_death_time = CaseTime + ChooseFromICDF(P.ILIToDeath_icdf , P.Mean_ILIToDeath[age], tn);
497 a->recovery_or_death_time = CaseTime + ChooseFromICDF(P.ILIToRecovery_icdf , P.Mean_ILIToRecovery[age], tn);
501 if ((a->inf== InfStat_InfectiousAlmostSymptomatic) && ((P.ControlPropCasesId == 1) || (ranf_mt(tn) < P.ControlPropCasesId)))
503 Hosts[ai].detected = 1;
504 Hosts[ai].detected_time = ts + (
unsigned short int)(P.LatentToSymptDelay * P.TimeStepsPerDay);
507 if ((P.DoDigitalContactTracing) && (Hosts[ai].detected_time >= (
unsigned short int)(AdUnits[Mcells[Hosts[ai].mcell].adunit].DigitalContactTracingTimeStart * P.TimeStepsPerDay)) && (Hosts[ai].detected_time < (
unsigned short int)((AdUnits[Mcells[Hosts[ai].mcell].adunit].DigitalContactTracingTimeStart + P.DigitalContactTracingPolicyDuration)*P.TimeStepsPerDay)) && (Hosts[ai].digitalContactTracingUser))
510 if (P.DoDigitalContactTracing)
511 if (Hosts[ai].dct_trigger_time == (USHRT_MAX - 1))
512 Hosts[ai].dct_trigger_time = Hosts[ai].detected_time + (
unsigned short int) (P.DelayFromIndexCaseDetectionToDCTIsolation * P.TimeStepsPerDay);
518 Cells[a->pcell].infected--;
520 if (Cells[a->pcell].L > 0)
522 Cells[a->pcell].susceptible[a->listpos] = Cells[a->pcell].latent[Cells[a->pcell].L];
523 Hosts[Cells[a->pcell].susceptible[a->listpos]].listpos = a->listpos;
524 a->listpos = Cells[a->pcell].S + Cells[a->pcell].L;
525 Cells[a->pcell].infected[0] = ai;
530 void DoDetectedCase(
int ai,
double t,
unsigned short int ts,
int tn)
536 int j, k, f, j1, j2, ad;
540 if (Mcells[a->mcell].treat_trig < USHRT_MAX - 1) Mcells[a->mcell].treat_trig++;
541 if (Mcells[a->mcell].vacc_trig < USHRT_MAX - 1) Mcells[a->mcell].vacc_trig++;
542 if (Mcells[a->mcell].move_trig < USHRT_MAX - 1) Mcells[a->mcell].move_trig++;
543 if (Mcells[a->mcell].socdist_trig < USHRT_MAX - 1) Mcells[a->mcell].socdist_trig++;
544 if (Mcells[a->mcell].keyworkerproph_trig < USHRT_MAX - 1) Mcells[a->mcell].keyworkerproph_trig++;
546 if (!P.AbsenteeismPlaceClosure)
548 if ((P.PlaceCloseRoundHousehold)&& (Mcells[a->mcell].place_trig < USHRT_MAX - 1)) Mcells[a->mcell].place_trig++;
549 if ((t >= P.PlaceCloseTimeStart) && (!P.DoAdminTriggers) && (!((P.DoGlobalTriggers)&&(P.PlaceCloseCellIncThresh<1000000000))))
550 for (j = 0; j < P.PlaceTypeNum; j++)
551 if ((j != P.HotelPlaceType) && (a->PlaceLinks[j] >= 0))
553 DoPlaceClose(j, a->PlaceLinks[j], ts, tn, 0);
554 if (!P.PlaceCloseRoundHousehold)
556 if (Mcells[Places[j][a->PlaceLinks[j]].mcell].place_trig < USHRT_MAX - 1)
558 #pragma omp critical (place_trig) 559 Mcells[Places[j][a->PlaceLinks[j]].mcell].place_trig++;
565 if (t >= P.TreatTimeStart)
566 if ((P.TreatPropCases == 1) || (ranf_mt(tn) < P.TreatPropCases))
568 DoTreatCase(ai, ts, tn);
571 if ((t < P.TreatTimeStart + P.TreatHouseholdsDuration) && ((P.TreatPropCaseHouseholds == 1) || (ranf_mt(tn) < P.TreatPropCaseHouseholds)))
573 j1 = Households[Hosts[ai].hh].FirstPerson; j2 = j1 + Households[Hosts[ai].hh].nh;
574 for (j = j1; j < j2; j++)
575 if (!HOST_TO_BE_TREATED(j)) DoProph(j, ts, tn);
580 if (t < P.TreatTimeStart + P.TreatPlaceGeogDuration)
581 for (j = 0; j < P.PlaceTypeNum; j++)
582 if (a->PlaceLinks[j] >= 0)
584 if (P.DoPlaceGroupTreat)
586 if ((P.TreatPlaceProbCaseId[j] == 1) || (ranf_mt(tn) < P.TreatPlaceProbCaseId[j]))
588 StateT[tn].p_queue[j][StateT[tn].np_queue[j]] = a->PlaceLinks[j];
589 StateT[tn].pg_queue[j][StateT[tn].np_queue[j]++] = a->PlaceGroupLinks[j];
595 #pragma omp critical (starttreat) 596 if (!Places[j][a->PlaceLinks[j]].treat) f = Places[j][a->PlaceLinks[j]].treat = 1;
599 if ((P.TreatPlaceProbCaseId[j] == 1) || (ranf_mt(tn) < P.TreatPlaceProbCaseId[j]))
600 StateT[tn].p_queue[j][StateT[tn].np_queue[j]++] = a->PlaceLinks[j];
602 Places[j][a->PlaceLinks[j]].treat = 0;
610 if ((!P.DoMassVacc) && (t >= P.VaccTimeStart) && (State.cumV < P.VaccMaxCourses))
611 if ((t < P.VaccTimeStart + P.VaccHouseholdsDuration) && ((P.VaccPropCaseHouseholds == 1) || (ranf_mt(tn) < P.VaccPropCaseHouseholds)))
613 j1 = Households[Hosts[ai].hh].FirstPerson; j2 = j1 + Households[Hosts[ai].hh].nh;
614 for (j = j1; j < j2; j++) DoVacc(j, ts);
618 if ((P.DoInterventionDelaysByAdUnit &&
619 (t >= AdUnits[Mcells[a->mcell].adunit].HQuarantineTimeStart && (t < AdUnits[Mcells[a->mcell].adunit].HQuarantineTimeStart + AdUnits[Mcells[a->mcell].adunit].HQuarantineDuration))) ||
620 (t >= AdUnits[Mcells[a->mcell].adunit].HQuarantineTimeStart && (t < AdUnits[Mcells[a->mcell].adunit].HQuarantineTimeStart + P.HQuarantinePolicyDuration)) )
622 j1 = Households[Hosts[ai].hh].FirstPerson; j2 = j1 + Households[Hosts[ai].hh].nh;
623 if ((!HOST_TO_BE_QUARANTINED(j1)) || (P.DoHQretrigger))
625 Hosts[j1].quar_start_time = ts + ((
unsigned short int) (P.TimeStepsPerDay * P.HQuarantineDelay));
626 k = (ranf_mt(tn) < P.HQuarantinePropHouseCompliant) ? 1 : 0;
627 if (k) StateT[tn].cumHQ++;
628 for (j = j1; j < j2; j++)
632 if(j>j1) Hosts[j].quar_start_time = Hosts[j1].quar_start_time;
633 Hosts[j].quar_comply = ((k == 0) ? 0 : ((ranf_mt(tn) < P.HQuarantinePropIndivCompliant) ? 1 : 0));
634 if ((Hosts[j].quar_comply) && (!HOST_ABSENT(j)))
636 if (HOST_AGE_YEAR(j) >= P.CaseAbsentChildAgeCutoff)
638 if (Hosts[j].PlaceLinks[P.PlaceTypeNoAirNum - 1] >= 0) StateT[tn].cumAH++;
640 else StateT[tn].cumACS++;
648 if ((P.DoInterventionDelaysByAdUnit &&
649 (t >= AdUnits[Mcells[a->mcell].adunit].CaseIsolationTimeStart && (t < AdUnits[Mcells[a->mcell].adunit].CaseIsolationTimeStart + AdUnits[Mcells[a->mcell].adunit].CaseIsolationPolicyDuration))) ||
650 (t >= AdUnits[Mcells[a->mcell].adunit].CaseIsolationTimeStart && (t < AdUnits[Mcells[a->mcell].adunit].CaseIsolationTimeStart + P.CaseIsolationPolicyDuration)) )
651 if ((P.CaseIsolationProp == 1) || (ranf_mt(tn) < P.CaseIsolationProp))
653 Hosts[ai].isolation_start_time = ts;
656 if (a->absent_stop_time < ts + P.usCaseAbsenteeismDelay + P.usCaseIsolationDuration)
657 a->absent_stop_time = ts + P.usCaseAbsenteeismDelay + P.usCaseIsolationDuration;
659 else if (P.DoRealSymptWithdrawal)
661 Hosts[ai].absent_start_time = ts + P.usCaseIsolationDelay;
662 Hosts[ai].absent_stop_time = ts + P.usCaseIsolationDelay + P.usCaseIsolationDuration;
665 if ((!HOST_QUARANTINED(ai)) && (Hosts[ai].PlaceLinks[P.PlaceTypeNoAirNum - 1] >= 0) && (HOST_AGE_YEAR(ai) >= P.CaseAbsentChildAgeCutoff))
668 if ((P.DoHouseholds) && (P.DoPlaces) && (HOST_AGE_YEAR(ai) < P.CaseAbsentChildAgeCutoff))
670 if (!HOST_QUARANTINED(ai)) StateT[tn].cumACS++;
671 if (Hosts[ai].ProbCare < P.CaseAbsentChildPropAdultCarers)
673 j1 = Households[Hosts[ai].hh].FirstPerson; j2 = j1 + Households[Hosts[ai].hh].nh;
677 for (j = j1; (j < j2) && (!f); j++)
678 f = ((abs(Hosts[j].inf) != InfStat_Dead) && (HOST_AGE_YEAR(j) >= P.CaseAbsentChildAgeCutoff) && ((Hosts[j].PlaceLinks[P.PlaceTypeNoAirNum - 1] < 0) || (HOST_ABSENT(j)) || (HOST_QUARANTINED(j))));
683 for (j = j1; (j < j2) & (!f); j++)
684 if ((HOST_AGE_YEAR(j) >= P.CaseAbsentChildAgeCutoff) && (abs(Hosts[j].inf) != InfStat_Dead)) { k = j; f = 1; }
687 Hosts[k].absent_start_time = ts + P.usCaseIsolationDelay;
688 Hosts[k].absent_stop_time = ts + P.usCaseIsolationDelay + P.usCaseIsolationDuration;
698 if ((P.DoDigitalContactTracing) && (t >= AdUnits[Mcells[Hosts[ai].mcell].adunit].DigitalContactTracingTimeStart) && (t < AdUnits[Mcells[Hosts[ai].mcell].adunit].DigitalContactTracingTimeStart + P.DigitalContactTracingPolicyDuration) && (Hosts[ai].digitalContactTracingUser))
702 if ((P.DCTIsolateIndexCases) && (Hosts[ai].index_case_dct==0))
704 ad = Mcells[Hosts[ai].mcell].adunit;
706 if(StateT[tn].ndct_queue[ad] < AdUnits[ad].n)
709 StateT[tn].dct_queue[ad][StateT[tn].ndct_queue[ad]++] = { ai,-1,ts };
713 fprintf(stderr,
"No more space in queue! AdUnit: %i, ndct=%i, max queue length: %i\n", ad, AdUnits[j].ndct, AdUnits[ad].n);
714 fprintf(stderr,
"Error!\n");
785 void DoCase(
int ai,
double t,
unsigned short int ts,
int tn)
791 age = HOST_AGE_GROUP(ai);
792 if (age >= NUM_AGE_GROUPS) age = NUM_AGE_GROUPS - 1;
794 if (a->inf == InfStat_InfectiousAlmostSymptomatic)
796 a->inf = InfStat_Case;
799 if (a->absent_stop_time < ts + P.usCaseAbsenteeismDelay + P.usCaseAbsenteeismDuration)
800 a->absent_stop_time = ts + P.usCaseAbsenteeismDelay + P.usCaseAbsenteeismDuration;
802 else if((P.DoRealSymptWithdrawal)&&(P.DoPlaces))
804 a->absent_start_time = USHRT_MAX - 1;
805 for (j = 0; j < P.PlaceTypeNum; j++)
806 if ((a->PlaceLinks[j] >= 0) && (j != P.HotelPlaceType) && (!HOST_ABSENT(ai)) && (P.SymptPlaceTypeWithdrawalProp[j] > 0))
808 if ((P.SymptPlaceTypeWithdrawalProp[j] == 1) || (ranf_mt(tn) < P.SymptPlaceTypeWithdrawalProp[j]))
810 a->absent_start_time = ts + P.usCaseAbsenteeismDelay;
811 a->absent_stop_time = ts + P.usCaseAbsenteeismDelay + P.usCaseAbsenteeismDuration;
812 if (P.AbsenteeismPlaceClosure)
814 if ((t >= P.PlaceCloseTimeStart) && (!P.DoAdminTriggers) && (!P.DoGlobalTriggers))
815 for (j = 0; j < P.PlaceTypeNum; j++)
816 if ((j != P.HotelPlaceType) && (a->PlaceLinks[j] >= 0))
817 DoPlaceClose(j, a->PlaceLinks[j], ts, tn, 0);
819 if ((!HOST_QUARANTINED(ai)) && (Hosts[ai].PlaceLinks[P.PlaceTypeNoAirNum - 1] >= 0) && (HOST_AGE_YEAR(ai) >= P.CaseAbsentChildAgeCutoff))
823 if ((P.DoHouseholds) && (HOST_AGE_YEAR(ai) < P.CaseAbsentChildAgeCutoff))
825 if (!HOST_QUARANTINED(ai)) StateT[tn].cumACS++;
826 if (Hosts[ai].ProbCare < P.CaseAbsentChildPropAdultCarers)
828 j1 = Households[Hosts[ai].hh].FirstPerson; j2 = j1 + Households[Hosts[ai].hh].nh;
830 for (
int j = j1; (j < j2) && (!f); j++)
831 f = ((abs(Hosts[j].inf) != InfStat_Dead) && (HOST_AGE_YEAR(j) >= P.CaseAbsentChildAgeCutoff) && ((Hosts[j].PlaceLinks[P.PlaceTypeNoAirNum - 1] < 0)|| (HOST_ABSENT(j)) || (HOST_QUARANTINED(j))));
834 for (
int j = j1; (j < j2) && (!f); j++)
835 if ((HOST_AGE_YEAR(j) >= P.CaseAbsentChildAgeCutoff) && (abs(Hosts[j].inf) != InfStat_Dead)) { k = j; f = 1; }
838 if (!HOST_ABSENT(k)) Hosts[k].absent_start_time = ts + P.usCaseIsolationDelay;
839 Hosts[k].absent_stop_time = ts + P.usCaseIsolationDelay + P.usCaseIsolationDuration;
850 if (Hosts[ai].detected == 1)
854 StateT[tn].cumDC_adunit[Mcells[a->mcell].adunit]++;
855 DoDetectedCase(ai, t, ts, tn);
860 if (HOST_TREATED(ai)) Cells[Hosts[ai].pcell].cumTC++;
862 StateT[tn].cumCa[age]++;
863 StateT[tn].cumC_country[Mcells[Hosts[ai].mcell].country]++;
864 StateT[tn].cumC_keyworker[a->keyworker]++;
869 if (a->Severity_Final == Severity_Mild)
874 if (P.DoAdUnits) StateT[tn].cumC_adunit[Mcells[a->mcell].adunit]++;
878 void DoFalseCase(
int ai,
double t,
unsigned short int ts,
int tn)
881 if ((P.ControlPropCasesId == 1) || (ranf_mt(tn) < P.ControlPropCasesId))
883 if ((!P.DoEarlyCaseDiagnosis) || (State.cumDC >= P.PreControlClusterIdCaseThreshold)) StateT[tn].cumDC++;
884 DoDetectedCase(ai, t, ts, tn);
889 void DoRecover(
int ai,
int tn,
int run)
895 if (a->inf == InfStat_InfectiousAsymptomaticNotCase || a->inf == InfStat_Case)
900 j = Cells[a->pcell].S + Cells[a->pcell].L + Cells[a->pcell].I;
901 if (i < Cells[a->pcell].S + Cells[a->pcell].L + Cells[a->pcell].I)
903 Cells[a->pcell].susceptible[i] = Cells[a->pcell].susceptible[j];
904 Hosts[Cells[a->pcell].susceptible[i]].listpos = i;
906 Cells[a->pcell].susceptible[j] = ai;
908 a->inf = (InfStat)(InfStat_Recovered * a->inf / abs(a->inf));
912 if ((P.OutputBitmapDetected == 0) || ((P.OutputBitmapDetected == 1) && (Hosts[ai].detected == 1)))
914 x = ((int)(Households[a->hh].loc_x * P.scalex)) - P.bminx;
915 y = ((
int)(Households[a->hh].loc_y * P.scaley)) - P.bminy;
916 if ((x >= 0) && (x < P.bwidth) && (y >= 0) && (y < P.bheight))
918 unsigned j = y * bmh->width + x;
919 if (j < bmh->imagesize)
934 void DoDeath(
int ai,
int tn,
int run)
939 if ((a->inf == InfStat_InfectiousAsymptomaticNotCase || a->inf == InfStat_Case))
941 a->inf = (InfStat)(InfStat_Dead * a->inf / abs(a->inf));
945 if (i < Cells[a->pcell].S + Cells[a->pcell].L + Cells[a->pcell].I)
947 Cells[a->pcell].susceptible[a->listpos] = Cells[a->pcell].infected[Cells[a->pcell].I];
948 Hosts[Cells[a->pcell].susceptible[a->listpos]].listpos = i;
949 a->listpos = Cells[a->pcell].S + Cells[a->pcell].L + Cells[a->pcell].I;
950 Cells[a->pcell].susceptible[a->listpos] = ai;
954 StateT[tn].cumDa[HOST_AGE_GROUP(ai)]++;
955 if (P.DoAdUnits) StateT[tn].cumD_adunit[Mcells[a->mcell].adunit]++;
958 if ((P.OutputBitmapDetected == 0) || ((P.OutputBitmapDetected == 1) && (Hosts[ai].detected == 1)))
960 x = ((int)(Households[a->hh].loc_x * P.scalex)) - P.bminx;
961 y = ((
int)(Households[a->hh].loc_y * P.scaley)) - P.bminy;
962 if ((x >= 0) && (x < P.bwidth) && (y >= 0) && (y < P.bheight))
964 unsigned j = y * bmh->width + x;
965 if (j < bmh->imagesize)
978 void DoTreatCase(
int ai,
unsigned short int ts,
int tn)
982 if (State.cumT < P.TreatMaxCourses)
984 #ifdef NO_TREAT_PROPH_CASES 985 if (!HOST_TO_BE_TREATED(ai))
988 Hosts[ai].treat_start_time = ts + ((
unsigned short int) (P.TimeStepsPerDay * P.TreatDelayMean));
989 Hosts[ai].treat_stop_time = ts + ((
unsigned short int) (P.TimeStepsPerDay * (P.TreatDelayMean + P.TreatCaseCourseLength)));
991 if ((abs(Hosts[ai].inf) > InfStat_Susceptible) && (Hosts[ai].inf != InfStat_Dead_WasAsymp)) Cells[Hosts[ai].pcell].cumTC++;
992 StateT[tn].cumT_keyworker[Hosts[ai].keyworker]++;
993 if ((++Hosts[ai].num_treats) < 2) StateT[tn].cumUT++;
994 Cells[Hosts[ai].pcell].tot_treat++;
995 if (P.DoAdUnits) StateT[tn].cumT_adunit[Mcells[Hosts[ai].mcell].adunit]++;
998 x = ((int)(Households[Hosts[ai].hh].loc_x * P.scalex)) - P.bminx;
999 y = ((
int)(Households[Hosts[ai].hh].loc_y * P.scaley)) - P.bminy;
1000 if ((x >= 0) && (x < P.bwidth) && (y >= 0) && (y < P.bheight))
1002 unsigned j = y * bmh->width + x;
1003 if (j < bmh->imagesize)
1014 void DoProph(
int ai,
unsigned short int ts,
int tn)
1019 if (State.cumT < P.TreatMaxCourses)
1021 Hosts[ai].treat_start_time = ts + ((
unsigned short int) (P.TimeStepsPerDay * P.TreatDelayMean));
1022 Hosts[ai].treat_stop_time = ts + ((
unsigned short int) (P.TimeStepsPerDay * (P.TreatDelayMean + P.TreatProphCourseLength)));
1024 StateT[tn].cumT_keyworker[Hosts[ai].keyworker]++;
1025 if ((++Hosts[ai].num_treats) < 2) StateT[tn].cumUT++;
1026 if (P.DoAdUnits) StateT[tn].cumT_adunit[Mcells[Hosts[ai].mcell].adunit]++;
1027 #pragma omp critical (tot_treat) 1028 Cells[Hosts[ai].pcell].tot_treat++;
1031 x = ((int)(Households[Hosts[ai].hh].loc_x * P.scalex)) - P.bminx;
1032 y = ((
int)(Households[Hosts[ai].hh].loc_y * P.scaley)) - P.bminy;
1033 if ((x >= 0) && (x < P.bwidth) && (y >= 0) && (y < P.bheight))
1035 unsigned j = y * bmh->width + x;
1036 if (j < bmh->imagesize)
1046 void DoProphNoDelay(
int ai,
unsigned short int ts,
int tn,
int nc)
1050 if (State.cumT < P.TreatMaxCourses)
1052 Hosts[ai].treat_start_time = ts;
1053 Hosts[ai].treat_stop_time = ts + ((
unsigned short int) (P.TimeStepsPerDay * P.TreatProphCourseLength * nc));
1054 StateT[tn].cumT += nc;
1055 StateT[tn].cumT_keyworker[Hosts[ai].keyworker] += nc;
1056 if ((++Hosts[ai].num_treats) < 2) StateT[tn].cumUT++;
1057 if (P.DoAdUnits) StateT[tn].cumT_adunit[Mcells[Hosts[ai].mcell].adunit] += nc;
1058 #pragma omp critical (tot_treat) 1059 Cells[Hosts[ai].pcell].tot_treat++;
1062 x = ((int)(Households[Hosts[ai].hh].loc_x * P.scalex)) - P.bminx;
1063 y = ((
int)(Households[Hosts[ai].hh].loc_y * P.scaley)) - P.bminy;
1064 if ((x >= 0) && (x < P.bwidth) && (y >= 0) && (y < P.bheight))
1066 unsigned j = y * bmh->width + x;
1067 if (j < bmh->imagesize)
1077 void DoPlaceClose(
int i,
int j,
unsigned short int ts,
int tn,
int DoAnyway)
1083 int k, ai, j1, j2, l, f, f2;
1084 unsigned short trig;
1085 unsigned short int t_start, t_stop;
1086 unsigned short int t_old, t_new;
1093 t_new = (
unsigned short)(((
double)ts) / P.TimeStepsPerDay);
1095 t_start = ts + ((
unsigned short int) (P.TimeStepsPerDay * P.PlaceCloseDelayMean));
1096 if (P.DoInterventionDelaysByAdUnit)
1098 k = Mcells[Places[i][j].mcell].adunit;
1099 t_stop = ts + ((
unsigned short int) (P.TimeStepsPerDay * (P.PlaceCloseDelayMean + AdUnits[k].PlaceCloseDuration)));
1103 t_stop = ts + ((
unsigned short int) (P.TimeStepsPerDay * (P.PlaceCloseDelayMean + P.PlaceCloseDuration)));
1105 #pragma omp critical (closeplace) 1110 if (Places[i][j].close_end_time < t_stop)
1112 if ((!DoAnyway) && (Places[i][j].control_trig < USHRT_MAX - 2))
1114 Places[i][j].control_trig++;
1115 if (P.AbsenteeismPlaceClosure)
1117 t_old = Places[i][j].AbsentLastUpdateTime;
1118 if (t_new >= t_old + P.MaxAbsentTime)
1119 for (l = 0; l < P.MaxAbsentTime; l++) Places[i][j].Absent[l] = 0;
1121 for (l = t_old; l < t_new; l++) Places[i][j].Absent[l % P.MaxAbsentTime] = 0;
1122 for (l = t_new; l < t_new + P.usCaseAbsenteeismDuration / P.TimeStepsPerDay; l++) Places[i][j].Absent[l % P.MaxAbsentTime]++;
1123 trig = Places[i][j].Absent[t_new % P.MaxAbsentTime];
1124 Places[i][j].AbsentLastUpdateTime = t_new;
1125 if ((P.PlaceCloseByAdminUnit) && (P.PlaceCloseAdunitPlaceTypes[i] > 0)
1126 && (((
double)trig) / ((
double)Places[i][j].n) > P.PlaceCloseCasePropThresh))
1129 k = Mcells[Places[i][j].mcell].adunit;
1130 if (AdUnits[k].place_close_trig < USHRT_MAX - 1) AdUnits[k].place_close_trig++;
1135 trig = Places[i][j].control_trig;
1136 if ((P.PlaceCloseByAdminUnit) && (P.PlaceCloseAdunitPlaceTypes[i] > 0)
1137 && (((
double)Places[i][j].control_trig) / ((
double)Places[i][j].n) > P.PlaceCloseCasePropThresh))
1140 k = Mcells[Places[i][j].mcell].adunit;
1141 if (AdUnits[k].place_close_trig < USHRT_MAX - 1) AdUnits[k].place_close_trig++;
1145 if (Places[i][j].control_trig < USHRT_MAX - 1)
1147 if (P.PlaceCloseFracIncTrig > 0)
1148 k = (((double)trig) / ((double)Places[i][j].n) > P.PlaceCloseFracIncTrig);
1150 k = (((int)trig) >= P.PlaceCloseIncTrig);
1151 if (((!P.PlaceCloseByAdminUnit) && (k)) || (DoAnyway))
1153 if (P.DoPlaceCloseOnceOnly)
1154 Places[i][j].control_trig = USHRT_MAX - 1;
1156 Places[i][j].control_trig = 0;
1160 if (Places[i][j].ProbClose >= P.PlaceCloseEffect[i])
1162 if (Places[i][j].close_start_time > t_start) Places[i][j].close_start_time = t_start;
1163 Places[i][j].close_end_time = t_stop;
1167 Places[i][j].close_start_time = Places[i][j].close_end_time = t_stop;
1175 if (P.DoRealSymptWithdrawal)
1176 for (k = 0; k < Places[i][j].n; k++)
1178 ai = Places[i][j].members[k];
1179 if (((P.PlaceClosePropAttending[i] == 0) || (Hosts[ai].ProbAbsent >= P.PlaceClosePropAttending[i])))
1181 if ((!HOST_ABSENT(ai)) && (!HOST_QUARANTINED(ai)) && (HOST_AGE_YEAR(ai) < P.CaseAbsentChildAgeCutoff))
1183 StateT[tn].cumAPCS++;
1184 if (Hosts[ai].ProbCare < P.CaseAbsentChildPropAdultCarers)
1186 j1 = Households[Hosts[ai].hh].FirstPerson; j2 = j1 + Households[Hosts[ai].hh].nh;
1187 if ((j1 < 0) || (j2 > P.
PopSize)) fprintf(stderr,
"++ %i %i %i (%i %i %i)## ", ai, j1, j2, i, j, k);
1191 for (l = j1; (l < j2) && (!f); l++)
1192 f = ((abs(Hosts[l].inf) != InfStat_Dead) && (HOST_AGE_YEAR(l) >= P.CaseAbsentChildAgeCutoff) && ((Hosts[l].PlaceLinks[P.PlaceTypeNoAirNum - 1] < 0) || (HOST_QUARANTINED(l))));
1195 for (l = j1; (l < j2) && (!f); l++)
1196 if ((HOST_AGE_YEAR(l) >= P.CaseAbsentChildAgeCutoff) && (abs(Hosts[l].inf) != InfStat_Dead))
1198 if (Hosts[l].absent_start_time > t_start) Hosts[l].absent_start_time = t_start;
1199 if (Hosts[l].absent_stop_time < t_stop) Hosts[l].absent_stop_time = t_stop;
1200 StateT[tn].cumAPA++;
1209 if (Hosts[ai].absent_start_time > t_start) Hosts[ai].absent_start_time = t_start;
1210 if (Hosts[ai].absent_stop_time < t_stop) Hosts[ai].absent_stop_time = t_stop;
1212 if ((HOST_AGE_YEAR(ai) >= P.CaseAbsentChildAgeCutoff) && (Hosts[ai].PlaceLinks[P.PlaceTypeNoAirNum - 1] >= 0)) StateT[tn].cumAPC++;
1219 void DoPlaceOpen(
int i,
int j,
unsigned short int ts,
int tn)
1221 int k, ai, j1, j2, l, f;
1223 #pragma omp critical (openplace) 1225 if (ts < Places[i][j].close_end_time)
1227 if (P.DoRealSymptWithdrawal)
1228 for (k = 0; k < Places[i][j].n; k++)
1230 ai = Places[i][j].members[k];
1231 if (Hosts[ai].absent_stop_time == Places[i][j].close_end_time) Hosts[ai].absent_stop_time = ts;
1232 if (Hosts[ai].ProbCare < P.CaseAbsentChildPropAdultCarers)
1234 if ((HOST_AGE_YEAR(ai) < P.CaseAbsentChildAgeCutoff) && (!HOST_QUARANTINED(ai)))
1236 j1 = Households[Hosts[ai].hh].FirstPerson; j2 = j1 + Households[Hosts[ai].hh].nh;
1238 for (l = j1; (l < j2) && (!f); l++)
1239 f = ((abs(Hosts[l].inf) != InfStat_Dead) && (HOST_AGE_YEAR(l) >= P.CaseAbsentChildAgeCutoff) && ((Hosts[l].PlaceLinks[P.PlaceTypeNoAirNum - 1] < 0) || (HOST_QUARANTINED(l))));
1242 for (l = j1; (l < j2) && (!f); l++)
1243 if ((HOST_AGE_YEAR(l) >= P.CaseAbsentChildAgeCutoff) && (abs(Hosts[l].inf) != InfStat_Dead) && (HOST_ABSENT(l)))
1245 if (Hosts[l].absent_stop_time == Places[i][j].close_end_time) Hosts[l].absent_stop_time = ts;
1251 Places[i][j].close_end_time = ts;
1256 int DoVacc(
int ai,
unsigned short int ts)
1260 if (State.cumV >= P.VaccMaxCourses)
1262 else if ((HOST_TO_BE_VACCED(ai)) || (Hosts[ai].inf < InfStat_InfectiousAlmostSymptomatic) || (Hosts[ai].inf >= InfStat_Dead_WasAsymp))
1266 Hosts[ai].vacc_start_time = ts + ((
unsigned short int) (P.TimeStepsPerDay * P.VaccDelayMean));
1268 #pragma omp critical (state_cumV) 1270 if (P.VaccDosePerDay >= 0)
1272 #pragma omp critical (state_cumV_daily) 1275 #pragma omp critical (tot_vacc) 1276 Cells[Hosts[ai].pcell].tot_vacc++;
1279 x = ((int)(Households[Hosts[ai].hh].loc_x * P.scalex)) - P.bminx;
1280 y = ((
int)(Households[Hosts[ai].hh].loc_y * P.scaley)) - P.bminy;
1281 if ((x >= 0) && (x < P.bwidth) && (y >= 0) && (y < P.bheight))
1283 unsigned j = y * bmh->width + x;
1284 if (j < bmh->imagesize)
1295 void DoVaccNoDelay(
int ai,
unsigned short int ts)
1298 bool cumVG_OK =
false;
1300 if ((HOST_TO_BE_VACCED(ai)) || (Hosts[ai].inf < InfStat_InfectiousAlmostSymptomatic) || (Hosts[ai].inf >= InfStat_Dead_WasAsymp))
1302 #pragma omp critical (state_cumVG) 1303 if (State.cumVG < P.VaccMaxCourses)
1310 Hosts[ai].vacc_start_time = ts;
1311 if (P.VaccDosePerDay >= 0)
1313 #pragma omp critical (state_cumV_daily) 1314 State.cumVG_daily++;
1316 #pragma omp critical (tot_vacc) 1317 Cells[Hosts[ai].pcell].tot_vacc++;
1320 x = ((int)(Households[Hosts[ai].hh].loc_x * P.scalex)) - P.bminx;
1321 y = ((
int)(Households[Hosts[ai].hh].loc_y * P.scaley)) - P.bminy;
1322 if ((x >= 0) && (x < P.bwidth) && (y >= 0) && (y < P.bheight))
1324 unsigned j = y * bmh->width + x;
1325 if (j < bmh->imagesize)
1336 Severity ChooseFinalDiseaseSeverity(
int AgeGroup,
int tn)
1338 Severity DiseaseSeverity;
1344 if (x < P.Prop_ILI_ByAge[AgeGroup]) DiseaseSeverity = Severity_ILI;
1345 else if (x < P.Prop_ILI_ByAge[AgeGroup] + P.Prop_SARI_ByAge[AgeGroup]) DiseaseSeverity = Severity_SARI;
1346 else if (x < P.Prop_ILI_ByAge[AgeGroup] + P.Prop_SARI_ByAge[AgeGroup] + P.Prop_Critical_ByAge[AgeGroup]) DiseaseSeverity = Severity_Critical;
1347 else DiseaseSeverity = Severity_Mild;
1348 return DiseaseSeverity;
1351 unsigned short int ChooseFromICDF(
double *ICDF,
double Mean,
int tn)
1353 unsigned short int Value;
1357 i = (int)floor(q = ranf_mt(tn) * CDF_RES);
1359 ti = -Mean * log(q * ICDF[i + 1] + (1.0 - q) * ICDF[i]);
1360 Value = (
unsigned short int) floor(0.5 + (ti * P.TimeStepsPerDay));
int cumMild_adunit[MAX_ADUNITS]
cum incidence quantities. (+ by admin unit)
double Mean_MildToRecovery[NUM_AGE_GROUPS]
means for above icdf's.
int cumMild_age[NUM_AGE_GROUPS]
cum incidence quantities. (+ by age group)