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_gravity_model_interface_h
17 #define _aspect_gravity_model_interface_h
18 
19 #include <aspect/plugins.h>
20 #include <deal.II/base/point.h>
22 
23 namespace aspect
24 {
31  namespace GravityModel
32  {
38  template <int dim>
39  class Interface : public Plugins::InterfaceBase
40  {
41  public:
45  virtual Tensor<1,dim> gravity_vector (const Point<dim> &position) const = 0;
46  };
47 
48 
49 
50 
66  template <int dim>
67  void
68  register_gravity_model (const std::string &name,
69  const std::string &description,
70  void (*declare_parameters_function) (ParameterHandler &),
71  std::unique_ptr<Interface<dim>> (*factory_function) ());
72 
83  template <int dim>
84  std::unique_ptr<Interface<dim>>
86 
87 
93  template <int dim>
94  void
96 
97 
107  template <int dim>
108  void
109  write_plugin_graph (std::ostream &output_stream);
110 
111 
119 #define ASPECT_REGISTER_GRAVITY_MODEL(classname,name,description) \
120  template class classname<2>; \
121  template class classname<3>; \
122  namespace ASPECT_REGISTER_GRAVITY_MODEL_ ## classname \
123  { \
124  aspect::internal::Plugins::RegisterHelper<aspect::GravityModel::Interface<2>,classname<2>> \
125  dummy_ ## classname ## _2d (&aspect::GravityModel::register_gravity_model<2>, \
126  name, description); \
127  aspect::internal::Plugins::RegisterHelper<aspect::GravityModel::Interface<3>,classname<3>> \
128  dummy_ ## classname ## _3d (&aspect::GravityModel::register_gravity_model<3>, \
129  name, description); \
130  }
131  }
132 }
133 
134 
135 #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)
void write_plugin_graph(std::ostream &output_stream)
static void declare_parameters(ParameterHandler &prm)