![]() |
Peano
|
Utility functions specific to the Peano SFC. More...
#include <PeanoCurve.h>
Static Public Member Functions | |
static bool | isTraversePositiveAlongAxis (const AutomatonState &state, int axis) |
static peano4::utils::LoopDirection | getLoopDirection (const AutomatonState &state) |
Holds a set bit for each dimension along which the traversal is positive. | |
static void | setExitFace (AutomatonState &cell, int axis) |
static void | setEntryFace (AutomatonState &cell, int axis) |
static void | invertEvenFlag (AutomatonState &cell, int axis) |
static void | removeFaceAccessNumber (AutomatonState &cell, int face) |
static void | setFaceAccessNumber (AutomatonState &cell, int face, int value) |
static std::bitset< Dimensions > | getFirstVertexIndex (const AutomatonState &cell) |
Looks into a cell of the spacetree and gives the index of the first local vertex. | |
static int | getVertexReadStackNumber (const AutomatonState &state, const std::bitset< Dimensions > &vertex) |
static int | getVertexWriteStackNumber (const AutomatonState &state, const std::bitset< Dimensions > &vertex) |
static int | getFaceNumberAlongCurve (const AutomatonState &state, int logicalFaceNumber) |
Faces are enumerated following the same paradigm as the vertices. | |
static int | getFaceReadStackNumber (const AutomatonState &state, int face) |
It is important to get the input/output stack ordering per stack type consistent among all grid entities. | |
static int | getFaceWriteStackNumber (const AutomatonState &state, int face) |
static int | getCellReadStackNumber (const AutomatonState &state) |
static int | getCellWriteStackNumber (const AutomatonState &state) |
static bool | isInOutStack (int number) |
static bool | isTemporaryStack (int number) |
static int | getInputStackNumber (const AutomatonState &state) |
static int | getOutputStackNumber (const AutomatonState &state) |
Static Public Attributes | |
static constexpr int | CallStack = 0 |
static constexpr int | NumberOfBaseStacks = 3 |
By setting the value to something bigger than 2, we effectively reserve NumberOfBaseStacks - 2 as callstack. | |
static constexpr int | NumberOfPeriodicBoundaryConditionStacks = 2*(ThreePowerD-1) |
In principle, there are Dimensions axes along which we can have periodic boundary conditions. | |
static constexpr int | MaxNumberOfCoreStacksPerSpacetreeInstance = NumberOfBaseStacks + Dimensions*2 + NumberOfPeriodicBoundaryConditionStacks |
Standard (serial) number of stacks required per spacetree. | |
Utility functions specific to the Peano SFC.
Definition at line 22 of file PeanoCurve.h.
|
static |
Definition at line 259 of file PeanoCurve.cpp.
References state.
Referenced by peano4::grid::GridTraversalEventGenerator::createEnterCellTraversalEvent().
|
static |
Definition at line 264 of file PeanoCurve.cpp.
References state.
Referenced by peano4::grid::GridTraversalEventGenerator::createLeaveCellTraversalEvent().
|
static |
Faces are enumerated following the same paradigm as the vertices.
Face 0 is the face with a x_0 as normal which runs through the origin (left bottom point), face 1 is the face with x_1 as normal, ... Face 0+d is the face parallel to face 0 but on the opposite side of the cell. In the SFC context, we obviously need a different enumeration scheme. With vertices, deriving this scheme is simple: you get the first vertex and then you xor the vertex numbers. Here, this is not possible, i.e. for faces users have to go through this routine.
Constructing a face enumeration is in principle similar to the vertex numbers. We start with our normalised enumeration as sketched above. Then we look at the even flags of the cell. For every even flag not set (odd numbers), we invert the enumerations along all other normals. If we run through the grid forward, we have, as pointed out above, first the face with normal 0 running through the origin, then the face with normal 1 running through the origin, ... If we invert the traversal, we first have to handle the face with normal d not running through the origin, then the one with normal d-1, and so forth.
Definition at line 203 of file PeanoCurve.cpp.
References peano4::grid::AutomatonState::getEvenFlags(), and peano4::grid::AutomatonState::getInverted().
Referenced by peano4::grid::GridTraversalEventGenerator::createEnterCellTraversalEvent(), and peano4::grid::GridTraversalEventGenerator::createLeaveCellTraversalEvent().
|
static |
It is important to get the input/output stack ordering per stack type consistent among all grid entities.
That is, in principle it does not matter whether we stream 1 to 2 and then back or 2 to 1 and then back. But if vertices stream from 1 to 2 first, then faces should do so as well. This allows the stack administration in the parallel case to map all stacks consistently (it doesn't have to search which input/output stack is full).
Definition at line 225 of file PeanoCurve.cpp.
References assertion1, peano4::grid::AutomatonState::getAccessNumber(), peano4::grid::AutomatonState::getEvenFlags(), peano4::grid::AutomatonState::getInverted(), and state.
Referenced by peano4::grid::GridTraversalEventGenerator::createEnterCellTraversalEvent().
|
static |
Definition at line 242 of file PeanoCurve.cpp.
References assertion1, peano4::grid::AutomatonState::getAccessNumber(), peano4::grid::AutomatonState::getEvenFlags(), and peano4::grid::AutomatonState::getInverted().
Referenced by peano4::grid::GridTraversalEventGenerator::createLeaveCellTraversalEvent().
|
static |
Looks into a cell of the spacetree and gives the index of the first local vertex.
The local enumeration obviously depends on the orientation of the curve. If you iterate over all vertices, an xor with the integer counter and this result makes the iterate a cell-local traversal. So a typical loop over all vertices of a cell along the Peano SFC reads as
We heavily exploit bitsets here. They allow us, for example, to invert the whole direction by a simple flip.
Definition at line 88 of file PeanoCurve.cpp.
References peano4::grid::AutomatonState::getEvenFlags(), and peano4::grid::AutomatonState::getInverted().
Referenced by peano4::grid::GridTraversalEventGenerator::createEnterCellTraversalEvent(), peano4::grid::GridTraversalEventGenerator::createLeaveCellTraversalEvent(), peano4::grid::Spacetree::loadVertices(), and peano4::grid::Spacetree::storeVertices().
|
static |
Definition at line 135 of file PeanoCurve.cpp.
References peano4::grid::AutomatonState::getInverted(), and state.
Referenced by peano4::parallel::SpacetreeSet::streamDataFromSplittingTreesToNewTrees().
|
static |
Holds a set bit for each dimension along which the traversal is positive.
Definition at line 24 of file PeanoCurve.cpp.
References state.
Referenced by peano4::grid::Spacetree::descend().
|
static |
Definition at line 140 of file PeanoCurve.cpp.
References peano4::grid::AutomatonState::getInverted(), and state.
Referenced by peano4::parallel::SpacetreeSet::streamDataFromSplittingTreeToNewTree().
|
static |
As the access numbers already are inverted in the new code where all access flags are created on the fly, we don't need the inversion flag here anymore. The only situation where we need it is to toggle input and output stacks.
Definition at line 145 of file PeanoCurve.cpp.
References assertion1, peano4::grid::AutomatonState::getAccessNumber(), peano4::grid::AutomatonState::getEvenFlags(), and state.
Referenced by peano4::grid::GridTraversalEventGenerator::createEnterCellTraversalEvent(), and peano4::grid::Spacetree::loadVertices().
|
static |
Definition at line 179 of file PeanoCurve.cpp.
References assertion1, peano4::grid::AutomatonState::getAccessNumber(), and peano4::grid::AutomatonState::getEvenFlags().
Referenced by peano4::grid::GridTraversalEventGenerator::createLeaveCellTraversalEvent(), and peano4::grid::Spacetree::storeVertices().
|
static |
Definition at line 59 of file PeanoCurve.cpp.
References assertion, and peano4::grid::AutomatonState::flipEvenFlags().
Referenced by peano4::grid::Spacetree::refineState().
Definition at line 169 of file PeanoCurve.cpp.
Referenced by peano4::grid::GridTraversalEventGenerator::createEnterCellTraversalEvent(), peano4::grid::GridTraversalEventGenerator::createLeaveCellTraversalEvent(), peano4::grid::Spacetree::loadVertices(), peano4::grid::Spacetree::receiveAndMergeUserData(), peano4::grid::Spacetree::sendUserData(), and peano4::grid::Spacetree::storeVertices().
Definition at line 174 of file PeanoCurve.cpp.
|
static |
Definition at line 9 of file PeanoCurve.cpp.
References assertion, and state.
Referenced by peano4::grid::Spacetree::refineState().
|
static |
Definition at line 66 of file PeanoCurve.cpp.
References assertion, peano4::grid::AutomatonState::getAccessNumber(), and peano4::grid::AutomatonState::setAccessNumber().
|
static |
Definition at line 47 of file PeanoCurve.cpp.
Referenced by peano4::grid::Spacetree::refineState().
|
static |
Definition at line 35 of file PeanoCurve.cpp.
Referenced by peano4::grid::Spacetree::refineState().
|
static |
Definition at line 112 of file PeanoCurve.cpp.
References assertion, peano4::grid::AutomatonState::getAccessNumber(), and peano4::grid::AutomatonState::setAccessNumber().
|
staticconstexpr |
Definition at line 27 of file PeanoCurve.h.
|
staticconstexpr |
Standard (serial) number of stacks required per spacetree.
The stacks are ordered as follows:
From hereon, all further stacks are used for parallel data exchange.
stack number | semantics | usage |
---|---|---|
0 | call stack | every tree |
1,2 | input/output stack | every tree |
3-6 | temporary stacks to | every tree |
| | exchange data with | | | adjacent cells | | 7-14 | output stacks for | tree 0 | | periodic BC data | | 15-22 | input stack for | tree 0 | | periodic BC data | | >=23 | parallel data xchange | all trees | | stacks |
Definition at line 86 of file PeanoCurve.h.
Referenced by peano4::parallel::Node::getInputStackNumberForHorizontalDataExchange(), peano4::parallel::Node::getInputStackNumberForVerticalDataExchange(), peano4::parallel::Node::getOutputStackForPeriodicBoundaryExchange(), peano4::parallel::Node::getOutputStackNumberForHorizontalDataExchange(), peano4::parallel::Node::getOutputStackNumberForVerticalDataExchange(), peano4::parallel::Node::getOutputStacksForPeriodicBoundaryExchange(), peano4::parallel::Node::getPeriodicBoundaryExchangeInputStackNumberForOutputStack(), peano4::parallel::Node::getPeriodicBoundaryExchangeInputStackNumberForOutputStack(), peano4::parallel::Node::getTreeNumberTiedToExchangeStackNumber(), peano4::parallel::Node::isHorizontalDataExchangeInputStackNumber(), peano4::parallel::Node::isHorizontalDataExchangeOutputStackNumber(), peano4::parallel::Node::isPeriodicBoundaryExchangeOutputStackNumber(), peano4::parallel::Node::isStorageStackNumber(), peano4::parallel::Node::isVerticalDataExchangeInputStackNumber(), peano4::parallel::Node::isVerticalDataExchangeOutputStackNumber(), and peano4::parallel::Node::mapPeriodicBoundaryExchangeOutputStackOntoInputStack().
|
staticconstexpr |
By setting the value to something bigger than 2, we effectively reserve NumberOfBaseStacks - 2 as callstack.
Definition at line 33 of file PeanoCurve.h.
|
staticconstexpr |
In principle, there are Dimensions axes along which we can have periodic boundary conditions.
The faces along the x axis can wrap over, those along the y axis can wrap over, those along the z axis, too. For each direction, we need two stacks. The first one is for data flow along the coordinate axis, the other one for the flow in the opposite direction.
Overall, we can have up to \( 3^d-1 \) different data flow directions. Obviously, faces use only up to \( 2d \) of these, as faces cannot be exchanged along diagonals.
The whole set of stacks is replicated: We need a set of these stacks to read from (those are the lower ones). They are followed by stacks to write to. The two stacks are swapped over after each iteration.
Definition at line 50 of file PeanoCurve.h.
Referenced by peano4::parallel::Node::getOutputStackForPeriodicBoundaryExchange(), peano4::parallel::Node::getOutputStacksForPeriodicBoundaryExchange(), peano4::parallel::Node::getPeriodicBoundaryExchangeInputStackNumberForOutputStack(), peano4::parallel::Node::getPeriodicBoundaryExchangeInputStackNumberForOutputStack(), peano4::parallel::Node::isPeriodicBoundaryExchangeOutputStackNumber(), and peano4::parallel::Node::mapPeriodicBoundaryExchangeOutputStackOntoInputStack().