ASPECT
interface.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2015 - 2022 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_integrator_interface_h
22 #define _aspect_particle_integrator_interface_h
23 
24 #include <aspect/plugins.h>
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/parameter_handler.h>
30 
31 namespace aspect
32 {
33  namespace Particle
34  {
35  namespace Integrator
36  {
37  using namespace dealii;
38  using namespace ::Particles;
39 
46  template <int dim>
47  class Interface
48  {
49  public:
54  virtual ~Interface () = default;
55 
60  virtual
61  void
62  initialize ();
63 
83  virtual
84  void
85  local_integrate_step(const typename ParticleHandler<dim>::particle_iterator &begin_particle,
86  const typename ParticleHandler<dim>::particle_iterator &end_particle,
87  const std::vector<Tensor<1,dim>> &old_velocities,
88  const std::vector<Tensor<1,dim>> &velocities,
89  const double dt) = 0;
90 
101  virtual bool new_integration_step();
102 
115  virtual std::size_t get_data_size() const;
116 
129  virtual
130  const void *
131  read_data(const typename ParticleHandler<dim>::particle_iterator &particle,
132  const void *data);
133 
146  virtual
147  void *
148  write_data(const typename ParticleHandler<dim>::particle_iterator &particle,
149  void *data) const;
150 
151 
158  static
159  void
160  declare_parameters (ParameterHandler &prm);
161 
168  virtual
169  void
170  parse_parameters (ParameterHandler &prm);
171  };
172 
173 
178  std::string
180 
181 
197  template <int dim>
198  void
199  register_particle_integrator (const std::string &name,
200  const std::string &description,
201  void (*declare_parameters_function) (ParameterHandler &),
202  std::unique_ptr<Interface<dim>> (*factory_function) ());
203 
214  template <int dim>
215  std::unique_ptr<Interface<dim>>
216  create_particle_integrator (ParameterHandler &prm);
217 
218 
224  template <int dim>
225  void
226  declare_parameters (ParameterHandler &prm);
227 
228 
238  template <int dim>
239  void
240  write_plugin_graph (std::ostream &output_stream);
241 
249 #define ASPECT_REGISTER_PARTICLE_INTEGRATOR(classname, name, description) \
250  template class classname<2>; \
251  template class classname<3>; \
252  namespace ASPECT_REGISTER_PARTICLE_INTEGRATOR_ ## classname \
253  { \
254  aspect::internal::Plugins::RegisterHelper<aspect::Particle::Integrator::Interface<2>,classname<2>> \
255  dummy_ ## classname ## _2d (&aspect::Particle::Integrator::register_particle_integrator<2>, \
256  name, description); \
257  aspect::internal::Plugins::RegisterHelper<aspect::Particle::Integrator::Interface<3>,classname<3>> \
258  dummy_ ## classname ## _3d (&aspect::Particle::Integrator::register_particle_integrator<3>, \
259  name, description); \
260  }
261  }
262  }
263 }
264 
265 
266 #endif
void register_particle_integrator(const std::string &name, const std::string &description, void(*declare_parameters_function)(ParameterHandler &), std::unique_ptr< Interface< dim >>(*factory_function)())
std::unique_ptr< Interface< dim > > create_particle_integrator(ParameterHandler &prm)
std::string integrator_object_names()
void write_plugin_graph(std::ostream &output_stream)
void declare_parameters(ParameterHandler &prm)
Definition: compat.h:88