Defines a D-dimensional stencil info with Q directions.
A stencil is defined by picking a subset of all possible directions. These directions are listed in the dir array. So when iterating a stencil, one iterates the dir array which contains the directions. To get the properties for these directions, the global arrays of Directions.h can be used:
{
}
Definition AABBQuadrant.h:29
constexpr std::array< int, NR_OF_DIRECTIONS > cx
The x component for each direction.
Definition Directions.h:110
Direction
Definition Directions.h:39
constexpr std::array< Direction, NR_OF_DIRECTIONS > inverseDir
Inverse directions.
Definition Directions.h:216
std::size_t uint_t
Definition DataTypes.h:161
static constexpr std::array< Direction, $Q > dir
Set of directions.
Definition Stencil.in.h:68
static constexpr uint_t Size
Definition Stencil.in.h:60
Since all these arrays are constant, the lookup can be resolved at compile time and no performance overhead should be generated.
For more convenient iteration, use the provided iterator. The following code is equivalent to the code example above:
{
}
static constexpr iterator end()
Definition Stencil.in.h:147
static constexpr iterator begin()
Definition Stencil.in.h:145
|
| static constexpr std::string_view | NAME = "$name" |
| static constexpr uint_t | D = $D |
| static constexpr uint_t | Q = $Q |
| static constexpr uint_t | POS_Q = $Q / 2 |
| static constexpr uint_t | Dimension = $D |
| static constexpr uint_t | Size = $Q |
| static constexpr bool | containsCenter = $containsCenter |
| static constexpr uint_t | noCenterFirstIdx = $noCenterFirstIndex |
| static constexpr std::array< Direction, $Q > | dir = { $dirs } |
| | Set of directions.
|
| static constexpr std::array< Direction, POS_Q > | dir_pos = { $dir_pos } |
| | Contains only half of the directions ( the positive ones ).
|
| static constexpr std::array< uint_t, NR_OF_DIRECTIONS > | idx = { $indexFromDir } |
| | Maps direction enums, to an index.
|
| static constexpr std::array< std::array< Direction, $Q/2 >, NR_OF_DIRECTIONS > | d_per_d { { $d_per_d } } |
| | Maps a direction to a set of sub-directions.
|
| static constexpr std::array< uint_t, NR_OF_DIRECTIONS > | d_per_d_length { $d_per_d_length } |
| | Length of the d_per_d array For usage see documentation of d_per_d.
|
| static constexpr size_t | subdirsLength { $subdirs_length } |
| static constexpr std::array< Direction, $subdirs_length > | subdirs { $subdirs } |
| static constexpr std::array< size_t, NR_OF_DIRECTIONS+1 > | subdirsPtr { $subdirsPtr } |
| static constexpr std::array< std::array< Direction, NR_OF_DIRECTIONS >, NR_OF_DIRECTIONS > | dir_neighbors { { $dir_neighbors } } |
| | Views directions as cells in a 3x3x3 grid.
|
| static constexpr std::array< uint_t, NR_OF_DIRECTIONS > | dir_neighbors_length { $dir_neighbors_length } |
| | Length of the dir_neighbors array For usage see documentation of dir_neighbors.
|
| static constexpr bool | containsDir (Direction d) |
| static constexpr uint_t | invDirIdx (Direction d) |
Views directions as cells in a 3x3x3 grid.
Describes neighborhood between cells/directions.
Basis a 3x3x3 grid where every cell corresponds to a direction. The following array provides answer to the question: What are the neighboring cells of a given cell using the current stencil. If a neighbor is not in this 3x3x3 grid it can not be described by a direction and is not returned. Therefore N , for example, has more neighbors that NW. By definition, the neighbors of C are identical to the dir[] array without C itself.
Maps direction enums, to an index.
Use this when working with fields: The direction enum cannot be used as field index directly. Consider having a D2Q4 stencil, then the fourth field index f ranges from 0 to 3, but the direction enums are S=1,N=2,E=3,W=4 start at 1. So a stencil class is needed to map back from direction to field index