ASPECT
interface.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2022 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_gravity_model_interface_h
23 #define _aspect_gravity_model_interface_h
24 
25 #include <aspect/plugins.h>
26 #include <deal.II/base/point.h>
27 #include <deal.II/base/parameter_handler.h>
28 
29 namespace aspect
30 {
37  namespace GravityModel
38  {
39  using namespace dealii;
40 
46  template <int dim>
47  class Interface
48  {
49  public:
54  virtual ~Interface() = default;
55 
61  virtual void initialize ();
62 
66  virtual Tensor<1,dim> gravity_vector (const Point<dim> &position) const = 0;
67 
77  virtual void update();
78 
85  static
86  void
87  declare_parameters (ParameterHandler &prm);
88 
95  virtual
96  void
97  parse_parameters (ParameterHandler &prm);
98  };
99 
100 
101 
102 
118  template <int dim>
119  void
120  register_gravity_model (const std::string &name,
121  const std::string &description,
122  void (*declare_parameters_function) (ParameterHandler &),
123  std::unique_ptr<Interface<dim>> (*factory_function) ());
124 
135  template <int dim>
136  std::unique_ptr<Interface<dim>>
137  create_gravity_model (ParameterHandler &prm);
138 
139 
145  template <int dim>
146  void
147  declare_parameters (ParameterHandler &prm);
148 
149 
159  template <int dim>
160  void
161  write_plugin_graph (std::ostream &output_stream);
162 
163 
171 #define ASPECT_REGISTER_GRAVITY_MODEL(classname,name,description) \
172  template class classname<2>; \
173  template class classname<3>; \
174  namespace ASPECT_REGISTER_GRAVITY_MODEL_ ## classname \
175  { \
176  aspect::internal::Plugins::RegisterHelper<aspect::GravityModel::Interface<2>,classname<2>> \
177  dummy_ ## classname ## _2d (&aspect::GravityModel::register_gravity_model<2>, \
178  name, description); \
179  aspect::internal::Plugins::RegisterHelper<aspect::GravityModel::Interface<3>,classname<3>> \
180  dummy_ ## classname ## _3d (&aspect::GravityModel::register_gravity_model<3>, \
181  name, description); \
182  }
183  }
184 }
185 
186 
187 #endif
void register_gravity_model(const std::string &name, const std::string &description, void(*declare_parameters_function)(ParameterHandler &), std::unique_ptr< Interface< dim >>(*factory_function)())
std::unique_ptr< Interface< dim > > create_gravity_model(ParameterHandler &prm)
void declare_parameters(ParameterHandler &prm)
void write_plugin_graph(std::ostream &output_stream)
Definition: compat.h:42