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_prescribed_solution_interface_h
23 #define _aspect_prescribed_solution_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 #include <boost/core/demangle.hpp>
32 #include <typeinfo>
33 
34 
35 namespace aspect
36 {
43  namespace PrescribedSolution
44  {
52  template <int dim>
54  {
55  public:
61  virtual
62  void constrain_solution (const typename DoFHandler<dim>::active_cell_iterator &cell,
63  const std::vector<Point<dim>> &positions,
64  const std::vector<unsigned int> &component_indices,
65  std::vector<bool> &should_be_constrained,
66  std::vector<double> &solution) = 0;
67  };
68 
74  template <int dim>
75  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
76  {
77  public:
81  DeclException1 (ExcPrescribedSolutionNameNotFound,
82  std::string,
83  << "Could not find entry <"
84  << arg1
85  << "> among the names of registered prescribed solution objects.");
86 
92  void constrain_solution (AffineConstraints<double> &current_constraints) const;
93 
111  static
112  void
113  register_prescribed_solution_plugin (const std::string &name,
114  const std::string &description,
115  void (*declare_parameters_function) (ParameterHandler &),
116  std::unique_ptr<Interface<dim>> (*factory_function) ());
117 
127  static
128  void
129  write_plugin_graph (std::ostream &output_stream);
130 
135  static
136  void
137  declare_parameters (ParameterHandler &prm);
138 
144  void
145  parse_parameters (ParameterHandler &prm) override;
146  };
147 
148 
155  template <int dim>
156  std::string
158 
166 #define ASPECT_REGISTER_PRESCRIBED_SOLUTION(classname,name,description) \
167  template class classname<2>; \
168  template class classname<3>; \
169  namespace ASPECT_REGISTER_PRESCRIBED_SOLUTION_ ## classname \
170  { \
171  aspect::internal::Plugins::RegisterHelper<aspect::PrescribedSolution::Interface<2>,classname<2>> \
172  dummy_ ## classname ## _2d (&aspect::PrescribedSolution::Manager<2>::register_prescribed_solution_plugin, \
173  name, description); \
174  aspect::internal::Plugins::RegisterHelper<aspect::PrescribedSolution::Interface<3>,classname<3>> \
175  dummy_ ## classname ## _3d (&aspect::PrescribedSolution::Manager<3>::register_prescribed_solution_plugin, \
176  name, description); \
177  }
178  }
179 }
180 
181 
182 #endif
virtual void parse_parameters(ParameterHandler &prm)
virtual void constrain_solution(const typename DoFHandler< dim >::active_cell_iterator &cell, const std::vector< Point< dim >> &positions, const std::vector< unsigned int > &component_indices, std::vector< bool > &should_be_constrained, std::vector< double > &solution)=0
void write_plugin_graph(std::ostream &output_stream)
std::string get_valid_model_names_pattern()
static void declare_parameters(ParameterHandler &prm)
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.")