![]() |
Peano
|
peano4::grid::GridControlEvent peano4::grid::internal::createBoundingBoxEvent | ( | const peano4::grid::GridControlEvent & | lhs, |
const peano4::grid::GridControlEvent & | rhs ) |
Definition at line 384 of file grid.cpp.
References peano4::grid::GridControlEvent::getOffset(), peano4::grid::GridControlEvent::getWidth(), tarch::la::max(), and tarch::la::min().
Referenced by mergeAdjacentRefinementEvents().
bool peano4::grid::internal::equals | ( | const peano4::grid::GridControlEvent & | lhs, |
const peano4::grid::GridControlEvent & | rhs ) |
Definition at line 347 of file grid.cpp.
References tarch::la::equals(), peano4::grid::GridControlEvent::getH(), peano4::grid::GridControlEvent::getOffset(), peano4::grid::GridControlEvent::getRefinementControl(), and peano4::grid::GridControlEvent::getWidth().
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.
Definition at line 183 of file grid.cpp.
References createBoundingBoxEvent(), logDebug, peano4::grid::GridControlEvent::toString(), and twoEventsAreAdjacent().
bool peano4::grid::internal::refinementEventOverrulesCoarsening | ( | const peano4::grid::GridControlEvent & | refineEvent, |
const peano4::grid::GridControlEvent & | eraseEvent ) |
A refinement event overrules the coarsening if.
Definition at line 359 of file grid.cpp.
References peano4::grid::GridControlEvent::getH(), peano4::grid::GridControlEvent::getRefinementControl(), tarch::la::oneSmallerEquals(), and twoEventsOverlap().
Referenced by 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 166 of file grid.cpp.
References peano4::grid::overlaps(), and refinementEventOverrulesCoarsening().
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.
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.
events | Input and output set of grid control events |
Definition at line 150 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().
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 368 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().
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 336 of file grid.cpp.
References peano4::grid::GridControlEvent::getOffset(), peano4::grid::GridControlEvent::getWidth(), and twoEventsOverlap().
Referenced by refinementEventOverrulesCoarsening(), and twoEventsOverlap().