1#ifndef UTOPIA_MODELS_SEIRD_STATE_HH
2#define UTOPIA_MODELS_SEIRD_STATE_HH
58 auto sfk = std::map<const Kind, std::string>{};
64 [&](
const auto&
kv){ return kv.second == kind; });
126 if (cfg[
"p_susceptible"]) {
130 throw std::invalid_argument(
"p_susceptible needs to be in "
131 "interval [0., 1.], but was " +
136 if (std::uniform_real_distribution<double>(0., 1.)(*rng) <
143 if (cfg[
"p_immune"]) {
147 throw std::invalid_argument(
"p_immune needs to be in "
148 "interval [0., 1.], but was " +
154 if (std::uniform_real_distribution<double>(0., 1.)(*rng) <
164 if (cfg[
"p_transmit"]) {
170 template<
typename RNG>
172 const std::shared_ptr<RNG>& rng)
176 if (mode ==
"value") {
181 else if (mode ==
"uniform") {
187 std::uniform_real_distribution<double>
distr(
range.first,
194 throw std::invalid_argument(fmt::format(
195 "Invalid mode! Need be either 'value' or 'uniform', was '{}'!",
YAML::Node Config
Type of a variadic dictionary-like data structure used throughout Utopia.
Definition types.hh:71
Container select_entities(const Manager &mngr, const DataIO::Config &sel_cfg)
Select entities according to parameters specified in a configuration.
Definition select.hh:213
decltype(auto) range(const Graph &g)
Get the iterator range over selected graph entities.
Definition iterator.hh:149
Definition counters.hh:10
const std::array< std::string, static_cast< char >(Kind::COUNT)> kind_names
The associated string names of each Kind enum entry.
Definition state.hh:76
const std::map< const std::string, Kind > kind_from_string
Map the Kind name given as a string to the actual Kind.
Definition state.hh:42
const std::map< const Kind, std::string > string_from_kind
The inverse of the kind_from_string mapping.
Definition state.hh:56
Kind
The kind of the cell.
Definition state.hh:16
@ source
Cell is an infection source: constantly infected, spreading infection.
@ inert
Cell does not partake in the dynamics.
@ COUNT
The number of kinds (COUNT)
@ recovered
Cell is recovered.
@ infected
Cell is infected.
@ deceased
Cell is deceased.
@ exposed
Cell is exposed to the dease but not yet infected.
@ susceptible
Cell represents a susceptible.
The full cell struct for the SEIRD model.
Definition state.hh:90
unsigned age
The age of the cell.
Definition state.hh:105
double p_transmit
Definition state.hh:99
unsigned int cluster_id
An ID denoting to which cluster this cell belongs.
Definition state.hh:111
static double initialize_p_transmit(const DataIO::Config &cfg, const std::shared_ptr< RNG > &rng)
Initialize p_transmit from a configuration node.
Definition state.hh:171
unsigned num_recoveries
The number of recoveries.
Definition state.hh:108
Kind kind
The cell state.
Definition state.hh:92
bool immune
Whether the agent is immune.
Definition state.hh:95
unsigned exposed_time
The time passed since first being exposed.
Definition state.hh:102
State(const DataIO::Config &cfg, const std::shared_ptr< RNG > &rng)
Construct the cell state from a configuration and an RNG.
Definition state.hh:115