Utopia  2
Framework for studying models of complex & adaptive systems.
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
Utopia::CellManager< CellTraits, Model > Class Template Reference

Manages a physical space, its grid discretization, and cells on that grid. More...

#include <cell_manager.hh>

Public Types

using Self = CellManager< CellTraits, Model >
 The type of this CellManager. More...
 
using Cell = Utopia::Cell< CellTraits >
 Type of the managed cells. More...
 
using Entity = Cell
 Alias for entity type; part of the shared interface of entity managers. More...
 
using CellState = typename CellTraits::State
 Type of the cell state. More...
 
using Space = typename Model::Space
 The space type this cell manager maps to. More...
 
using GridType = Grid< Space >
 Grid type; this refers to the base type of the stored (derived) object. More...
 
using SpaceVec = SpaceVecType< dim >
 Type of vectors that represent a physical quantity. More...
 
using MultiIndex = typename GridType::MultiIndex
 Type of multi-index like arrays. More...
 
using RNG = typename Model::RNG
 Random number generator type. More...
 
using Config = typename Model::Config
 Configuration node type. More...
 
using NBFuncCell = std::function< CellContainer< Cell >(const Cell &)>
 Neighborhood function used in public interface (with cell as argument) More...
 
using RuleFunc = typename std::function< CellState(const std::shared_ptr< Cell > &)>
 The type of a rule function acting on cells of this cell manager. More...
 
using VoidRuleFunc = typename std::function< void(const std::shared_ptr< Cell > &)>
 The type of a void rule function acting on cells of this cell manager. More...
 

Public Member Functions

 CellManager (const Model &model, const Config &custom_cfg={})
 Construct a cell manager. More...
 
 CellManager (const Model &model, const CellState initial_state, const Config &custom_cfg={})
 Construct a cell manager explicitly passing an initial cell state. More...
 
const auto & log () const
 
const Configcfg () const
 Return the configuration used for building this cell manager. More...
 
const std::shared_ptr< RNG > & rng () const
 Return a reference to the shared random number generator. More...
 
const std::shared_ptr< Space > & space () const
 Return pointer to the space, for convenience. More...
 
const std::shared_ptr< GridType > & grid () const
 Return const reference to the grid. More...
 
const CellContainer< Cell > & cells () const
 Return const reference to the managed CA cells. More...
 
const CellContainer< Cell > & entities () const
 Return const reference to the entities managed by this manager: cells. More...
 
MultiIndex midx_of (const Cell &cell) const
 Returns the multi-index of the given cell. More...
 
MultiIndex midx_of (const std::shared_ptr< Cell > &cell) const
 Returns the multi-index of the given cell. More...
 
SpaceVec barycenter_of (const Cell &cell) const
 Returns the barycenter of the given cell. More...
 
SpaceVec barycenter_of (const std::shared_ptr< Cell > &cell) const
 Returns the barycenter of the given cell. More...
 
SpaceVec extent_of (const Cell &cell) const
 Returns the physical extent of the given cell. More...
 
SpaceVec extent_of (const std::shared_ptr< Cell > &cell) const
 Returns the physical extent of the given cell. More...
 
std::vector< SpaceVecvertices_of (const Cell &cell) const
 Returns a container of vertices of the given cell. More...
 
std::vector< SpaceVecvertices_of (const std::shared_ptr< Cell > &cell) const
 Returns a container of vertices of the given cell. More...
 
const std::shared_ptr< Cell > & cell_at (const SpaceVec &pos) const
 Return the cell covering the given point in physical space. More...
 
CellContainer< Cellboundary_cells (const std::string &select="all") const
 Retrieve a container of cells that are at a specified boundary. More...
 
template<SelectionMode mode, class... Args>
CellContainer< Cellselect_cells (Args &&... args) const
 Select cells using the Utopia::select_entities interface. More...
 
CellContainer< Cellselect_cells (const Config &sel_cfg) const
 Select entities according to parameters specified in a configuration. More...
 
template<class ElementT = double, class SetterFunc >
void set_cell_states (const std::string &hdf5_file, const std::string &dset_path, const SetterFunc &setter_func)
 Set all cell states using information from a HDF5 file. More...
 
