ASPECT
interface.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 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_termination_criteria_interface_h
23 #define _aspect_termination_criteria_interface_h
24 
25 #include <aspect/global.h>
26 #include <aspect/plugins.h>
27 
28 #include <memory>
29 #include <deal.II/base/parameter_handler.h>
31 
32 
33 namespace aspect
34 {
35  using namespace dealii;
36 
37  template <int dim> class Simulator;
38 
39 
47  namespace TerminationCriteria
48  {
49 
64  template <int dim>
66  {
67  public:
84  virtual
85  bool
86  execute () = 0;
87 
100  virtual double check_for_last_time_step (const double time_step) const;
101  };
102 
103 
104 
105 
106 
107 
114  template <int dim>
115  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
116  {
117  public:
131  virtual
132  bool
133  execute () const;
134 
148  double check_for_last_time_step (const double time_step) const;
149 
154  static
155  void
156  declare_parameters (ParameterHandler &prm);
157 
163  void
164  parse_parameters (ParameterHandler &prm) override;
165 
183  static
184  void
185  register_termination_criterion (const std::string &name,
186  const std::string &description,
187  void (*declare_parameters_function) (ParameterHandler &),
188  std::unique_ptr<Interface<dim>> (*factory_function) ());
189 
199  static
200  void
201  write_plugin_graph (std::ostream &output_stream);
202 
206  DeclException1 (ExcTerminationCriteriaNameNotFound,
207  std::string,
208  << "Could not find entry <"
209  << arg1
210  << "> among the names of registered termination criteria objects.");
211  };
212 
213 
214 
222 #define ASPECT_REGISTER_TERMINATION_CRITERION(classname,name,description) \
223  template class classname<2>; \
224  template class classname<3>; \
225  namespace ASPECT_REGISTER_TERMINATION_CRITERION_ ## classname \
226  { \
227  aspect::internal::Plugins::RegisterHelper<aspect::TerminationCriteria::Interface<2>,classname<2>> \
228  dummy_ ## classname ## _2d (&aspect::TerminationCriteria::Manager<2>::register_termination_criterion, \
229  name, description); \
230  aspect::internal::Plugins::RegisterHelper<aspect::TerminationCriteria::Interface<3>,classname<3>> \
231  dummy_ ## classname ## _3d (&aspect::TerminationCriteria::Manager<3>::register_termination_criterion, \
232  name, description); \
233  }
234  }
235 }
236 
237 
238 #endif
void write_plugin_graph(std::ostream &output_stream)
Definition: compat.h:59
void declare_parameters(ParameterHandler &prm)
Definition: compat.h:42
DeclException1(ProbabilityFunctionNegative, Point< dim >,<< "Your probability density function in the particle generator " "returned a negative probability density for the following position: "<< arg1<< ". Please check your function expression.")