template<typename Dummy = int>
struct walberla::stencil::internal::$name< Dummy >
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:
using namespace stencil;
{
}
const std::array< Direction, NR_OF_DIRECTIONS > inverseDir
Inverse directions.
Definition Directions.h:214
Direction
Definition Directions.h:37
const std::array< int, NR_OF_DIRECTIONS > cx
The x component for each direction.
Definition Directions.h:108
std::size_t uint_t
Definition DataTypes.h:133
static const std::array< Direction, $Q > dir
Subset of directions. Defines the stencil.
Definition Stencil.in.h:65
static const 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:
using namespace stencil;
{
}
static iterator begin()
Definition Stencil.in.h:86
static iterator end()
Definition Stencil.in.h:88
|
static const char * | NAME = "$name" |
|
static const uint_t | D = $D |
|
static const uint_t | Q = $Q |
|
static const uint_t | POS_Q = $Q / 2 |
|
static const uint_t | Dimension = $D |
|
static const uint_t | Size = $Q |
|
static const bool | containsCenter = $containsCenter |
|
static const uint_t | noCenterFirstIdx = $noCenterFirstIndex |
|
static const std::array< Direction, $Q > | dir { $dirs } |
| Subset of directions. Defines the stencil.
|
|
static const std::array< Direction, POS_Q > | dir_pos { $dir_pos } |
| Contains only half of the directions ( the positive ones )
|
|
static const std::array< uint_t, NR_OF_DIRECTIONS > | idx { $indexFromDir } |
| Maps direction enums, to an index.
|
|
static const 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 const 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 const std::array< std::array< Direction, NR_OF_DIRECTIONS >, NR_OF_DIRECTIONS > | dir_neighbors { { $dir_neighbors } } |
| Views directions as cells in a 3x3x3 grid.
|
|
static const 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 bool | containsDir (Direction d) |
|
static uint_t | invDirIdx (Direction d) |
|
template<typename Dummy >
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.
template<typename Dummy >
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