Stride Reference Manual  - generated for commit 9643b11
Populator.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 2018, 2019, Jan Broeckhove and Bistromatics group.
14  */
15 
16 #pragma once
17 
18 #include "contact/ContactType.h"
19 #include "contact/ContactPool.h"
20 #include "geopop/GeoGridConfig.h"
21 #include "util/LogUtils.h"
22 #include "util/RnMan.h"
23 
24 #include <spdlog/logger.h>
25 
26 namespace geopop {
27 
28 class GeoGrid;
29 class GeoGridConfig;
30 class Location;
31 
35 template <typename stride::ContactType::Id ID>
36 class Populator
37 {
38 public:
40  explicit Populator(stride::util::RnMan& rnMan, std::shared_ptr<spdlog::logger> logger = nullptr)
41  : m_rn_man(rnMan), m_logger(move(logger))
42  {
43  if (!m_logger)
45  }
46 
48  ~Populator() = default;
49 
51  void Apply(GeoGrid&, const GeoGridConfig&) {};
52 
53 protected:
55  std::shared_ptr<spdlog::logger> m_logger;
56 };
57 
58 // ---------------------------------------------------------------
59 // Declare specializations (implemntation in separate .cpp files).
60 // ---------------------------------------------------------------
61 template<>
63 
64 template<>
66 
67 template<>
69 
70 template<>
72 
73 template<>
75 
76 template<>
78 
79 // ---------------------------------------------------------------
80 // Shorthand definitions.
81 // ---------------------------------------------------------------
88 
89 } // namespace geopop
Configuration data mostly for generating a population, but also for computing the required number of ...
Definition: GeoGridConfig.h:35
Header for the core ContactPool class.
A Geographic grid of simulation region contains Locations that in turn contain an index to the Contac...
Definition: GeoGrid.h:41
Interface of RnMan.
Definition of ContactPool Id Type.
Logging (spdlog) utilities.
Namespace for the geographic and demograhic classes.
Definition: Coordinate.h:21
Populator uses geo & pop data to populate ContactPools in the GeoGrid.
Definition: Populator.h:36
void Apply(GeoGrid &, const GeoGridConfig &)
Populate the ContactPools type ID. This is a placeholder for the specializations. ...
Definition: Populator.h:51
~Populator()=default
Default is OK.
Populator(stride::util::RnMan &rnMan, std::shared_ptr< spdlog::logger > logger=nullptr)
Construct with a RnMan and a logger.
Definition: Populator.h:40
stride::util::RnMan & m_rn_man
RnManager used by populators.
Definition: Populator.h:51
static std::shared_ptr< spdlog::logger > CreateNullLogger(const std::string &logger_name="null_logger")
Return a (not-yet-registered) null logger, without registering it.
Definition: LogUtils.cpp:71
std::shared_ptr< spdlog::logger > m_logger
Logger used by populators.
Definition: Populator.h:55