21 Man *MAN(Person *pPerson);
22 Woman *WOMAN(Person *pPerson);
27 enum InfectionType { None, Partner, Mother, Seed };
28 enum InfectionStage { NoInfection, Acute, Chronic, AIDS, AIDSFinal };
30 Person(
double dateOfBirth, Gender g);
36 void setFather(Man *pFather) { assert(m_pFather == 0); assert(pFather != 0); m_pFather = pFather; }
37 void setMother(Woman *pMother) { assert(m_pMother == 0); assert(pMother != 0); m_pMother = pMother; }
39 Man *getFather()
const {
return m_pFather; }
40 Woman *getMother()
const {
return m_pMother; }
43 int getNumberOfRelationships()
const {
return m_relationshipsSet.size(); }
44 void startRelationshipIteration();
45 Person *getNextRelationshipPartner(
double &formationTime);
47 bool hasRelationshipWith(Person *pPerson)
const;
50 void addRelationship(Person *pPerson,
double t);
51 void removeRelationship(Person *pPerson,
double t,
bool deathBased);
54 double getLastRelationshipChangeTime()
const {
return m_lastRelationChangeTime; }
56 void setSexuallyActive(
double t) { m_sexuallyActive =
true; assert(t >= 0); m_debutTime = t; }
57 bool isSexuallyActive() {
return m_sexuallyActive;}
58 double getDebutTime()
const {
return m_debutTime; }
60 void setInfected(
double t, Person *pOrigin, InfectionType iType);
61 bool isInfected()
const {
if (m_infectionStage == NoInfection)
return false;
return true; }
62 double getInfectionTime()
const { assert(m_infectionStage != NoInfection);
return m_infectionTime; }
63 InfectionStage getInfectionStage()
const {
return m_infectionStage; }
64 void setInChronicStage() { assert(m_infectionStage == Acute); m_infectionStage = Chronic; }
65 void setInAIDSStage() { assert(m_infectionStage == Chronic); m_infectionStage = AIDS; }
66 void setInFinalAIDSStage() { assert(m_infectionStage == AIDS); m_infectionStage = AIDSFinal; }
68 double getSetPointViralLoad()
const { assert(m_infectionStage != NoInfection);
return m_Vsp; }
69 double getViralLoad()
const;
70 void lowerViralLoad(
double fractionOnLogscale,
double treatmentTime);
71 bool hasLoweredViralLoad()
const { assert(m_infectionStage != NoInfection); assert(m_Vsp > 0);
return m_VspLowered; }
72 double getTreatmentTime()
const { assert(m_infectionStage != NoInfection); assert(m_Vsp > 0); assert(m_VspLowered); assert(m_treatmentTime >= 0);
return m_treatmentTime; }
74 double getFormationEagernessParameter()
const {
return m_formationEagerness; }
75 double getPreferredAgeDifference()
const { assert(m_preferredAgeDiff < 200.0 && m_preferredAgeDiff > -200.0);
return m_preferredAgeDiff; }
82 void addChild(Person *pPerson);
83 bool hasChild(Person *pPerson)
const;
84 int getNumberOfChildren()
const {
return m_children.size(); }
85 Person *getChild(
int idx);
88 void addPersonOfInterest(Person *pPerson);
89 void removePersonOfInterest(Person *pPerson);
90 void clearPersonsOfInterest() { m_personsOfInterest.clear(); }
91 int getNumberOfPersonsOfInterest()
const {
return m_personsOfInterest.size(); }
92 Person *getPersonOfInterest(
int idx)
const { assert(idx >= 0 && idx < m_personsOfInterest.size()); Person *pPerson = m_personsOfInterest[idx]; assert(pPerson);
return pPerson; }
95 static void obtainConfig(ConfigWriter &config);
97 static void writeToRelationLog(
const Person *pMan,
const Person *pWoman,
double formationTime,
double dissolutionTime);
98 void writeToPersonLog();
100 double initializeEagerness();
101 double getViralLoadFromSetPointViralLoad(
double x)
const;
102 static double pickSeedSetPointViralLoad();
103 static double pickInheritedSetPointViralLoad(
const Person *pOrigin);
110 Relationship(Person *pPerson,
double formationTime) { assert(pPerson != 0); assert(formationTime > 0); m_pPerson = pPerson; m_formationTime = formationTime; }
111 Relationship(Person *pPerson) { assert(pPerson != 0); m_pPerson = pPerson; m_formationTime = -1; }
113 Person *getPartner()
const {
return m_pPerson; }
114 double getFormationTime()
const {
return m_formationTime; }
116 bool operator<(
const Relationship &rel)
const
118 if (m_pPerson->getPersonID() < rel.m_pPerson->getPersonID())
124 double m_formationTime;
128 bool m_relIterationBusy;
131 std::set<Relationship> m_relationshipsSet;
132 std::set<Relationship>::const_iterator m_relationshipsIterator;
133 double m_lastRelationChangeTime;
134 bool m_sexuallyActive;
137 double m_infectionTime;
138 Person *m_pInfectionOrigin;
139 InfectionType m_infectionType;
140 InfectionStage m_infectionStage;
142 double m_Vsp, m_VspOriginal;
144 double m_treatmentTime;
149 double m_formationEagerness;
150 double m_preferredAgeDiff;
152 std::vector<Person *> m_children;
153 std::vector<Person *> m_personsOfInterest;
155 static double m_hivSeedWeibullShape;
156 static double m_hivSeedWeibullScale;
157 static double m_VspHeritabilitySigmaFraction;
158 static double m_acuteFromSetPointParamX;
159 static double m_aidsFromSetPointParamX;
160 static double m_finalAidsFromSetPointParamX;
161 static double m_maxValue;
162 static double m_maxViralLoad;
166 static VspModel *m_pVspModel;
169 inline double Person::getViralLoad()
const
171 assert(m_infectionStage != NoInfection);
172 if (m_infectionStage == Acute)
173 return getViralLoadFromSetPointViralLoad(m_acuteFromSetPointParamX);
174 else if (m_infectionStage == Chronic)
175 return getSetPointViralLoad();
176 else if (m_infectionStage == AIDS)
177 return getViralLoadFromSetPointViralLoad(m_aidsFromSetPointParamX);
178 else if (m_infectionStage == AIDSFinal)
179 return getViralLoadFromSetPointViralLoad(m_finalAidsFromSetPointParamX);
181 abortWithMessage(
"Unknown stage in Person::getViralLoad");
185 inline void Person::addChild(Person *pPerson)
187 assert(pPerson != 0);
188 assert(!hasChild(pPerson));
190 m_children.push_back(pPerson);
195 inline bool Person::hasChild(Person *pPerson)
const
197 assert(pPerson != 0);
199 for (
int i = 0 ; i < m_children.size() ; i++)
201 assert(m_children[i] != 0);
203 if (m_children[i] == pPerson)
210 class Man :
public Person
213 Man(
double dateOfBirth);
217 class Woman :
public Person
220 Woman(
double dateOfBirth);
223 void setPregnant(
bool f) { m_pregnant = f; }
224 bool isPregnant()
const {
return m_pregnant; }
229 inline bool Person::hasRelationshipWith(Person *pPerson)
const
231 return m_relationshipsSet.find(Person::Relationship(pPerson)) != m_relationshipsSet.end();
234 inline Man *MAN(Person *pPerson)
236 assert(pPerson != 0);
239 return static_cast<Man*
>(pPerson);
242 inline Woman *WOMAN(Person *pPerson)
244 assert(pPerson != 0);
247 return static_cast<Woman*
>(pPerson);
250 inline Person* Person::getChild(
int idx)
252 assert(idx >= 0 && idx < m_children.size());
253 Person *pChild = m_children[idx];
259 assert(pChild->getMother() ==
this);
263 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