waLBerla 7.3
Loading...
Searching...
No Matches
walberla::stencil Namespace Reference

Classes

class  Iterator
 Iterator over all directions contained in a stencil. More...
struct  $name
 Defines a D-dimensional stencil info with Q directions. More...

Enumerations

enum  Direction {
  C = 0 , N = 1 , S = 2 , W = 3 ,
  E = 4 , T = 5 , B = 6 , NW = 7 ,
  NE = 8 , SW = 9 , SE = 10 , TN = 11 ,
  TS = 12 , TW = 13 , TE = 14 , BN = 15 ,
  BS = 16 , BW = 17 , BE = 18 , TNE = 19 ,
  TNW = 20 , TSE = 21 , TSW = 22 , BNE = 23 ,
  BNW = 24 , BSE = 25 , BSW = 26 , INVALID_DIR = 27
}
enum  BinaryDirection {
  Bin_C = 1<<0 , Bin_N = 1<<1 , Bin_S = 1<<2 , Bin_W = 1<<3 ,
  Bin_E = 1<<4 , Bin_T = 1<<5 , Bin_B = 1<<6 , Bin_NW = 1<<7 ,
  Bin_NE = 1<<8 , Bin_SW = 1<<9 , Bin_SE = 1<<10 , Bin_TN = 1<<11 ,
  Bin_TS = 1<<12 , Bin_TW = 1<<13 , Bin_TE = 1<<14 , Bin_BN = 1<<15 ,
  Bin_BS = 1<<16 , Bin_BW = 1<<17 , Bin_BE = 1<<18 , Bin_TNE = 1<<19 ,
  Bin_TNW = 1<<20 , Bin_TSE = 1<<21 , Bin_TSW = 1<<22 , Bin_BNE = 1<<23 ,
  Bin_BNW = 1<<24 , Bin_BSE = 1<<25 , Bin_BSW = 1<<26
}

Functions

template<typename U>
Direction getQuadrant (const math::GenericAABB< U > &aabb, const typename math::GenericAABB< U >::vector_type &p)
 Determine sin which neighboring section of an AABB a point lies.
Direction vectorToDirection (cell_idx_t x, cell_idx_t y, cell_idx_t z)
 Maps a (x,y,z) direction vector to its direction.
Direction vectorToDirection (Vector3< cell_idx_t > vec)
constexpr bool isFaceDirection (Direction dir)
constexpr bool isEdgeDirection (Direction dir)
constexpr bool isCornerDirection (Direction dir)
Direction directionFromAxis (int axis, bool minOrMax)
 Maps (direction,axis) pair to direction.
Direction directionFromAxis (uint_t axis, bool minOrMax)
 Maps (direction,axis) pair to direction.
Cell operator+ (const Cell &cell, const Direction d)
 Computes neighbor from cell in direction d.
Cell operator- (const Cell &cell, const Direction d)
 Computes neighbor from cell in direction inverseDir[d].
Celloperator+= (Cell &cell, const Direction d)
 Shifts cell to its neighbor in direction d.
Celloperator-= (Cell &cell, const Direction d)
 Shifts cell to its neighbor in direction inverseDir[d].

Variables

constexpr uint_t NR_OF_DIRECTIONS = 27
constexpr std::array< int, NR_OF_DIRECTIONScx
 The x component for each direction.
constexpr std::array< int, NR_OF_DIRECTIONScy
 The y component for each direction.
constexpr std::array< int, NR_OF_DIRECTIONScz
 The z component for each direction.
constexpr std::array< std::array< int, NR_OF_DIRECTIONS >, 3 > c
 The x,y,z component for each direction.
constexpr std::array< std::array< real_t, NR_OF_DIRECTIONS >, 3 > cNorm
 The x,y,z component for each normalized direction.
constexpr std::array< std::string_view, NR_OF_DIRECTIONSdirToString
 String representation for each direction.
constexpr std::array< BinaryDirection, NR_OF_DIRECTIONSdirToBinary
 Binary encoded direction for each direction.
constexpr std::array< Direction, NR_OF_DIRECTIONSinverseDir
 Inverse directions.
