Stride Reference Manual  - generated for commit 9643b11
GeoGridReader.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, Jan Broeckhove and Bistromatics group.
14  */
15 
16 #pragma once
17 
18 #include <istream>
19 #include <map>
20 #include <memory>
21 #include <tuple>
22 #include <vector>
23 
24 namespace stride {
25 class Person;
26 class Population;
27 } // namespace stride
28 
29 namespace geopop {
30 
31 class GeoGrid;
32 
38 {
39 public:
41  GeoGridReader(std::unique_ptr<std::istream> inputStream, stride::Population* pop);
42 
44  GeoGridReader(const GeoGridReader&) = delete;
45 
47  GeoGridReader& operator=(const GeoGridReader&) = delete;
48 
50  virtual ~GeoGridReader() = default;
51 
53  virtual void Read() = 0;
54 
55 protected:
57  void AddCommutes(GeoGrid& geoGrid);
58 
59 protected:
61  std::map<unsigned int, stride::Person*> m_people;
62 
64  std::vector<std::tuple<unsigned int, unsigned int, double>> m_commutes;
65 
66  std::unique_ptr<std::istream> m_inputStream;
68 };
69 
70 } // namespace geopop
void AddCommutes(GeoGrid &geoGrid)
Add the commutes that were found to their respective Locations symmetrically.
GeoGridReader(std::unique_ptr< std::istream > inputStream, stride::Population *pop)
Parametrized constructor.
stride::Population * m_population
Population to use in the GeoGrid may be nullptr.
Definition: GeoGridReader.h:67
A Geographic grid of simulation region contains Locations that in turn contain an index to the Contac...
Definition: GeoGrid.h:41
Key Data structure: container for (a) all individuals in the population (b) the ContactPoolSys wchich...
Definition: Population.h:47
Namespace for the geographic and demograhic classes.
Definition: Coordinate.h:21
std::vector< std::tuple< unsigned int, unsigned int, double > > m_commutes
Definition: GeoGridReader.h:64
std::unique_ptr< std::istream > m_inputStream
File to read.
Definition: GeoGridReader.h:66
virtual void Read()=0
Perform the actual read and return the created GeoGrid.
An abstract base class for creating a GeoGrid that was read from a file, can be implemented using mul...
Definition: GeoGridReader.h:37
virtual ~GeoGridReader()=default
Default destructor.
std::map< unsigned int, stride::Person * > m_people
< Store the persons (id->person) that were found while loping over the ContactPools.
Definition: GeoGridReader.h:61
Namespace for the simulator and related classes.
Definition: Calendar.cpp:28
GeoGridReader & operator=(const GeoGridReader &)=delete
No copy assignment.