Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
counters.hh
Go to the documentation of this file.
1#ifndef UTOPIA_MODELS_SEIRD_COUNTERS_HH
2#define UTOPIA_MODELS_SEIRD_COUNTERS_HH
3
4#include <array>
5#include <string>
6
8
9
11
13
20template<class Counter>
21struct Counters {
23
25 static constexpr std::size_t size = 11;
26
27private:
29 std::array<Counter, size> _counts {};
30
32 inline static const std::array<std::string, size> _labels {
33 "empty_to_susceptible",
34 "living_to_empty",
35 "susceptible_to_exposed_contact",
36 "susceptible_to_exposed_random",
37 "susceptible_to_exposed_controlled",
38 "exposed_to_infected",
39 "infected_to_recovered",
40 "infected_to_deceased",
41 "recovered_to_susceptible",
42 "move_randomly",
43 "move_away_from_infected"
44 };
45
46public:
49 _counts.fill(0);
50 }
51
53 auto counts () {
54 return _counts;
55 }
56
58 const auto& labels () {
59 return _labels;
60 }
61
64 ++_counts[0];
65 }
66
69 ++_counts[1];
70 }
71
76
81
86
89 ++_counts[5];
90 }
91
96
99 ++_counts[7];
100 }
101
106
109 ++_counts[9];
110 }
111
114 ++_counts[10];
115 }
116};
117
118
119} // namespace Utopia::Models::SEIRD
120
121#endif // UTOPIA_MODELS_SEIRD_COUNTERS_HH
Definition counters.hh:10
A struct holding counters for state transitions and other global counters.
Definition counters.hh:21
void increment_susceptible_to_exposed_random()
Increment counter for transitions from susceptible to exposed (random)
Definition counters.hh:78
void increment_infected_to_recovered()
Increment counter for transitions from infected to recovered.
Definition counters.hh:93
const auto & labels()
The labels cooresponding to each entry of the counts array.
Definition counters.hh:58
Counters()
Counstruct a Counters object with all counts set to zero.
Definition counters.hh:48
void increment_empty_to_susceptible()
Increment counter for transitions from empty to susceptible.
Definition counters.hh:63
void increment_recovered_to_susceptible()
Increment counter for transitions from recovered to susceptible.
Definition counters.hh:103
static constexpr std::size_t size
Number of counters.
Definition counters.hh:25
void increment_move_randomly()
Increment counter for random movement events.
Definition counters.hh:108
void increment_susceptible_to_exposed_controlled()
Increment counter for transitions from susceptible to exposed (control)
Definition counters.hh:83
void increment_infected_to_deceased()
Increment counter for transitions from infected to deceased.
Definition counters.hh:98
auto counts()
Return a copy of the current value of all counts.
Definition counters.hh:53
static const std::array< std::string, size > _labels
The array holding the corresponding counter labels.
Definition counters.hh:32
void increment_living_to_empty()
Increment counter for transitions from living to empty.
Definition counters.hh:68
std::array< Counter, size > _counts
The array holding the counter values.
Definition counters.hh:29
void increment_move_away_from_infected()
Increment counter for movement events away from an infected agent.
Definition counters.hh:113
void increment_exposed_to_infected()
Increment counter for transitions from exposed to infected.
Definition counters.hh:88
void increment_susceptible_to_exposed_contact()
Increment counter for transitions from susceptible to exposed (contact)
Definition counters.hh:73