Stride Reference Manual  - generated for commit 9643b11
Sim.h
Go to the documentation of this file.
1 /*
2  * This is free software: you can redistribute it and/or modify it
3  * under the terms of the GNU General Public License as published by
4  * the Free Software Foundation, either version 3 of the License, or
5  * any later version.
6  * The software is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  * You should have received a copy of the GNU General Public License
11  * along with the software. If not, see <http://www.gnu.org/licenses/>.
12  *
13  * Copyright 2017, 2018, Kuylen E, Willem L, Broeckhove J
14  */
15 
21 #pragma once
22 
24 #include "contact/ContactHandler.h"
25 #include "contact/ContactLogMode.h"
26 #include "contact/InfectorExec.h"
29 
30 #include <boost/property_tree/ptree.hpp>
31 #include <string>
32 
33 namespace stride {
34 
35 class Calendar;
36 class Population;
37 
38 namespace util {
39 class RnMan;
40 }
41 
46 class Sim
47 {
48 public:
50  static std::shared_ptr<Sim> Create(const boost::property_tree::ptree& config, std::shared_ptr<Population> pop,
51  util::RnMan rnMan);
52 
54  static std::shared_ptr<Sim> Create(const std::string& configString, std::shared_ptr<Population> pop, util::RnMan rnMan);
55 
58  std::shared_ptr<Calendar> GetCalendar() const { return m_calendar; }
59 
61  std::string GetConfigValue(const std::string& attribute) const { return m_config.get<std::string>(attribute); }
62 
64  std::shared_ptr<Population> GetPopulation() { return m_population; }
65 
67  double GetTransmissionProbability() const { return m_transmission_profile.GetProbability(); }
68 
70  util::RnMan& RefRnManager() { return m_rn_man; }
71 
73  const TransmissionProfile& RefTransmissionProfile() const { return m_transmission_profile; }
74 
76  void TimeStep();
77 
78 private:
80  explicit Sim();
81 
82  friend class SimBuilder;
83 
84 private:
85  boost::property_tree::ptree m_config;
87  unsigned int m_num_threads;
90 
91  std::shared_ptr<Calendar> m_calendar;
93  std::vector<ContactHandler> m_handlers;
95  std::shared_ptr<Population> m_population;
97 
100 };
101 
102 } // namespace stride
TransmissionProfile m_transmission_profile
Profile of disease.
Definition: Sim.h:98
std::shared_ptr< Population > GetPopulation()
Get the population.
Definition: Sim.h:64
Contact profiles stored in simulator.
unsigned int m_num_threads
The number of (OpenMP) threads.
Definition: Sim.h:87
AgeContactProfiles m_contact_profiles
Contact profiles w.r.t age.
Definition: Sim.h:92
Header for the TransmissionProfile class.
InfectorExec * m_infector
Executes contacts/transmission loops in contact pool.
Definition: Sim.h:94
ContactLogMode::Id m_contact_log_mode
Specifies contact/transmission logging mode.
Definition: Sim.h:86
std::shared_ptr< Calendar > m_calendar
Management of calendar.
Definition: Sim.h:91
bool m_track_index_case
General simulation or tracking index case.
Definition: Sim.h:88
Builds a simulator based a configuration property tree.
Definition: SimBuilder.h:41
Header for the InfectorExec class.
PublicHealthAgency m_public_health_agency
Agency to implement reactive strategies.
Definition: Sim.h:99
Header for the ContactHandler class.
const TransmissionProfile & RefTransmissionProfile() const
Get the transmission profile.
Definition: Sim.h:73
Simulator can time step and reveal some of the key data.
Definition: Sim.h:46
double GetTransmissionProbability() const
Get the stored transmission probability.
Definition: Sim.h:67
std::vector< ContactHandler > m_handlers
Contact handlers (rng & rates).
Definition: Sim.h:93
std::shared_ptr< Calendar > GetCalendar() const
Calendar for the simulated world.
Definition: Sim.h:58
bool m_adaptive_symptomatic_behavior
Should symptomatic cases stay home?
Definition: Sim.h:89
boost::property_tree::ptree m_config
Configuration property tree.
Definition: Sim.h:85
util::RnMan m_rn_man
Random number generation management.
Definition: Sim.h:96
Header for the ContactLogMode class.
std::string GetConfigValue(const std::string &attribute) const
Get the Sim configuration for the given attribute.
Definition: Sim.h:61
util::RnMan & RefRnManager()
Get the random number manager.
Definition: Sim.h:70
void( InfectorExec)(ContactPool &pool, const AgeContactProfile &profile, const TransmissionProfile &trans_profile, ContactHandler &c_handler, unsigned short int sim_day, std::shared_ptr< spdlog::logger > c_logger)
For use in the InfectorMap and Sim; executes infector.
Definition: InfectorExec.h:33
Transmission probabilities from disease data.
std::shared_ptr< Population > m_population
Pointer to the Population.
Definition: Sim.h:95
Header for the PublicHealthAgency class.
Namespace for the simulator and related classes.
Definition: Calendar.cpp:28