Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions | Variables
CellManager

An interface to build and use cellular automata. More...

Collaboration diagram for CellManager:

Classes

class  Utopia::Cell< Traits >
 A cell is a slightly specialized state container. More...
 
class  Utopia::CellManager< CellTraits, Model >
 Manages a physical space, its grid discretization, and cells on that grid. More...
 
class  Utopia::Grid< Space >
 The base class for all grid discretizations used by the CellManager. More...
 
class  Utopia::HexagonalGrid< Space >
 A grid discretization using hexagonal cells. More...
 
class  Utopia::SquareGrid< Space >
 A grid discretization using square cells. More...
 
class  Utopia::TriangularGrid< Space >
 A grid discretization using triangular cells. More...
 

Typedefs

template<typename StateType , Update update_mode, bool use_def_state_constr = false, typename CellTags = EmptyTag, template< class > class CustomLinkContainers = NoCustomLinks>
using Utopia::CellTraits = EntityTraits< StateType, update_mode, use_def_state_constr, CellTags, CustomLinkContainers >
 CellTraits are just another name for Utopia::EntityTraits.
 
template<class Grid >
using Utopia::NBFuncID = std::function< IndexContainer(const IndexType)>
 Type of the neighborhood calculating function.
 

Enumerations

enum class  Utopia::GridStructure { Utopia::GridStructure::square , Utopia::GridStructure::triangular , Utopia::GridStructure::hexagonal }
 Available grid implementations. More...
 
enum class  Utopia::NBMode { Utopia::NBMode::empty = 0 , Utopia::NBMode::vonNeumann = 1 , Utopia::NBMode::Moore = 2 , Utopia::NBMode::hexagonal = 3 }
 Possible neighborhood types; availability depends on choice of grid. More...
 

Functions

std::string Utopia::grid_structure_to_string (const GridStructure &structure)
 Given an GridStructure enum value, return the corresponding string key.
 
std::string Utopia::nb_mode_to_string (const NBMode &nb_mode)
 Given an NBMode enum value, return the corresponding string key.
 

Variables

const std::map< std::string, GridStructureUtopia::grid_structure_map
 A map from strings to grid structure enum values.
 
const std::map< std::string, NBModeUtopia::nb_mode_map
 A map from strings to neighborhood enum values.
 

Detailed Description

An interface to build and use cellular automata.

The Utopia::CellManager and associated constructs allow convenient use of discretizations of physical space into rectangular, hexagonal, or triangular grids.

Typedef Documentation

◆ CellTraits

template<typename StateType , Update update_mode, bool use_def_state_constr = false, typename CellTags = EmptyTag, template< class > class CustomLinkContainers = NoCustomLinks>
using Utopia::CellTraits = typedef EntityTraits<StateType, update_mode, use_def_state_constr, CellTags, CustomLinkContainers>

CellTraits are just another name for Utopia::EntityTraits.

◆ NBFuncID

Type of the neighborhood calculating function.

Enumeration Type Documentation

◆ GridStructure

Available grid implementations.

Enumerator
square 

A square lattice grid.

triangular 

A triangular lattice grid.

hexagonal 

A hexagonal lattice grid.

13 {
15 square,
20};
@ hexagonal
A hexagonal lattice grid.
@ square
A square lattice grid.
@ triangular
A triangular lattice grid.

◆ NBMode

Possible neighborhood types; availability depends on choice of grid.

Enumerator
empty 

Every entity is utterly alone in the world.

vonNeumann 

The vonNeumann neighborhood, i.e. only nearest neighbors.

Moore 

The Moore neighborhood, i.e. nearest and next nearest neighbors.

hexagonal 

The hexagonal neighbourhood, i.e. the neighbourhood on a hexagonal grid.

52 {
54 empty = 0,
56 vonNeumann = 1,
58 Moore = 2,
60 hexagonal = 3
61};
@ vonNeumann
The vonNeumann neighborhood, i.e. only nearest neighbors.
@ Moore
The Moore neighborhood, i.e. nearest and next nearest neighbors.
@ empty
Every entity is utterly alone in the world.

Function Documentation

◆ grid_structure_to_string()

std::string Utopia::grid_structure_to_string ( const GridStructure structure)

Given an GridStructure enum value, return the corresponding string key.

This iterates over the grid_structure_map and returns the first key that matches the given enum value.

35 {
36 for (const auto& m : grid_structure_map) {
37 if (m.second == structure) {
38 return m.first;
39 }
40 }
41 // Entry is missing; this should not happen, as the
42 // grid_structure_to_string is meant to include all possible enum values.
43 throw std::invalid_argument(
44 "The given grid structure was not available in the "
45 "grid_structure_map! Are all GridStructure enum values represented "
46 "in the map?"
47 );
48};
const std::map< std::string, GridStructure > grid_structure_map
A map from strings to grid structure enum values.
Definition base.hh:25

◆ nb_mode_to_string()

std::string Utopia::nb_mode_to_string ( const NBMode nb_mode)

Given an NBMode enum value, return the corresponding string key.

This iterates over the nb_mode_map and returns the first key that matches the given enum value.

78 {
79 for (const auto& m : nb_mode_map) {
80 if (m.second == nb_mode) {
81 return m.first;
82 }
83 }
84 // Entry is missing; this should not happen, as the nb_mode_map is meant to
85 // include all possible enum values. Inform about it ...
86 throw std::invalid_argument("The given nb_mode was not available in the "
87 "nb_mode_map! Are all NBMode enum values represented in the map?");
88};
const std::map< std::string, NBMode > nb_mode_map
A map from strings to neighborhood enum values.
Definition base.hh:67

Variable Documentation

◆ grid_structure_map

const std::map<std::string, GridStructure> Utopia::grid_structure_map
Initial value:
{
{"square", GridStructure::square},
{"triangular", GridStructure::triangular},
{"hexagonal", GridStructure::hexagonal}
}

A map from strings to grid structure enum values.

25 {
26 {"square", GridStructure::square},
27 {"triangular", GridStructure::triangular},
28 {"hexagonal", GridStructure::hexagonal}
29};

◆ nb_mode_map

const std::map<std::string, NBMode> Utopia::nb_mode_map
Initial value:
{
{"empty", NBMode::empty},
{"vonNeumann", NBMode::vonNeumann},
{"Moore", NBMode::Moore},
{"hexagonal", NBMode::hexagonal}
}

A map from strings to neighborhood enum values.

67 {
68 {"empty", NBMode::empty},
69 {"vonNeumann", NBMode::vonNeumann},
70 {"Moore", NBMode::Moore},
71 {"hexagonal", NBMode::hexagonal}
72};