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 : public Plugins::InterfaceBase
48  {
49  public:
53  virtual Tensor<1,dim> gravity_vector (const Point<dim> &position) const = 0;
54  };
55 
56 
57 
58 
74  template <int dim>
75  void
76  register_gravity_model (const std::string &name,
77  const std::string &description,
78  void (*declare_parameters_function) (ParameterHandler &),
79  std::unique_ptr<Interface<dim>> (*factory_function) ());
80 
91  template <int dim>
92  std::unique_ptr<Interface<dim>>
93  create_gravity_model (ParameterHandler &prm);
94 
95 
101  template <int dim>
102  void
103  declare_parameters (ParameterHandler &prm);
104 
105 
115  template <int dim>
116  void
117  write_plugin_graph (std::ostream &output_stream);
118 
119 
127 #define ASPECT_REGISTER_GRAVITY_MODEL(classname,name,description) \
128  template class classname<2>; \
129  template class classname<3>; \
130  namespace ASPECT_REGISTER_GRAVITY_MODEL_ ## classname \
131  { \
132  aspect::internal::Plugins::RegisterHelper<aspect::GravityModel::Interface<2>,classname<2>> \
133  dummy_ ## classname ## _2d (&aspect::GravityModel::register_gravity_model<2>, \
134  name, description); \
135  aspect::internal::Plugins::RegisterHelper<aspect::GravityModel::Interface<3>,classname<3>> \
136  dummy_ ## classname ## _3d (&aspect::GravityModel::register_gravity_model<3>, \
137  name, description); \
138  }
139  }
140 }
141 
142 
143 #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)
Definition: compat.h:59
void write_plugin_graph(std::ostream &output_stream)
Definition: compat.h:42