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_postprocess_interface_h
17 #define _aspect_postprocess_interface_h
18 
19 #include <aspect/global.h>
20 #include <aspect/plugins.h>
22 
23 #include <memory>
26 
27 #include <boost/serialization/split_member.hpp>
28 #include <boost/core/demangle.hpp>
29 
30 #include <typeinfo>
31 
32 
33 namespace aspect
34 {
35  template <int dim> class Simulator;
36  template <int dim> class SimulatorAccess;
37 
38 
45  namespace Postprocess
46  {
47 
62  template <int dim>
64  {
65  public:
86  virtual
87  std::pair<std::string,std::string>
88  execute (TableHandler &statistics) = 0;
89 
112  virtual
113  std::list<std::string>
115  };
116 
117 
118 
128  template <int dim>
129  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
130  {
131  public:
140  std::list<std::pair<std::string,std::string>>
141  execute (TableHandler &statistics);
142 
157  template <typename PostprocessorType,
158  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,PostprocessorType>::value>>
160  bool
161  has_matching_postprocessor () const;
162 
179  template <typename PostprocessorType,
180  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,PostprocessorType>::value>>
182  const PostprocessorType &
183  get_matching_postprocessor () const;
184 
189  static
190  void
192 
198  void
199  parse_parameters (ParameterHandler &prm) override;
200 
218  static
219  void
220  register_postprocessor (const std::string &name,
221  const std::string &description,
222  void (*declare_parameters_function) (ParameterHandler &),
223  std::unique_ptr<Interface<dim>> (*factory_function) ());
224 
234  static
235  void
236  write_plugin_graph (std::ostream &output_stream);
237 
241  DeclException1 (ExcPostprocessorNameNotFound,
242  std::string,
243  << "Could not find entry <"
244  << arg1
245  << "> among the names of registered postprocessors.");
246  };
247 
248 
249  /* -------------------------- inline and template functions ---------------------- */
250 
251  template <int dim>
252  template <typename PostprocessorType, typename>
253  inline
254  bool
256  {
257  return this->template has_matching_active_plugin<PostprocessorType>();
258  }
259 
260 
261 
262  template <int dim>
263  template <typename PostprocessorType, typename>
264  inline
265  const PostprocessorType &
267  {
268  return this->template get_matching_active_plugin<PostprocessorType>();
269  }
270 
271 
279 #define ASPECT_REGISTER_POSTPROCESSOR(classname,name,description) \
280  template class classname<2>; \
281  template class classname<3>; \
282  namespace ASPECT_REGISTER_POSTPROCESSOR_ ## classname \
283  { \
284  aspect::internal::Plugins::RegisterHelper<aspect::Postprocess::Interface<2>,classname<2>> \
285  dummy_ ## classname ## _2d (&aspect::Postprocess::Manager<2>::register_postprocessor, \
286  name, description); \
287  aspect::internal::Plugins::RegisterHelper<aspect::Postprocess::Interface<3>,classname<3>> \
288  dummy_ ## classname ## _3d (&aspect::Postprocess::Manager<3>::register_postprocessor, \
289  name, description); \
290  }
291  }
292 }
293 
294 
295 #endif
virtual void parse_parameters(ParameterHandler &prm)
void write_plugin_graph(std::ostream &output_stream)
DEAL_II_DEPRECATED const PostprocessorType & get_matching_postprocessor() const
virtual std::pair< std::string, std::string > execute(TableHandler &statistics)=0
DEAL_II_DEPRECATED bool has_matching_postprocessor() const
virtual std::list< std::string > required_other_postprocessors() const
#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.")