const NBModenb_mode () const
 Return the currently selected neighborhood mode. More...
 
auto nb_size () const
 Return the (maximum) size of the currently selected neighborhood. More...
 
CellContainer< Cellneighbors_of (const Cell &cell) const
 Retrieve the given cell's neighbors. More...
 
CellContainer< Cellneighbors_of (const std::shared_ptr< Cell > &cell) const
 Retrieve the given cell's neighbors. More...
 
void select_neighborhood (const Config &nb_cfg)
 Select the neighborhood and all parameters fully from a config node. More...
 
void select_neighborhood (const std::string &nb_mode, const bool compute_and_store=true, const Config &nb_params={})
 Select the neighborhood mode using a string for the mode argument. More...
 
void select_neighborhood (const NBMode &nb_mode, const bool compute_and_store=true, const Config &nb_params={})
 Set the neighborhood mode. More...
 
void compute_cell_neighbors ()
 Compute (and store) all cells' neighbors. More...
 
template<class IndexContainer >
CellContainer< Cellentity_pointers_from_ids (IndexContainer &&ids) const
 Given a container IDs, convert it to container of entity pointers. More...
 

Public Attributes

bool _empty_nb_warning_emitted = false
 Whether a warning about an empty neighbourhood was already emitted. More...
 

Static Public Attributes

static constexpr DimType dim = Model::Space::dim
 Dimensionality of the space this cell manager is to discretize. More...
 

Private Member Functions

Config setup_cfg (const Model &model, const Config &custom_cfg) const
 Set up the cell manager configuration member. More...
 
std::shared_ptr< GridTypesetup_grid () const
 Set up the grid discretization. More...
 
CellContainer< Cellsetup_cells (const CellState &initial_state) const
 Set up the cells container using an explicitly passed initial state. More...
 
CellContainer< Cellsetup_cells () const
 Set up cells container via config or default constructor. More...
 
void setup_nb_funcs ()
 Setup the neighborhood functions using config entries. More...
 

Private Attributes

const std::shared_ptr< spdlog::logger > _log
 The logger (same as the model this manager resides in) More...
 
const Config _cfg
 Cell manager configuration node. More...
 
const std::shared_ptr< RNG_rng
 The model's random number generator, used e.g. for cell construction. More...
 
const std::shared_ptr< Space_space
 The physical space the cells are to reside in. More...
 
const std::shared_ptr< GridType_grid
 The grid that discretely maps cells into space. More...
 
CellContainer< Cell_cells
 Storage container for cells. More...
 
std::vector< CellContainer< Cell > > _cell_neighbors
 Storage container for pre-calculated (!) cell neighbors. More...
 
NBFuncCell _nb_func
 The currently chosen neighborhood function (working directly on cells) More...
 
NBFuncCell _nb_from_cache
 Return the pre-computed neighbors of the given cell. More...
 
NBFuncCell _nb_compute_each_time
 Compute the neighbors for the given cell using the grid. More...
 
NBFuncCell _nb_compute_each_time_empty
 Compute the neighbors for the given cell using the grid. More...
 

Detailed Description

template<class CellTraits, class Model>
class Utopia::CellManager< CellTraits, Model >

Manages a physical space, its grid discretization, and cells on that grid.

This class implements a common interface for working with cells as a representation of volumes of physical space. A typical use case is the cellular automaton.

To that end, a discretization of space is needed: the grid. This spatial discretization is handled by concrete classes derived from Utopia::Grid. The CellManager communicates with these objects solely via cell indices (which are the indices within the container of cells), making the grid implementation independent of the type of cells used.

Template Parameters
CellTraitsType traits of the cells used
ModelType of the model using this manager

Member Typedef Documentation

◆ Cell

template<class CellTraits , class Model >
using Utopia::CellManager< CellTraits, Model >::Cell = Utopia::Cell<CellTraits>

Type of the managed cells.

◆ CellState

template<class CellTraits , class Model >
using Utopia::CellManager< CellTraits, Model >::CellState = typename CellTraits::State

