7 #include "aidstodutil.h"
22 Man *MAN(Person *pPerson);
23 Woman *WOMAN(Person *pPerson);
28 enum InfectionType { None, Partner, Mother, Seed };
29 enum InfectionStage { NoInfection, Acute, Chronic, AIDS, AIDSFinal };
31 Person(
double dateOfBirth, Gender g);
37 void setFather(Man *pFather) { assert(m_pFather == 0); assert(pFather != 0); m_pFather = pFather; }
38 void setMother(Woman *pMother) { assert(m_pMother == 0); assert(pMother != 0); m_pMother = pMother; }
40 Man *getFather()
const {
return m_pFather; }
41 Woman *getMother()
const {
return m_pMother; }
44 int getNumberOfRelationships()
const {
return m_relationshipsSet.size(); }
45 void startRelationshipIteration();
46 Person *getNextRelationshipPartner(
double &formationTime);
48 bool hasRelationshipWith(Person *pPerson)
const;
51 void addRelationship(Person *pPerson,
double t);
52 void removeRelationship(Person *pPerson,
double t,
bool deathBased);
55 double getLastRelationshipChangeTime()
const {
return m_lastRelationChangeTime; }
57 void setSexuallyActive(
double t) { m_sexuallyActive =
true; assert(t >= 0); m_debutTime = t; }
58 bool isSexuallyActive() {
return m_sexuallyActive;}
59 double getDebutTime()
const {
return m_debutTime; }
61 void setInfected(
double t, Person *pOrigin, InfectionType iType);
62 bool isInfected()
const {
if (m_infectionStage == NoInfection)
return false;
return true; }
63 double getInfectionTime()
const { assert(m_infectionStage != NoInfection);
return m_infectionTime; }
64 InfectionStage getInfectionStage()
const {
return m_infectionStage; }
65 void setInChronicStage() { assert(m_infectionStage == Acute); m_infectionStage = Chronic; }
66 void setInAIDSStage() { assert(m_infectionStage == Chronic); m_infectionStage = AIDS; }
67 void setInFinalAIDSStage() { assert(m_infectionStage == AIDS); m_infectionStage = AIDSFinal; }
68 double getAIDSMortalityTime()
const {
return m_aidsTodUtil.getTimeOfDeath(); }
70 double getSetPointViralLoad()
const { assert(m_infectionStage != NoInfection);
return m_Vsp; }
71 double getViralLoad()
const;
72 void lowerViralLoad(
double fractionOnLogscale,
double treatmentTime);
73 bool hasLoweredViralLoad()
const { assert(isInfected()); assert(m_Vsp > 0);
return m_VspLowered; }
74 double getLastTreatmentStartTime()
const { assert(isInfected()); assert(m_Vsp > 0); assert(m_VspLowered); assert(m_lastTreatmentStartTime >= 0);
return m_lastTreatmentStartTime; }
75 void resetViralLoad(
double dropoutTime);
76 int getNumberTreatmentStarted()
const { assert(isInfected());
return m_treatmentCount; }
78 double getFormationEagernessParameter()
const {
return m_formationEagerness; }
79 double getPreferredAgeDifference()
const { assert(m_preferredAgeDiff < 200.0 && m_preferredAgeDiff > -200.0);
return m_preferredAgeDiff; }
86 void addChild(Person *pPerson);
87 bool hasChild(Person *pPerson)
const;
88 int getNumberOfChildren()
const {
return m_children.size(); }
89 Person *getChild(
int idx);
92 void addPersonOfInterest(Person *pPerson);
93 void removePersonOfInterest(Person *pPerson);
94 void clearPersonsOfInterest() { m_personsOfInterest.clear(); }
95 int getNumberOfPersonsOfInterest()
const {
return m_personsOfInterest.size(); }
96 Person *getPersonOfInterest(
int idx)
const { assert(idx >= 0 && idx < m_personsOfInterest.size()); Person *pPerson = m_personsOfInterest[idx]; assert(pPerson);
return pPerson; }
98 double getCD4Count(
double t)
const;
101 static void obtainConfig(ConfigWriter &config);
103 static void writeToRelationLog(
const Person *pMan,
const Person *pWoman,
double formationTime,
double dissolutionTime);
104 void writeToPersonLog();
105 void writeToTreatmentLog(
double dropoutTime,
bool justDied);
107 double initializeEagerness();
108 double getViralLoadFromSetPointViralLoad(
double x)
const;
109 void initializeCD4Counts();
110 static double pickSeedSetPointViralLoad();
111 static double pickInheritedSetPointViralLoad(
const Person *pOrigin);
118 Relationship(Person *pPerson,
double formationTime) { assert(pPerson != 0); assert(formationTime > 0); m_pPerson = pPerson; m_formationTime = formationTime; }
119 Relationship(Person *pPerson) { assert(pPerson != 0); m_pPerson = pPerson; m_formationTime = -1; }
121 Person *getPartner()
const {
return m_pPerson; }
122 double getFormationTime()
const {
return m_formationTime; }
124 bool operator<(
const Relationship &rel)
const
126 if (m_pPerson->getPersonID() < rel.m_pPerson->getPersonID())
132 double m_formationTime;
136 bool m_relIterationBusy;
139 std::set<Relationship> m_relationshipsSet;
140 std::set<Relationship>::const_iterator m_relationshipsIterator;
141 double m_lastRelationChangeTime;
142 bool m_sexuallyActive;
145 double m_infectionTime;
146 Person *m_pInfectionOrigin;
147 InfectionType m_infectionType;
148 InfectionStage m_infectionStage;
150 double m_Vsp, m_VspOriginal;
152 double m_lastTreatmentStartTime;
153 int m_treatmentCount;
158 double m_formationEagerness;
159 double m_preferredAgeDiff;
161 std::vector<Person *> m_children;
162 std::vector<Person *> m_personsOfInterest;
164 AIDSTimeOfDeathUtility m_aidsTodUtil;
166 double m_cd4AtStart, m_cd4AtDeath;
168 static double m_hivSeedWeibullShape;
169 static double m_hivSeedWeibullScale;
170 static double m_VspHeritabilitySigmaFraction;
171 static double m_acuteFromSetPointParamX;
172 static double m_aidsFromSetPointParamX;
173 static double m_finalAidsFromSetPointParamX;
174 static double m_maxValue;
175 static double m_maxViralLoad;
179 static VspModel *m_pVspModel;
185 inline double Person::getViralLoad()
const
187 assert(m_infectionStage != NoInfection);
188 if (m_infectionStage == Acute)
189 return getViralLoadFromSetPointViralLoad(m_acuteFromSetPointParamX);
190 else if (m_infectionStage == Chronic)
191 return getSetPointViralLoad();
192 else if (m_infectionStage == AIDS)
193 return getViralLoadFromSetPointViralLoad(m_aidsFromSetPointParamX);
194 else if (m_infectionStage == AIDSFinal)
195 return getViralLoadFromSetPointViralLoad(m_finalAidsFromSetPointParamX);
197 abortWithMessage(
"Unknown stage in Person::getViralLoad");
201 inline void Person::addChild(Person *pPerson)
203 assert(pPerson != 0);
204 assert(!hasChild(pPerson));
206 m_children.push_back(pPerson);
211 inline bool Person::hasChild(Person *pPerson)
const
213 assert(pPerson != 0);
215 for (
int i = 0 ; i < m_children.size() ; i++)
217 assert(m_children[i] != 0);
219 if (m_children[i] == pPerson)
226 class Man :
public Person
229 Man(
double dateOfBirth);
233 class Woman :
public Person
236 Woman(
double dateOfBirth);
239 void setPregnant(
bool f) { m_pregnant = f; }
240 bool isPregnant()
const {
return m_pregnant; }
245 inline bool Person::hasRelationshipWith(Person *pPerson)
const
247 return m_relationshipsSet.find(Person::Relationship(pPerson)) != m_relationshipsSet.end();
250 inline Man *MAN(Person *pPerson)
252 assert(pPerson != 0);
255 return static_cast<Man*
>(pPerson);
258 inline Woman *WOMAN(Person *pPerson)
260 assert(pPerson != 0);
263 return static_cast<Woman*
>(pPerson);
266 inline Person* Person::getChild(
int idx)
268 assert(idx >= 0 && idx < m_children.size());
269 Person *pChild = m_children[idx];
275 assert(pChild->getMother() ==
this);
279 assert(pChild->getFather() ==
this);
The person is a man.
Definition: personbase.h:30
Gender getGender() const
Returns the gender of the person as set at construction time.
Definition: personbase.h:50
Helper class to read configuration settings, more advanced than ConfigReader.
Definition: configsettings.h:21
The person is a woman.
Definition: personbase.h:32
This class allows you to generate random numbers, and uses the GNU Scientific Library for this...
Definition: gslrandomnumbergenerator.h:16
This is the base class for a person in a population-based simulation that used the Population class...
Definition: personbase.h:23
Abstract base class for probability distribution implementations so that they can be used interchange...
Definition: probabilitydistribution.h:15