ASPECT
interface.h
Go to the documentation of this file.
1 // ------------------------------------------------------
2 //
3 // SPDX-License-Identifier: GPL-2.0-or-later
4 //
5 // SPDX-FileCopyrightText: Copyright (C) 2011-2025 by the ASPECT authors.
6 //
7 // This file is part of ASPECT.
8 //
9 // Detailed license information governing the source code and
10 // contributions can be found in the folder LICENSES and in
11 // LICENSE and CONTRIBUTING.md at the top level directory.
12 //
13 // ------------------------------------------------------
14 
15 
16 #ifndef _aspect_initial_temperature_interface_h
17 #define _aspect_initial_temperature_interface_h
18 
19 #include <aspect/plugins.h>
20 #include <aspect/utilities.h>
22 
23 #include <deal.II/base/point.h>
25 
26 #include <boost/core/demangle.hpp>
27 #include <typeinfo>
28 
29 
30 namespace aspect
31 {
32  template <int dim> class SimulatorAccess;
33 
40  namespace InitialTemperature
41  {
47  template <int dim>
48  class Interface : public Plugins::InterfaceBase
49  {
50  public:
54  virtual
55  double initial_temperature (const Point<dim> &position) const = 0;
56  };
57 
58 
64  template <int dim>
65  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
66  {
67  public:
72  static
73  void
75 
81  void
82  parse_parameters (ParameterHandler &prm) override;
83 
89  double
90  initial_temperature (const Point<dim> &position) const;
91 
109  static
110  void
111  register_initial_temperature (const std::string &name,
112  const std::string &description,
113  void (*declare_parameters_function) (ParameterHandler &),
114  std::unique_ptr<Interface<dim>> (*factory_function) ());
115 
116 
125  const std::vector<std::string> &
126  get_active_initial_temperature_names () const;
127 
136  const std::list<std::unique_ptr<Interface<dim>>> &
137  get_active_initial_temperature_conditions () const;
138 
153  template <typename InitialTemperatureType,
154  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,InitialTemperatureType>::value>>
156  bool
157  has_matching_initial_temperature_model () const;
158 
175  template <typename InitialTemperatureType,
176  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,InitialTemperatureType>::value>>
178  const InitialTemperatureType &
179  get_matching_initial_temperature_model () const;
180 
181 
191  static
192  void
193  write_plugin_graph (std::ostream &output_stream);
194 
198  DeclException1 (ExcInitialTemperatureNameNotFound,
199  std::string,
200  << "Could not find entry <"
201  << arg1
202  << "> among the names of registered initial temperature objects.");
203  private:
210  std::vector<aspect::Utilities::Operator> model_operators;
211  };
212 
213 
214 
215  template <int dim>
216  template <typename InitialTemperatureType, typename>
217  inline
218  bool
220  {
221  return this->template has_matching_active_plugin<InitialTemperatureType>();
222  }
223 
224 
225  template <int dim>
226  template <typename InitialTemperatureType, typename>
227  inline
228  const InitialTemperatureType &
230  {
231  return this->template get_matching_active_plugin<InitialTemperatureType>();
232  }
233 
234 
241  template <int dim>
242  std::string
244 
245 
246 
254 #define ASPECT_REGISTER_INITIAL_TEMPERATURE_MODEL(classname,name,description) \
255  template class classname<2>; \
256  template class classname<3>; \
257  namespace ASPECT_REGISTER_INITIAL_TEMPERATURE_MODEL_ ## classname \
258  { \
259  aspect::internal::Plugins::RegisterHelper<aspect::InitialTemperature::Interface<2>,classname<2>> \
260  dummy_ ## classname ## _2d (&aspect::InitialTemperature::Manager<2>::register_initial_temperature, \
261  name, description); \
262  aspect::internal::Plugins::RegisterHelper<aspect::InitialTemperature::Interface<3>,classname<3>> \
263  dummy_ ## classname ## _3d (&aspect::InitialTemperature::Manager<3>::register_initial_temperature, \
264  name, description); \
265  }
266  }
267 }
268 
269 
270 #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:210
virtual double initial_temperature(const Point< dim > &position) const =0
DEAL_II_DEPRECATED const InitialTemperatureType & get_matching_initial_temperature_model() const
#define DEAL_II_DEPRECATED
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.")