Type of the cell state.

◆ Config

template<class CellTraits , class Model >
using Utopia::CellManager< CellTraits, Model >::Config = typename Model::Config

Configuration node type.

◆ Entity

template<class CellTraits , class Model >
using Utopia::CellManager< CellTraits, Model >::Entity = Cell

Alias for entity type; part of the shared interface of entity managers.

◆ GridType

template<class CellTraits , class Model >
using Utopia::CellManager< CellTraits, Model >::GridType = Grid<Space>

Grid type; this refers to the base type of the stored (derived) object.

◆ MultiIndex

template<class CellTraits , class Model >
using Utopia::CellManager< CellTraits, Model >::MultiIndex = typename GridType::MultiIndex

Type of multi-index like arrays.

◆ NBFuncCell

template<class CellTraits , class Model >
using Utopia::CellManager< CellTraits, Model >::NBFuncCell = std::function<CellContainer<Cell>(const Cell&)>

Neighborhood function used in public interface (with cell as argument)

◆ RNG

template<class CellTraits , class Model >
using Utopia::CellManager< CellTraits, Model >::RNG = typename Model::RNG

Random number generator type.

◆ RuleFunc

template<class CellTraits , class Model >
using Utopia::CellManager< CellTraits, Model >::RuleFunc = typename std::function<CellState(const std::shared_ptr<Cell>&)>

The type of a rule function acting on cells of this cell manager.

This is a convenience type def that models can use to easily have this type available.

◆ Self

template<class CellTraits , class Model >
using Utopia::CellManager< CellTraits, Model >::Self = CellManager<CellTraits, Model>

The type of this CellManager.

◆ Space

template<class CellTraits , class Model >
using Utopia::CellManager< CellTraits, Model >::Space = typename Model::Space

The space type this cell manager maps to.

◆ SpaceVec

template<class CellTraits , class Model >
using Utopia::CellManager< CellTraits, Model >::SpaceVec = SpaceVecType<dim>

Type of vectors that represent a physical quantity.

◆ VoidRuleFunc

template<class CellTraits , class Model >
using Utopia::CellManager< CellTraits, Model >::VoidRuleFunc = typename std::function<void(const std::shared_ptr<Cell>&)>

The type of a void rule function acting on cells of this cell manager.

This is a convenience type def that models can use to easily have this type available. Void rule functions are only possible for asynchronous updates.

Constructor & Destructor Documentation

◆ CellManager() [1/2]

template<class CellTraits , class Model >
Utopia::CellManager< CellTraits, Model >::CellManager ( const Model model,
const Config custom_cfg = {} 
)
inline

Construct a cell manager.

With the model available, the CellManager can extract the required information from the model without the need to pass it explicitly. Furthermore, this constructor differs to the one with the initial_state parameter such that the way the initial state of the cells is determined can be controlled via the configuration.

Parameters
modelThe model this CellManager belongs to
custom_cfgA custom config node to use to use for grid and cell setup. If not given, the model's configuration is used to extract the required entries.

◆ CellManager() [2/2]

template<class CellTraits , class Model >
Utopia::CellManager< CellTraits, Model >::CellManager ( const Model model,
const CellState  initial_state,
const Config custom_cfg = {} 
)
inline

Construct a cell manager explicitly passing an initial cell state.

Parameters
modelThe model this CellManager belongs to
initial_stateThe initial state of the cells
custom_cfgA custom config node to use to use for grid and cell setup. If not given, the model's configuration is used to extract the required entries.

Member Function Documentation

◆ barycenter_of() [1/2]

template<class CellTraits , class Model >
SpaceVec Utopia::CellManager< CellTraits, Model >::barycenter_of ( const Cell cell) const
inline

Returns the barycenter of the given cell.

◆ barycenter_of() [2/2]

template<class CellTraits , class Model >
SpaceVec Utopia::CellManager< CellTraits, Model >::barycenter_of ( const std::shared_ptr< Cell > &  cell) const
inline

Returns the barycenter of the given cell.

◆ boundary_cells()

