Peano
Loading...
Searching...
No Matches
peano4::datamanagement::CellMarker Struct Reference

Cell marker. More...

#include <CellMarker.h>

Collaboration diagram for peano4::datamanagement::CellMarker:

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, doublex () const
 Centre of a cell.
tarch::la::Vector< Dimensions, doublegetInvokingParentCellsCentre () 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, doubleh () const
tarch::la::Vector< Dimensions, doublegetOffset () 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, intgetRelativePositionWithinFatherCell () 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).

Detailed Description

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.

Constructor & Destructor Documentation

◆ CellMarker()

Member Function Documentation

◆ getInvokingParentCellsCentre()

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 _centre, _h, _relativePositionOfCellWithinFatherCell, assertion1, and toString().

Here is the call graph for this function:

◆ getOffset()

tarch::la::Vector< Dimensions, double > peano4::datamanagement::CellMarker::getOffset ( ) const
Returns
Offset of cell, i.e. the bottom left vertex's coordinate

Definition at line 120 of file CellMarker.cpp.

References _centre, and _h.

◆ getRelativePositionWithinFatherCell()

tarch::la::Vector< Dimensions, int > peano4::datamanagement::CellMarker::getRelativePositionWithinFatherCell ( ) const

Definition at line 44 of file CellMarker.cpp.

References _relativePositionOfCellWithinFatherCell.

◆ h()

tarch::la::Vector< Dimensions, double > peano4::datamanagement::CellMarker::h ( ) const
Returns
Size of cell

Definition at line 118 of file CellMarker.cpp.

References _h.

Referenced by isContained().

Here is the caller graph for this function:

◆ hasBeenEnclaveCell()

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

  • is adjacent to a resolution transitions; or
  • is adjacent to a domain boundary.

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.

Dynamic load balancing

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.

See also
page_exahype_solvers_enclave_solvers for a high-level description

Definition at line 140 of file CellMarker.cpp.

References _hasBeenEnclave.

◆ hasBeenRefined()

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().

See also
willBeRefined()

Definition at line 95 of file CellMarker.cpp.

References _hasBeenRefined.

◆ hasBeenSkeletonCell()

bool peano4::datamanagement::CellMarker::hasBeenSkeletonCell ( ) const

A skeleton cell is a not-enclave cell.

See also
hasBeenEnclaveCell()

Definition at line 142 of file CellMarker.cpp.

References _hasBeenEnclave.

◆ initDatatype()

void peano4::datamanagement::CellMarker::initDatatype ( )
static

◆ isContained() [1/2]

bool peano4::datamanagement::CellMarker::isContained ( const tarch::la::Vector< Dimensions, double > & x,
const tarch::la::Vector< Dimensions, double > & cellCentre,
const tarch::la::Vector< Dimensions, double > & h,
double tolerance )
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.

See the other isContained() routine for a description, but keep in mind that this other routine refers to this place, i.e. this routine provides the actual behaviour.

Parameters
xPoint to query
cellCentreCentre of cell of interest
hMesh size on this level
toleranceSearch tolerance

Definition at line 65 of file CellMarker.cpp.

References h(), and x().

Here is the call graph for this function:

◆ isContained() [2/2]

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.

See also
The routine calls the static isContained() routine and passes the local attributes in.
Parameters
toleranceAbsolute tolerance when we compare two values.

Definition at line 54 of file CellMarker.cpp.

References _centre, _h, isContained(), and x().

Referenced by toolbox::particles::getAdjacentCellsOwningParticle(), isContained(), toolbox::particles::liftParticleAssociatedWithVertex(), and toolbox::particles::updateContainedInAdjacentCellProperty().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isLocal()

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.

References _isLocal.

◆ isParentLocal()

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.

See also
isLocal()

Definition at line 99 of file CellMarker.cpp.

References _isParentLocal.

◆ overlaps()

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 _centre, _h, and overlaps().

Referenced by overlaps().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ receive() [1/2]

void peano4::datamanagement::CellMarker::receive ( CellMarker & buffer,
int source,
int tag,
MPI_Comm communicator )
static

Definition at line 259 of file CellMarker.cpp.

References Datatype.

Referenced by receiveAndPollDanglingMessages().

Here is the caller graph for this function:

◆ receive() [2/2]

void peano4::datamanagement::CellMarker::receive ( CellMarker & buffer,
int source,
int tag,
std::function< void()> startCommunicationFunctor,
std::function< void()> waitFunctor,
MPI_Comm communicator )
static

Definition at line 286 of file CellMarker.cpp.

References Datatype.

◆ receiveAndPollDanglingMessages()

◆ send() [1/2]

void peano4::datamanagement::CellMarker::send ( const CellMarker & buffer,
int destination,
int tag,
MPI_Comm communicator )
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.

References Datatype.

Referenced by sendAndPollDanglingMessages().

Here is the caller graph for this function:

◆ send() [2/2]

void peano4::datamanagement::CellMarker::send ( const CellMarker & buffer,
int destination,
int tag,
std::function< void()> startCommunicationFunctor,
std::function< void()> waitFunctor,
MPI_Comm communicator )
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.

References Datatype.

