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_mesh_refinement_interface_h
17 #define _aspect_mesh_refinement_interface_h
18 
19 #include <aspect/global.h>
20 #include <aspect/plugins.h>
22 
23 #include <memory>
27 
28 
29 namespace aspect
30 {
31  template <int dim> class Simulator;
32  template <int dim> class SimulatorAccess;
33 
34 
41  namespace MeshRefinement
42  {
43 
65  template <int dim>
67  {
68  public:
78  virtual
79  void
80  execute (Vector<float> &error_indicators) const;
81 
92  virtual
93  void
94  tag_additional_cells () const;
95  };
96 
97 
98 
99 
100 
101 
108  template <int dim>
109  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
110  {
111  public:
118  virtual
119  void
120  execute (Vector<float> &error_indicators) const;
121 
127  virtual
128  void
129  tag_additional_cells () const;
130 
135  static
136  void
138 
144  void
145  parse_parameters (ParameterHandler &prm) override;
146 
161  template <typename MeshRefinementType,
162  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,MeshRefinementType>::value>>
164  bool
165  has_matching_mesh_refinement_strategy () const;
166 
183  template <typename MeshRefinementType,
184  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,MeshRefinementType>::value>>
186  const MeshRefinementType &
187  get_matching_mesh_refinement_strategy () const;
188 
206  static
207  void
208  register_mesh_refinement_criterion (const std::string &name,
209  const std::string &description,
210  void (*declare_parameters_function) (ParameterHandler &),
211  std::unique_ptr<Interface<dim>> (*factory_function) ());
212 
222  static
223  void
224  write_plugin_graph (std::ostream &output_stream);
225 
229  DeclException1 (ExcMeshRefinementNameNotFound,
230  std::string,
231  << "Could not find entry <"
232  << arg1
233  << "> among the names of registered mesh refinement objects.");
234  private:
240  { plus, max };
241 
248 
255 
262  std::vector<double> scaling_factors;
263  };
264 
265 
266 
267  template <int dim>
268  template <typename MeshRefinementType, typename>
269  inline
270  bool
272  {
273  return this->template has_matching_active_plugin<MeshRefinementType>();
274  }
275 
276 
277 
278  template <int dim>
279  template <typename MeshRefinementType, typename>
280  inline
281  const MeshRefinementType &
283  {
284  return this->template get_matching_active_plugin<MeshRefinementType>();
285  }
286 
287 
288 
296 #define ASPECT_REGISTER_MESH_REFINEMENT_CRITERION(classname,name,description) \
297  template class classname<2>; \
298  template class classname<3>; \
299  namespace ASPECT_REGISTER_MESH_REFINEMENT_CRITERION_ ## classname \
300  { \
301  aspect::internal::Plugins::RegisterHelper<aspect::MeshRefinement::Interface<2>,classname<2>> \
302  dummy_ ## classname ## _2d (&aspect::MeshRefinement::Manager<2>::register_mesh_refinement_criterion, \
303  name, description); \
304  aspect::internal::Plugins::RegisterHelper<aspect::MeshRefinement::Interface<3>,classname<3>> \
305  dummy_ ## classname ## _3d (&aspect::MeshRefinement::Manager<3>::register_mesh_refinement_criterion, \
306  name, description); \
307  }
308  }
309 }
310 
311 
312 #endif
virtual void parse_parameters(ParameterHandler &prm)
MergeOperation merge_operation
Definition: interface.h:247
virtual void tag_additional_cells() const
virtual void execute(Vector< float > &error_indicators) const
DEAL_II_DEPRECATED bool has_matching_mesh_refinement_strategy() const
void write_plugin_graph(std::ostream &output_stream)
DEAL_II_DEPRECATED const MeshRefinementType & get_matching_mesh_refinement_strategy() const
std::vector< double > scaling_factors
Definition: interface.h:262
#define DEAL_II_DEPRECATED
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.")