constexpr std::array< real_t, NR_OF_DIRECTIONSdirLength
 Length for each direction.
constexpr std::array< real_t, NR_OF_DIRECTIONSgaussianWeights
constexpr std::array< uint_t, NR_OF_DIRECTIONSgaussianMultipliers
constexpr std::array< Direction, NR_OF_DIRECTIONSmirrorX
 The mirrored directions (flip W-E).
constexpr std::array< Direction, NR_OF_DIRECTIONSmirrorY
 The mirrored directions (flip N-S).
constexpr std::array< Direction, NR_OF_DIRECTIONSmirrorZ
 The mirrored directions (flip T-B).
constexpr std::array< std::array< Direction, NR_OF_DIRECTIONS >, 3 > map2Dto3D
 Maps from 2D directions (C, N, S, W, E, NW, NE, SW, SE) to 3D directions, by slicing through x,y or z coordinate The first array index represents the slice dimension ( 0 for x, 1 for y, 2 for z) Example: printing a slice through x coordinate (keeping x fixed) of a D3Q19 field:

Enumeration Type Documentation

◆ BinaryDirection

Enumerator
Bin_C 

Center.

Bin_N 

North.

Bin_S 

South.

Bin_W 

West.

Bin_E 

East.

Bin_T 

Top.

Bin_B 

Bottom.

Bin_NW 

North-West.

Bin_NE 

North-East.

Bin_SW 

South-West.

Bin_SE 

South-East.

Bin_TN 

Top-North.

Bin_TS 

Top-South.

Bin_TW 

Top-West.

Bin_TE 

Top-East.

Bin_BN 

Bottom-North.

Bin_BS 

Bottom-South.

Bin_BW 

Bottom-West.

Bin_BE 

Bottom-East.

Bin_TNE 

Top-North-East.

Bin_TNW 

Top-North-West.

Bin_TSE 

Top-South-East.

Bin_TSW 

Top-South-West.

Bin_BNE 

Bottom-North-East.

Bin_BNW 

Bottom-North-West.

Bin_BSE 

Bottom-South-East.

Bin_BSW 

Bottom-South-West.

◆ Direction

Enumerator

Center.

North.

South.

West.

East.

Top.

Bottom.

NW 

North-West.

NE 

North-East.

SW 

South-West.

SE 

South-East.

TN 

Top-North.

TS 

Top-South.

TW 

Top-West.

TE 

Top-East.

BN 

Bottom-North.

BS 

Bottom-South.

BW 

Bottom-West.

BE 

Bottom-East.

TNE 

Top-North-East.

TNW 

Top-North-West.

TSE 

Top-South-East.

TSW 

Top-South-West.

BNE 

Bottom-North-East.

BNW 

Bottom-North-West.

BSE 

Bottom-South-East.

BSW 

Bottom-South-West.

INVALID_DIR 

Invalid direction.

Function Documentation

◆ directionFromAxis() [1/2]

Direction walberla::stencil::directionFromAxis ( int axis,
bool minOrMax )
inline

Maps (direction,axis) pair to direction.

Parameters
axis0,1 or 2 standing for x,y,z
minOrMaxif true, the direction pointing in the negative axis direction is returned, if false, the positive axis direction

◆ directionFromAxis() [2/2]

Direction walberla::stencil::directionFromAxis ( uint_t axis,
bool minOrMax )
inline

Maps (direction,axis) pair to direction.

Parameters
axis0,1 or 2 standing for x,y,z
minOrMaxif true, the direction pointing in the negative axis direction is returned, if false, the positive axis direction

◆ getQuadrant()

template<typename U>
Direction walberla::stencil::getQuadrant ( const math::GenericAABB< U > & aabb,
const typename math::GenericAABB< U >::vector_type & p )

Determine sin which neighboring section of an AABB a point lies.

If p lies within aabb returns C. Other it is determined in which of the 26 imaginary neighboring AABBs p is located. The direction of the from aabb to the determined neighboring aabb is returned

2D Example:

----------------------— Let aabb be the AABB marked with asterisks. The boxes surrounding aabb are the eight (in 2D) imaginary | | | | neighboring boxes. Let p be marked with x. The result of the function would be NE. | | | x |
| | | | -----—*********-----— | * * | | * * | | * * | -----—*********-----—


