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>
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 
158 
163  bool should_refine_mesh() const;
164 
169 
174 
179  static
180  void
182 
188  void
190 
191  template <class Archive>
192  void
193  serialize (Archive &ar, const unsigned int)
194  {
196  }
197 
207  static
208  void
209  write_plugin_graph (std::ostream &output_stream);
210 
229  static
230  void
231  register_time_stepping_model (const std::string &name,
232  const std::string &description,
233  void (*declare_parameters_function) (ParameterHandler &),
234  std::unique_ptr<Interface<dim>> (*factory_function) ());
235 
236  private:
237 
242 
247 
255 
264 
270  };
271 
272 
273 
280 #define ASPECT_REGISTER_TIME_STEPPING_MODEL(classname,name,description) \
281  template class classname<2>; \
282  template class classname<3>; \
283  namespace ASPECT_REGISTER_TIME_STEPPING_MODEL_ ## classname \
284  { \
285  aspect::internal::Plugins::RegisterHelper<aspect::TimeStepping::Interface<2>,classname<2>> \
286  dummy_ ## classname ## _2d (&aspect::TimeStepping::Manager<2>::register_time_stepping_model, \
287  name, description); \
288  aspect::internal::Plugins::RegisterHelper<aspect::TimeStepping::Interface<3>,classname<3>> \
289  dummy_ ## classname ## _3d (&aspect::TimeStepping::Manager<3>::register_time_stepping_model, \
290  name, description); \
291  }
292 
293  }
294 }
295 
296 #endif
virtual std::pair< Reaction, double > determine_reaction(const TimeStepInfo &info)
bool should_repeat_time_step() const
void serialize(Archive &ar, const unsigned int)
Definition: interface.h:193
static void declare_parameters(ParameterHandler &prm)
double get_next_time_step_size() const
static void register_time_stepping_model(const std::string &name, const std::string &description, void(*declare_parameters_function)(ParameterHandler &), std::unique_ptr< Interface< dim >>(*factory_function)())
bool need_checkpoint_on_terminate() const
void parse_parameters(ParameterHandler &prm) override
static void write_plugin_graph(std::ostream &output_stream)
TerminationCriteria::Manager< dim > termination_manager
Definition: interface.h:269
bool should_simulation_terminate_now() const
void initialize_simulator(const Simulator< dim > &simulator_object) override