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  template <int dim> class Simulator;
36 
37 
45  namespace TerminationCriteria
46  {
47 
62  template <int dim>
64  {
65  public:
82  virtual
83  bool
84  execute () = 0;
85 
98  virtual double check_for_last_time_step (const double time_step) const;
99  };
100 
101 
102 
103 
104 
105 
112  template <int dim>
113  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
114  {
115  public:
129  virtual
130  bool
131  execute () const;
132 
146  double check_for_last_time_step (const double time_step) const;
147 
152  static
153  void
154  declare_parameters (ParameterHandler &prm);
155 
161  void
162  parse_parameters (ParameterHandler &prm) override;
163 
181  static
182  void
183  register_termination_criterion (const std::string &name,
184  const std::string &description,
185  void (*declare_parameters_function) (ParameterHandler &),
186  std::unique_ptr<Interface<dim>> (*factory_function) ());
187 
197  static
198  void
199  write_plugin_graph (std::ostream &output_stream);
200 
204  DeclException1 (ExcTerminationCriteriaNameNotFound,
205  std::string,
206  << "Could not find entry <"
207  << arg1
208  << "> among the names of registered termination criteria objects.");
209  };
210 
211 
212 
220 #define ASPECT_REGISTER_TERMINATION_CRITERION(classname,name,description) \
221  template class classname<2>; \
222  template class classname<3>; \
223  namespace ASPECT_REGISTER_TERMINATION_CRITERION_ ## classname \
224  { \
225  aspect::internal::Plugins::RegisterHelper<aspect::TerminationCriteria::Interface<2>,classname<2>> \
226  dummy_ ## classname ## _2d (&aspect::TerminationCriteria::Manager<2>::register_termination_criterion, \
227  name, description); \
228  aspect::internal::Plugins::RegisterHelper<aspect::TerminationCriteria::Interface<3>,classname<3>> \
229  dummy_ ## classname ## _3d (&aspect::TerminationCriteria::Manager<3>::register_termination_criterion, \
230  name, description); \
231  }
232  }
233 }
234 
235 
236 #endif
virtual void parse_parameters(ParameterHandler &prm)
void write_plugin_graph(std::ostream &output_stream)
virtual double check_for_last_time_step(const double time_step) const
Definition: compat.h:59
static void declare_parameters(ParameterHandler &prm)
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.")