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-2026 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_prescribed_solution_interface_h
17 #define _aspect_prescribed_solution_interface_h
18 
19 #include <aspect/plugins.h>
21 
22 #include <deal.II/base/point.h>
24 
25 #include <boost/core/demangle.hpp>
26 #include <typeinfo>
27 
28 
29 namespace aspect
30 {
37  namespace PrescribedSolution
38  {
46  template <int dim>
48  {
49  public:
55  virtual
57  const std::vector<Point<dim>> &positions,
58  const std::vector<unsigned int> &component_indices,
59  std::vector<bool> &should_be_constrained,
60  std::vector<double> &solution) = 0;
61  };
62 
68  template <int dim>
69  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
70  {
71  public:
75  DeclException1 (ExcPrescribedSolutionNameNotFound,
76  std::string,
77  << "Could not find entry <"
78  << arg1
79  << "> among the names of registered prescribed solution objects.");
80 
86  void constrain_solution (AffineConstraints<double> &current_constraints) const;
87 
105  static
106  void
107  register_prescribed_solution_plugin (const std::string &name,
108  const std::string &description,
109  void (*declare_parameters_function) (ParameterHandler &),
110  std::unique_ptr<Interface<dim>> (*factory_function) ());
111 
121  static
122  void
123  write_plugin_graph (std::ostream &output_stream);
124 
129  static
130  void
132 
138  void
139  parse_parameters (ParameterHandler &prm) override;
140  };
141 
142 
149  template <int dim>
150  std::string
152 
160 #define ASPECT_REGISTER_PRESCRIBED_SOLUTION(classname,name,description) \
161  template class classname<2>; \
162  template class classname<3>; \
163  namespace ASPECT_REGISTER_PRESCRIBED_SOLUTION_ ## classname \
164  { \
165  aspect::internal::Plugins::RegisterHelper<aspect::PrescribedSolution::Interface<2>,classname<2>> \
166  dummy_ ## classname ## _2d (&aspect::PrescribedSolution::Manager<2>::register_prescribed_solution_plugin, \
167  name, description); \
168  aspect::internal::Plugins::RegisterHelper<aspect::PrescribedSolution::Interface<3>,classname<3>> \
169  dummy_ ## classname ## _3d (&aspect::PrescribedSolution::Manager<3>::register_prescribed_solution_plugin, \
170  name, description); \
171  }
172  }
173 }
174 
175 
176 #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.")