namespace Particles
{
- namespace internal
- {
- /**
- * This function packs a vector of particles into a vector
- * of bytes. If there are properties associated with the
- * particles they are also serialized. The function does
- * not perform compression, but is faster
- * than the corresponding function Utilities::pack().
- */
- template <int dim, int spacedim>
- std::vector<char>
- pack_particles(std::vector<Particle<dim, spacedim>> &particles);
-
- /**
- * This function unpacks a vector of bytes into a vector
- * of particles. It assumes the vector of bytes was created
- * with the pack_particles() function above. If the particles
- * had properties when they were serialized this function
- * requires an additional argument that is a PropertyPool
- * object with the correct number of properties per particle
- * to be able to correctly unpack the particles.
- */
- template <int dim, int spacedim>
- std::vector<Particle<dim, spacedim>>
- unpack_particles(
- const boost::iterator_range<std::vector<char>::const_iterator>
- & data_range,
- PropertyPool &property_pool = PropertyPool(0));
- } // namespace internal
-
/**
* This class manages the storage and handling of particles. It provides
* the data structures necessary to store particles efficiently, accessor
namespace Particles
{
- namespace internal
+ namespace
{
template <int dim, int spacedim>
std::vector<char>
while (data < &(*data_range.end()))
{
- particles.push_back(Particle<dim, spacedim>(data, &property_pool));
+ particles.emplace_back(data, &property_pool);
}
Assert(
return particles;
}
- } // namespace internal
+ } // namespace
template <int dim, int spacedim>
ParticleHandler<dim, spacedim>::ParticleHandler()
break;
}
- return internal::pack_particles(stored_particles_on_cell);
+ return pack_particles(stored_particles_on_cell);
}
template <int dim, int spacedim>
// We leave this container non-const to be able to `std::move`
// its contents directly into the particles multimap later.
std::vector<Particle<dim, spacedim>> loaded_particles_on_cell =
- internal::unpack_particles<dim, spacedim>(data_range, *property_pool);
+ unpack_particles<dim, spacedim>(data_range, *property_pool);
// Update the reference to the current property pool for all particles.
// This was not stored, because they might be transported across process
#if deal_II_dimension <= deal_II_space_dimension
namespace Particles
\{
- namespace internal
- \{
- template std::vector<char>
- pack_particles(
- std::vector<Particle<deal_II_dimension, deal_II_space_dimension>>
- &particles);
-
- template std::vector<
- Particle<deal_II_dimension, deal_II_space_dimension>>
- unpack_particles(
- const boost::iterator_range<std::vector<char>::const_iterator>
- & data_range,
- PropertyPool &property_pool);
- \}
-
template class ParticleHandler<deal_II_dimension,
deal_II_space_dimension>;
\}