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_mesh_refinement_interface_h
23 #define _aspect_mesh_refinement_interface_h
24 
25 #include <aspect/global.h>
26 #include <aspect/plugins.h>
28 
29 #include <memory>
33 
34 
35 namespace aspect
36 {
37  template <int dim> class Simulator;
38  template <int dim> class SimulatorAccess;
39 
40 
47  namespace MeshRefinement
48  {
49 
71  template <int dim>
73  {
74  public:
84  virtual
85  void
86  execute (Vector<float> &error_indicators) const;
87 
98  virtual
99  void
101  };
102 
103 
104 
105 
106 
107 
114  template <int dim>
115  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
116  {
117  public:
124  virtual
125  void
126  execute (Vector<float> &error_indicators) const;
127 
133  virtual
134  void
136 
141  static
142  void
144 
150  void
152 
167  template <typename MeshRefinementType,
168  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,MeshRefinementType>::value>>
170  bool
172 
189  template <typename MeshRefinementType,
190  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,MeshRefinementType>::value>>
192  const MeshRefinementType &
194 
212  static
213  void
214  register_mesh_refinement_criterion (const std::string &name,
215  const std::string &description,
216  void (*declare_parameters_function) (ParameterHandler &),
217  std::unique_ptr<Interface<dim>> (*factory_function) ());
218 
228  static
229  void
230  write_plugin_graph (std::ostream &output_stream);
231 
235  DeclException1 (ExcMeshRefinementNameNotFound,
236  std::string,
237  << "Could not find entry <"
238  << arg1
239  << "> among the names of registered mesh refinement objects.");
240  private:
246  { plus, max };
247 
254 
261 
268  std::vector<double> scaling_factors;
269  };
270 
271 
272 
273  template <int dim>
274  template <typename MeshRefinementType, typename>
275  inline
276  bool
278  {
279  return this->template has_matching_active_plugin<MeshRefinementType>();
280  }
281 
282 
283 
284  template <int dim>
285  template <typename MeshRefinementType, typename>
286  inline
287  const MeshRefinementType &
289  {
290  return this->template get_matching_active_plugin<MeshRefinementType>();
291  }
292 
293 
294 
302 #define ASPECT_REGISTER_MESH_REFINEMENT_CRITERION(classname,name,description) \
303  template class classname<2>; \
304  template class classname<3>; \
305  namespace ASPECT_REGISTER_MESH_REFINEMENT_CRITERION_ ## classname \
306  { \
307  aspect::internal::Plugins::RegisterHelper<aspect::MeshRefinement::Interface<2>,classname<2>> \
308  dummy_ ## classname ## _2d (&aspect::MeshRefinement::Manager<2>::register_mesh_refinement_criterion, \
309  name, description); \
310  aspect::internal::Plugins::RegisterHelper<aspect::MeshRefinement::Interface<3>,classname<3>> \
311  dummy_ ## classname ## _3d (&aspect::MeshRefinement::Manager<3>::register_mesh_refinement_criterion, \
312  name, description); \
313  }
314  }
315 }
316 
317 
318 #endif
virtual void execute(Vector< float > &error_indicators) const
virtual void tag_additional_cells() const
virtual void tag_additional_cells() const
std::vector< double > scaling_factors
Definition: interface.h:268
DEAL_II_DEPRECATED bool has_matching_mesh_refinement_strategy() const
DeclException1(ExcMeshRefinementNameNotFound, std::string,<< "Could not find entry <"<< arg1<< "> among the names of registered mesh refinement objects.")
virtual void execute(Vector< float > &error_indicators) const
DEAL_II_DEPRECATED const MeshRefinementType & get_matching_mesh_refinement_strategy() const
void parse_parameters(ParameterHandler &prm) override
static void declare_parameters(ParameterHandler &prm)
MergeOperation merge_operation
Definition: interface.h:253
static void write_plugin_graph(std::ostream &output_stream)
static void register_mesh_refinement_criterion(const std::string &name, const std::string &description, void(*declare_parameters_function)(ParameterHandler &), std::unique_ptr< Interface< dim >>(*factory_function)())
#define DEAL_II_DEPRECATED