From 1bb2c9494dec7007dd3a5d0aeef936598189d07c Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Fri, 11 Jun 2021 08:57:01 -0400 Subject: [PATCH] Revert "Only resort if necessary" This reverts commit cf58b8714e3aac81770656625ab093e164573091. --- source/particles/particle_handler.cc | 30 +--------------------------- source/particles/property_pool.cc | 2 +- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/source/particles/particle_handler.cc b/source/particles/particle_handler.cc index f41ada5324..52d47fc513 100644 --- a/source/particles/particle_handler.cc +++ b/source/particles/particle_handler.cc @@ -1291,35 +1291,7 @@ namespace Particles // remove_particles also calls update_cached_numbers() remove_particles(particles_out_of_cell); - - // Sort the particle memory if we noticed during sorting - // the particles above that more than 10% of particle - // handles are non-consecutive. We do not want to do this - // if it is not necessary, because it involves a copy of - // all particle memory. - types::particle_index n_fragmented_handles = 0; - typename PropertyPool::Handle last_handle = - PropertyPool::invalid_handle; - for (const auto &particles_in_cell : particles) - for (const auto &particle : particles_in_cell) - { - if (last_handle == PropertyPool::invalid_handle) - { - last_handle = particle; - continue; - } - - if (particle != last_handle + 1) - ++n_fragmented_handles; - - last_handle = particle; - } - - if (n_fragmented_handles > n_locally_owned_particles() / 3) - { - property_pool->sort_memory_slots(particles); - } - + property_pool->sort_memory_slots(particles); } // namespace Particles diff --git a/source/particles/property_pool.cc b/source/particles/property_pool.cc index 950a70b8a5..94a1906964 100644 --- a/source/particles/property_pool.cc +++ b/source/particles/property_pool.cc @@ -178,7 +178,7 @@ namespace Particles std::vector sorted_ids(ids.size()); std::vector sorted_properties(properties.size()); - Handle i = 0; + unsigned int i = 0; for (auto &handles_in_cell : sorted_handles) for (auto &handle : handles_in_cell) { -- 2.39.5