ASPECT
interface.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2019 - 2024 by the authors of the ASPECT code.
3 
4  This file is part of ASPECT.
5 
6  ASPECT is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)
9  any later version.
10 
11  ASPECT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with ASPECT; see the file LICENSE. If not see
18  <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 #ifndef _aspect_time_stepping_interface_h
23 #define _aspect_time_stepping_interface_h
24 
25 #include <aspect/global.h>
28 
29 namespace aspect
30 {
34  namespace TimeStepping
35  {
36 
45  enum class Reaction
46  {
62  advance
63  };
64 
69  struct TimeStepInfo
70  {
76 
82  };
83 
89  template <int dim>
91  {
92  public:
101  virtual
102  double
103  execute() = 0;
104 
117  virtual
118  std::pair<Reaction, double>
119  determine_reaction(const TimeStepInfo &info);
120  };
121 
122 
127  template <int dim>
128  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
129  {
130  public:
135  void initialize_simulator (const Simulator<dim> &simulator_object) override;
136 
137 
145  void
146  update() override;
147 
151  double get_next_time_step_size() const;
152 
157  bool should_repeat_time_step() const;
158 
163  bool should_refine_mesh() const;
164 
168  bool need_checkpoint_on_terminate() const;
169 
173  bool should_simulation_terminate_now() const;
174 
179  static
180  void
181  declare_parameters (ParameterHandler &prm);
182 
188  void
189  parse_parameters (ParameterHandler &prm) override;
190 
200  static
201  void
202  write_plugin_graph (std::ostream &output_stream);
203 
222  static
223  void
224  register_time_stepping_model (const std::string &name,
225  const std::string &description,
226  void (*declare_parameters_function) (ParameterHandler &),
227  std::unique_ptr<Interface<dim>> (*factory_function) ());
228 
229  private:
230 
235 
240 
245 
251 
257  };
258 
259 
260 
267 #define ASPECT_REGISTER_TIME_STEPPING_MODEL(classname,name,description) \
268  template class classname<2>; \
269  template class classname<3>; \
270  namespace ASPECT_REGISTER_TIME_STEPPING_MODEL_ ## classname \
271  { \
272  aspect::internal::Plugins::RegisterHelper<aspect::TimeStepping::Interface<2>,classname<2>> \
273  dummy_ ## classname ## _2d (&aspect::TimeStepping::Manager<2>::register_time_stepping_model, \
274  name, description); \
275  aspect::internal::Plugins::RegisterHelper<aspect::TimeStepping::Interface<3>,classname<3>> \
276  dummy_ ## classname ## _3d (&aspect::TimeStepping::Manager<3>::register_time_stepping_model, \
277  name, description); \
278  }
279 
280  }
281 }
282 
283 #endif
TerminationCriteria::Manager< dim > termination_manager
Definition: interface.h:256
void write_plugin_graph(std::ostream &output_stream)
Definition: compat.h:59
void declare_parameters(ParameterHandler &prm)