void
PropertyPool<dim, spacedim>::clear()
{
- if (n_properties > 0)
- {
- const unsigned int n_open_handles =
- properties.size() / n_properties - currently_available_handles.size();
- (void)n_open_handles;
- Assert(n_open_handles == 0,
- ExcMessage("This property pool currently still holds " +
- std::to_string(n_open_handles) +
- " open handles to memory that was allocated "
- "via allocate_properties_array() but that has "
- "not been returned via "
- "deregister_particle()."));
- }
+ const unsigned int n_open_handles =
+ locations.size() - currently_available_handles.size();
+ (void)n_open_handles;
+ Assert(n_open_handles == 0,
+ ExcMessage("This property pool currently still holds " +
+ std::to_string(n_open_handles) +
+ " open handles to memory that was allocated "
+ "via allocate_properties_array() but that has "
+ "not been returned via "
+ "deregister_particle()."));
// Clear vectors and ensure deallocation of memory
locations.clear();
#include "../tests.h"
-template <int dim, int spacedim>
-void
-create_regular_particle_distribution(
- Particles::ParticleHandler<dim, spacedim> &particle_handler,
- const parallel::distributed::Triangulation<dim, spacedim> &tr,
- const unsigned int particles_per_direction = 3)
-{
- for (unsigned int i = 0; i < particles_per_direction; ++i)
- for (unsigned int j = 0; j < particles_per_direction; ++j)
- {
- Point<spacedim> position;
- Point<dim> reference_position;
- unsigned int id = i * particles_per_direction + j;
-
- position[0] = static_cast<double>(i) /
- static_cast<double>(particles_per_direction - 1);
- position[1] = static_cast<double>(j) /
- static_cast<double>(particles_per_direction - 1);
-
- if (dim > 2)
- for (unsigned int k = 0; k < particles_per_direction; ++k)
- {
- position[2] = static_cast<double>(j) /
- static_cast<double>(particles_per_direction - 1);
- }
- else
- {
- Particles::Particle<dim, spacedim> particle(position,
- reference_position,
- id);
-
- typename parallel::distributed::Triangulation<dim, spacedim>::
- active_cell_iterator cell =
- GridTools::find_active_cell_around_point(
- tr, particle.get_location());
-
- particle_handler.insert_particle(particle, cell);
- }
- }
-}
-
template <int dim, int spacedim>
void
test()