Template Struct GhostIndex¶
Defined in File ghost_index.hpp
Struct Documentation¶
-
template<size_t
Dimensions
>
structripple
::
GhostIndex
¶ Forward declaration of the GhostIndex struct which stores the index of a ghost cell in a number of dimensions.
Implementation of the GhostIndex struct to store the index of a ghost cell in a number of dimensions.
For any dimension, the index of a ghost cell is the number of cells from which it needs to be offset in the given dimension to reach the first non ghost cell in the dimension. For example, in 2 dimensions, on the following 2 x 2 domain, with 2 padding (ghost) cells, the ghost cell indices would be:
- Template Parameters
Dimensions
: The number of dimensions for the ghost indices.MaxPadding
: The max padding value.
--------------------------------------------------------- | (2,2) | (1,2) | (0,2) | (0,2) | (-1,2) | (-2,2) | --------------------------------------------------------- | (2,1) | (1,1) | (0,1) | (0,1) | (-1,1) | (-2,1) | --------------------------------------------------------- | (2,0) | (1,0) | x | x | (-1,0) | (-2,0) | --------------------------------------------------------- | (2,0) | (1,0) | x | x | (-1,0) | (-2,0) | --------------------------------------------------------- | (2,-1) | (1,-1) | (0,-1) | (0,-1) | (-1,-1) | (-2,-1) | --------------------------------------------------------- | (2,-2) | (1,-2) | (0,-2) | (0,-2) | (-1,-2) | (-2,-2) | ---------------------------------------------------------
- Template Parameters
Dimensions
: The number of dimensions for the ghost indices.
Public Types
-
using
Value
= int8_t¶ Defines the type used for the indices.
Public Functions
-
template<typename
Iterator
>
constexpr autoinit_as_global
(Iterator &&it) noexcept -> bool¶ Initialises the indices from the iterator for the global domain, returning true if one of the indices for a dimension is valid, and hence that the index structure is valid (i.e that it defines a valid index for a ghost cell).
- Return
true if one of the indicies for a dimension is valid.
- Parameters
it
: The iterator to use to set the ghost cell.Iterator
: The type of the iterator.
-
template<typename
Iterator
, typenameSpace
>
constexpr autoinit_as_block
(Iterator &&it, Space &&space) noexcept -> bool¶ Initialises the indices from the iterator for the block level domain, returning true if one of the indices for a dimension is valid, and hence that the index structure is valid (i.e that it defines a valid index for a ghost cell).
- Return
true if one of the indicies for a dimension is valid.
- Parameters
it
: The iterator to use to set the ghost cell.space
: The space which defines the size of the block.Iterator
: The type of the iterator
-
constexpr auto
dimensions
() const noexcept -> size_t¶ Gets the number of dimensions for the ghost indices.
- Return
The number of dimensions of ghost indices.
-
template<typename
Dim
>
constexpr autoindex
(Dim &&dim) const noexcept -> Value¶ Gets the value of the index in the dim dimension.
- Return
The index in the dimension dim.
- Parameters
dim
: The dimension to get the index for.
- Template Parameters
Dim
: The type of the dimension specifier.
-
template<typename
Dim
>
constexpr autoindex
(Dim &&dim) noexcept -> Value&¶ Gets a reference to the value of the index in the dim dimension.
- Return
An reference to the index for dimension dim.
- Parameters
dim
: The dimension to get the index for.
- Template Parameters
Dim
: The type of the dimension specifier.
-
template<typename
Dim
>
constexpr autoabs_index
(Dim &&dim) const noexcept -> Value¶ Gets the absolute value of the index in the dim dimension.
- Return
The abs value of the index in dimension dim.
- Parameters
dim
: The dimension to get the index for.
- Template Parameters
Dim
: The type of the dimension specifier.
-
template<typename
Dim
>
constexpr autois_front
(Dim &&dim) const noexcept -> bool¶ Determines if an index is at the from of the domain for dimension dim.
- Return
true if the index is at the front of the dimension.
- Parameters
dim
: The dimension to determine if is a front index.
- Template Parameters
Dim
: The type of the dimension specifier.
-
template<typename
Dim
>
constexpr autois_back
(Dim &&dim) const noexcept -> bool¶ Determines if the index is at the back of the domain for dimension dim.
- Return
true if the index is at the back of the dimension.
- Parameters
dim
: The dimension to determine if is a front index.
- Template Parameters
Dim
: The type of the dimension specifier.
-
template<typename
Dim
>
constexpr autois_void
(Dim &&dim) const noexcept -> bool¶ Determines if the index is void it is neither a front nor back index.
- Return
true if the index is neither front nor back.
- Parameters
dim
: The dimension to set as void.
- Template Parameters
Dim
: The type of the dimension specifier.