template<class CellTraits , class Model >
CellContainer<Cell> Utopia::CellManager< CellTraits, Model >::boundary_cells ( const std::string &  select = "all") const
inline

Retrieve a container of cells that are at a specified boundary.

Lets the grid compute the set of cell IDs at the boundary and then converts them into pointers to cells. As the set is sorted by cell IDs, the returned container is also sorted.

Warning
For a periodic space, an empty container is returned; no error or warning is emitted!
Parameters

◆ cell_at()

template<class CellTraits , class Model >
const std::shared_ptr<Cell>& Utopia::CellManager< CellTraits, Model >::cell_at ( const SpaceVec pos) const
inline

Return the cell covering the given point in physical space.

Cells are interpreted as covering half-open intervals in space, i.e., including their low-value edges and excluding their high-value edges. The special case of points on high-value edges for non-periodic space behaves such that these points are associated with the cells at the boundary.

Note
For non-periodic space, a check is performed whether the given point is inside the physical space associated with the grid. If that is not the case, an error is raised. For periodic space, the given position is mapped back into the physical space, thus always returning a valid cell.

◆ cells()

template<class CellTraits , class Model >
const CellContainer<Cell>& Utopia::CellManager< CellTraits, Model >::cells ( ) const
inline

Return const reference to the managed CA cells.

◆ cfg()

template<class CellTraits , class Model >
const Config& Utopia::CellManager< CellTraits, Model >::cfg ( ) const
inline

Return the configuration used for building this cell manager.

◆ compute_cell_neighbors()

template<class CellTraits , class Model >
void Utopia::CellManager< CellTraits, Model >::compute_cell_neighbors ( )
inline

Compute (and store) all cells' neighbors.

After this function was called, the cell neighbors will be returned from the storage container rather than re-calculated for every access.

◆ entities()

template<class CellTraits , class Model >
const CellContainer<Cell>& Utopia::CellManager< CellTraits, Model >::entities ( ) const
inline

Return const reference to the entities managed by this manager: cells.

◆ entity_pointers_from_ids()

template<class CellTraits , class Model >
template<class IndexContainer >
CellContainer<Cell> Utopia::CellManager< CellTraits, Model >::entity_pointers_from_ids ( IndexContainer &&  ids) const
inline

Given a container IDs, convert it to container of entity pointers.

\TODO This should move into a common manager base class

◆ extent_of() [1/2]

template<class CellTraits , class Model >
SpaceVec Utopia::CellManager< CellTraits, Model >::extent_of ( const Cell cell) const
inline

Returns the physical extent of the given cell.

◆ extent_of() [2/2]

template<class CellTraits , class Model >
SpaceVec Utopia::CellManager< CellTraits, Model >::extent_of ( const std::shared_ptr< Cell > &  cell) const
inline

Returns the physical extent of the given cell.

◆ grid()

template<class CellTraits , class Model >
const std::shared_ptr<GridType>& Utopia::CellManager< CellTraits, Model >::grid ( ) const
inline

Return const reference to the grid.

◆ log()

template<class CellTraits , class Model >
const auto& Utopia::CellManager< CellTraits, Model >::log ( ) const
inline

– Getters ---------------------------------------------------------— Return the CellManager logger

◆ midx_of() [1/2]

template<class CellTraits , class Model >
MultiIndex Utopia::CellManager< CellTraits, Model >::midx_of ( const Cell cell) const
inline

Returns the multi-index of the given cell.

Note
Consult the documentation of the selected grid discretization to learn about the interpretation of the returned values.

◆ midx_of() [2/2]

template<class CellTraits , class Model >
MultiIndex Utopia::CellManager< CellTraits, Model >::midx_of ( const std::shared_ptr< Cell > &  cell) const
inline

Returns the multi-index of the given cell.

Note
Consult the documentation of the selected grid discretization to learn about the interpretation of the returned values.

◆ nb_mode()

template<class CellTraits , class Model >
const NBMode& Utopia::CellManager< CellTraits, Model >::nb_mode ( ) const
inline

Return the currently selected neighborhood mode.

