16#ifndef dealii_particles_particle_handler_h
17#define dealii_particles_particle_handler_h
39#include <boost/range/iterator_range.hpp>
40#include <boost/serialization/map.hpp>
65 template <
int dim,
int spacedim = dim>
100 const unsigned int n_properties = 0);
115 const unsigned int n_properties = 0);
169 reserve(
const std::size_t n_particles);
397 std::map<unsigned int, IndexSet>
401 & global_bounding_boxes,
402 const std::vector<std::vector<double>> & properties = {},
403 const std::vector<types::particle_index> &ids = {});
435 std::map<unsigned int, IndexSet>
437 const std::vector<Particle<dim, spacedim>> &
particles,
439 &global_bounding_boxes);
484 template <
class VectorType>
485 typename std::enable_if<
486 std::is_convertible<VectorType *, Function<spacedim> *>::value ==
489 const bool displace_particles =
true);
513 const bool displace_particles =
true);
536 const bool displace_particles =
true);
565 template <
class VectorType>
568 const bool add_to_output_vector =
false);
586 const bool add_to_output_vector =
false);
723 PropertyPool<dim, spacedim> &
829 DEAL_II_DEPRECATED_EARLY
843 DEAL_II_DEPRECATED_EARLY
851 template <
class Archive>
853 serialize(Archive &ar,
const unsigned int version);
882 boost::signals2::signal<void(
1055#ifdef DEAL_II_WITH_MPI
1087 &new_cells_for_particles = std::map<
1091 const bool enable_cache =
false);
1107 &particles_to_send);
1179 const boost::iterator_range<std::vector<char>::const_iterator>
1186 typename particle_container::iterator
1193 typename particle_container::iterator
1200 typename particle_container::iterator
1207 typename particle_container::iterator
1216 template <
int dim,
int spacedim>
1225 template <
int dim,
int spacedim>
1236 template <
int dim,
int spacedim>
1245 template <
int dim,
int spacedim>
1254 template <
int dim,
int spacedim>
1263 template <
int dim,
int spacedim>
1274 template <
int dim,
int spacedim>
1283 template <
int dim,
int spacedim>
1292 template <
int dim,
int spacedim>
1299 typename particle_container::iterator begin =
1306 template <
int dim,
int spacedim>
1311 return owned_particles_end;
1316 template <
int dim,
int spacedim>
1321 typename particle_container::iterator begin = owned_particles_end;
1327 template <
int dim,
int spacedim>
1332 typename particle_container::iterator end =
1339 template <
int dim,
int spacedim>
1340 template <
class Archive>
1349 &global_number_of_particles &global_max_particles_per_cell
1350 & next_free_particle_index;
1355 template <
int dim,
int spacedim>
1356 template <
class VectorType>
1357 inline typename std::enable_if<
1358 std::is_convertible<VectorType *, Function<spacedim> *>::value ==
1361 const VectorType &input_vector,
1362 const bool displace_particles)
1365 get_next_free_particle_index() * spacedim);
1366 for (
auto &p : *
this)
1368 auto new_point(displace_particles ? p.get_location() :
1370 const auto id = p.get_id();
1371 for (
unsigned int i = 0; i < spacedim; ++i)
1372 new_point[i] += input_vector[
id * spacedim + i];
1373 p.set_location(new_point);
1375 sort_particles_into_subdomains_and_cells();
1380 template <
int dim,
int spacedim>
1381 template <
class VectorType>
1384 VectorType &output_vector,
1385 const bool add_to_output_vector)
1388 get_next_free_particle_index() * spacedim);
1389 for (
const auto &p : *
this)
1391 auto point = p.get_location();
1392 const auto id = p.get_id();
1393 if (add_to_output_vector)
1394 for (
unsigned int i = 0; i < spacedim; ++i)
1395 output_vector[
id * spacedim + i] += point[i];
1397 for (
unsigned int i = 0; i < spacedim; ++i)
1398 output_vector[
id * spacedim + i] = point[i];
1400 if (add_to_output_vector)
1408 template <
int dim,
int spacedim>
1412 return this->locally_owned_particle_ids();
Abstract base class for mapping classes.
std::list< ParticlesInCell > particle_container
std::function< void *(const particle_iterator &, void *)> store_callback
void register_additional_store_load_functions(const std::function< std::size_t()> &size_callback, const std::function< void *(const particle_iterator &, void *)> &store_callback, const std::function< const void *(const particle_iterator &, const void *)> &load_callback)
void exchange_ghost_particles(const bool enable_ghost_cache=false)
types::particle_index n_global_particles() const
particle_iterator end_ghost() const
unsigned int global_max_particles_per_cell
void unpack_after_coarsening_and_refinement()
void register_data_attach()
internal::GhostParticlePartitioner< dim, spacedim > ghost_particles_cache
particle_container::iterator particle_container_ghost_begin() const
void prepare_for_serialization()
IndexSet locally_relevant_ids() const
unsigned int n_properties_per_particle() const
types::particle_index global_number_of_particles
void get_particle_positions(VectorType &output_vector, const bool add_to_output_vector=false)
particle_container::iterator particle_container_owned_end() const
void update_cached_numbers()
void prepare_for_coarsening_and_refinement()
particle_container::iterator particle_container_ghost_end() const
boost::iterator_range< particle_iterator > particle_iterator_range
void post_mesh_change_action()
void send_recv_particles(const std::map< types::subdomain_id, std::vector< particle_iterator > > &particles_to_send, const std::map< types::subdomain_id, std::vector< typename Triangulation< dim, spacedim >::active_cell_iterator > > &new_cells_for_particles=std::map< types::subdomain_id, std::vector< typename Triangulation< dim, spacedim >::active_cell_iterator > >(), const bool enable_cache=false)
ParticleIterator< dim, spacedim > particle_iterator
void send_recv_particles_properties_and_location(const std::map< types::subdomain_id, std::vector< particle_iterator > > &particles_to_send)
types::particle_index number_of_locally_owned_particles
particle_iterator begin_ghost() const
PropertyPool< dim, spacedim > & get_property_pool() const
void initialize(const Triangulation< dim, spacedim > &tria, const Mapping< dim, spacedim > &mapping, const unsigned int n_properties=0)
void serialize(Archive &ar, const unsigned int version)
std::unique_ptr< PropertyPool< dim, spacedim > > property_pool
types::particle_index get_max_local_particle_index() const
void reserve(const std::size_t n_particles)
particle_iterator begin() const
std::map< unsigned int, IndexSet > insert_global_particles(const std::vector< Point< spacedim > > &positions, const std::vector< std::vector< BoundingBox< spacedim > > > &global_bounding_boxes, const std::vector< std::vector< double > > &properties={}, const std::vector< types::particle_index > &ids={})
void notify_ready_to_unpack(const bool serialization)
void connect_to_triangulation_signals()
void register_load_callback_function(const bool serialization)
std::function< std::size_t()> size_callback
void insert_particles(const std::multimap< typename Triangulation< dim, spacedim >::active_cell_iterator, Particle< dim, spacedim > > &particles)
types::particle_index next_free_particle_index
const particle_container::iterator owned_particles_end
void unpack_callback(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const typename Triangulation< dim, spacedim >::CellStatus status, const boost::iterator_range< std::vector< char >::const_iterator > &data_range)
void register_store_callback_function()
particle_iterator end() const
void remove_particle(const particle_iterator &particle)
types::particle_index n_locally_owned_particles() const
void reset_particle_container(particle_container &particles)
types::particle_index n_particles_in_cell(const typename Triangulation< dim, spacedim >::active_cell_iterator &cell) const
void update_ghost_particles()
typename ParticleAccessor< dim, spacedim >::particle_container particle_container
particle_iterator_range particles_in_cell(const typename Triangulation< dim, spacedim >::active_cell_iterator &cell)
SmartPointer< const Triangulation< dim, spacedim >, ParticleHandler< dim, spacedim > > triangulation
particle_iterator insert_particle(const Particle< dim, spacedim > &particle, const typename Triangulation< dim, spacedim >::active_cell_iterator &cell)
void sort_particles_into_subdomains_and_cells()
void remove_particles(const std::vector< particle_iterator > &particles)
types::particle_index n_global_max_particles_per_cell() const
std::vector< boost::signals2::connection > tria_listeners
particle_container::iterator particle_container_owned_begin() const
virtual ~ParticleHandler()
std::vector< typename particle_container::iterator > cells_to_particle_cache
void copy_from(const ParticleHandler< dim, spacedim > &particle_handler)
std::function< const void *(const particle_iterator &, const void *)> load_callback
SmartPointer< const Mapping< dim, spacedim >, ParticleHandler< dim, spacedim > > mapping
std::unique_ptr< GridTools::Cache< dim, spacedim > > triangulation_cache
std::enable_if< std::is_convertible< VectorType *, Function< spacedim > * >::value==false >::type set_particle_positions(const VectorType &input_vector, const bool displace_particles=true)
types::particle_index get_next_free_particle_index() const
particle_container particles
std::vector< char > pack_callback(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const typename Triangulation< dim, spacedim >::CellStatus status) const
IndexSet locally_owned_particle_ids() const
#define DEAL_II_DEPRECATED
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
boost::signals2::signal< void(const typename Particles::ParticleIterator< dim, spacedim > &particle, const typename Triangulation< dim, spacedim >::active_cell_iterator &cell)> particle_lost
const ::Triangulation< dim, spacedim > & tria