Simpact Cyan
Population based event driven simulation using mNRM
eventaidsmortality.h
1 #ifndef EVENTAIDSMORTALITY_H
2 
3 #define EVENTAIDSMORTALITY_H
4 
5 #include "eventmortalitybase.h"
6 #include "eventvariablefiretime.h"
7 
8 // AIDS mortality
9 class EventAIDSMortality : public EventMortalityBase
10 {
11 public:
12  EventAIDSMortality(Person *pPerson);
13  ~EventAIDSMortality();
14 
15  std::string getDescription(double tNow) const;
16  void writeLogs(double tNow) const;
17 #ifndef NDEBUG
18  void fire(State *pState, double t);
19 #endif // !NDEBUG
20 
21  static void processConfig(ConfigSettings &config);
22  static void obtainConfig(ConfigWriter &config);
23 
24  static double getExpectedSurvivalTime(const Person *pPerson);
25  static double getExpectedTimeOfDeath(const Person *pPerson);
26 private:
27  double getNewInternalTimeDifference(GslRandomNumberGenerator *pRndGen, const State *pState);
28  double calculateInternalTimeInterval(const State *pState, double t0, double dt);
29  double solveForRealTimeInterval(const State *pState, double Tdiff, double t0);
30  void checkFireTime(double t0);
31 
32  EventVariableFireTime_Helper m_eventHelper;
33 
34  // TODO: use access functions
35  static double m_C;
36  static double m_k;
37 };
38 
39 inline double EventAIDSMortality::getExpectedSurvivalTime(const Person *pPerson)
40 {
41  assert(pPerson);
42  double Vsp = pPerson->getSetPointViralLoad();
43  assert(Vsp > 0);
44 
45  double tSurvival = m_C/std::pow(Vsp, -m_k);
46  assert(tSurvival > 0);
47 
48  return tSurvival;
49 }
50 
51 inline double EventAIDSMortality::getExpectedTimeOfDeath(const Person *pPerson)
52 {
53  assert(pPerson);
54  assert(pPerson->isInfected());
55 
56  double expectedTimeOfDeath = getExpectedSurvivalTime(pPerson) + pPerson->getInfectionTime();
57 
58  return expectedTimeOfDeath;
59 }
60 
61 #endif // EVENTMORTALITY_H
62 
This class both describes the simulation state and contains the core algorithm (as shown on the main ...
Definition: state.h:40
Helper class to read configuration settings, more advanced than ConfigReader.
Definition: configsettings.h:20
This class allows you to generate random numbers, and uses the GNU Scientific Library for this...
Definition: gslrandomnumbergenerator.h:16