27 #include <boost/property_tree/ptree.hpp> 36 HealthSeeder::HealthSeeder(
const boost::property_tree::ptree& diseasePt)
37 : m_start_symptomatic(), m_time_asymptomatic(), m_time_infectious(), m_time_symptomatic()
52 const boost::property_tree::ptree& subtree = rootPt.get_child(xmlTag);
53 for (
const auto& tree : subtree) {
54 distribution.push_back(tree.second.get<
double>(
""));
60 auto ret =
static_cast<unsigned short int>(distribution.size());
61 for (
unsigned short int i = 0; i < distribution.size(); i++) {
62 if (random01 <= distribution[i]) {
70 void HealthSeeder::Seed(
const std::shared_ptr<stride::Population>& pop, vector<ContactHandler>& handlers)
72 auto& population = *pop;
74 #pragma omp parallel num_threads(handlers.size()) 76 auto& gen01 = handlers[
static_cast<size_t>(omp_get_thread_num())];
78 for (
size_t i = 0; i < population.size(); ++i) {
83 population[i].GetHealth() =
84 Health(startInfectiousness, startSymptomatic, timeInfectious, timeSymptomatic);
void Seed(const std::shared_ptr< Population > &pop, std::vector< ContactHandler > &handlers)
Seeds the population with Health data.
Utilities for the project.
void GetDistribution(std::vector< double > &distribution, const boost::property_tree::ptree &rootPt, const std::string &xmlTag)
Utility method to etract distribution from data in ptree.
std::vector< double > m_time_symptomatic
Holds a person's health data.
std::vector< double > m_start_symptomatic
#define AssertThrow(CONDITION, MESSAGE, LOGGER)
Header for the ContactHandler class.
unsigned short int Sample(const std::vector< double > &distribution, double random01)
Sample for each of the health data item individually.
std::vector< double > m_time_asymptomatic
Header for the Health class.
Header file for the core Population class.
std::vector< double > m_time_infectious
Namespace for the simulator and related classes.
Header file for the HealthSeeder.