Peano 4
Loading...
Searching...
No Matches
peano4::grid::internal Namespace Reference

Functions

void removeEraseEventsThatAreCancelledByRefineEvents (const std::list< peano4::grid::GridControlEvent > &refineEvents, std::list< peano4::grid::GridControlEvent > &eraseEvents)
 This is the first thing I do.
 
void mergeAdjacentRefinementEvents (std::list< peano4::grid::GridControlEvent > &inputEvents, int Tolerance)
 Merge adjacent events.
 
bool twoEventsOverlap (const peano4::grid::GridControlEvent &lhs, const peano4::grid::GridControlEvent &rhs)
 Helper function which helps us throughout the merge.
 
bool equals (const peano4::grid::GridControlEvent &lhs, const peano4::grid::GridControlEvent &rhs)
 
bool refinementEventOverrulesCoarsening (const peano4::grid::GridControlEvent &refineEvent, const peano4::grid::GridControlEvent &eraseEvent)
 A refinement event overrules the coarsening if.
 
bool twoEventsAreAdjacent (const peano4::grid::GridControlEvent &lhs, const peano4::grid::GridControlEvent &rhs, double Tolerance)
 Are two events adjacent.
 
void sort (std::list< peano4::grid::GridControlEvent > &events)
 Sort grid control events geometrically.
 
peano4::grid::GridControlEvent createBoundingBoxEvent (const peano4::grid::GridControlEvent &lhs, const peano4::grid::GridControlEvent &rhs)
 

Function Documentation

◆ createBoundingBoxEvent()

peano4::grid::GridControlEvent peano4::grid::internal::createBoundingBoxEvent ( const peano4::grid::GridControlEvent & lhs,
const peano4::grid::GridControlEvent & rhs )

Definition at line 385 of file grid.cpp.

References peano4::grid::GridControlEvent::getOffset(), peano4::grid::GridControlEvent::getWidth(), tarch::la::max(), and tarch::la::min().

Referenced by mergeAdjacentRefinementEvents().

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

◆ equals()

◆ mergeAdjacentRefinementEvents()

void peano4::grid::internal::mergeAdjacentRefinementEvents ( std::list< peano4::grid::GridControlEvent > & inputEvents,
int Tolerance )

Merge adjacent events.

This routine merges adjacent events, i.e. events of the same time which share a common face and can be combined into one larger, rectangular event. The routine does not distinguish refine from coarsen events, i.e. you should only pass in events of the same type.

To make this routine faster, we first sort() the events geometrically. After that, we sweep over them and merge. As we have sorted the elements, we can "only" consider neighbouring events. Once a sweep has completed, we have to decide to rerun the whole procedure. This is necessary if something has changed within the list.

See also
createBoundingBoxEvent()
twoEventsAreAdjacent()

Definition at line 184 of file grid.cpp.

References createBoundingBoxEvent(), logDebug, peano4::grid::GridControlEvent::toString(), and twoEventsAreAdjacent().

Here is the call graph for this function:

◆ refinementEventOverrulesCoarsening()

bool peano4::grid::internal::refinementEventOverrulesCoarsening ( const peano4::grid::GridControlEvent & refineEvent,
const peano4::grid::GridControlEvent & eraseEvent )

A refinement event overrules the coarsening if.

  • The two events overlap
  • The refine event defines a way coarser mesh then the coarse event.

Definition at line 360 of file grid.cpp.

References peano4::grid::GridControlEvent::getH(), peano4::grid::GridControlEvent::getRefinementControl(), tarch::la::oneSmallerEquals(), and twoEventsOverlap().

Referenced by removeEraseEventsThatAreCancelledByRefineEvents().

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

◆ removeEraseEventsThatAreCancelledByRefineEvents()

void peano4::grid::internal::removeEraseEventsThatAreCancelledByRefineEvents ( const std::list< peano4::grid::GridControlEvent > & refineEvents,
std::list< peano4::grid::GridControlEvent > & eraseEvents )

This is the first thing I do.

Before I even start to think about the erase events, lets get rid of those that are definitely cancelled.

Uses the routine internal::refinementEventOverrulesCoarsening() to flag those events within eraseEvents which have to go.

Definition at line 167 of file grid.cpp.

References peano4::grid::overlaps(), and refinementEventOverrulesCoarsening().

Here is the call graph for this function:

◆ sort()

void peano4::grid::internal::sort ( std::list< peano4::grid::GridControlEvent > & events)

Sort grid control events geometrically.

Very simplistic sorting algorithm. The only "interesting" thing here is the fact that we provide the actual comparison operator. In a real C++ world, we would define the operator < over GridControlEvent. This GridControlEvent class however is usually generated, i.e. we dump it through Python. It would be a little bit of a headache to add the operator (it would have to be defined in Python, and then piped into the C++ code), so I decided to wrap one here manually.

The routine defines a natural order over the individual coordinates.

Sort has to work purely spatially. Otherwise, we would never be able to handle strong AMR.

Comparison operator

The comparison operator represents a < operator. First of all, we distinguish events that trigger different mesh sizes. That is, if you request a mesh size of h=0.1 and then of h=0.001, then the latter request is always bigger than the first one. If two events request the same mesh resolution, we first sort along the x-axis, then along the y-axis, and so forth. This way, we ensure that merges (which always merge two events next to each other) are deterministic.

See also
merge() for a discussion
Parameters
eventsInput and output set of grid control events

Definition at line 151 of file grid.cpp.

References peano4::grid::GridControlEvent::getH(), peano4::grid::GridControlEvent::getOffset(), tarch::la::greater(), tarch::la::smaller(), and tarch::la::volume().

Referenced by peano4::grid::tests::GridControlEventTest::testSortWithinMerge().

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

◆ twoEventsAreAdjacent()

bool peano4::grid::internal::twoEventsAreAdjacent ( const peano4::grid::GridControlEvent & lhs,
const peano4::grid::GridControlEvent & rhs,
double Tolerance )

Are two events adjacent.

Two events are adjacent if they have the same h, and if the sum of their bounding box volumes is roughly the same as the bounding box volume of the merger. We notice that the name is slightly wrong: We are not only flagging adjacent events, we are even searching for adjacent events of the same size.

Definition at line 369 of file grid.cpp.

References tarch::la::equals(), peano4::grid::GridControlEvent::getH(), peano4::grid::GridControlEvent::getOffset(), peano4::grid::GridControlEvent::getWidth(), tarch::la::max(), tarch::la::min(), tarch::la::relativeEps(), tarch::la::smallerEquals(), and tarch::la::volume().

Referenced by mergeAdjacentRefinementEvents(), and peano4::grid::tests::GridControlEventTest::testMerge2().

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

◆ twoEventsOverlap()

bool peano4::grid::internal::twoEventsOverlap ( const peano4::grid::GridControlEvent & lhs,
const peano4::grid::GridControlEvent & rhs )

Helper function which helps us throughout the merge.

Definition at line 337 of file grid.cpp.

References peano4::grid::GridControlEvent::getOffset(), peano4::grid::GridControlEvent::getWidth(), and twoEventsOverlap().

Referenced by refinementEventOverrulesCoarsening(), and twoEventsOverlap().

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