Note
This is a shortcut that accesses the value set in the grid.

◆ nb_size()

template<class CellTraits , class Model >
auto Utopia::CellManager< CellTraits, Model >::nb_size ( ) const
inline

Return the (maximum) size of the currently selected neighborhood.

Note
This is a shortcut that accesses the value computed in the grid.

◆ neighbors_of() [1/2]

template<class CellTraits , class Model >
CellContainer<Cell> Utopia::CellManager< CellTraits, Model >::neighbors_of ( const Cell cell) const
inline

Retrieve the given cell's neighbors.

The behaviour of this method is different depending on the choice of neighborhood.

◆ neighbors_of() [2/2]

template<class CellTraits , class Model >
CellContainer<Cell> Utopia::CellManager< CellTraits, Model >::neighbors_of ( const std::shared_ptr< Cell > &  cell) const
inline

Retrieve the given cell's neighbors.

The behaviour of this method is different depending on the choice of neighborhood.

◆ rng()

template<class CellTraits , class Model >
const std::shared_ptr<RNG>& Utopia::CellManager< CellTraits, Model >::rng ( ) const
inline

Return a reference to the shared random number generator.

◆ select_cells() [1/2]

template<class CellTraits , class Model >
template<SelectionMode mode, class... Args>
CellContainer<Cell> Utopia::CellManager< CellTraits, Model >::select_cells ( Args &&...  args) const
inline

Select cells using the Utopia::select_entities interface.

Returns a container of cells that were selected according to a certain selection mode. This is done via the Utopia::select_entities interface.

Template Parameters
modeThe selection mode

\args args Forwarded to Utopia::select_entities

◆ select_cells() [2/2]

template<class CellTraits , class Model >
CellContainer<Cell> Utopia::CellManager< CellTraits, Model >::select_cells ( const Config sel_cfg) const
inline

Select entities according to parameters specified in a configuration.

Via the mode key, one of the selection modes can be chosen; for available oens, see Utopia::SelectionMode.

Depending on that mode, the other parameters are extracted from the configuration. See Utopia::select_entities for more info.

Parameters
sel_cfgThe configuration node containing the expected key-value pairs specifying the selection.

◆ select_neighborhood() [1/3]

template<class CellTraits , class Model >
void Utopia::CellManager< CellTraits, Model >::select_neighborhood ( const Config nb_cfg)
inline

Select the neighborhood and all parameters fully from a config node.

If this method is used to set up the neighborhood, the following keys will be read and parsed:

- ``mode`` (required): the neighborhood mode
- ``compute_and_store`` (optional, default: ``true``): whether to
  directly compute all neighbors and henceforth use the buffer to
  get these neighbors.

Subsequently, these values are passed to the appropriate overload of the select_neighborhood function.

Parameters
nb_cfgThe neighborhood configuration node. Apart from the keys that are parsed here, the full config node is passed along further.

◆ select_neighborhood() [2/3]

template<class CellTraits , class Model >
void Utopia::CellManager< CellTraits, Model >::select_neighborhood ( const NBMode nb_mode,
const bool  compute_and_store = true,
const Config nb_params = {} 
)
inline

Set the neighborhood mode.

Parameters
nb_modeThe name of the neighborhood to select
compute_and_storeWhether to directly compute all neighbors and henceforth use the buffer to get these neighbors. Default: true.
nb_paramsPassed on to the Grid::select_neighborhood method, carrying additional parameters.

◆ select_neighborhood() [3/3]

template<class CellTraits , class Model >
void Utopia::CellManager< CellTraits, Model >::select_neighborhood ( const std::string &  nb_mode,
const bool  compute_and_store = true,
const Config nb_params = {} 
)
inline

Select the neighborhood mode using a string for the mode argument.

Resolves a string-type nb_mode to NBmode, then invokes the appropriate overload.

Parameters
nb_modeThe name of the neighborhood to select
compute_and_storeWhether to directly compute all neighbors and henceforth use the buffer to get these neighbors. Default: true.
nb_paramsPassed on to the Grid::select_neighborhood method, carrying additional parameters.

