SmartPointer<const Mapping<dim, spacedim>, ParticleHandler<dim, spacedim>>
mapping;
+ /**
+ * This object owns and organizes the memory for all particle
+ * properties. Since particles reference the property pool, the
+ * latter has to be destroyed *after* the particles are destroyed.
+ * This is achieved by making sure the `property_pool` member variable
+ * precedes the declaration of the `particles` and `ghost_particles`
+ * members.
+ */
+ std::unique_ptr<PropertyPool> property_pool;
+
/**
* Set of particles currently living in the local domain, organized by
* the level/index of the cell they are in.
*/
types::particle_index next_free_particle_index;
- /**
- * This object owns and organizes the memory for all particle
- * properties.
- */
- std::unique_ptr<PropertyPool> property_pool;
-
/**
* A function that can be registered by calling
* register_additional_store_load_functions. It is called when serializing
template <int dim, int spacedim>
ParticleHandler<dim, spacedim>::ParticleHandler()
: triangulation()
+ , property_pool(std::make_unique<PropertyPool>(0))
, particles()
, ghost_particles()
, global_number_of_particles(0)
, global_max_particles_per_cell(0)
, next_free_particle_index(0)
- , property_pool(std::make_unique<PropertyPool>(0))
, size_callback()
, store_callback()
, load_callback()
const unsigned int n_properties)
: triangulation(&triangulation, typeid(*this).name())
, mapping(&mapping, typeid(*this).name())
+ , property_pool(std::make_unique<PropertyPool>(n_properties))
, particles()
, ghost_particles()
, global_number_of_particles(0)
, global_max_particles_per_cell(0)
, next_free_particle_index(0)
- , property_pool(std::make_unique<PropertyPool>(n_properties))
, size_callback()
, store_callback()
, load_callback()