Template Parameters
TThe scalar data type used for the AABB and the tested point
Parameters
aabbThe AABB
pThe tested point

◆ isCornerDirection()

bool walberla::stencil::isCornerDirection ( Direction dir)
inlineconstexpr

◆ isEdgeDirection()

bool walberla::stencil::isEdgeDirection ( Direction dir)
inlineconstexpr

◆ isFaceDirection()

bool walberla::stencil::isFaceDirection ( Direction dir)
inlineconstexpr

◆ operator+()

Cell walberla::stencil::operator+ ( const Cell & cell,
const Direction d )
inline

Computes neighbor from cell in direction d.

Parameters
cellorigin cell
ddirection pointing towards the computed neighbor

◆ operator+=()

Cell & walberla::stencil::operator+= ( Cell & cell,
const Direction d )
inline

Shifts cell to its neighbor in direction d.

Parameters
cellshifted cell
ddirection in which to shift the cell

◆ operator-()

Cell walberla::stencil::operator- ( const Cell & cell,
const Direction d )
inline

Computes neighbor from cell in direction inverseDir[d].

Parameters
cellorigin cell
ddirection pointing away from the computed neighbor

◆ operator-=()

Cell & walberla::stencil::operator-= ( Cell & cell,
const Direction d )
inline

Shifts cell to its neighbor in direction inverseDir[d].

Parameters
cellshifted cell
ddirection opposite to which the cell gets shifted

◆ vectorToDirection() [1/2]

Direction walberla::stencil::vectorToDirection ( cell_idx_t x,
cell_idx_t y,
cell_idx_t z )
inline

Maps a (x,y,z) direction vector to its direction.

◆ vectorToDirection() [2/2]

Direction walberla::stencil::vectorToDirection ( Vector3< cell_idx_t > vec)
inline

Variable Documentation

◆ c

std::array< std::array< int, NR_OF_DIRECTIONS >, 3 > walberla::stencil::c
inlineconstexpr
Initial value:
{ {
{
0, 0, 0, -1, 1, 0, 0, -1, 1, -1, 1, 0, 0, -1, 1, 0, 0, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1
}, {
0, 1, -1, 0, 0, 0, 0, 1, 1, -1, -1, 1, -1, 0, 0, 1, -1, 0, 0, 1, 1, -1, -1, 1, 1, -1, -1
}, {
0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1
}
} }

The x,y,z component for each direction.

◆ cNorm

