Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Utopia::Models::CopyMeGrid::CellState Struct Reference

The type of a cell's state. More...

#include <CopyMeGrid.hh>

Public Member Functions

 CellState (const DataIO::Config &cfg)
 Construct the cell state from a configuration.
 
template<class RNG >
 CellState (const DataIO::Config &cfg, const std::shared_ptr< RNG > &rng)
 Construct the cell state from a configuration and an RNG.
 

Public Attributes

double some_state
 A useful documentation string.
 
int some_trait
 Another useful documentation string, yeah.
 
bool is_a_vip_cell
 Whether this cell is very important.
 

Detailed Description

The type of a cell's state.

Constructor & Destructor Documentation

◆ CellState() [1/2]

Utopia::Models::CopyMeGrid::CellState::CellState ( const DataIO::Config cfg)
inline

Construct the cell state from a configuration.

33 :
34 some_state(get_as<double>("some_state", cfg)),
35 some_trait(get_as<int>("some_trait", cfg)),
36 is_a_vip_cell(false)
37 {}
Container select_entities(const Manager &mngr, const DataIO::Config &sel_cfg)
Select entities according to parameters specified in a configuration.
Definition select.hh:213
int some_trait
Another useful documentation string, yeah.
Definition CopyMeGrid.hh:26
double some_state
A useful documentation string.
Definition CopyMeGrid.hh:23
bool is_a_vip_cell
Whether this cell is very important.
Definition CopyMeGrid.hh:29

◆ CellState() [2/2]

template<class RNG >
Utopia::Models::CopyMeGrid::CellState::CellState ( const DataIO::Config cfg,
const std::shared_ptr< RNG > &  rng 
)
inline

Construct the cell state from a configuration and an RNG.

42 :
43 // Use the config constructor to get the values
44 CellState(cfg)
45 {
46 // Do some more things using the random number generator
47 // There is the possibility to set a random initial trait
48 if (cfg["random_initial_trait"]) {
49 if (not get_as<bool>("random_initial_trait", cfg)) {
50 // Is set, but is false. Just return:
51 return;
52 }
53
54 // Choose a random value between 0 and the current value
55 some_trait = std::uniform_int_distribution(0, some_trait)(*rng);
56 }
57 // else: the config option was not available
58 }
CellState(const DataIO::Config &cfg)
Construct the cell state from a configuration.
Definition CopyMeGrid.hh:32

Member Data Documentation

◆ is_a_vip_cell

bool Utopia::Models::CopyMeGrid::CellState::is_a_vip_cell

Whether this cell is very important.

◆ some_state

double Utopia::Models::CopyMeGrid::CellState::some_state

A useful documentation string.

◆ some_trait

int Utopia::Models::CopyMeGrid::CellState::some_trait

Another useful documentation string, yeah.


The documentation for this struct was generated from the following file: