ASPECT
interface.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2015 - 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 #ifndef _aspect_particle_interpolator_interface_h
22 #define _aspect_particle_interpolator_interface_h
23 
25 #include <aspect/global.h>
26 
27 #include <deal.II/particles/particle.h>
28 #include <deal.II/particles/particle_handler.h>
29 #include <deal.II/base/point.h>
30 #include <deal.II/base/parameter_handler.h>
31 #include <deal.II/distributed/tria.h>
32 #include <deal.II/fe/component_mask.h>
33 
34 namespace aspect
35 {
36  namespace Particle
37  {
38  namespace Interpolator
39  {
40  using namespace ::Particles;
41 
48  template <int dim>
50  {
51  public:
77  virtual
78  std::vector<std::vector<double>>
79  properties_at_points(const ParticleHandler<dim> &particle_handler,
80  const std::vector<Point<dim>> &positions,
81  const ComponentMask &selected_properties,
82  const typename parallel::distributed::Triangulation<dim>::active_cell_iterator &cell) const = 0;
83  };
84 
85 
90  std::string
92 
93 
109  template <int dim>
110  void
111  register_particle_interpolator (const std::string &name,
112  const std::string &description,
113  void (*declare_parameters_function) (ParameterHandler &),
114  std::unique_ptr<Interface<dim>> (*factory_function) ());
115 
126  template <int dim>
127  std::unique_ptr<Interface<dim>>
128  create_particle_interpolator (ParameterHandler &prm);
129 
130 
136  template <int dim>
137  void
138  declare_parameters (ParameterHandler &prm);
139 
140 
150  template <int dim>
151  void
152  write_plugin_graph (std::ostream &output_stream);
153 
161 #define ASPECT_REGISTER_PARTICLE_INTERPOLATOR(classname, name, description) \
162  template class classname<2>; \
163  template class classname<3>; \
164  namespace ASPECT_REGISTER_PARTICLE_INTERPOLATOR_ ## classname \
165  { \
166  aspect::internal::Plugins::RegisterHelper<aspect::Particle::Interpolator::Interface<2>,classname<2>> \
167  dummy_ ## classname ## _2d (&aspect::Particle::Interpolator::register_particle_interpolator<2>, \
168  name, description); \
169  aspect::internal::Plugins::RegisterHelper<aspect::Particle::Interpolator::Interface<3>,classname<3>> \
170  dummy_ ## classname ## _3d (&aspect::Particle::Interpolator::register_particle_interpolator<3>, \
171  name, description); \
172  }
173  }
174  }
175 }
176 
177 
178 #endif
std::unique_ptr< Interface< dim > > create_particle_interpolator(ParameterHandler &prm)
virtual std::vector< std::vector< double > > properties_at_points(const ParticleHandler< dim > &particle_handler, const std::vector< Point< dim >> &positions, const ComponentMask &selected_properties, const typename parallel::distributed::Triangulation< dim >::active_cell_iterator &cell) const =0
void write_plugin_graph(std::ostream &output_stream)
std::string interpolator_object_names()
void register_particle_interpolator(const std::string &name, const std::string &description, void(*declare_parameters_function)(ParameterHandler &), std::unique_ptr< Interface< dim >>(*factory_function)())
static void declare_parameters(ParameterHandler &prm)