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_initial_temperature_interface_h
23 #define _aspect_initial_temperature_interface_h
24 
25 #include <aspect/plugins.h>
26 #include <aspect/utilities.h>
28 
29 #include <deal.II/base/point.h>
30 #include <deal.II/base/parameter_handler.h>
31 
32 #include <boost/core/demangle.hpp>
33 #include <typeinfo>
34 
35 
36 namespace aspect
37 {
38  template <int dim> class SimulatorAccess;
39 
46  namespace InitialTemperature
47  {
53  template <int dim>
54  class Interface : public Plugins::InterfaceBase
55  {
56  public:
60  virtual
61  double initial_temperature (const Point<dim> &position) const = 0;
62  };
63 
64 
70  template <int dim>
71  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
72  {
73  public:
78  static
79  void
80  declare_parameters (ParameterHandler &prm);
81 
87  void
88  parse_parameters (ParameterHandler &prm) override;
89 
95  double
96  initial_temperature (const Point<dim> &position) const;
97 
115  static
116  void
117  register_initial_temperature (const std::string &name,
118  const std::string &description,
119  void (*declare_parameters_function) (ParameterHandler &),
120  std::unique_ptr<Interface<dim>> (*factory_function) ());
121 
122 
130  DEAL_II_DEPRECATED
131  const std::vector<std::string> &
132  get_active_initial_temperature_names () const;
133 
141  DEAL_II_DEPRECATED
142  const std::list<std::unique_ptr<Interface<dim>>> &
143  get_active_initial_temperature_conditions () const;
144 
159  template <typename InitialTemperatureType,
160  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,InitialTemperatureType>::value>>
161  DEAL_II_DEPRECATED
162  bool
163  has_matching_initial_temperature_model () const;
164 
181  template <typename InitialTemperatureType,
182  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,InitialTemperatureType>::value>>
183  DEAL_II_DEPRECATED
184  const InitialTemperatureType &
185  get_matching_initial_temperature_model () const;
186 
187 
197  static
198  void
199  write_plugin_graph (std::ostream &output_stream);
200 
204  DeclException1 (ExcInitialTemperatureNameNotFound,
205  std::string,
206  << "Could not find entry <"
207  << arg1
208  << "> among the names of registered initial temperature objects.");
209  private:
216  std::vector<aspect::Utilities::Operator> model_operators;
217  };
218 
219 
220 
221  template <int dim>
222  template <typename InitialTemperatureType, typename>
223  inline
224  bool
226  {
227  return this->template has_matching_active_plugin<InitialTemperatureType>();
228  }
229 
230 
231  template <int dim>
232  template <typename InitialTemperatureType, typename>
233  inline
234  const InitialTemperatureType &
236  {
237  return this->template get_matching_active_plugin<InitialTemperatureType>();
238  }
239 
240 
247  template <int dim>
248  std::string
250 
251 
252 
260 #define ASPECT_REGISTER_INITIAL_TEMPERATURE_MODEL(classname,name,description) \
261  template class classname<2>; \
262  template class classname<3>; \
263  namespace ASPECT_REGISTER_INITIAL_TEMPERATURE_MODEL_ ## classname \
264  { \
265  aspect::internal::Plugins::RegisterHelper<aspect::InitialTemperature::Interface<2>,classname<2>> \
266  dummy_ ## classname ## _2d (&aspect::InitialTemperature::Manager<2>::register_initial_temperature, \
267  name, description); \
268  aspect::internal::Plugins::RegisterHelper<aspect::InitialTemperature::Interface<3>,classname<3>> \
269  dummy_ ## classname ## _3d (&aspect::InitialTemperature::Manager<3>::register_initial_temperature, \
270  name, description); \
271  }
272  }
273 }
274 
275 
276 #endif
virtual void parse_parameters(ParameterHandler &prm)
std::string get_valid_model_names_pattern()
void write_plugin_graph(std::ostream &output_stream)
DEAL_II_DEPRECATED bool has_matching_initial_temperature_model() const
std::vector< aspect::Utilities::Operator > model_operators
Definition: interface.h:216
Definition: compat.h:59
virtual double initial_temperature(const Point< dim > &position) const =0
DEAL_II_DEPRECATED const InitialTemperatureType & get_matching_initial_temperature_model() const
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.")