std::array< std::array< real_t, NR_OF_DIRECTIONS >, 3 > walberla::stencil::cNorm
inlineconstexpr
Initial value:
{ {
{
0_r, 0_r, 0_r, -1_r, 1_r, 0_r, 0_r, -1_r / std::numbers::sqrt2_v<real_t>,
1_r / std::numbers::sqrt2_v<real_t>, -1_r / std::numbers::sqrt2_v<real_t>, 1_r / std::numbers::sqrt2_v<real_t>, 0_r, 0_r,
-1_r / std::numbers::sqrt2_v<real_t>, 1_r / std::numbers::sqrt2_v<real_t>, 0_r, 0_r, -1_r / std::numbers::sqrt2_v<real_t>,
1_r / std::numbers::sqrt2_v<real_t>, 1_r / std::numbers::sqrt3_v<real_t>, -1_r / std::numbers::sqrt3_v<real_t>,
1_r / std::numbers::sqrt3_v<real_t>, -1_r / std::numbers::sqrt3_v<real_t>, 1_r / std::numbers::sqrt3_v<real_t>,
-1_r / std::numbers::sqrt3_v<real_t>, 1_r / std::numbers::sqrt3_v<real_t>, -1_r / std::numbers::sqrt3_v<real_t>
}, {
0_r, 1_r, -1_r, 0_r, 0_r, 0_r, 0_r, 1_r / std::numbers::sqrt2_v<real_t>,
1_r / std::numbers::sqrt2_v<real_t>, -1_r / std::numbers::sqrt2_v<real_t>, -1_r / std::numbers::sqrt2_v<real_t>,
1_r / std::numbers::sqrt2_v<real_t>, -1_r / std::numbers::sqrt2_v<real_t>, 0_r, 0_r, 1_r / std::numbers::sqrt2_v<real_t>,
-1_r / std::numbers::sqrt2_v<real_t>, 0_r, 0_r, 1_r / std::numbers::sqrt3_v<real_t>, 1_r / std::numbers::sqrt3_v<real_t>,
-1_r / std::numbers::sqrt3_v<real_t>, -1_r / std::numbers::sqrt3_v<real_t>, 1_r / std::numbers::sqrt3_v<real_t>,
1_r / std::numbers::sqrt3_v<real_t>, -1_r / std::numbers::sqrt3_v<real_t>, -1_r / std::numbers::sqrt3_v<real_t>
}, {
0_r, 0_r, 0_r, 0_r, 0_r, 1_r, -1_r, 0_r, 0_r, 0_r, 0_r,
1_r / std::numbers::sqrt2_v<real_t>, 1_r / std::numbers::sqrt2_v<real_t>, 1_r / std::numbers::sqrt2_v<real_t>,
1_r / std::numbers::sqrt2_v<real_t>, -1_r / std::numbers::sqrt2_v<real_t>, -1_r / std::numbers::sqrt2_v<real_t>,
-1_r / std::numbers::sqrt2_v<real_t>, -1_r / std::numbers::sqrt2_v<real_t>, 1_r / std::numbers::sqrt3_v<real_t>,
1_r / std::numbers::sqrt3_v<real_t>, 1_r / std::numbers::sqrt3_v<real_t>, 1_r / std::numbers::sqrt3_v<real_t>,
-1_r / std::numbers::sqrt3_v<real_t>, -1_r / std::numbers::sqrt3_v<real_t>, -1_r / std::numbers::sqrt3_v<real_t>,
-1_r / std::numbers::sqrt3_v<real_t>
}
} }

The x,y,z component for each normalized direction.

◆ cx

std::array< int, NR_OF_DIRECTIONS > walberla::stencil::cx
inlineconstexpr
Initial value:
{
0, 0, 0, -1, 1, 0, 0, -1, 1, -1, 1, 0, 0, -1, 1, 0, 0, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1
}

The x component for each direction.

◆ cy

std::array< int, NR_OF_DIRECTIONS > walberla::stencil::cy
inlineconstexpr
Initial value:
{
0, 1, -1, 0, 0, 0, 0, 1, 1, -1, -1, 1, -1, 0, 0, 1, -1, 0, 0, 1, 1, -1, -1, 1, 1, -1, -1
}

The y component for each direction.

◆ cz

std::array< int, NR_OF_DIRECTIONS > walberla::stencil::cz
inlineconstexpr
Initial value:
{
0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1
}

The z component for each direction.

◆ dirLength

std::array< real_t, NR_OF_DIRECTIONS > walberla::stencil::dirLength
inlineconstexpr
Initial value:
{
0_r, 1_r, 1_r, 1_r, 1_r, 1_r, 1_r,
std::numbers::sqrt2_v<real_t>, std::numbers::sqrt2_v<real_t>, std::numbers::sqrt2_v<real_t>, std::numbers::sqrt2_v<real_t>,
std::numbers::sqrt2_v<real_t>, std::numbers::sqrt2_v<real_t>, std::numbers::sqrt2_v<real_t>, std::numbers::sqrt2_v<real_t>,
std::numbers::sqrt2_v<real_t>, std::numbers::sqrt2_v<real_t>, std::numbers::sqrt2_v<real_t>, std::numbers::sqrt2_v<real_t>,
std::numbers::sqrt3_v<real_t>, std::numbers::sqrt3_v<real_t>, std::numbers::sqrt3_v<real_t>, std::numbers::sqrt3_v<real_t>,
std::numbers::sqrt3_v<real_t>, std::numbers::sqrt3_v<real_t>, std::numbers::sqrt3_v<real_t>, std::numbers::sqrt3_v<real_t>
}

Length for each direction.

◆ dirToBinary

