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 
126  virtual std::array<bool, 3> required_solution_vectors() const = 0;
127 
140  virtual
141  const void *
142  read_data(const typename ParticleHandler<dim>::particle_iterator &particle,
143  const void *data);
144 
157  virtual
158  void *
159  write_data(const typename ParticleHandler<dim>::particle_iterator &particle,
160  void *data) const;
161 
162 
169  static
170  void
171  declare_parameters (ParameterHandler &prm);
172 
179  virtual
180  void
181  parse_parameters (ParameterHandler &prm);
182  };
183 
184 
189  std::string
191 
192 
208  template <int dim>
209  void
210  register_particle_integrator (const std::string &name,
211  const std::string &description,
212  void (*declare_parameters_function) (ParameterHandler &),
213  std::unique_ptr<Interface<dim>> (*factory_function) ());
214 
225  template <int dim>
226  std::unique_ptr<Interface<dim>>
227  create_particle_integrator (ParameterHandler &prm);
228 
229 
235  template <int dim>
236  void
237  declare_parameters (ParameterHandler &prm);
238 
239 
249  template <int dim>
250  void
251  write_plugin_graph (std::ostream &output_stream);
252 
260 #define ASPECT_REGISTER_PARTICLE_INTEGRATOR(classname, name, description) \
261  template class classname<2>; \
262  template class classname<3>; \
263  namespace ASPECT_REGISTER_PARTICLE_INTEGRATOR_ ## classname \
264  { \
265  aspect::internal::Plugins::RegisterHelper<aspect::Particle::Integrator::Interface<2>,classname<2>> \
266  dummy_ ## classname ## _2d (&aspect::Particle::Integrator::register_particle_integrator<2>, \
267  name, description); \
268  aspect::internal::Plugins::RegisterHelper<aspect::Particle::Integrator::Interface<3>,classname<3>> \
269  dummy_ ## classname ## _3d (&aspect::Particle::Integrator::register_particle_integrator<3>, \
270  name, description); \
271  }
272  }
273  }
274 }
275 
276 
277 #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:42