Peano
Loading...
Searching...
No Matches
SingleSweepAbstract.template.h
Go to the documentation of this file.
1// This file is part of the ExaHyPE2 project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
6#include "exahype2/Solver.h"
7#include "tarch/la/Vector.h"
11
13
14#include "Constants.h"
15
16{% if USE_VARIABLE_SHORTCUT is sameas True %}
17#include "VariableShortcuts.h"
18{% endif %}
19
20{{SOLVER_INCLUDES}}
21
22{% for item in NAMESPACE -%}
23 namespace {{ item }} {
24
25{%- endfor %}
26 class {{CLASSNAME}};
27
28{% for item in NAMESPACE -%}
29 }
30{%- endfor %}
31
32class {{NAMESPACE | join("::")}}::{{CLASSNAME}}: public ::exahype2::Solver {
33 public:
34 enum class SolverState {
35 GridConstruction,
36 GridInitialisation,
37 TimeStep,
38 Plotting,
39 TimeStepAfterGridInitialisation,
40 PlottingAfterGridInitialisation,
41 Suspended
42 };
43
44 static std::string toString(SolverState);
45
46 static constexpr int NumberOfFiniteVolumesPerAxisPerPatch = {{NUMBER_OF_VOLUMES_PER_AXIS}};
47
53 static constexpr double MaxAdmissiblePatchH = {{MAX_VOLUME_H}} * NumberOfFiniteVolumesPerAxisPerPatch;
54 static constexpr double MaxAdmissibleVolumeH = {{MAX_VOLUME_H}};
55 static constexpr double MaxAdmissibleCellH = MaxAdmissiblePatchH;
56
65 static constexpr double MinAdmissiblePatchH = {{MIN_VOLUME_H}} * NumberOfFiniteVolumesPerAxisPerPatch;
66 static constexpr double MinAdmissibleVolumeH = {{MIN_VOLUME_H}};
67 static constexpr double MinAdmissibleCellH = MinAdmissiblePatchH;
68
69 {{CLASSNAME}}();
70
74 static std::bitset<Dimensions> PeriodicBC;
75
76 double getMinTimeStamp() const final;
77 double getMaxTimeStamp() const final;
78 double getMinTimeStepSize() const final;
79 double getMaxTimeStepSize() const final;
80
85 virtual ::exahype2::RefinementCommand refinementCriterion(
86 [[maybe_unused]] const double* __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
87 [[maybe_unused]] const tarch::la::Vector<Dimensions, double>& volumeCentre,
88 [[maybe_unused]] const tarch::la::Vector<Dimensions, double>& volumeH,
89 [[maybe_unused]] double t
90 ) {% if REFINEMENT_CRITERION_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final {% endif %};
91
92 virtual void initialCondition(
93 [[maybe_unused]] double* __restrict__ Q, // Q[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
94 [[maybe_unused]] const tarch::la::Vector<Dimensions, double>& volumeCentre,
95 [[maybe_unused]] const tarch::la::Vector<Dimensions, double>& volumeH,
96 [[maybe_unused]] bool gridIsConstructed
97 ) {% if INITIAL_CONDITIONS_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final {% endif %};
98
99 {% if BOUNDARY_CONDITIONS_IMPLEMENTATION=="<none>" %}
100 {% else %}
107 virtual void boundaryConditions(
108 [[maybe_unused]] const double* __restrict__ Qinside, // Qinside[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
109 [[maybe_unused]] double* __restrict__ Qoutside, // Qoutside[{{NUMBER_OF_UNKNOWNS}}+{{NUMBER_OF_AUXILIARY_VARIABLES}}]
110 [[maybe_unused]] const tarch::la::Vector<Dimensions, double>& faceCentre,
111 [[maybe_unused]] const tarch::la::Vector<Dimensions, double>& volumeH,
112 [[maybe_unused]] double t,
113 [[maybe_unused]] int normal
114 ) {% if BOUNDARY_CONDITIONS_IMPLEMENTATION=="<user-defined>" %}= 0{% else %} final{% endif %};
115 {% endif %}
116
121 virtual void startGridConstructionStep() override;
122
127 virtual void finishGridConstructionStep() override;
128
133 virtual void startGridInitialisationStep() override;
134
139 virtual void finishGridInitialisationStep() override;
140
145 virtual void startTimeStep(
146 double globalMinTimeStamp,
147 double globalMaxTimeStamp,
148 double globalMinTimeStepSize,
149 double globalMaxTimeStepSize
150 ) override;
151
156 virtual void finishTimeStep() override;
157
162 virtual void startPlottingStep(
163 double globalMinTimeStamp,
164 double globalMaxTimeStamp,
165 double globalMinTimeStepSize,
166 double globalMaxTimeStepSize
167 ) override;
168
173 virtual void finishPlottingStep() override;
174
184 double getMaxPatchSize() const;
185 double getMinPatchSize() const;
186 double getMaxVolumeSize() const;
187 double getMinVolumeSize() const;
188
192 virtual double getMaxMeshSize() const override final;
193 virtual double getMinMeshSize() const override final;
194
201 void update(double timeStepSize, double timeStamp, double patchSize);
202
203 SolverState getSolverState() const;
204
205 #if defined(GPUOffloadingOMP)
206 #pragma omp declare target
207 #endif
208 static constexpr int NumberOfUnknowns = {{NUMBER_OF_UNKNOWNS}};
209 static constexpr int NumberOfAuxiliaryVariables = {{NUMBER_OF_AUXILIARY_VARIABLES}};
210 {{SOLVER_CONSTANTS}}
211 #if defined(GPUOffloadingOMP)
212 #pragma omp end declare target
213 #endif
214
218 virtual bool mayPlot() const override;
219
224 bool isFirstGridSweepOfTimeStep() const;
225 bool isLastGridSweepOfTimeStep() const;
226
227 {% if STATELESS_PDE_TERMS %}
234 {% else %}
241 {% endif %}
242 virtual bool patchCanUseStatelessPDETerms(
243 const tarch::la::Vector<Dimensions, double>& patchCentre,
245 double t,
246 double dt
247 ) const;
248
253 virtual void startSimulation() override;
254
255 virtual void suspendSolversForOneGridSweep() override;
256
261 virtual void finishSimulation() override;
262
263 protected:
265
266 SolverState _solverState;
267
268 double _minTimeStamp;
269 double _maxTimeStamp;
270
271 double _minTimeStampThisTimeStep;
272 double _maxTimeStampThisTimeStep;
273
274 double _localMinTimeStampThisTimeStep;
275 double _localMaxTimeStampThisTimeStep;
276
277 double _minVolumeH;
278 double _maxVolumeH;
279
280 double _minVolumeHThisTimeStep;
281 double _maxVolumeHThisTimeStep;
282
283 double _minTimeStepSize;
284 double _maxTimeStepSize;
285
286 double _minTimeStepSizeThisTimeStep;
287 double _maxTimeStepSizeThisTimeStep;
288
289 int _patchUpdates;
290
292
293 {{ABSTRACT_SOLVER_USER_DECLARATIONS}}
294};
295
296{# Empty line here #}
std::string toString(exahype2::RefinementCommand value)
Log Device.
Definition Log.h:517
This file is part of the multigrid project within Peano 4.
Definition __init__.py:1
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:19
Simple vector class.
Definition Vector.h:159