20 template <
typename FaceLabel>
24 double result = std::numeric_limits<double>::max();
26 for (
int d=0; d<Dimensions; d++) {
27 result = std::min(result, faceLabelEnumerator(d).getNewTimeStamp(0) );
28 result = std::min(result, faceLabelEnumerator(d+Dimensions).getNewTimeStamp(1) );
60 template <
typename CellLabel,
typename FaceLabel>
62 const CellLabel& cellLabel,
65 double result = std::numeric_limits<double>::max();
66 bool oneIsAhead =
false;
67 bool oneIsBehind =
false;
69 for (
int d=0; d<Dimensions; d++) {
70 double leftNeighbourTimeStamp = faceLabelEnumerator(d).getNewTimeStamp(0);
72 not faceLabelEnumerator(d).getBoundary()
76 result = std::min(result,leftNeighbourTimeStamp);
80 not faceLabelEnumerator(d).getBoundary()
87 double rightNeighbourTimeStamp = faceLabelEnumerator(d+Dimensions).getNewTimeStamp(1);
89 not faceLabelEnumerator(d+Dimensions).getBoundary()
93 result = std::min(result,rightNeighbourTimeStamp);
97 not faceLabelEnumerator(d+Dimensions).getBoundary()
105 if (oneIsAhead and not oneIsBehind) {
106 assertion(result>cellLabel.getTimeStamp());
110 return cellLabel.getTimeStamp();
131 template <
typename CellLabel,
typename FaceLabel>
133 const CellLabel& cellLabel,
135 double globalMinTimeStamp
137 double cellTimeStamp = cellLabel.getTimeStamp();
138 double cellTimeStepSize = cellLabel.getTimeStepSize();
140 const double Tolerance = 0.01;
199 template <
typename CellLabel,
typename FaceLabel>
201 const CellLabel& cellLabel,
207 const double Tolerance = 0.01;
210 double maxOfMatchingTimeStamps = -1.0;
211 const double currentFutureTimeStamp = cellLabel.getTimeStamp() + timeStepSize;
212 for (
int d=0; d<Dimensions; d++) {
214 not faceLabelEnumerator(d).getBoundary()
216 tarch::la::equals( faceLabelEnumerator(d).getNewTimeStamp(0), currentFutureTimeStamp, relativeTolerance)
218 maxOfMatchingTimeStamps = std::max(maxOfMatchingTimeStamps,faceLabelEnumerator(d).getNewTimeStamp(0));
221 not faceLabelEnumerator(d).getBoundary()
223 tarch::la::equals( faceLabelEnumerator(d+Dimensions).getNewTimeStamp(1), currentFutureTimeStamp, relativeTolerance)
225 maxOfMatchingTimeStamps = std::max(maxOfMatchingTimeStamps,faceLabelEnumerator(d+Dimensions).getNewTimeStamp(1));
229 if ( maxOfMatchingTimeStamps>0.0 ) {
230 double tweakedTimeStepSize = maxOfMatchingTimeStamps - cellLabel.getTimeStamp();
232 if (tweakedTimeStepSize>timeStepSize) {
233 logDebug(
"removeTimeStepAccummulationErrorsFromCell(...)",
"adopt local time step from " << timeStepSize <<
" to " << tweakedTimeStepSize );
235 timeStepSize = tweakedTimeStepSize;
238 logDebug(
"removeTimeStepAccummulationErrorsFromCell(...)",
"dt=" << timeStepSize <<
", max-match=" << maxOfMatchingTimeStamps );
258 std::pair<double,double>
getInterpolationWeights(
double oldTimeStampOnFace,
double newTimeStampOnFace,
double cellTimeStamp );
306 double cellTimeStepSize,
307 double maxGlobalTimeStepSize,
308 int discretisationStepsSize
#define assertion2(expr, param0, param1)
#define logDebug(methodName, logMacroMessageStream)
tarch::logging::Log _log("::")
Enumerator over an array of faces.
double getMinTimeStampOfNeighbours(const peano4::datamanagement::FaceEnumerator< FaceLabel > &faceLabelEnumerator)
Run over all neighbours and analyse their time stamp.
For the generic kernels that I use here most of the time.
double removeTimeStepAccumulationErrorsFromCell(const CellLabel &cellLabel, const peano4::datamanagement::FaceEnumerator< FaceLabel > &faceLabelEnumerator, double timeStepSize)
Remove accumulation errors from cell time stamps.
double getMinTimeStampOfNeighboursAhead(const CellLabel &cellLabel, const peano4::datamanagement::FaceEnumerator< FaceLabel > &faceLabelEnumerator)
Similar to getMinTimeStampOfNeighbours(), but we minimise only over those neighbours that are actuall...
std::pair< double, double > getInterpolationWeights(double oldTimeStampOnFace, double newTimeStampOnFace, double cellTimeStamp)
bool runTimeStepOnCell(const CellLabel &cellLabel, const peano4::datamanagement::FaceEnumerator< FaceLabel > &faceLabelEnumerator, double globalMinTimeStamp)
Determine whether to run a time step on a cell by analysing the neighbouring cells' timestamp.
double discretiseAndTruncateTimeStepSizes(double cellTimeStepSize, double maxGlobalTimeStepSize, int discretisationStepsSize)
Discretise (bucket) time step sizes and truncate it.
static bool smaller(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE) InlineMethod
Smaller operator for floating point values.
bool greater(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool greaterEquals(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
constexpr double NUMERICAL_ZERO_DIFFERENCE
bool equals(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs, const Scalar &tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares to matrices on equality by means of a numerical accuracy.