Peano
StaticCouplingAbstract.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 #include "exahype2/Solver.h"
10 
11 #include "tarch/la/Vector.h"
12 #include "tarch/logging/Log.h"
13 #include "tarch/NonCriticalAssertions.h"
14 #include "tarch/mpi/Rank.h"
15 #include "tarch/multicore/BooleanSemaphore.h"
16 
17 #include "peano4/utils/Globals.h"
18 
19 #include "Constants.h"
20 
21 {{SOLVER_INCLUDES}}
22 
23 {% for item in NAMESPACE -%}
24  namespace {{ item }} {
25 
26 {%- endfor %}
27  class {{CLASSNAME}};
28 
29 {% for item in NAMESPACE -%}
30  }
31 {%- endfor %}
32 
33 class {{NAMESPACE | join("::")}}::{{CLASSNAME}}: public ::exahype2::Solver {
34  public:
52  enum class Offloadable {
53  Yes
54  };
55 
56  enum class SolverState {
57  GridConstruction,
58  GridInitialisation,
59  LimiterStatusSpreadingToNeighbours,
60  TimeStepping,
61  Plotting,
62  PlottingAfterGridInitialisation,
63  Suspended
64  };
65 
66  static std::string toString(SolverState);
67 
68  {{CLASSNAME}}();
69  ~{{CLASSNAME}}();
70 
71  SolverState getSolverState() const;
72 
73  double getMinTimeStamp(bool ofCurrentlyRunningGridSweep=false) const final;
74  double getMaxTimeStamp(bool ofCurrentlyRunningGridSweep=false) const final;
75  double getMinTimeStepSize() const final;
76  double getMaxTimeStepSize() const final;
77 
78  virtual double getMaxMeshSize() const override final;
79  virtual double getMinMeshSize() const override final;
80 
81  //TODO: link these to the max and min of the other solvers
82  static constexpr double MaxAdmissibleCellH = 1000.;
83  static constexpr double MinAdmissibleCellH = 0.;
84 
89  virtual void startGridConstructionStep() override;
90 
95  virtual void finishGridConstructionStep() override;
96 
97 
102  virtual void startGridInitialisationStep() override;
103 
108  virtual void finishGridInitialisationStep() override;
109 
110 
111  virtual void suspendSolversForOneGridSweep() override;
112 
113 
118  virtual void startTimeStep() override;
119 
124  virtual void finishTimeStep() override;
125 
126  virtual void printTimeStep(bool ofCurrentlyRunningGridSweep) override;
127 
132  virtual void startPlottingStep() override;
133 
138  virtual void finishPlottingStep() override;
139 
143  virtual bool mayPlot() const override;
144 
149  bool isFirstGridSweepOfTimeStep() const;
150  bool isLastGridSweepOfTimeStep() const;
151 
156  virtual void startSimulation() override;
157 
162  virtual void finishSimulation() override;
163 
164 
165  public:
171  void addTroubledCell();
172  int getNumberOfTroubledCells() const;
173 
177  void mapDiscreteMaximumPrincipleObservables(double* const observables, const double* const Q) const {
178  ::tarch::triggerNonCriticalAssertion( __FILE__, __LINE__, "map discrete maximum principle observables was called, it should never be.", "" );
179  }
180 
184  double getDiscreteMaximumPrincipleRelaxationParameter(
185  const double& specifiedRelaxationParameter,
186  const int& observable,
187  const double& localMin,
188  const double& localMax,
189  const double& boundaryMinPerObservable,
190  const double& previousMax) const {
191  ::tarch::triggerNonCriticalAssertion( __FILE__, __LINE__, "get discrete maximum principle relaxation parameter was called, it should never be.", "" );
192  return 0.0;
193  }
194 
195 {% if ADMISSIBILITY_IMPLEMENTATION!="<none>" %}
196  virtual bool isPhysicallyAdmissible(
197  const {{REGULAR_SOLVER_STORAGE_PRECISION}}* const Q,
198  const tarch::la::Vector<DIMENSIONS,double>& x,
199  const tarch::la::Vector<DIMENSIONS,double>& h,
200  const double timeStamp) {% if ADMISSIBILITY_IMPLEMENTATION=="<user-defined>" %} = 0 {% else %} final {% endif %};
201 {% endif %}
202 
203 
204  protected:
205  static tarch::logging::Log _log;
206 
207  SolverState _solverState;
208 
209  int _cellUpdates;
210 
212 
213  tarch::multicore::BooleanSemaphore _semaphore;
214 
215 
216  {{SOLVER_USER_DECLARATIONS}}
217 };
218 
219 
_cellUpdates(0)
constexpr double timeStamp
h
Definition: swe.py:79
tarch::logging::Log _log
This is variant 1 of the fused kernels.