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_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  {
44  template <int dim>
45  class Interface : public Plugins::InterfaceBase
46  {
47  public:
51  virtual Tensor<1,dim> gravity_vector (const Point<dim> &position) const = 0;
52  };
53 
54 
55 
56 
72  template <int dim>
73  void
74  register_gravity_model (const std::string &name,
75  const std::string &description,
76  void (*declare_parameters_function) (ParameterHandler &),
77  std::unique_ptr<Interface<dim>> (*factory_function) ());
78 
89  template <int dim>
90  std::unique_ptr<Interface<dim>>
91  create_gravity_model (ParameterHandler &prm);
92 
93 
99  template <int dim>
100  void
101  declare_parameters (ParameterHandler &prm);
102 
103 
113  template <int dim>
114  void
115  write_plugin_graph (std::ostream &output_stream);
116 
117 
125 #define ASPECT_REGISTER_GRAVITY_MODEL(classname,name,description) \
126  template class classname<2>; \
127  template class classname<3>; \
128  namespace ASPECT_REGISTER_GRAVITY_MODEL_ ## classname \
129  { \
130  aspect::internal::Plugins::RegisterHelper<aspect::GravityModel::Interface<2>,classname<2>> \
131  dummy_ ## classname ## _2d (&aspect::GravityModel::register_gravity_model<2>, \
132  name, description); \
133  aspect::internal::Plugins::RegisterHelper<aspect::GravityModel::Interface<3>,classname<3>> \
134  dummy_ ## classname ## _3d (&aspect::GravityModel::register_gravity_model<3>, \
135  name, description); \
136  }
137  }
138 }
139 
140 
141 #endif
virtual Tensor< 1, dim > gravity_vector(const Point< dim > &position) const =0
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)
Definition: compat.h:59
void write_plugin_graph(std::ostream &output_stream)
static void declare_parameters(ParameterHandler &prm)