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_postprocess_interface_h
23 #define _aspect_postprocess_interface_h
24 
25 #include <aspect/global.h>
26 #include <aspect/plugins.h>
28 
29 #include <memory>
30 #include <deal.II/base/table_handler.h>
31 #include <deal.II/base/parameter_handler.h>
32 
33 #include <boost/serialization/split_member.hpp>
34 #include <boost/core/demangle.hpp>
35 
36 #include <typeinfo>
37 
38 
39 namespace aspect
40 {
41  template <int dim> class Simulator;
42  template <int dim> class SimulatorAccess;
43 
44 
51  namespace Postprocess
52  {
53 
68  template <int dim>
70  {
71  public:
89  virtual
90  std::pair<std::string,std::string>
91  execute (TableHandler &statistics) = 0;
92 
115  virtual
116  std::list<std::string>
118  };
119 
120 
121 
131  template <int dim>
132  class Manager : public Plugins::ManagerBase<Interface<dim>>, public SimulatorAccess<dim>
133  {
134  public:
143  std::list<std::pair<std::string,std::string>>
144  execute (TableHandler &statistics);
145 
160  template <typename PostprocessorType,
161  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,PostprocessorType>::value>>
162  DEAL_II_DEPRECATED
163  bool
164  has_matching_postprocessor () const;
165 
182  template <typename PostprocessorType,
183  typename = typename std::enable_if_t<std::is_base_of<Interface<dim>,PostprocessorType>::value>>
184  DEAL_II_DEPRECATED
185  const PostprocessorType &
186  get_matching_postprocessor () const;
187 
192  static
193  void
194  declare_parameters (ParameterHandler &prm);
195 
201  void
202  parse_parameters (ParameterHandler &prm) override;
203 
221  static
222  void
223  register_postprocessor (const std::string &name,
224  const std::string &description,
225  void (*declare_parameters_function) (ParameterHandler &),
226  std::unique_ptr<Interface<dim>> (*factory_function) ());
227 
237  static
238  void
239  write_plugin_graph (std::ostream &output_stream);
240 
244  DeclException1 (ExcPostprocessorNameNotFound,
245  std::string,
246  << "Could not find entry <"
247  << arg1
248  << "> among the names of registered postprocessors.");
249  };
250 
251 
252  /* -------------------------- inline and template functions ---------------------- */
253 
254  template <int dim>
255  template <typename PostprocessorType, typename>
256  inline
257  bool
259  {
260  return this->template has_matching_active_plugin<PostprocessorType>();
261  }
262 
263 
264 
265  template <int dim>
266  template <typename PostprocessorType, typename>
267  inline
268  const PostprocessorType &
270  {
271  return this->template get_matching_active_plugin<PostprocessorType>();
272  }
273 
274 
282 #define ASPECT_REGISTER_POSTPROCESSOR(classname,name,description) \
283  template class classname<2>; \
284  template class classname<3>; \
285  namespace ASPECT_REGISTER_POSTPROCESSOR_ ## classname \
286  { \
287  aspect::internal::Plugins::RegisterHelper<aspect::Postprocess::Interface<2>,classname<2>> \
288  dummy_ ## classname ## _2d (&aspect::Postprocess::Manager<2>::register_postprocessor, \
289  name, description); \
290  aspect::internal::Plugins::RegisterHelper<aspect::Postprocess::Interface<3>,classname<3>> \
291  dummy_ ## classname ## _3d (&aspect::Postprocess::Manager<3>::register_postprocessor, \
292  name, description); \
293  }
294  }
295 }
296 
297 
298 #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
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.")