std::array< BinaryDirection, NR_OF_DIRECTIONS > walberla::stencil::dirToBinary
inlineconstexpr
Initial value:
{
}
@ Bin_BE
Bottom-East.
Definition Directions.h:98
@ Bin_BS
Bottom-South.
Definition Directions.h:96
@ Bin_BNW
Bottom-North-West.
Definition Directions.h:104
@ Bin_BW
Bottom-West.
Definition Directions.h:97
@ Bin_TE
Top-East.
Definition Directions.h:94
@ Bin_E
East.
Definition Directions.h:84
@ Bin_SE
South-East.
Definition Directions.h:90
@ Bin_TNW
Top-North-West.
Definition Directions.h:100
@ Bin_SW
South-West.
Definition Directions.h:89
@ Bin_BSW
Bottom-South-West.
Definition Directions.h:106
@ Bin_NE
North-East.
Definition Directions.h:88
@ Bin_TW
Top-West.
Definition Directions.h:93
@ Bin_TN
Top-North.
Definition Directions.h:91
@ Bin_TSE
Top-South-East.
Definition Directions.h:101
@ Bin_TSW
Top-South-West.
Definition Directions.h:102
@ Bin_TS
Top-South.
Definition Directions.h:92
@ Bin_N
North.
Definition Directions.h:81
@ Bin_NW
North-West.
Definition Directions.h:87
@ Bin_B
Bottom.
Definition Directions.h:86
@ Bin_BNE
Bottom-North-East.
Definition Directions.h:103
@ Bin_W
West.
Definition Directions.h:83
@ Bin_BN
Bottom-North.
Definition Directions.h:95
@ Bin_BSE
Bottom-South-East.
Definition Directions.h:105
@ Bin_TNE
Top-North-East.
Definition Directions.h:99
@ Bin_S
South.
Definition Directions.h:82
@ Bin_T
Top.
Definition Directions.h:85
@ Bin_C
Center.
Definition Directions.h:80

Binary encoded direction for each direction.

◆ dirToString

std::array< std::string_view, NR_OF_DIRECTIONS > walberla::stencil::dirToString
inlineconstexpr
Initial value:
{
"C", "N", "S", "W", "E", "T", "B",
"NW", "NE", "SW", "SE", "TN", "TS", "TW", "TE", "BN", "BS", "BW","BE",
"TNE", "TNW", "TSE", "TSW", "BNE", "BNW", "BSE", "BSW",
}

String representation for each direction.

◆ gaussianMultipliers

std::array< uint_t, NR_OF_DIRECTIONS > walberla::stencil::gaussianMultipliers
inlineconstexpr
Initial value:
{
uint_t{8u},
uint_t{4u}, uint_t{4u}, uint_t{4u}, uint_t{4u} ,
uint_t{4u}, uint_t{4u},
uint_t{2u}, uint_t{2u}, uint_t{2u}, uint_t{2u} ,
uint_t{2u}, uint_t{2u}, uint_t{2u}, uint_t{2u} ,
uint_t{2u}, uint_t{2u}, uint_t{2u}, uint_t{2u} ,
uint_t{1u}, uint_t{1u}, uint_t{1u}, uint_t{1u} ,
uint_t{1u}, uint_t{1u}, uint_t{1u}, uint_t{1u}
}
std::size_t uint_t
Definition DataTypes.h:161

◆ gaussianWeights

std::array< real_t, NR_OF_DIRECTIONS > walberla::stencil::gaussianWeights
inlineconstexpr
Initial value:
{
8_r / 64_r,
4_r / 64_r, 4_r / 64_r, 4_r / 64_r, 4_r / 64_r,
4_r / 64_r, 4_r / 64_r,
2_r / 64_r, 2_r / 64_r, 2_r / 64_r, 2_r / 64_r,
2_r / 64_r, 2_r / 64_r, 2_r / 64_r, 2_r / 64_r,
2_r / 64_r, 2_r / 64_r, 2_r / 64_r, 2_r / 64_r,
1_r / 64_r, 1_r / 64_r, 1_r / 64_r, 1_r / 64_r,
1_r / 64_r, 1_r / 64_r, 1_r / 64_r, 1_r / 64_r
}

◆ inverseDir

