Stride Reference Manual  - generated for commit 9643b11
Population.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, Kuylen E, Willem L, Broeckhove J
14  */
15 
21 #pragma once
22 
23 #include "contact/ContactPool.h"
24 #include "contact/ContactPoolSys.h"
25 #include "contact/ContactType.h"
26 #include "geopop/GeoGrid.h"
27 #include "pop/Person.h"
28 #include "util/RnMan.h"
29 #include "util/SegmentedVector.h"
30 
31 #include <boost/property_tree/ptree_fwd.hpp>
32 #include <memory>
33 #include <spdlog/spdlog.h>
34 
35 namespace stride {
36 
37 namespace util {
38 class RnMan;
39 }
40 
47 class Population : public util::SegmentedVector<Person, 2048>
48 {
49 public:
51  static std::shared_ptr<Population> Create(const boost::property_tree::ptree& config, util::RnMan rnMan,
52  std::shared_ptr<spdlog::logger> strideLogger = nullptr);
53 
55  static std::shared_ptr<Population> Create(const std::string& configString, util::RnMan rnMan,
56  std::shared_ptr<spdlog::logger> stride_logger = nullptr);
57 
59  static std::shared_ptr<Population> Create();
60 
61 public:
63  Person* CreatePerson(unsigned int id, double age, unsigned int householdId, unsigned int k12SchoolId,
64  unsigned int collegeId, unsigned int workId, unsigned int primaryCommunityId,
65  unsigned int secondaryCommunityId);
66 
68  unsigned int GetInfectedCount() const;
69 
71  const ContactPoolSys& CRefPoolSys() const { return m_pool_sys; }
72 
74  const geopop::GeoGrid& CRefGeoGrid() const { return m_geo_grid; }
75 
77  std::shared_ptr<spdlog::logger>& RefContactLogger() { return m_contact_logger; }
78 
80  ContactPoolSys& RefPoolSys() { return m_pool_sys; }
81 
83  geopop::GeoGrid& RefGeoGrid() { return m_geo_grid; }
84 
85 private:
87  Population();
88 
89 private:
91  std::shared_ptr<spdlog::logger> m_contact_logger;
93 };
94 
95 } // namespace stride
Header file for the Person class.
Container for the contact pools of various type (household, work, ...).
Header for the core ContactPool class.
const geopop::GeoGrid & CRefGeoGrid() const
Get the GeoGrid associated with this population (may be a nullptr).
Definition: Population.h:74
const ContactPoolSys & CRefPoolSys() const
The ContactPoolSys of the simulator.
Definition: Population.h:71
Interface and implementation for SegmentedVector class.
geopop::GeoGrid & RefGeoGrid()
Reference the GeoGrid associated with this population (may be a nullptr).
Definition: Population.h:83
A Geographic grid of simulation region contains Locations that in turn contain an index to the Contac...
Definition: GeoGrid.h:41
ContactPoolSys & RefPoolSys()
Reference the ContactPoolSys of the Population.
Definition: Population.h:80
Interface of RnMan.
Key Data structure: container for (a) all individuals in the population (b) the ContactPoolSys wchich...
Definition: Population.h:47
Container that stores objects "almost contiguously" (in a chain of blocks) and guarantees that pointe...
Definition of ContactPool Id Type.
std::shared_ptr< spdlog::logger > m_contact_logger
Logger for contact/transmission.
Definition: Population.h:91
geopop::GeoGrid m_geo_grid
Associated may be nullptr.
Definition: Population.h:92
ContactPoolSys contains for each of the type of pools (Household, K12School, ...) a vector of with al...
std::shared_ptr< spdlog::logger > & RefContactLogger()
Return the contactlogger.
Definition: Population.h:77
ContactPoolSys m_pool_sys
The global .
Definition: Population.h:90
Store and handle person data.
Definition: Person.h:34
Namespace for the simulator and related classes.
Definition: Calendar.cpp:28