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_integrator_interface_h
22 #define _aspect_particle_integrator_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/parameter_handler.h>
30 
31 namespace aspect
32 {
33  namespace Particle
34  {
35  namespace Integrator
36  {
37  using namespace ::Particles;
38 
45  template <int dim>
47  {
48  public:
68  virtual
69  void
70  local_integrate_step(const typename ParticleHandler<dim>::particle_iterator &begin_particle,
71  const typename ParticleHandler<dim>::particle_iterator &end_particle,
72  const std::vector<Tensor<1,dim>> &old_velocities,
73  const std::vector<Tensor<1,dim>> &velocities,
74  const double dt) = 0;
75 
86  virtual bool new_integration_step();
87 
100  virtual std::size_t get_data_size() const;
101 
111  virtual std::array<bool, 3> required_solution_vectors() const = 0;
112 
125  virtual
126  const void *
127  read_data(const typename ParticleHandler<dim>::particle_iterator &particle,
128  const void *data);
129 
142  virtual
143  void *
144  write_data(const typename ParticleHandler<dim>::particle_iterator &particle,
145  void *data) const;
146  };
147 
148 
153  std::string
155 
156 
172  template <int dim>
173  void
174  register_particle_integrator (const std::string &name,
175  const std::string &description,
176  void (*declare_parameters_function) (ParameterHandler &),
177  std::unique_ptr<Interface<dim>> (*factory_function) ());
178 
189  template <int dim>
190  std::unique_ptr<Interface<dim>>
191  create_particle_integrator (ParameterHandler &prm);
192 
193 
199  template <int dim>
200  void
201  declare_parameters (ParameterHandler &prm);
202 
203 
213  template <int dim>
214  void
215  write_plugin_graph (std::ostream &output_stream);
216 
224 #define ASPECT_REGISTER_PARTICLE_INTEGRATOR(classname, name, description) \
225  template class classname<2>; \
226  template class classname<3>; \
227  namespace ASPECT_REGISTER_PARTICLE_INTEGRATOR_ ## classname \
228  { \
229  aspect::internal::Plugins::RegisterHelper<aspect::Particle::Integrator::Interface<2>,classname<2>> \
230  dummy_ ## classname ## _2d (&aspect::Particle::Integrator::register_particle_integrator<2>, \
231  name, description); \
232  aspect::internal::Plugins::RegisterHelper<aspect::Particle::Integrator::Interface<3>,classname<3>> \
233  dummy_ ## classname ## _3d (&aspect::Particle::Integrator::register_particle_integrator<3>, \
234  name, description); \
235  }
236  }
237  }
238 }
239 
240 
241 #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)
virtual void local_integrate_step(const typename ParticleHandler< dim >::particle_iterator &begin_particle, const typename ParticleHandler< dim >::particle_iterator &end_particle, const std::vector< Tensor< 1, dim >> &old_velocities, const std::vector< Tensor< 1, dim >> &velocities, const double dt)=0
std::string integrator_object_names()
void write_plugin_graph(std::ostream &output_stream)
Definition: compat.h:59
virtual void * write_data(const typename ParticleHandler< dim >::particle_iterator &particle, void *data) const
virtual std::size_t get_data_size() const
virtual const void * read_data(const typename ParticleHandler< dim >::particle_iterator &particle, const void *data)
static void declare_parameters(ParameterHandler &prm)
virtual std::array< bool, 3 > required_solution_vectors() const =0