Stride Reference Manual  1.0
popgen/utils.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include "util/GeoCoordinate.h"
5 #include <random>
6 
7 namespace stride {
8 namespace popgen {
9 
10 using namespace std;
11 using namespace util;
12 
13 #define PI 3.14159265
14 
15 extern uniform_real_distribution<double> real01;
16 
17 using uint = unsigned int;
18 
19 template<class T>
20 class PopulationGenerator;
21 
22 class SimplePerson {
23 public:
24 
25  SimplePerson(uint age = 0, uint family_id = 0);
26 
27  friend std::ostream& operator<<(std::ostream& os, const SimplePerson& p);
28 
29  template<class U> friend
30  class PopulationGenerator;
31 
32  uint m_age = 0;
33  uint m_household_id = 0;
34  uint m_school_id = 0;
35  uint m_work_id = 0;
36  uint m_primary_community = 0;
37  uint m_secondary_community = 0;
38  util::GeoCoordinate m_coord;
39 };
40 
42  uint m_id = 0;
43  std::vector<uint> m_indices;
44 };
45 
46 struct SimpleCluster {
47  uint m_current_size = 0;
48  uint m_max_size = 0;
49  uint m_id = 0;
51 };
52 
53 struct SimpleCity {
54 
55  SimpleCity(uint current_size, uint max_size, uint id, std::string name, util::GeoCoordinate coordinate) {
56  m_current_size = current_size;
57  m_max_size = max_size;
58  m_id = id;
59  m_name = name;
60  m_coord = coordinate;
61  }
62 
63  uint m_current_size = 0;
64  uint m_max_size = 0;
65  uint m_id = 0;
66  std::string m_name = "";
68 };
69 
70 std::ostream& operator<<(std::ostream& os, const SimplePerson& p);
71 
72 struct MinMax {
73  MinMax(uint _min = 0, uint _max = 0) : min(_min), max(_max) {}
74 
77 };
78 
79 struct MinMaxAvg : public MinMax {
80  MinMaxAvg(uint _min = 0, uint _max = 0, uint _avg = 0)
81  : MinMax(_min, _max), avg(_avg) {}
82 
84 };
85 
86 }
87 }
MinMax(uint _min=0, uint _max=0)
Definition: popgen/utils.h:73
MinMaxAvg(uint _min=0, uint _max=0, uint _avg=0)
Definition: popgen/utils.h:80
unsigned int uint
Definition: FamilyParser.h:12
Time Dependent Person DataType.
Definition: NoBehaviour.h:17
util::GeoCoordinate m_coord
Definition: popgen/utils.h:50
SimpleCity(uint current_size, uint max_size, uint id, std::string name, util::GeoCoordinate coordinate)
Definition: popgen/utils.h:55
util::GeoCoordinate m_coord
Definition: popgen/utils.h:67
std::vector< uint > m_indices
Definition: popgen/utils.h:43
STL namespace.
uniform_real_distribution< double > real01
Definition: utils.cpp:10
std::ostream & operator<<(std::ostream &os, const SimplePerson &p)
Definition: utils.cpp:12