The Space bundles properties about the physical space a model resides in.
More...
#include <space.hh>
|
static constexpr std::size_t | dim = num_dims |
| The dimensionality of the space. More...
|
|
template<std::size_t num_dims>
struct Utopia::Space< num_dims >
The Space bundles properties about the physical space a model resides in.
It is, for example, used by the CellManager and its Grid discretization and by the AgentManager to properly map agent positions and movements within the spatial domain.
- Template Parameters
-
num_dims | The dimensionality of the space |
◆ SpaceVec
template<std::size_t num_dims>
The type for vectors relating to physical space.
◆ Space() [1/2]
template<std::size_t num_dims>
Construct a Space using information from a config node.
- Parameters
-
cfg | The config node to read the periodic and extent entries from. |
◆ Space() [2/2]
template<std::size_t num_dims>
Default constructor i.e. constructing a space with default parameters.
The default space is non-periodic and has default extent of 1. into each dimension.
◆ contains()
template<std::size_t num_dims>
template<bool include_high_value_boundary = true>
Whether this space contains the given coordinate (without mapping it)
Checks whether the given coordinate is within this space's extent by computing the relative position and checking whether it is within [0, 1] or [0, 1) for all elements.
- Note
- No distinction is made between periodic and non-periodic space.
- Template Parameters
-
include_high_value_boundary | Whether to check the closed or the half-open interval. The latter case is useful when working with periodic grids, allowing to map values on the high-value boundary back to the low-value boundary. |
◆ displacement()
template<std::size_t num_dims>
Compute the displacement vector between two coordinates.
Calculates vector pointing from pos_0 to pos_1. In periodic space, it calculates the shorter displacement.
- Warning
- The displacement of two coordinates in periodic boundary can be maximum of half the domain size, i.e. moving away from a coordinate in a certain direction will decrease the displacement once reached half the domain size.
◆ distance()
template<std::size_t num_dims>
template<class NormType = std::size_t>
The distance of two coordinates in space.
Calculates the distance of two coordinates using the norm implemented within Armadillo. In periodic boundary it calculates the shorter distance.
- Warning
- The distance of two coordinates in periodic boundary can be maximum of half the domain size wrt every dimension, i.e. moving away from a coordinate in a certain direction will decrease the distance once reached half the domain size.
- Parameters
-
p | The norm used to compute the distance, see arma::norm. Can be either an integer >= 1 or one of: "-inf", "inf", "fro" |
◆ map_into_space()
template<std::size_t num_dims>
Map a position (potentially outside space's extent) back into space.
This is intended for use with periodic space. It will also work with non-periodic space, but the input value should not have been permitted in the first place.
- Note
- The high-value boundary is is mapped back to the low-value boundary, such that all points are well-defined.
◆ setup_extent() [1/2]
template<std::size_t num_dims>
Construct a default space extent vector (valued 1 in each dimension)
◆ setup_extent() [2/2]
template<std::size_t num_dims>
Construct a space extent vector from a config node.
- Parameters
-
cfg | The config node to read the extent parameter from. If that entry is missing, the default extent (1) is used. If the entry is a scalar, space will be set up to have equal extent in all dimensions. Otherwise, it is expected to be a sequence node. |
◆ setup_periodic()
template<std::size_t num_dims>
Setup the member periodic
from a config node.
◆ dim
template<std::size_t num_dims>
The dimensionality of the space.
◆ extent
template<std::size_t num_dims>
The physical (euclidean) extent of the space.
◆ periodic
template<std::size_t num_dims>
Whether the space is to be assumed periodic.
The documentation for this struct was generated from the following file: