37 {{CONSTRUCTOR_IMPLEMENTATION}}
41double {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::getMaxMeshSize()
const {
42 return getMaxCellSize();
46double {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::getMinMeshSize()
const {
47 return getMinCellSize();
51void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::suspendSolversForOneGridSweep() {
52 _solverState = SolverState::Suspended;
56double {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::getMinCellSize(
bool ofCurrentlyRunningGridSweep)
const {
61double {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::getMaxCellSize(
bool ofCurrentlyRunningGridSweep)
const {
66double {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::getMinTimeStamp(
bool ofCurrentlyRunningGridSweep)
const {
71double {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::getMaxTimeStamp(
bool ofCurrentlyRunningGridSweep)
const {
76double {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::getMinTimeStepSize()
const {
81double {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::getMaxTimeStepSize()
const {
86void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::update(
double timeStepSize,
double timeStamp,
double cellSize) {
90 assertion1(timeStepSize<std::numeric_limits<double>::max()/10.0,timeStepSize);
98 _localMinTimeStampThisTimeStep = std::min(_localMinTimeStampThisTimeStep, timeStamp);
99 _localMaxTimeStampThisTimeStep = std::max(_localMaxTimeStampThisTimeStep, timeStamp);
102 assertion1(timeStamp<std::numeric_limits<double>::max()/10.0,timeStamp);
108 assertion1(cellSize<std::numeric_limits<double>::max()/10.0,cellSize);
113 logDebug(
"update(double,double,double)",
"updated with dt=" << timeStepSize <<
", t=" << timeStamp <<
", h=" << cellSize <<
": t(new)=" <<
_minTimeStampThisTimeStep );
117{{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::SolverState {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::getSolverState()
const {
122{%
if REFINEMENT_CRITERION_IMPLEMENTATION!=
"<user-defined>" %}
124 const double * __restrict__ Q,
129 {%
if REFINEMENT_CRITERION_IMPLEMENTATION==
"<empty>" %}
135 {{REFINEMENT_CRITERION_IMPLEMENTATION}}
141{%
if INITIAL_CONDITIONS_IMPLEMENTATION!=
"<user-defined>" %}
142void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::initialCondition(
143 double * __restrict__ Q,
147 bool gridIsConstructed
149 {{INITIAL_CONDITIONS_IMPLEMENTATION}}
154{%
if BOUNDARY_CONDITIONS_IMPLEMENTATION!=
"<user-defined>" and BOUNDARY_CONDITIONS_IMPLEMENTATION!=
"<none>" %}
155void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::boundaryConditions(
156 const double * __restrict__ Qinside,
157 double * __restrict__ Qoutside,
162 {%
if BOUNDARY_CONDITIONS_IMPLEMENTATION!=
"<empty>" %}
163 {{BOUNDARY_CONDITIONS_IMPLEMENTATION}}
169void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::startGridConstructionStep() {
170 assertion( _solverState == SolverState::GridConstruction );
174void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::finishGridConstructionStep() {
178void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::startGridInitialisationStep() {
179 _solverState = SolverState::GridInitialisation;
183void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::finishGridInitialisationStep() {
187void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::startTimeStep(
188 double globalMinTimeStamp,
189 double globalMaxTimeStamp,
190 double globalMinTimeStepSize,
191 double globalMaxTimeStepSize
193 switch (_solverState) {
194 case SolverState::GridConstruction:
195 _solverState = SolverState::GridInitialisation;
197 case SolverState::GridInitialisation:
198 _solverState = SolverState::ProjectOnFacesAndComputeVolumeIntegralOfStep0;
200 case SolverState::Suspended:
201 _solverState = SolverState::ProjectOnFacesAndComputeVolumeIntegralOfStep0;
203 case SolverState::Plotting:
204 _solverState = SolverState::ProjectOnFacesAndComputeVolumeIntegralOfStep0;
206 {%
for item in range(RK_STEPS-1) %}
207 case SolverState::ProjectOnFacesAndComputeVolumeIntegralOfStep{{item}}:
208 _solverState = SolverState::SolveRiemannProblemAndAddToVolumeIntegralOfStep{{item}};
210 case SolverState::SolveRiemannProblemAndAddToVolumeIntegralOfStep{{item}}:
211 _solverState = SolverState::ProjectOnFacesAndComputeVolumeIntegralOfStep{{item+1}};
214 case SolverState::ProjectOnFacesAndComputeVolumeIntegralOfStep{{RK_STEPS-1}}:
215 _solverState = SolverState::SolveRiemannProblemAndAddToVolumeIntegralOfStep{{RK_STEPS-1}};
217 case SolverState::SolveRiemannProblemAndAddToVolumeIntegralOfStep{{RK_STEPS-1}}:
218 _solverState = SolverState::ProjectOnFacesAndComputeVolumeIntegralOfStep0;
222 {{START_TIME_STEP_IMPLEMENTATION}}
224 if ( isFirstGridSweepOfTimeStep() ) {
243 _localMinTimeStampThisTimeStep = std::numeric_limits<double>::max();
244 _localMaxTimeStampThisTimeStep = std::numeric_limits<double>::min();
255void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::finishTimeStep() {
256 if ( isLastGridSweepOfTimeStep() ) {
266 double newLocalMinTimeStamp = _localMinTimeStampThisTimeStep;
267 double newLocalMaxTimeStamp = _localMaxTimeStampThisTimeStep;
317 &newLocalMinTimeStamp,
318 &_localMinTimeStampThisTimeStep,
324 &newLocalMaxTimeStamp,
325 &_localMaxTimeStampThisTimeStep,
348 {{FINISH_TIME_STEP_IMPLEMENTATION}}
352void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::startPlottingStep(
353 double globalMinTimeStamp,
354 double globalMaxTimeStamp,
355 double globalMinTimeStepSize,
356 double globalMaxTimeStepSize
358 assertion( mayPlot() or ::tarch::hasNonCriticalAssertionBeenViolated() );
359 _solverState = SolverState::Plotting;
363void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::finishPlottingStep() {
367std::string {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}
::toString(SolverState
state) {
369 case SolverState::GridConstruction:
370 return "grid-construction";
371 case SolverState::GridInitialisation:
372 return "grid-initialisation";
373 case SolverState::Plotting:
375 {%
for item in range(RK_STEPS) %}
376 case SolverState::ProjectOnFacesAndComputeVolumeIntegralOfStep{{item}}:
377 return "project-on-faces-and-compute-volume-integral-of-step-{{item}}";
379 case SolverState::SolveRiemannProblemAndAddToVolumeIntegralOfStep{{item}}:
380 return "solve-Riemann-problem-and-add-to-volume-integral-of-step-{{item}}";
387bool {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::mayPlot()
const {
388 return isLastGridSweepOfTimeStep()
389 or _solverState==SolverState::GridInitialisation
390 or _solverState==SolverState::Plotting;
394bool {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::isFirstGridSweepOfTimeStep()
const {
395 return _solverState==SolverState::ProjectOnFacesAndComputeVolumeIntegralOfStep0;
399bool {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::isLastGridSweepOfTimeStep()
const {
400 return _solverState==SolverState::SolveRiemannProblemAndAddToVolumeIntegralOfStep{{RK_STEPS-1}};
404void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::startSimulation() {
409void {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::finishSimulation() {
414bool {{NAMESPACE | join(
"::")}}::{{CLASSNAME}}::cellCanUseStatelessPDETerms(
425{{ABSTRACT_SOLVER_USER_DEFINITIONS}}