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_boundary_traction_interface_h
23 #define _aspect_boundary_traction_interface_h
24 
25 #include <aspect/plugins.h>
27 
28 #include <deal.II/base/point.h>
29 #include <deal.II/base/parameter_handler.h>
30 
31 namespace aspect
32 {
39  namespace BoundaryTraction
40  {
41  using namespace dealii;
42 
48  template <int dim>
49  class Interface : public Plugins::InterfaceBase
50  {
51  public:
66  virtual
67  Tensor<1,dim>
68  boundary_traction (const types::boundary_id boundary_indicator,
69  const Point<dim> &position,
70  const Tensor<1,dim> &normal_vector) const = 0;
71  };
72 
73  template <int dim>
74  class Manager : public SimulatorAccess<dim>
75  {
76  public:
81  ~Manager () override;
82 
92  virtual
93  void
94  update ();
95 
101  Tensor<1,dim>
102  boundary_traction (const types::boundary_id boundary_indicator,
103  const Point<dim> &position,
104  const Tensor<1,dim> &normal_vector) const;
105 
118  const std::map<types::boundary_id, std::pair<std::string,std::vector<std::string>>> &
119  get_active_boundary_traction_names () const;
120 
130  const std::map<types::boundary_id,std::vector<std::unique_ptr<BoundaryTraction::Interface<dim>>>> &
131  get_active_boundary_traction_conditions () const;
132 
137  static
138  void
139  declare_parameters (ParameterHandler &prm);
140 
146  void
147  parse_parameters (ParameterHandler &prm);
148 
158  static
159  void
160  write_plugin_graph (std::ostream &output_stream);
161 
162 
166  DeclException1 (ExcBoundaryTractionNameNotFound,
167  std::string,
168  << "Could not find entry <"
169  << arg1
170  << "> among the names of registered boundary traction objects.");
171 
188  static
189  void
190  register_boundary_traction (const std::string &name,
191  const std::string &description,
192  void (*declare_parameters_function) (ParameterHandler &),
193  std::unique_ptr<Interface<dim>> (*factory_function) ());
194 
195  private:
200  std::map<types::boundary_id,std::vector<std::unique_ptr<BoundaryTraction::Interface<dim>>>> boundary_traction_objects;
201 
210  std::map<types::boundary_id, std::pair<std::string,std::vector<std::string>>> boundary_traction_indicators;
211 
212  };
213 
224  template <int dim>
225  std::unique_ptr<Interface<dim>>
226  create_boundary_traction (const std::string &name);
227 
233  template <int dim>
234  std::string
235  get_names ();
236 
243  template <int dim>
244  void
245  declare_parameters (ParameterHandler &prm);
246 
247 
257  template <int dim>
258  void
259  write_plugin_graph (std::ostream &output_stream);
260 
261 
262 
270 #define ASPECT_REGISTER_BOUNDARY_TRACTION_MODEL(classname,name,description) \
271  template class classname<2>; \
272  template class classname<3>; \
273  namespace ASPECT_REGISTER_BOUNDARY_TRACTION_MODEL_ ## classname \
274  { \
275  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryTraction::Interface<2>,classname<2>> \
276  dummy_ ## classname ## _2d (&aspect::BoundaryTraction::Manager<2>::register_boundary_traction, \
277  name, description); \
278  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryTraction::Interface<3>,classname<3>> \
279  dummy_ ## classname ## _3d (&aspect::BoundaryTraction::Manager<3>::register_boundary_traction, \
280  name, description); \
281  }
282  }
283 }
284 
285 
286 #endif
std::unique_ptr< Interface< dim > > create_boundary_traction(const std::string &name)
void write_plugin_graph(std::ostream &output_stream)
void declare_parameters(ParameterHandler &prm)
std::map< types::boundary_id, std::pair< std::string, std::vector< std::string > > > boundary_traction_indicators
Definition: interface.h:210
std::map< types::boundary_id, std::vector< std::unique_ptr< BoundaryTraction::Interface< dim > > > > boundary_traction_objects
Definition: interface.h:200
Definition: compat.h:59
Definition: compat.h:42
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.")