◆ set_cell_states()

template<class CellTraits , class Model >
template<class ElementT = double, class SetterFunc >
void Utopia::CellManager< CellTraits, Model >::set_cell_states ( const std::string &  hdf5_file,
const std::string &  dset_path,
const SetterFunc &  setter_func 
)
inline

Set all cell states using information from a HDF5 file.

Using armadillo functionality, this loads the data from the given HDF5 file into an array of ElementT. It then iterates over all cells, looks up the multi index, and passes it to the setter_func, which has the responsibility of setting the cell state accordingly.

The setter_func should accept as first argument a reference to the cell (more accurately: const std::shared_ptr<Cell>&) and as second argument the value from the loaded dataset.

Note
Currently only supports 2D grids and cells with Update::manual.
Template Parameters
ElemenTThe type that armadillo should load the data as. Need be supported by armadillo.
SetterFuncType of the setter function, e.g. std::function<…>
Parameters
hdf5_fileThe hdf5 file to load the data from. Can be an absolute path or relative to the working directory.
dset_pathThe path within the HDF5 file that points to the dataset to load data from.
setter_funcThe void(cell, value) function that sets the cell state given the value from the loaded dataset corresponding to the cells' multi-index.

◆ setup_cells() [1/2]

template<class CellTraits , class Model >
CellContainer<Cell> Utopia::CellManager< CellTraits, Model >::setup_cells ( ) const
inlineprivate

Set up cells container via config or default constructor.

If no explicit initial state is given, this setup function is called. There are three modes: If the CellTraits are set such that the default constructor of the cell state is to be used, that constructor is required and is called for each cell.

Otherwise, the CellState needs to be constructible via a const Config& argument, which gets passed the config entry cell_params from the CellManager's configuration. If a constructor with the signature (const Config&, const std::shared_ptr<RNG>&) is supported, that constructor is called instead.

Note
If the constructor for the cell state has an RNG available it is called anew for each cell; otherwise, an initial state is constructed once and used for all cells.

◆ setup_cells() [2/2]

template<class CellTraits , class Model >
CellContainer<Cell> Utopia::CellManager< CellTraits, Model >::setup_cells ( const CellState initial_state) const
inlineprivate

Set up the cells container using an explicitly passed initial state.

◆ setup_cfg()

template<class CellTraits , class Model >
Config Utopia::CellManager< CellTraits, Model >::setup_cfg ( const Model model,
const Config custom_cfg 
) const
inlineprivate

Set up the cell manager configuration member.

This function determines whether to use a custom configuration or the one provided by the model this CellManager belongs to

◆ setup_grid()

template<class CellTraits , class Model >
std::shared_ptr<GridType> Utopia::CellManager< CellTraits, Model >::setup_grid ( ) const
inlineprivate

Set up the grid discretization.

◆ setup_nb_funcs()

template<class CellTraits , class Model >
void Utopia::CellManager< CellTraits, Model >::setup_nb_funcs ( )
inlineprivate

Setup the neighborhood functions using config entries.

◆ space()

template<class CellTraits , class Model >
const std::shared_ptr<Space>& Utopia::CellManager< CellTraits, Model >::space ( ) const
inline

Return pointer to the space, for convenience.

◆ vertices_of() [1/2]

template<class CellTraits , class Model >
std::vector<SpaceVec> Utopia::CellManager< CellTraits, Model >::vertices_of ( const Cell cell) const
inline

Returns a container of vertices of the given cell.

The vertices are the absolute coordinates that define the cell. For example, a 2D square cell is the surface of a polygon defined by four points.

Note
Consult the documentation of the selected grid discretization to learn about the order of the returned values.

◆ vertices_of() [2/2]

template<class CellTraits , class Model >
std::vector<SpaceVec> Utopia::CellManager< CellTraits, Model >::vertices_of ( const std::shared_ptr< Cell > &  cell) const
inline

Returns a container of vertices of the given cell.

Note
Consult the documentation of the selected grid discretization to learn about the order of the returned values.

Member Data Documentation

◆ _cell_neighbors

