Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Variables
Utopia::Models::SEIRD Namespace Reference

Classes

struct  Counters
 A struct holding counters for state transitions and other global counters. More...
 
struct  ExposureContParams
 Parameters specifying the exposure control. More...
 
struct  ImmunityContParams
 Parameters specifying the immunity control. More...
 
struct  Params
 Parameters of the SEIRD. More...
 
class  SEIRD
 SEIRD model on a grid. More...
 
struct  State
 The full cell struct for the SEIRD model. More...
 
struct  TransmitContParams
 Parameters specifying the transmit control. More...
 

Typedefs

using CDCellTraits = Utopia::CellTraits< State, Update::manual >
 
using CDTypes = ModelTypes<>
 Typehelper to define data types of SEIRD model.
 

Enumerations

enum class  Kind : char {
  empty = 0 , susceptible = 1 , exposed = 2 , infected = 3 ,
  recovered = 4 , deceased = 5 , source = 6 , inert = 7 ,
  COUNT = 8
}
 The kind of the cell. More...
 

Variables

const std::map< const std::string, Kindkind_from_string
 Map the Kind name given as a string to the actual Kind.
 
const std::map< const Kind, std::string > string_from_kind
 The inverse of the kind_from_string mapping.
 
const std::array< std::string, static_cast< char >(Kind::COUNT)> kind_names
 The associated string names of each Kind enum entry.
 

Typedef Documentation

◆ CDCellTraits

Specifies the type of each cells' state as first template argument and the update mode as second.

See Utopia::CellTraits for more information.

◆ CDTypes

Typehelper to define data types of SEIRD model.

Enumeration Type Documentation

◆ Kind

The kind of the cell.

Enumerator
empty 

Unoccupied.

susceptible 

Cell represents a susceptible.

exposed 

Cell is exposed to the dease but not yet infected.

infected 

Cell is infected.

recovered 

Cell is recovered.

deceased 

Cell is deceased.

source 

Cell is an infection source: constantly infected, spreading infection.

inert 

Cell does not partake in the dynamics.

COUNT 

The number of kinds (COUNT)

Attention
The COUNT should always be the last member of the enum class to ensure that it reflects the correct number of kinds.
16{
18 empty = 0,
20 susceptible = 1,
22 exposed = 2,
24 infected = 3,
26 recovered = 4,
28 deceased = 5,
30 source = 6,
32 inert = 7,
33
35
38 COUNT = 8,
39};
@ empty
Every entity is utterly alone in the world.
@ inert
Cell does not partake in the dynamics.
@ COUNT
The number of kinds (COUNT)
@ recovered
Cell is recovered.
@ deceased
Cell is deceased.
@ exposed
Cell is exposed to the dease but not yet infected.
@ susceptible
Cell represents a susceptible.

Variable Documentation

◆ kind_from_string

const std::map<const std::string, Kind> Utopia::Models::SEIRD::kind_from_string
Initial value:
{
{"empty", Kind::empty},
{"susceptible", Kind::susceptible},
{"exposed", Kind::exposed},
{"infected", Kind::infected},
{"recovered", Kind::recovered},
{"deceased", Kind::deceased},
{"source", Kind::source},
{"inert", Kind::inert}
}

Map the Kind name given as a string to the actual Kind.

42 {
43 {"empty", Kind::empty},
44 {"susceptible", Kind::susceptible},
45 {"exposed", Kind::exposed},
46 {"infected", Kind::infected},
47 {"recovered", Kind::recovered},
48 {"deceased", Kind::deceased},
49 {"source", Kind::source},
50 {"inert", Kind::inert}
51};

◆ kind_names

const std::array<std::string, static_cast<char>(Kind::COUNT)> Utopia::Models::SEIRD::kind_names
Initial value:
=
[](){
auto names = std::array<std::string, static_cast<char>(Kind::COUNT)>{};
for (auto i = 0u; i < static_cast<char>(Kind::COUNT); i++) {
names[i] = string_from_kind.at(static_cast<Kind>(i));
}
return names;
}()
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

The associated string names of each Kind enum entry.

The indices of this array correspond to the char value used when writing out data. It thus is a mapping from char to Kind names, which is a mapping that is useful to have on frontend side.

77 {
78 auto names = std::array<std::string, static_cast<char>(Kind::COUNT)>{};
79 for (auto i = 0u; i < static_cast<char>(Kind::COUNT); i++) {
80 names[i] = string_from_kind.at(static_cast<Kind>(i));
81 }
82 return names;
83 }();

◆ string_from_kind

const std::map<const Kind, std::string> Utopia::Models::SEIRD::string_from_kind
Initial value:
=
[](){
auto sfk = std::map<const Kind, std::string>{};
for (auto i = 0u; i < static_cast<char>(Kind::COUNT); i++) {
const Kind kind = static_cast<Kind>(i);
const auto item =
std::find_if(kind_from_string.begin(), kind_from_string.end(),
[&](const auto& kv){ return kv.second == kind; });
sfk[kind] = item->first;
}
return sfk;
}()
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

The inverse of the kind_from_string mapping.

This can be used to retrieve a string corresponding to a certain Kind value

57 {
58 auto sfk = std::map<const Kind, std::string>{};
59
60 for (auto i = 0u; i < static_cast<char>(Kind::COUNT); i++) {
61 const Kind kind = static_cast<Kind>(i);
62 const auto item =
63 std::find_if(kind_from_string.begin(), kind_from_string.end(),
64 [&](const auto& kv){ return kv.second == kind; });
65 sfk[kind] = item->first;
66 }
67
68 return sfk;
69 }();