Peano
Loading...
Searching...
No Matches
OneSweepPerRungeKuttaStepAbstract.template.h
Go to the documentation of this file.
1// **********************************************************************************************
2// *** !!!WARNING!!! ***
3// *** WARNING: AUTO GENERATED FILE! DO NOT MODIFY BY HAND! YOUR CHANGES WILL BE OVERWRITTEN! ***
4// *** !!!WARNING!!! ***
5// *** Generated by Peano's Python API: www.peano-framework.org ***
6// **********************************************************************************************
7#pragma once
8
10#include "exahype2/Solver.h"
11
12#include "tarch/la/Vector.h"
15
17
18#include "Constants.h"
19
20{% if USE_VARIABLE_SHORTCUT is sameas True %}
21#include "VariableShortcuts.h"
22{% endif %}
23
24{{SOLVER_INCLUDES}}
25
26{% for item in NAMESPACE -%}
27 namespace {{ item }} {
28
29{%- endfor %}
30 class {{CLASSNAME}};
31
32{% for item in NAMESPACE -%}
33 }
34{%- endfor %}
35
36
37
38class {{NAMESPACE | join("::")}}::{{CLASSNAME}}: public ::exahype2::Solver {
39 public:
57 enum class Offloadable {
58 Yes
59 };
60
61 enum class SolverState {
62 GridConstruction,
63 GridInitialisation,
64 PlottingAfterGridInitialisation,
65 Suspended,
66 RungeKuttaSubStep0AfterGridInitialisation,
67 Plotting {% for item in range(RK_STEPS) -%}
68 ,
69 RungeKuttaSubStep{{item}}
70 {%- endfor %}
71 };
72
73 static std::string toString(SolverState);
74
75 static constexpr int NumberOfGridCellsPerPatchPerAxis = {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}};
76
82 static constexpr double MaxAdmissiblePatchH = {{MAX_GRID_CELL_H}} * NumberOfGridCellsPerPatchPerAxis;
83 static constexpr double MaxAdmissibleGridCellH = {{MAX_GRID_CELL_H}};
84 static constexpr double MaxAdmissibleCellH = MaxAdmissiblePatchH;
85
94 static constexpr double MinAdmissiblePatchH = {{MIN_GRID_CELL_H}} * NumberOfGridCellsPerPatchPerAxis;
95 static constexpr double MinAdmissibleGridCellH = {{MIN_GRID_CELL_H}};
96 static constexpr double MinAdmissibleCellH = MinAdmissiblePatchH;
97
98
99 {{CLASSNAME}}();
100
104 static std::bitset<Dimensions> PeriodicBC;
105
106 double getMinTimeStamp(bool ofCurrentlyRunningGridSweep=false) const final;
107 double getMaxTimeStamp(bool ofCurrentlyRunningGridSweep=false) const final;
108 double getMinTimeStepSize() const final;
109 double getMaxTimeStepSize() const final;
110
111
116 virtual ::exahype2::RefinementCommand refinementCriterion(
117 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
118 const tarch::la::Vector<Dimensions,double>& meshCellCentre,
119 const tarch::la::Vector<Dimensions,double>& meshCellH,
120 double t
121 ) {% if REFINEMENT_CRITERION_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final {% endif %};
122
123
124 virtual void initialCondition(
125 double * __restrict__ Q,
126 const tarch::la::Vector<Dimensions,double>& meshCellCentre,
128 bool gridIsConstructed
129 ) {% if INITIAL_CONDITIONS_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final {% endif %};
130
131
132 {% if BOUNDARY_CONDITIONS_IMPLEMENTATION=="<none>" %}
133 {% else %}
140 virtual void boundaryConditions(
141 const double * __restrict__ Qinside, // Qinside[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
142 double * __restrict__ Qoutside, // Qoutside[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
143 const tarch::la::Vector<Dimensions,double>& faceCentre,
145 double t,
146 int normal
147 ) {% if BOUNDARY_CONDITIONS_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final{% endif %};
148 {% endif %}
149
150
151
156 virtual void startGridConstructionStep() override;
157
162 virtual void finishGridConstructionStep() override;
163
164
165
170 virtual void startGridInitialisationStep() override;
171
176 virtual void finishGridInitialisationStep() override;
177
178
179
180
185 virtual void startTimeStep(
186 double globalMinTimeStamp,
187 double globalMaxTimeStamp,
188 double globalMinTimeStepSize,
189 double globalMaxTimeStepSize
190 ) override;
191
196 virtual void finishTimeStep() override;
197
198
203 virtual void startPlottingStep(
204 double globalMinTimeStamp,
205 double globalMaxTimeStamp,
206 double globalMinTimeStepSize,
207 double globalMaxTimeStepSize
208 ) override;
209
210
215 virtual void finishPlottingStep() override;
216
217
227 double getMaxPatchSize(bool currentTimeStep = true) const;
228 double getMinPatchSize(bool currentTimeStep = true) const;
229 double getMaxGridCellSize(bool currentTimeStep = true) const;
230 double getMinGridCellSize(bool currentTimeStep = true) const;
231
238 virtual double getMaxMeshSize() const override final;
239 virtual double getMinMeshSize() const override final;
240
247 void update(double timeStepSize, double timeStamp, double patchSize);
248
249 SolverState getSolverState() const;
250
251 #if defined(GPUOffloadingOMP)
252 #pragma omp declare target
253 #endif
254 static constexpr int NumberOfUnknowns = {{NUMBER_OF_UNKNOWNS}};
255 static constexpr int NumberOfAuxiliaryVariables = {{NUMBER_OF_AUXILIARY_VARIABLES}};
256 {{SOLVER_CONSTANTS}}
257 #if defined(GPUOffloadingOMP)
258 #pragma omp end declare target
259 #endif
260
264 virtual bool mayPlot() const override;
265
266 virtual void suspendSolversForOneGridSweep() override;
267
272 bool isFirstGridSweepOfTimeStep() const;
273 bool isLastGridSweepOfTimeStep() const;
274
279 virtual void startSimulation() override;
280
285 virtual void finishSimulation() override;
286
287 protected:
289
290 SolverState _solverState;
291
292 double _minTimeStamp;
293 double _maxTimeStamp;
294
297
298 double _localMinTimeStampThisTimeStep;
299 double _localMaxTimeStampThisTimeStep;
300
301 double _minGridCellH;
302 double _maxGridCellH;
303
306
307 double _minTimeStepSize;
308 double _maxTimeStepSize;
309
312
313 int _patchUpdates;
314
316
317 {{ABSTRACT_SOLVER_USER_DECLARATIONS}}
318};
319
320
321
322{# Empty line here #}
_minGridCellHThisTimeStep(std::numeric_limits< double >::max()/NumberOfGridCellsPerPatchPerAxis/2.0)
_maxGridCellHThisTimeStep(0.0)
_minGridCellH(std::numeric_limits< double >::max()/NumberOfGridCellsPerPatchPerAxis/2.0)
_maxGridCellH(0.0)
_maxTimeStampThisTimeStep(0.0)
_minTimeStepSize(std::numeric_limits< double >::max())
_minTimeStamp(0.0)
_maxTimeStepSizeThisTimeStep(0.0)
_maxTimeStamp(0.0)
_minTimeStampThisTimeStep(0.0)
_minTimeStepSizeThisTimeStep(std::numeric_limits< double >::max())
_maxTimeStepSize(0.0)
Definition vec.h:7
Log Device.
Definition Log.h:516
std::string toString(Filter filter)
Definition convert.cpp:170
tarch::logging::Log _log("exahype2::fv")
For the generic kernels that I use here most of the time.
Definition CellAccess.h:13
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:19
Simple vector class.
Definition Vector.h:150