Peano
Loading...
Searching...
No Matches
SeparateSweepsAbstract.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
9
10{{SOLVER_INCLUDES}}
11
13#include "exahype2/Solver.h"
14
15#include "tarch/la/Vector.h"
18
20
21#include "Constants.h"
22
23{% if USE_VARIABLE_SHORTCUT is sameas True %}
24#include "VariableShortcuts.h"
25{% endif %}
26
27{% for item in NAMESPACE -%}
28 namespace {{ item }} {
29
30{%- endfor %}
31 class {{CLASSNAME}};
32
33{% for item in NAMESPACE -%}
34 }
35{%- endfor %}
36
37
38
39class {{NAMESPACE | join("::")}}::{{CLASSNAME}}: public ::exahype2::Solver {
40 public:
41 enum class SolverState {
42 GridConstruction,
43 GridInitialisation,
44 Suspended,
45 PlottingAfterGridInitialisation,
46 RungeKuttaSubStep0AfterGridInitialisation,
47 Plotting {% for item in range(RK_STEPS) -%}
48 ,
49 RungeKuttaSubStep{{item}}
50 {%- endfor %}
51 {% if RECONSTRUCTION_STAGES!=0 %} {% for item in range(RECONSTRUCTION_STAGES) -%}
52 ,
53 ReconstructionSubStep{{item}}
54 {%- endfor %}
55 {% endif %}
56 };
57
58 static std::string toString(SolverState);
59
60 static constexpr int NumberOfGridCellsPerPatchPerAxis = {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}};
61
67 static constexpr double MaxAdmissiblePatchH = {{MAX_GRID_CELL_H}} * NumberOfGridCellsPerPatchPerAxis;
68 static constexpr double MaxAdmissibleGridCellH = {{MAX_GRID_CELL_H}};
69 static constexpr double MaxAdmissibleCellH = MaxAdmissiblePatchH;
70
79 static constexpr double MinAdmissiblePatchH = {{MIN_GRID_CELL_H}} * NumberOfGridCellsPerPatchPerAxis;
80 static constexpr double MinAdmissibleGridCellH = {{MIN_GRID_CELL_H}};
81 static constexpr double MinAdmissibleCellH = MinAdmissiblePatchH;
82
83
84 {{CLASSNAME}}();
85
89 static std::bitset<Dimensions> PeriodicBC;
90
91 double getMinTimeStamp(bool ofCurrentlyRunningGridSweep=false) const final;
92 double getMaxTimeStamp(bool ofCurrentlyRunningGridSweep=false) const final;
93 double getMinTimeStepSize() const final;
94 double getMaxTimeStepSize() const final;
95
96
101 virtual ::exahype2::RefinementCommand refinementCriterion(
102 const double * __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}],
103 const tarch::la::Vector<Dimensions,double>& meshCellCentre,
104 const tarch::la::Vector<Dimensions,double>& meshCellH,
105 double t
106 ) {% if REFINEMENT_CRITERION_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final {% endif %};
107
108
109 virtual void initialCondition(
110 double * __restrict__ Q,
111 const tarch::la::Vector<Dimensions,double>& meshCellCentre,
113 bool gridIsConstructed
114 ) {% if INITIAL_CONDITIONS_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final {% endif %};
115
116
117 {% if BOUNDARY_CONDITIONS_IMPLEMENTATION=="<none>" %}
118 {% else %}
125 virtual void boundaryConditions(
126 const double * __restrict__ Qinside, // Qinside[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
127 double * __restrict__ Qoutside, // Qoutside[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
128 const tarch::la::Vector<Dimensions,double>& faceCentre,
130 double t,
131 int normal
132 ) {% if BOUNDARY_CONDITIONS_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final{% endif %};
133 {% endif %}
134
135
136
141 virtual void startGridConstructionStep() override;
142
147 virtual void finishGridConstructionStep() override;
148
149
150
155 virtual void startGridInitialisationStep() override;
156
161 virtual void finishGridInitialisationStep() override;
162
163 virtual void suspendSolversForOneGridSweep() override;
164
165
166
171 virtual void startTimeStep(
172 double globalMinTimeStamp,
173 double globalMaxTimeStamp,
174 double globalMinTimeStepSize,
175 double globalMaxTimeStepSize
176 ) override;
177
182 virtual void finishTimeStep() override;
183
184
189 virtual void startPlottingStep(
190 double globalMinTimeStamp,
191 double globalMaxTimeStamp,
192 double globalMinTimeStepSize,
193 double globalMaxTimeStepSize
194 ) override;
195
196
201 virtual void finishPlottingStep() override;
202
203
213 double getMaxPatchSize(bool currentTimeStep = true) const;
214 double getMinPatchSize(bool currentTimeStep = true) const;
215 double getMaxGridCellSize(bool currentTimeStep = true) const;
216 double getMinGridCellSize(bool currentTimeStep = true) const;
217
224 virtual double getMaxMeshSize() const override final;
225 virtual double getMinMeshSize() const override final;
226
233 void update(double timeStepSize, double timeStamp, double patchSize);
234
235 SolverState getSolverState() const;
236
237 #if defined(GPUOffloadingOMP)
238 #pragma omp declare target
239 #endif
240 static constexpr int NumberOfUnknowns = {{NUMBER_OF_UNKNOWNS}};
241 static constexpr int NumberOfAuxiliaryVariables = {{NUMBER_OF_AUXILIARY_VARIABLES}};
242 {{SOLVER_CONSTANTS}}
243 #if defined(GPUOffloadingOMP)
244 #pragma omp end declare target
245 #endif
246
251 virtual bool mayPlot() const override;
252
257 bool isFirstGridSweepOfTimeStep() const;
258 bool isLastGridSweepOfTimeStep() const;
259
264 virtual void startSimulation() override;
265
270 virtual void finishSimulation() override;
271
272 protected:
274
275 SolverState _solverState;
276
277 double _minTimeStamp;
278 double _maxTimeStamp;
279
282
283 double _localMinTimeStampThisTimeStep;
284 double _localMaxTimeStampThisTimeStep;
285
286 double _minGridCellH;
287 double _maxGridCellH;
288
291
292 double _minTimeStepSize;
293 double _maxTimeStepSize;
294
297
298 int _patchUpdates;
299
301
302 {{ABSTRACT_SOLVER_USER_DECLARATIONS}}
303};
304
305
306
307{# 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