Peano
|
Cell marker. More...
#include <CellMarker.h>
Public Member Functions | |
CellMarker (const peano4::grid::GridTraversalEvent &event) | |
bool | hasBeenRefined () const |
Has the cell been refined when we kicked off this mesh traversal. | |
bool | willBeRefined () const |
Will the cell be refined in the subsequent iteration. | |
tarch::la::Vector< Dimensions, double > | x () const |
Centre of a cell. | |
tarch::la::Vector< Dimensions, double > | getInvokingParentCellsCentre () const |
See getInvokingCellCentre(). | |
bool | isContained (const tarch::la::Vector< Dimensions, double > &x, double tolerance=tarch::la::NUMERICAL_ZERO_DIFFERENCE) const |
Is x contained within cell identified by marker object. | |
bool | overlaps (const tarch::la::Vector< Dimensions, double > &offset, const tarch::la::Vector< Dimensions, double > &size) const |
tarch::la::Vector< Dimensions, double > | h () const |
tarch::la::Vector< Dimensions, double > | getOffset () const |
std::string | toString () const |
bool | isLocal () const |
Usually if you have an event of a cell, then the cell is alo local. | |
bool | isParentLocal () const |
A cell can be local and its parent still might not be local. | |
bool | hasBeenEnclaveCell () const |
Define enclave cell. | |
bool | willBeEnclaveCell () const |
bool | hasBeenSkeletonCell () const |
A skeleton cell is a not-enclave cell. | |
bool | willBeSkeletonCell () const |
tarch::la::Vector< Dimensions, int > | getRelativePositionWithinFatherCell () const |
Static Public Member Functions | |
static bool | isContained (const tarch::la::Vector< Dimensions, double > &x, const tarch::la::Vector< Dimensions, double > &cellCentre, const tarch::la::Vector< Dimensions, double > &h, double tolerance) |
Is point contained in cell. | |
static void | initDatatype () |
To be called prior to any MPI usage of this class. | |
static void | shutdownDatatype () |
static void | send (const CellMarker &buffer, int destination, int tag, MPI_Comm communicator) |
In DaStGen (the first version), I had a non-static version of the send as well as the receive. | |
static void | receive (CellMarker &buffer, int source, int tag, MPI_Comm communicator) |
static void | send (const CellMarker &buffer, int destination, int tag, std::function< void()> startCommunicationFunctor, std::function< void()> waitFunctor, MPI_Comm communicator) |
Alternative to the other send() where I trigger a non-blocking send an then invoke the functor until the corresponding MPI_Test tells me that the message went through. | |
static void | receive (CellMarker &buffer, int source, int tag, std::function< void()> startCommunicationFunctor, std::function< void()> waitFunctor, MPI_Comm communicator) |
static void | sendAndPollDanglingMessages (const CellMarker &message, int destination, int tag, MPI_Comm communicator) |
static void | receiveAndPollDanglingMessages (CellMarker &message, int source, int tag, MPI_Comm communicator) |
Static Public Attributes | |
static MPI_Datatype | Datatype |
Private Attributes | |
tarch::la::Vector< Dimensions, double > | _centre |
tarch::la::Vector< Dimensions, double > | _h |
bool | _hasBeenRefined |
bool | _willBeRefined |
bool | _isLocal |
bool | _isParentLocal |
bool | _areAllVerticesRefined |
bool | _isOneVertexHanging |
bool | _isOneVertexCreatedOrDestroyed |
bool | _areAllVerticesInsideDomain |
bool | _invokingSpacetreeIsNotInvolvedInAnyDynamicLoadBalancing |
bool | _willBeEnclave |
bool | _hasBeenEnclave |
tarch::la::Vector< Dimensions, int > | _relativePositionOfCellWithinFatherCell |
Entries from (0,1,2). | |
Cell marker.
This object provides information on the cell aka octant within the spacetree. This includes spatial information such as size and position. It also comprises mesh topology properties such as "will this cell be refined" or "is its parent a local cell".
It is an object which users are not supposed to manipulate. The mesh traversal automaton creates it once per octant while it runs through the mesh and passes in information about adjacent vertices, parent data, and so forth. The constructor then distills the user representation from that data and, from hereon, users can use this distilled information to make logical decisions what to do and how to do things within the spacetree octant.
Definition at line 39 of file CellMarker.h.
peano4::datamanagement::CellMarker::CellMarker | ( | const peano4::grid::GridTraversalEvent & | event | ) |
Definition at line 12 of file CellMarker.cpp.
References _areAllVerticesInsideDomain, _hasBeenEnclave, _hasBeenRefined, _invokingSpacetreeIsNotInvolvedInAnyDynamicLoadBalancing, _isOneVertexCreatedOrDestroyed, _isOneVertexHanging, _relativePositionOfCellWithinFatherCell, _willBeEnclave, _willBeRefined, peano4::grid::TraversalObserver::CreateOrDestroyHangingGridEntity, peano4::grid::TraversalObserver::CreateOrDestroyPersistentGridEntity, and TwoPowerD.
tarch::la::Vector< Dimensions, double > peano4::datamanagement::CellMarker::getInvokingParentCellsCentre | ( | ) | const |
See getInvokingCellCentre().
This routine gives you the centre of its parent cell.
Definition at line 103 of file CellMarker.cpp.
References assertion1, and toString().
tarch::la::Vector< Dimensions, double > peano4::datamanagement::CellMarker::getOffset | ( | ) | const |
Definition at line 120 of file CellMarker.cpp.
tarch::la::Vector< Dimensions, int > peano4::datamanagement::CellMarker::getRelativePositionWithinFatherCell | ( | ) | const |
Definition at line 44 of file CellMarker.cpp.
tarch::la::Vector< Dimensions, double > peano4::datamanagement::CellMarker::h | ( | ) | const |
Definition at line 118 of file CellMarker.cpp.
Referenced by exahypype.kernel::Evaluate(), and exahypype.kernel::halo().
bool peano4::datamanagement::CellMarker::hasBeenEnclaveCell | ( | ) | const |
Define enclave cell.
A enclave cell in the definition of Charrier, Hazelwood, Weinzierl is a cell that is not a skeleton cell. A skeleton cell is cell which either
Enclave cells are cells that you can potentially (if your algorithm allows) deploy to a task running in the background. The only thing you have to do is to ensure that it is passed all data via firstprivate copy and that you never refine an enclave cell.
In line with the above definition, we may label a cell as enclave cell if some dynamic load balancing is triggered or actually running. In this case, any enclave cell might be subject of a domain transfer. If we deployed its computation to the background, we could move around a cell whose computations is done by a thread currently.
Definition at line 140 of file CellMarker.cpp.
bool peano4::datamanagement::CellMarker::hasBeenRefined | ( | ) | const |
Has the cell been refined when we kicked off this mesh traversal.
If the attribute holds, this implies that the cell is refined in this sweep, as cells do not change their state throughout the traversal. It does not mean that the cell will be refined in the next mesh traversal however. To find this out, you have to study willBeRefined().
Definition at line 95 of file CellMarker.cpp.
bool peano4::datamanagement::CellMarker::hasBeenSkeletonCell | ( | ) | const |
A skeleton cell is a not-enclave cell.
Definition at line 142 of file CellMarker.cpp.
|
static |
To be called prior to any MPI usage of this class.
Definition at line 195 of file CellMarker.cpp.
Referenced by peano4::parallel::Node::initMPIDatatypes().
|
static |
Is point contained in cell.
Evaluate if x is in a h/2 environment around cellCentre. We use tarch::la comparison functions as we operate with floating point values. tolerance is the tolerance we pass into these functions.
x | Point to query |
cellCentre | Centre of cell of interest |
h | Mesh size on this level |
tolerance | Search tolerance |
Definition at line 65 of file CellMarker.cpp.
References tarch::la::greaterEquals(), and tarch::la::smallerEquals().
bool peano4::datamanagement::CellMarker::isContained | ( | const tarch::la::Vector< Dimensions, double > & | x, |
double | tolerance = tarch::la::NUMERICAL_ZERO_DIFFERENCE ) const |
Is x contained within cell identified by marker object.
Check whether the point x is contained within the marker. This is an operation which works with smaller equals and greater equals and numerical tolerances. Therefore, the routine includes any x that is exactly on a cell boundary. The other way round: a particle for example that resides exactly on the cell boundary, subject to the chosen floating point precision in the tarch::la library, will be considered to belong both to its left and its right neighbour.
On top of the fact that we work with closed intervals, it is important to realise that we work with floating point comparisons from the tarch::la library. Therefore, we employ some built-in floating point precision. You might want to switch to another precision. Most popular is a relative size that takes the dimensions of the marker into account:
marker.isContained( p->getX(), tarch::la::relativeEps( marker.h()(0) ) )
This variant uses relativeEps() as defined in tarch/la/Scalar.h.
tolerance | Absolute tolerance when we compare two values. |
Definition at line 54 of file CellMarker.cpp.
Referenced by toolbox::particles::getAdjacentCellsOwningParticle(), and toolbox::particles::liftParticleAssociatedWithVertex().
bool peano4::datamanagement::CellMarker::isLocal | ( | ) | const |
Usually if you have an event of a cell, then the cell is alo local.
Otherwise, an event not be called.
Definition at line 97 of file CellMarker.cpp.
bool peano4::datamanagement::CellMarker::isParentLocal | ( | ) | const |
A cell can be local and its parent still might not be local.
This happens if we have a horizontal tree cut. It also happens on the very top of the spacetree: Level 0 is by definition not persistent and thus is not considered to be local.
Definition at line 99 of file CellMarker.cpp.
bool peano4::datamanagement::CellMarker::overlaps | ( | const tarch::la::Vector< Dimensions, double > & | offset, |
const tarch::la::Vector< Dimensions, double > & | size ) const |
Definition at line 80 of file CellMarker.cpp.
References tarch::la::greaterEquals(), and tarch::la::smallerEquals().
|
static |
Definition at line 259 of file CellMarker.cpp.
Referenced by receiveAndPollDanglingMessages().
|
static |
Definition at line 286 of file CellMarker.cpp.
|
static |
Definition at line 171 of file CellMarker.cpp.
References tarch::mpi::Rank::getInstance(), tarch::services::ServiceRepository::getInstance(), receive(), tarch::services::ServiceRepository::receiveDanglingMessages(), tarch::mpi::Rank::setDeadlockTimeOutTimeStamp(), tarch::mpi::Rank::setDeadlockWarningTimeStamp(), tarch::mpi::Rank::triggerDeadlockTimeOut(), and tarch::mpi::Rank::writeTimeOutWarning().
|
static |
In DaStGen (the first version), I had a non-static version of the send as well as the receive.
However, this did not work with newer C++11 versions, as a member function using this as pointer usually doesn't see the vtable while the init sees the object from outside, i.e. including a vtable. So this routine now is basically an alias for a blocking MPI_Send.
Definition at line 253 of file CellMarker.cpp.
Referenced by sendAndPollDanglingMessages().
|
static |
Alternative to the other send() where I trigger a non-blocking send an then invoke the functor until the corresponding MPI_Test tells me that the message went through.
In systems with heavy MPI usage, this can help to avoid deadlocks.
Definition at line 267 of file CellMarker.cpp.
|
static |
Definition at line 147 of file CellMarker.cpp.
References tarch::mpi::Rank::getInstance(), tarch::services::ServiceRepository::getInstance(), tarch::services::ServiceRepository::receiveDanglingMessages(), send(), tarch::mpi::Rank::setDeadlockTimeOutTimeStamp(), tarch::mpi::Rank::setDeadlockWarningTimeStamp(), tarch::mpi::Rank::triggerDeadlockTimeOut(), and tarch::mpi::Rank::writeTimeOutWarning().
|
static |
Definition at line 251 of file CellMarker.cpp.
Referenced by peano4::parallel::Node::shutdownMPIDatatypes().
std::string peano4::datamanagement::CellMarker::toString | ( | ) | const |
Definition at line 124 of file CellMarker.cpp.
Referenced by exahype2::dg::tests::DGUtilsTest::testEvaluatePolynomialOrder1(), and exahype2::dg::tests::DGUtilsTest::testEvaluatePolynomialOrder2().
bool peano4::datamanagement::CellMarker::willBeEnclaveCell | ( | ) | const |
Definition at line 136 of file CellMarker.cpp.
bool peano4::datamanagement::CellMarker::willBeRefined | ( | ) | const |
Will the cell be refined in the subsequent iteration.
If hasBeenRefined() returns false but willBeRefined() holds, we have a cell which Peano 4 will refine in the current mesh sweep. It might however not yet be refined. This analysis makes sense once we take into account that refinement in Peano first have to be triggered. In the subsequent mesh traversal, the affected vertices then switch to refining and the new mesh elements are actually added.
The function which ultimately defines if this flag is set or not is peano4::grid::willVerticesBeRefined().
If willBeRefined() is false but hasBeenRefined() is true, the current cell is refined, but it will be coarsened in the very mesh traversal in which we run through the mesh.
Definition at line 93 of file CellMarker.cpp.
bool peano4::datamanagement::CellMarker::willBeSkeletonCell | ( | ) | const |
Definition at line 138 of file CellMarker.cpp.
tarch::la::Vector< Dimensions, double > peano4::datamanagement::CellMarker::x | ( | ) | const |
Centre of a cell.
If you want to know the position of one of the cell's vertices, you have to reconstruct this one manually. It is particularly simple if you already know the number of the vertex as a bitset:
Definition at line 101 of file CellMarker.cpp.
|
private |
Definition at line 53 of file CellMarker.h.
Referenced by CellMarker().
|
private |
Definition at line 49 of file CellMarker.h.
|
private |
Definition at line 41 of file CellMarker.h.
|
private |
Definition at line 43 of file CellMarker.h.
|
private |
Definition at line 57 of file CellMarker.h.
Referenced by CellMarker().
|
private |
Definition at line 45 of file CellMarker.h.
Referenced by CellMarker().
|
private |
Definition at line 54 of file CellMarker.h.
Referenced by CellMarker().
|
private |
Definition at line 47 of file CellMarker.h.
|
private |
Definition at line 51 of file CellMarker.h.
Referenced by CellMarker().
|
private |
Definition at line 50 of file CellMarker.h.
Referenced by CellMarker().
|
private |
Definition at line 48 of file CellMarker.h.
|
private |
Entries from (0,1,2).
(0,0) or (0,0,0) is the left, bottom cell.
Definition at line 62 of file CellMarker.h.
Referenced by CellMarker().
|
private |
Definition at line 56 of file CellMarker.h.
Referenced by CellMarker().
|
private |
Definition at line 46 of file CellMarker.h.
Referenced by CellMarker().
|
static |
Definition at line 283 of file CellMarker.h.