ASPECT
interface.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2023 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  {
48  using namespace dealii;
49 
55  template <int dim>
56  class Interface : public Plugins::InterfaceBase
57  {
58  public:
62  virtual
63  double initial_temperature (const Point<dim> &position) const = 0;
64  };
65 
66 
72  template <int dim>
73  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
74  {
75  public:
80  static
81  void
82  declare_parameters (ParameterHandler &prm);
83 
89  void
90  parse_parameters (ParameterHandler &prm) override;
91 
97  double
98  initial_temperature (const Point<dim> &position) const;
99 
117  static
118  void
119  register_initial_temperature (const std::string &name,
120  const std::string &description,
121  void (*declare_parameters_function) (ParameterHandler &),
122  std::unique_ptr<Interface<dim>> (*factory_function) ());
123 
124 
133  const std::vector<std::string> &
134  get_active_initial_temperature_names () const;
135 
144  const std::list<std::unique_ptr<Interface<dim>>> &
145  get_active_initial_temperature_conditions () const;
146 
161  template <typename InitialTemperatureType,
162  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,InitialTemperatureType>::value>>
164  bool
165  has_matching_initial_temperature_model () const;
166 
183  template <typename InitialTemperatureType,
184  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,InitialTemperatureType>::value>>
186  const InitialTemperatureType &
187  get_matching_initial_temperature_model () const;
188 
189 
199  static
200  void
201  write_plugin_graph (std::ostream &output_stream);
202 
206  DeclException1 (ExcInitialTemperatureNameNotFound,
207  std::string,
208  << "Could not find entry <"
209  << arg1
210  << "> among the names of registered initial temperature objects.");
211  private:
218  std::vector<aspect::Utilities::Operator> model_operators;
219  };
220 
221 
222 
223  template <int dim>
224  template <typename InitialTemperatureType, typename>
225  inline
226  bool
228  {
229  return this->template has_matching_active_plugin<InitialTemperatureType>();
230  }
231 
232 
233  template <int dim>
234  template <typename InitialTemperatureType, typename>
235  inline
236  const InitialTemperatureType &
238  {
239  return this->template get_matching_active_plugin<InitialTemperatureType>();
240  }
241 
242 
249  template <int dim>
250  std::string
252 
253 
254 
262 #define ASPECT_REGISTER_INITIAL_TEMPERATURE_MODEL(classname,name,description) \
263  template class classname<2>; \
264  template class classname<3>; \
265  namespace ASPECT_REGISTER_INITIAL_TEMPERATURE_MODEL_ ## classname \
266  { \
267  aspect::internal::Plugins::RegisterHelper<aspect::InitialTemperature::Interface<2>,classname<2>> \
268  dummy_ ## classname ## _2d (&aspect::InitialTemperature::Manager<2>::register_initial_temperature, \
269  name, description); \
270  aspect::internal::Plugins::RegisterHelper<aspect::InitialTemperature::Interface<3>,classname<3>> \
271  dummy_ ## classname ## _3d (&aspect::InitialTemperature::Manager<3>::register_initial_temperature, \
272  name, description); \
273  }
274  }
275 }
276 
277 
278 #endif
StructuredDataLookup< dim > DEAL_II_DEPRECATED
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:218
Definition: compat.h:59
DEAL_II_DEPRECATED const InitialTemperatureType & get_matching_initial_temperature_model() const
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.")