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  {
46  template <int dim>
47  class Interface : public Plugins::InterfaceBase
48  {
49  public:
64  virtual
65  Tensor<1,dim>
66  boundary_traction (const types::boundary_id boundary_indicator,
67  const Point<dim> &position,
68  const Tensor<1,dim> &normal_vector) const = 0;
69  };
70 
71  template <int dim>
72  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
73  {
74  public:
80  Tensor<1,dim>
81  boundary_traction (const types::boundary_id boundary_indicator,
82  const Point<dim> &position,
83  const Tensor<1,dim> &normal_vector) const;
84 
100  DEAL_II_DEPRECATED
101  const std::map<types::boundary_id, std::pair<std::string,std::vector<std::string>>> &
102  get_active_boundary_traction_names () const;
103 
116  DEAL_II_DEPRECATED
117  const std::map<types::boundary_id,std::vector<std::unique_ptr<BoundaryTraction::Interface<dim>>>> &
118  get_active_boundary_traction_conditions () const;
119 
124  const std::set<types::boundary_id> &
125  get_prescribed_boundary_traction_indicators () const;
126 
133  const std::vector<types::boundary_id> &
134  get_active_plugin_boundary_indicators() const;
135 
146  ComponentMask
147  get_component_mask(const types::boundary_id boundary_id) const;
148 
153  static
154  void
155  declare_parameters (ParameterHandler &prm);
156 
162  void
163  parse_parameters (ParameterHandler &prm) override;
164 
174  static
175  void
176  write_plugin_graph (std::ostream &output_stream);
177 
178 
182  DeclException1 (ExcBoundaryTractionNameNotFound,
183  std::string,
184  << "Could not find entry <"
185  << arg1
186  << "> among the names of registered boundary traction objects.");
187 
204  static
205  void
206  register_boundary_traction (const std::string &name,
207  const std::string &description,
208  void (*declare_parameters_function) (ParameterHandler &),
209  std::unique_ptr<Interface<dim>> (*factory_function) ());
210 
211  private:
220  std::vector<types::boundary_id> boundary_indicators;
221 
230  std::vector<ComponentMask> component_masks;
231 
235  std::set<types::boundary_id> prescribed_traction_boundary_indicators;
236 
244  std::map<types::boundary_id,std::vector<std::unique_ptr<BoundaryTraction::Interface<dim>>>> boundary_traction_objects;
245 
259  std::map<types::boundary_id, std::pair<std::string,std::vector<std::string>>> boundary_traction_indicators;
260 
261  };
262 
273  template <int dim>
274  std::unique_ptr<Interface<dim>>
275  create_boundary_traction (const std::string &name);
276 
282  template <int dim>
283  std::string
284  get_names ();
285 
292  template <int dim>
293  void
294  declare_parameters (ParameterHandler &prm);
295 
296 
306  template <int dim>
307  void
308  write_plugin_graph (std::ostream &output_stream);
309 
310 
311 
319 #define ASPECT_REGISTER_BOUNDARY_TRACTION_MODEL(classname,name,description) \
320  template class classname<2>; \
321  template class classname<3>; \
322  namespace ASPECT_REGISTER_BOUNDARY_TRACTION_MODEL_ ## classname \
323  { \
324  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryTraction::Interface<2>,classname<2>> \
325  dummy_ ## classname ## _2d (&aspect::BoundaryTraction::Manager<2>::register_boundary_traction, \
326  name, description); \
327  aspect::internal::Plugins::RegisterHelper<aspect::BoundaryTraction::Interface<3>,classname<3>> \
328  dummy_ ## classname ## _3d (&aspect::BoundaryTraction::Manager<3>::register_boundary_traction, \
329  name, description); \
330  }
331  }
332 }
333 
334 
335 #endif
virtual void parse_parameters(ParameterHandler &prm)
std::vector< ComponentMask > component_masks
Definition: interface.h:230
std::unique_ptr< Interface< dim > > create_boundary_traction(const std::string &name)
void write_plugin_graph(std::ostream &output_stream)
std::map< types::boundary_id, std::pair< std::string, std::vector< std::string > > > boundary_traction_indicators
Definition: interface.h:259
std::map< types::boundary_id, std::vector< std::unique_ptr< BoundaryTraction::Interface< dim > > > > boundary_traction_objects
Definition: interface.h:244
Definition: compat.h:59
std::vector< types::boundary_id > boundary_indicators
Definition: interface.h:220
std::set< types::boundary_id > prescribed_traction_boundary_indicators
Definition: interface.h:235
static void declare_parameters(ParameterHandler &prm)
virtual Tensor< 1, dim > boundary_traction(const types::boundary_id boundary_indicator, const Point< dim > &position, const Tensor< 1, dim > &normal_vector) const =0
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.")