template<class CellTraits , class Model >
std::vector<CellContainer<Cell> > Utopia::CellManager< CellTraits, Model >::_cell_neighbors
private

Storage container for pre-calculated (!) cell neighbors.

◆ _cells

template<class CellTraits , class Model >
CellContainer<Cell> Utopia::CellManager< CellTraits, Model >::_cells
private

Storage container for cells.

◆ _cfg

template<class CellTraits , class Model >
const Config Utopia::CellManager< CellTraits, Model >::_cfg
private

Cell manager configuration node.

◆ _empty_nb_warning_emitted

template<class CellTraits , class Model >
bool Utopia::CellManager< CellTraits, Model >::_empty_nb_warning_emitted = false

Whether a warning about an empty neighbourhood was already emitted.

This is to prevent a gigantic amount of warnings being logged

◆ _grid

template<class CellTraits , class Model >
const std::shared_ptr<GridType> Utopia::CellManager< CellTraits, Model >::_grid
private

The grid that discretely maps cells into space.

◆ _log

template<class CellTraits , class Model >
const std::shared_ptr<spdlog::logger> Utopia::CellManager< CellTraits, Model >::_log
private

The logger (same as the model this manager resides in)

◆ _nb_compute_each_time

template<class CellTraits , class Model >
NBFuncCell Utopia::CellManager< CellTraits, Model >::_nb_compute_each_time
private
Initial value:
= [this](const Cell& cell) {
return
this->_grid->neighbors_of(cell.id()));
}
CellContainer< Cell > entity_pointers_from_ids(IndexContainer &&ids) const
Given a container IDs, convert it to container of entity pointers.
Definition: cell_manager.hh:607
Utopia::Cell< CellTraits > Cell
Type of the managed cells.
Definition: cell_manager.hh:47
const std::shared_ptr< GridType > _grid
The grid that discretely maps cells into space.
Definition: cell_manager.hh:110

Compute the neighbors for the given cell using the grid.

◆ _nb_compute_each_time_empty

template<class CellTraits , class Model >
NBFuncCell Utopia::CellManager< CellTraits, Model >::_nb_compute_each_time_empty
private
Initial value:
= [this](const Cell& cell) {
if (not this->_empty_nb_warning_emitted) {
this->_log->warn("No neighborhood selected! Calls to the "
"CellManager::neighbors_of method will always return an empty "
"container. There will be no further warning.");
this->_empty_nb_warning_emitted = true;
}
return
this->_grid->neighbors_of(cell.id()));
}
const std::shared_ptr< spdlog::logger > _log
The logger (same as the model this manager resides in)
Definition: cell_manager.hh:98
bool _empty_nb_warning_emitted
Whether a warning about an empty neighbourhood was already emitted.
Definition: cell_manager.hh:125

Compute the neighbors for the given cell using the grid.

◆ _nb_from_cache

template<class CellTraits , class Model >
NBFuncCell Utopia::CellManager< CellTraits, Model >::_nb_from_cache
private
Initial value:
= [this](const Cell& cell) {
return this->_cell_neighbors[cell.id()];
}
std::vector< CellContainer< Cell > > _cell_neighbors
Storage container for pre-calculated (!) cell neighbors.
Definition: cell_manager.hh:116

Return the pre-computed neighbors of the given cell.

◆ _nb_func

template<class CellTraits , class Model >
NBFuncCell Utopia::CellManager< CellTraits, Model >::_nb_func
private

The currently chosen neighborhood function (working directly on cells)

◆ _rng

template<class CellTraits , class Model >
const std::shared_ptr<RNG> Utopia::CellManager< CellTraits, Model >::_rng
private

The model's random number generator, used e.g. for cell construction.

◆ _space

template<class CellTraits , class Model >
const std::shared_ptr<Space> Utopia::CellManager< CellTraits, Model >::_space
private

The physical space the cells are to reside in.

◆ dim

template<class CellTraits , class Model >
constexpr DimType Utopia::CellManager< CellTraits, Model >::dim = Model::Space::dim
staticconstexpr

Dimensionality of the space this cell manager is to discretize.


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