std::array< Direction, NR_OF_DIRECTIONS > walberla::stencil::inverseDir
inlineconstexpr
Initial value:
{
C, S, N, E, W, B, T,
SE, SW, NE, NW, BS, BN, BE, BW, TS, TN, TE, TW,
}
@ BSW
Bottom-South-West.
Definition Directions.h:66
@ W
West.
Definition Directions.h:43
@ TE
Top-East.
Definition Directions.h:54
@ TN
Top-North.
Definition Directions.h:51
@ TNE
Top-North-East.
Definition Directions.h:59
@ BNE
Bottom-North-East.
Definition Directions.h:63
@ E
East.
Definition Directions.h:44
@ BSE
Bottom-South-East.
Definition Directions.h:65
@ TSE
Top-South-East.
Definition Directions.h:61
@ C
Center.
Definition Directions.h:40
@ TS
Top-South.
Definition Directions.h:52
@ BS
Bottom-South.
Definition Directions.h:56
@ NW
North-West.
Definition Directions.h:47
@ SW
South-West.
Definition Directions.h:49
@ TSW
Top-South-West.
Definition Directions.h:62
@ TW
Top-West.
Definition Directions.h:53
@ T
Top.
Definition Directions.h:45
@ BN
Bottom-North.
Definition Directions.h:55
@ B
Bottom.
Definition Directions.h:46
@ N
North.
Definition Directions.h:41
@ BNW
Bottom-North-West.
Definition Directions.h:64
@ SE
South-East.
Definition Directions.h:50
@ BW
Bottom-West.
Definition Directions.h:57
@ BE
Bottom-East.
Definition Directions.h:58
@ S
South.
Definition Directions.h:42
@ NE
North-East.
Definition Directions.h:48
@ TNW
Top-North-West.
Definition Directions.h:60

Inverse directions.

◆ map2Dto3D

std::array< std::array< Direction, NR_OF_DIRECTIONS >, 3 > walberla::stencil::map2Dto3D
inlineconstexpr
Initial value:

Maps from 2D directions (C, N, S, W, E, NW, NE, SW, SE) to 3D directions, by slicing through x,y or z coordinate The first array index represents the slice dimension ( 0 for x, 1 for y, 2 for z) Example: printing a slice through x coordinate (keeping x fixed) of a D3Q19 field:

for(auto i = D2Q9::begin(); i != D2Q9::end(); ++i)
cout << pdfField.get(x,y,z, D3Q19::idx[ map2Dto3D[0][*i] ] ) << endl;
T & get(cell_idx_t x, cell_idx_t y, cell_idx_t z)
get function with only (x,y,z) coordinates, assumes fSize=1
Definition Field.impl.h:758
Extends the Field with ghost-layer information.
Definition GhostLayerField.h:51
constexpr std::array< std::array< Direction, NR_OF_DIRECTIONS >, 3 > map2Dto3D
Maps from 2D directions (C, N, S, W, E, NW, NE, SW, SE) to 3D directions, by slicing through x,...
Definition Directions.h:289

◆ mirrorX

std::array< Direction, NR_OF_DIRECTIONS > walberla::stencil::mirrorX
inlineconstexpr
Initial value:
{
C, N, S, E, W, T, B,
NE, NW, SE, SW, TN, TS, TE, TW, BN, BS, BE, BW,
}

The mirrored directions (flip W-E).

◆ mirrorY

std::array< Direction, NR_OF_DIRECTIONS > walberla::stencil::mirrorY
inlineconstexpr
Initial value:
{
C, S, N, W, E, T, B,
SW, SE, NW, NE, TS, TN, TW, TE, BS, BN, BW, BE,
}

The mirrored directions (flip N-S).

◆ mirrorZ

std::array< Direction, NR_OF_DIRECTIONS > walberla::stencil::mirrorZ
inlineconstexpr
Initial value:
{
C, N, S, W, E, B, T,
NW, NE, SW, SE, BN, BS, BW, BE, TN, TS, TW, TE,
}

The mirrored directions (flip T-B).

◆ NR_OF_DIRECTIONS

uint_t walberla::stencil::NR_OF_DIRECTIONS = 27
inlineconstexpr