◆ sendAndPollDanglingMessages()

void peano4::datamanagement::CellMarker::sendAndPollDanglingMessages ( const CellMarker & message,
int destination,
int tag,
MPI_Comm communicator )
static

◆ shutdownDatatype()

void peano4::datamanagement::CellMarker::shutdownDatatype ( )
static

Definition at line 251 of file CellMarker.cpp.

References Datatype.

Referenced by peano4::parallel::Node::shutdownMPIDatatypes().

Here is the caller graph for this function:

◆ toString()

◆ willBeEnclaveCell()

bool peano4::datamanagement::CellMarker::willBeEnclaveCell ( ) const
See also
hasBeenEnclaveCell()

Definition at line 136 of file CellMarker.cpp.

References _willBeEnclave.

◆ willBeRefined()

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.

References _willBeRefined.

◆ willBeSkeletonCell()

bool peano4::datamanagement::CellMarker::willBeSkeletonCell ( ) const
See also
hasBeenEnclaveCell()

Definition at line 138 of file CellMarker.cpp.

References _willBeEnclave.

◆ x()

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:

marker.x() - 0.5 * marker.h() + tarch::la::multiplyComponents(tarch::la::Vector<Dimensions,double>(targetVertex),marker.h())
Matrix< Rows, Cols, Scalar > multiplyComponents(const Matrix< Rows, X, Scalar > &lhs, const Matrix< X, Cols, Scalar > &rhs)
Simple vector class.
Definition Vector.h:159
Returns
Centre of cell.

Definition at line 101 of file CellMarker.cpp.

References _centre.

Referenced by isContained(), and isContained().

Here is the caller graph for this function:

Field Documentation

◆ _areAllVerticesInsideDomain

bool peano4::datamanagement::CellMarker::_areAllVerticesInsideDomain
private

Definition at line 53 of file CellMarker.h.

Referenced by CellMarker(), initDatatype(), and toString().

◆ _areAllVerticesRefined

bool peano4::datamanagement::CellMarker::_areAllVerticesRefined
private

Definition at line 49 of file CellMarker.h.

Referenced by initDatatype().

◆ _centre

tarch::la::Vector<Dimensions, double> peano4::datamanagement::CellMarker::_centre
private

◆ _h

tarch::la::Vector<Dimensions, double> peano4::datamanagement::CellMarker::_h
private

◆ _hasBeenEnclave

bool peano4::datamanagement::CellMarker::_hasBeenEnclave
private

Definition at line 57 of file CellMarker.h.

Referenced by CellMarker(), hasBeenEnclaveCell(), hasBeenSkeletonCell(), and toString().

◆ _hasBeenRefined

bool peano4::datamanagement::CellMarker::_hasBeenRefined
private

Definition at line 45 of file CellMarker.h.

Referenced by CellMarker(), hasBeenRefined(), initDatatype(), and toString().

◆ _invokingSpacetreeIsNotInvolvedInAnyDynamicLoadBalancing

bool peano4::datamanagement::CellMarker::_invokingSpacetreeIsNotInvolvedInAnyDynamicLoadBalancing
private

Definition at line 54 of file CellMarker.h.

Referenced by CellMarker(), initDatatype(), and toString().

◆ _isLocal

bool peano4::datamanagement::CellMarker::_isLocal
private

Definition at line 47 of file CellMarker.h.

Referenced by CellMarker(), initDatatype(), isLocal(), and toString().

◆ _isOneVertexCreatedOrDestroyed

bool peano4::datamanagement::CellMarker::_isOneVertexCreatedOrDestroyed
private

Definition at line 51 of file CellMarker.h.

Referenced by CellMarker(), and toString().

◆ _isOneVertexHanging

bool peano4::datamanagement::CellMarker::_isOneVertexHanging
private

Definition at line 50 of file CellMarker.h.

Referenced by CellMarker(), initDatatype(), and toString().

◆ _isParentLocal

bool peano4::datamanagement::CellMarker::_isParentLocal
private

Definition at line 48 of file CellMarker.h.

Referenced by CellMarker(), and isParentLocal().

◆ _relativePositionOfCellWithinFatherCell

tarch::la::Vector<Dimensions, int> peano4::datamanagement::CellMarker::_relativePositionOfCellWithinFatherCell
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(), getInvokingParentCellsCentre(), getRelativePositionWithinFatherCell(), initDatatype(), and toString().

◆ _willBeEnclave

bool peano4::datamanagement::CellMarker::_willBeEnclave
private

Definition at line 56 of file CellMarker.h.

Referenced by CellMarker(), toString(), willBeEnclaveCell(), and willBeSkeletonCell().

◆ _willBeRefined

bool peano4::datamanagement::CellMarker::_willBeRefined
private

Definition at line 46 of file CellMarker.h.

Referenced by CellMarker(), initDatatype(), toString(), and willBeRefined().

◆ Datatype

MPI_Datatype peano4::datamanagement::CellMarker::Datatype
static

Definition at line 291 of file CellMarker.h.

Referenced by initDatatype(), receive(), receive(), send(), send(), and shutdownDatatype().


The documentation for this struct was generated from the following files: