35 #include <boost/property_tree/ptree.hpp> 45 Population::Population() : m_pool_sys(), m_contact_logger(), m_geo_grid(this) {}
48 std::shared_ptr<spdlog::logger> strideLogger)
58 if (config.get<
bool>(
"run.contact_output_file",
true)) {
59 const auto prefix = config.get<
string>(
"run.output_prefix");
62 pop->RefContactLogger()->set_pattern(
"%v");
63 strideLogger->info(
"Contact logging requested; logger set up.");
66 strideLogger->info(
"No contact logging requested.");
72 std::string pop_type = config.get<std::string>(
"run.population_type",
"default");
73 if (pop_type ==
"import") {
74 strideLogger->info(
"Invoking ImportPopBuilder.");
76 }
else if (pop_type ==
"generate") {
77 strideLogger->info(
"Invoking GeoPopBuilder.");
80 strideLogger->info(
"Invoking DefaultPopBuilder.");
91 std::shared_ptr<spdlog::logger> stride_logger)
101 struct make_shared_enabler :
public Population 104 auto r = make_shared<make_shared_enabler>();
109 unsigned int college,
unsigned int workId,
unsigned int primaryCommunityId,
110 unsigned int secondaryCommunityId)
112 return emplace_back(
id, age, householdId, k12SchoolId, college, workId, primaryCommunityId,
113 secondaryCommunityId);
118 unsigned int total{0U};
119 for (
const auto& p : *
this) {
120 const auto& h = p.GetHealth();
121 total += h.IsInfected() || h.IsRecovered();
std::shared_ptr< Population > Build(std::shared_ptr< Population > pop) override
Generates a synthetic population.
static std::shared_ptr< Population > Create()
Create an empty Population, used in gengeopop.
Utilities for the project.
unsigned int GetInfectedCount() const
Get the cumulative number of cases.
std::shared_ptr< Population > Build(std::shared_ptr< Population > pop) override
Build Population and return it afterwards.
Interface and implementation for SegmentedVector class.
static std::shared_ptr< spdlog::logger > CreateRotatingLogger(const std::string &logger_name, const std::string &file_name)
Return a (not-yet-registered) rotating logger, without registering it.
Header for the Health class.
Key Data structure: container for (a) all individuals in the population (b) the ContactPoolSys wchich...
Logging (spdlog) utilities.
Person * CreatePerson(unsigned int id, double age, unsigned int householdId, unsigned int k12SchoolId, unsigned int collegeId, unsigned int workId, unsigned int primaryCommunityId, unsigned int secondaryCommunityId)
Create Person in the population.
static filesys::path BuildPath(const std::string &output_prefix, const std::string &filename)
Interpret prefix (directory or filename prefix) and return appropriate path.
Initializes Population objects.
std::shared_ptr< Population > Build(std::shared_ptr< Population > pop) override
Creates a population by importing it.
Builds poulation of a geographic grid.
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.
Miscellaneous string utilities.
Person * emplace_back(Args &&...args)
Constructs element in-place at the end.
Interface for install directory queries.
Store and handle person data.
Namespace for the simulator and related classes.
static std::shared_ptr< spdlog::logger > CreateNullLogger(const std::string &logger_name="null_logger")
Return a (not-yet-registered) null logger, without registering it.
Initializes Population objects.
Namespace to manage types of ContactPool.