37 using namespace ContactLogMode;
40 : m_config(), m_contact_log_mode(
Id::
None), m_num_threads(1U), m_track_index_case(false),
41 m_adaptive_symptomatic_behavior(false), m_calendar(nullptr), m_contact_profiles(), m_handlers(), m_infector(),
42 m_population(nullptr), m_rn_man(), m_transmission_profile(), m_public_health_agency()
46 std::shared_ptr<Sim>
Sim::Create(
const boost::property_tree::ptree& config, shared_ptr<Population> pop,
49 struct make_shared_enabler :
public Sim 51 explicit make_shared_enabler() :
Sim() {}
53 shared_ptr<Sim> sim = make_shared<make_shared_enabler>();
54 SimBuilder(config).Build(sim, std::move(pop), std::move(rnMan));
67 const auto daysOff = std::make_shared<DaysOffStandard>(
m_calendar);
68 const bool isWorkOff = daysOff->IsWorkOff();
69 const bool isSchoolOff = daysOff->IsSchoolOff();
75 const auto simDay =
m_calendar->GetSimulationDay();
78 #pragma omp parallel num_threads(m_num_threads) 83 #pragma omp for schedule(static) 84 for (
size_t i = 0; i < population.
size(); ++i) {
93 const auto thread_num =
static_cast<unsigned int>(omp_get_thread_num());
100 #pragma omp for schedule(static) 101 for (
size_t i = 1; i < poolSys.RefPools(typ).size(); i++) {
103 m_handlers[thread_num], simDay, contactLogger);
TransmissionProfile m_transmission_profile
Profile of disease.
AgeContactProfiles m_contact_profiles
Contact profiles w.r.t age.
Sim()
Constructor for empty Simulator.
InfectorExec * m_infector
Executes contacts/transmission loops in contact pool.
constexpr std::initializer_list< Id > IdList
To allow iteration over the type ids.
std::shared_ptr< Calendar > m_calendar
Management of calendar.
Header for the SimBuilder class.
Header for the InfectorExec class.
PublicHealthAgency m_public_health_agency
Agency to implement reactive strategies.
static std::shared_ptr< Sim > Create(const boost::property_tree::ptree &config, std::shared_ptr< Population > pop, util::RnMan rnMan)
Create Sim initialized by the configuration in property tree and population.
void Exec(std::shared_ptr< Population > pop, util::RnMan &rnManager, unsigned short int sim_day)
Execute.
ContactPoolSys & RefPoolSys()
Reference the ContactPoolSys of the Population.
Simulator can time step and reveal some of the key data.
std::vector< ContactHandler > m_handlers
Contact handlers (rng & rates).
Key Data structure: container for (a) all individuals in the population (b) the ContactPoolSys wchich...
Definition of ContactPool Id Type.
void TimeStep()
Run one time step, computing full simulation (default) or only index case.
bool m_adaptive_symptomatic_behavior
Should symptomatic cases stay home?
util::RnMan m_rn_man
Random number generation management.
Header file for the core Population class.
static boost::property_tree::ptree FromString(const std::string &s)
Reconstitute property tree from string representation.
Produce run config ptree.
std::shared_ptr< spdlog::logger > & RefContactLogger()
Return the contactlogger.
std::size_t size() const
Returns the number of elements.
Header for the Simulator class.
std::shared_ptr< Population > m_population
Pointer to the Population.
Namespace for the simulator and related classes.