Skip to content

Commit ba4d5cb

Browse files
authored
updating the setting for current_time (#150)
1 parent bc9b6bf commit ba4d5cb

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

include/hepce/model/person.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Created Date: 2025-04-17 //
55
// Author: Matthew Carroll //
66
// ----- //
7-
// Last Modified: 2025-10-09 //
7+
// Last Modified: 2025-11-12 //
88
// Modified By: Matthew Carroll //
99
// ----- //
1010
// Copyright (c) 2025 Syndemics Lab at Boston Medical Center //
@@ -32,6 +32,7 @@ class Person {
3232
Die(data::DeathReason deathReason = data::DeathReason::kBackground) = 0;
3333

3434
virtual void SetPersonDetails(const data::PersonSelect &select) = 0;
35+
virtual void SetStartTime(const int start_time = 0) = 0;
3536

3637
// HCV
3738
virtual data::HCVDetails GetHCVDetails() const = 0;

src/model/internals/person_internals.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Created Date: 2025-04-18 //
55
// Author: Matthew Carroll //
66
// ----- //
7-
// Last Modified: 2025-10-09 //
7+
// Last Modified: 2025-11-12 //
88
// Modified By: Matthew Carroll //
99
// ----- //
1010
// Copyright (c) 2025 Syndemics Lab at Boston Medical Center //
@@ -45,6 +45,10 @@ class PersonImpl : public Person {
4545

4646
void SetPersonDetails(const data::PersonSelect &select) override;
4747

48+
void SetStartTime(const int start_time) override {
49+
_current_time = start_time;
50+
}
51+
4852
// Section Getters
4953
inline data::HCVDetails GetHCVDetails() const override {
5054
return _hcv_details;

src/model/simulation.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,12 @@ HepceImpl::ReadICPopulation(const int population_size,
109109
std::vector<data::PersonSelect> vec =
110110
std::any_cast<std::vector<data::PersonSelect>>(storage);
111111
std::vector<std::unique_ptr<model::Person>> population = {};
112+
int start_time =
113+
utils::GetIntFromConfig("simulation.start_time", model_data);
112114
for (const auto &ps : vec) {
113115
auto person = model::Person::Create(GetLogName());
114116
person->SetPersonDetails(ps);
117+
person->SetStartTime(start_time);
115118
population.push_back(std::move(person));
116119
}
117120
return population;
@@ -160,9 +163,12 @@ HepceImpl::ReadPopPopulation(const int population_size,
160163
std::vector<data::PersonSelect> vec =
161164
std::any_cast<std::vector<data::PersonSelect>>(storage);
162165
std::vector<std::unique_ptr<model::Person>> population = {};
166+
int start_time =
167+
utils::GetIntFromConfig("simulation.start_time", model_data);
163168
for (const auto &ps : vec) {
164169
auto person = model::Person::Create(GetLogName());
165170
person->SetPersonDetails(ps);
171+
person->SetStartTime(start_time);
166172
population.push_back(std::move(person));
167173
}
168174
return population;

tests/mocks/person_mock.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Created: 2025-01-06 //
55
// Author: Matthew Carroll //
66
// ----- //
7-
// Last Modified: 2025-10-09 //
7+
// Last Modified: 2025-11-12 //
88
// Modified By: Matthew Carroll //
99
// ----- //
1010
// Copyright (c) 2025 Syndemics Lab at Boston Medical Center //
@@ -31,6 +31,7 @@ class MockPerson : public virtual Person {
3131
MOCK_METHOD(void, Die, (data::DeathReason deathReason), (override));
3232
MOCK_METHOD(void, SetPersonDetails, (const data::PersonSelect &select),
3333
(override));
34+
MOCK_METHOD(void, SetStartTime, (const int), (override));
3435

3536
// HCV
3637
MOCK_METHOD(data::HCVDetails, GetHCVDetails, (), (const, override));

0 commit comments

Comments
 (0)