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);
47 int getNumberOfDiagnosedPartners();
49 bool hasRelationshipWith(Person *pPerson)
const;
52 void addRelationship(Person *pPerson,
double t);
53 void removeRelationship(Person *pPerson,
double t,
bool deathBased);
56 double getLastRelationshipChangeTime()
const {
return m_lastRelationChangeTime; }
58 void setSexuallyActive(
double t) { m_sexuallyActive =
true; assert(t >= 0); m_debutTime = t; }
59 bool isSexuallyActive() {
return m_sexuallyActive;}
60 double getDebutTime()
const {
return m_debutTime; }
62 void setInfected(
double t, Person *pOrigin, InfectionType iType);
63 bool isInfected()
const {
if (m_infectionStage == NoInfection)
return false;
return true; }
64 double getInfectionTime()
const { assert(m_infectionStage != NoInfection);
return m_infectionTime; }
65 InfectionStage getInfectionStage()
const {
return m_infectionStage; }
66 void setInChronicStage() { assert(m_infectionStage == Acute); m_infectionStage = Chronic; }
67 void setInAIDSStage() { assert(m_infectionStage == Chronic); m_infectionStage = AIDS; }
68 void setInFinalAIDSStage() { assert(m_infectionStage == AIDS); m_infectionStage = AIDSFinal; }
69 double getAIDSMortalityTime()
const {
return m_aidsTodUtil.getTimeOfDeath(); }
71 bool isDiagnosed()
const {
return (m_diagnoseCount > 0); }
72 void increaseDiagnoseCount() { m_diagnoseCount++; }
73 int getDiagnoseCount()
const {
return m_diagnoseCount; }
75 double getSetPointViralLoad()
const { assert(m_infectionStage != NoInfection);
return m_Vsp; }
76 double getViralLoad()
const;
77 void lowerViralLoad(
double fractionOnLogscale,
double treatmentTime);
78 bool hasLoweredViralLoad()
const { assert(isInfected()); assert(m_Vsp > 0);
return m_VspLowered; }
79 double getLastTreatmentStartTime()
const { assert(isInfected()); assert(m_Vsp > 0); assert(m_VspLowered); assert(m_lastTreatmentStartTime >= 0);
return m_lastTreatmentStartTime; }
80 void resetViralLoad(
double dropoutTime);
81 int getNumberTreatmentStarted()
const { assert(isInfected());
return m_treatmentCount; }
83 double getFormationEagernessParameter()
const {
return m_formationEagerness; }
84 double getPreferredAgeDifference()
const { assert(m_preferredAgeDiff < 200.0 && m_preferredAgeDiff > -200.0);
return m_preferredAgeDiff; }
91 void addChild(Person *pPerson);
92 bool hasChild(Person *pPerson)
const;
93 int getNumberOfChildren()
const {
return m_children.size(); }
94 Person *getChild(
int idx);
97 void addPersonOfInterest(Person *pPerson);
98 void removePersonOfInterest(Person *pPerson);
99 void clearPersonsOfInterest() { m_personsOfInterest.clear(); }
100 int getNumberOfPersonsOfInterest()
const {
return m_personsOfInterest.size(); }
101 Person *getPersonOfInterest(
int idx)
const { assert(idx >= 0 && idx < m_personsOfInterest.size()); Person *pPerson = m_personsOfInterest[idx]; assert(pPerson);
return pPerson; }
103 double getCD4Count(
double t)
const;
104 double getARTAcceptanceThreshold()
const {
return m_artAcceptanceThreshold; }
107 static void obtainConfig(ConfigWriter &config);
109 static void writeToRelationLog(
const Person *pMan,
const Person *pWoman,
double formationTime,
double dissolutionTime);
110 void writeToPersonLog();
111 void writeToTreatmentLog(
double dropoutTime,
bool justDied);
113 double initializeEagerness();
114 double getViralLoadFromSetPointViralLoad(
double x)
const;
115 void initializeCD4Counts();
116 static double pickSeedSetPointViralLoad();
117 static double pickInheritedSetPointViralLoad(
const Person *pOrigin);
124 Relationship(Person *pPerson,
double formationTime) { assert(pPerson != 0); assert(formationTime > 0); m_pPerson = pPerson; m_formationTime = formationTime; }
125 Relationship(Person *pPerson) { assert(pPerson != 0); m_pPerson = pPerson; m_formationTime = -1; }
127 Person *getPartner()
const {
return m_pPerson; }
128 double getFormationTime()
const {
return m_formationTime; }
130 bool operator<(
const Relationship &rel)
const
132 if (m_pPerson->getPersonID() < rel.m_pPerson->getPersonID())
138 double m_formationTime;
142 bool m_relIterationBusy;
145 std::set<Relationship> m_relationshipsSet;
146 std::set<Relationship>::const_iterator m_relationshipsIterator;
147 double m_lastRelationChangeTime;
148 bool m_sexuallyActive;
151 double m_infectionTime;
152 Person *m_pInfectionOrigin;
153 InfectionType m_infectionType;
154 InfectionStage m_infectionStage;
157 double m_Vsp, m_VspOriginal;
159 double m_lastTreatmentStartTime;
160 int m_treatmentCount;
165 double m_formationEagerness;
166 double m_preferredAgeDiff;
168 std::vector<Person *> m_children;
169 std::vector<Person *> m_personsOfInterest;
171 AIDSTimeOfDeathUtility m_aidsTodUtil;
173 double m_cd4AtStart, m_cd4AtDeath;
174 double m_artAcceptanceThreshold;
176 static double m_hivSeedWeibullShape;
177 static double m_hivSeedWeibullScale;
178 static double m_VspHeritabilitySigmaFraction;
179 static double m_acuteFromSetPointParamX;
180 static double m_aidsFromSetPointParamX;
181 static double m_finalAidsFromSetPointParamX;
182 static double m_maxValue;
183 static double m_maxViralLoad;
187 static VspModel *m_pVspModel;
194 inline double Person::getViralLoad()
const
196 assert(m_infectionStage != NoInfection);
197 if (m_infectionStage == Acute)
198 return getViralLoadFromSetPointViralLoad(m_acuteFromSetPointParamX);
199 else if (m_infectionStage == Chronic)
200 return getSetPointViralLoad();
201 else if (m_infectionStage == AIDS)
202 return getViralLoadFromSetPointViralLoad(m_aidsFromSetPointParamX);
203 else if (m_infectionStage == AIDSFinal)
204 return getViralLoadFromSetPointViralLoad(m_finalAidsFromSetPointParamX);
206 abortWithMessage(
"Unknown stage in Person::getViralLoad");
210 inline void Person::addChild(Person *pPerson)
212 assert(pPerson != 0);
213 assert(!hasChild(pPerson));
215 m_children.push_back(pPerson);
220 inline bool Person::hasChild(Person *pPerson)
const
222 assert(pPerson != 0);
224 for (
int i = 0 ; i < m_children.size() ; i++)
226 assert(m_children[i] != 0);
228 if (m_children[i] == pPerson)
235 class Man :
public Person
238 Man(
double dateOfBirth);
242 class Woman :
public Person
245 Woman(
double dateOfBirth);
248 void setPregnant(
bool f) { m_pregnant = f; }
249 bool isPregnant()
const {
return m_pregnant; }
254 inline bool Person::hasRelationshipWith(Person *pPerson)
const
256 return m_relationshipsSet.find(Person::Relationship(pPerson)) != m_relationshipsSet.end();
259 inline Man *MAN(Person *pPerson)
261 assert(pPerson != 0);
264 return static_cast<Man*
>(pPerson);
267 inline Woman *WOMAN(Person *pPerson)
269 assert(pPerson != 0);
272 return static_cast<Woman*
>(pPerson);
275 inline Person* Person::getChild(
int idx)
277 assert(idx >= 0 && idx < m_children.size());
278 Person *pChild = m_children[idx];
284 assert(pChild->getMother() ==
this);
288 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