ASPECT
interface.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2023 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
50  {
51  public:
56  virtual ~Interface() = default;
57 
63  virtual
64  void
65  initialize ();
66 
78  virtual
79  void
80  update ();
81 
96  virtual
97  Tensor<1,dim>
98  boundary_traction (const types::boundary_id boundary_indicator,
99  const Point<dim> &position,
100  const Tensor<1,dim> &normal_vector) const = 0;
101 
108  static
109  void
110  declare_parameters (ParameterHandler &prm);
111 
118  virtual
119  void
120  parse_parameters (ParameterHandler &prm);
121 
122  protected:
127  };
128 
129  template <int dim>
130  class Manager : public ::aspect::SimulatorAccess<dim>
131  {
132  public:
137  ~Manager () override;
138 
148  virtual
149  void
150  update ();
151 
157  Tensor<1,dim>
158  boundary_traction (const types::boundary_id boundary_indicator,
159  const Point<dim> &position,
160  const Tensor<1,dim> &normal_vector) const;
161 
174  const std::map<types::boundary_id, std::pair<std::string,std::vector<std::string>>> &
175  get_active_boundary_traction_names () const;
176 
186  const std::map<types::boundary_id,std::vector<std::unique_ptr<BoundaryTraction::Interface<dim>>>> &
187  get_active_boundary_traction_conditions () const;
188 
193  static
194  void
195  declare_parameters (ParameterHandler &prm);
196 
202  void
203  parse_parameters (ParameterHandler &prm);
204 
214  static
215  void
216  write_plugin_graph (std::ostream &output_stream);
217 
218 
222  DeclException1 (ExcBoundaryTractionNameNotFound,
223  std::string,
224  << "Could not find entry <"
225  << arg1
226  << "> among the names of registered boundary traction objects.");
227 
244  static
245  void
246  register_boundary_traction (const std::string &name,
247  const std::string &description,
248  void (*declare_parameters_function) (ParameterHandler &),
249  std::unique_ptr<Interface<dim>> (*factory_function) ());
250 
251  private:
256  std::map<types::boundary_id,std::vector<std::unique_ptr<BoundaryTraction::Interface<dim>>>> boundary_traction_objects;
257 
266  std::map<types::boundary_id, std::pair<std::string,std::vector<std::string>>> boundary_traction_indicators;
267 
268  };
269 
280  template <int dim>
281  std::unique_ptr<Interface<dim>>
282  create_boundary_traction (const std::string &name);
283 
289  template <int dim>
290  std::string
291  get_names ();
292 
299  template <int dim>
300  void
301  declare_parameters (ParameterHandler &prm);
302 
303 
313  template <int dim>
314  void
315  write_plugin_graph (std::ostream &output_stream);
316 
317 
318 
326 #define ASPECT_REGISTER_BOUNDARY_TRACTION_MODEL(classname,name,description) \
327  template class classname<2>; \
328  template class classname<3>; \
329  namespace ASPECT_REGISTER_BOUNDARY_TRACTION_MODEL_ ## classname \
330  { \
331  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryTraction::Interface<2>,classname<2>> \
332  dummy_ ## classname ## _2d (&aspect::BoundaryTraction::Manager<2>::register_boundary_traction, \
333  name, description); \
334  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryTraction::Interface<3>,classname<3>> \
335  dummy_ ## classname ## _3d (&aspect::BoundaryTraction::Manager<3>::register_boundary_traction, \
336  name, description); \
337  }
338  }
339 }
340 
341 
342 #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:266
const GeometryModel::Interface< dim > * geometry_model
Definition: interface.h:126
std::map< types::boundary_id, std::vector< std::unique_ptr< BoundaryTraction::Interface< dim > > > > boundary_traction_objects
Definition: interface.h:256
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.")