From 1f9406e7849b4b6cdb35d35bb1f54c52a281710c Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 23 Jun 2020 17:27:25 -0600 Subject: [PATCH] Do not forget to set the property pool of a particle. When inserting multiple particles at once, we forget one step that we do when inserting a single particle. --- source/particles/particle_handler.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source/particles/particle_handler.cc b/source/particles/particle_handler.cc index 9a0438458c..e699041786 100644 --- a/source/particles/particle_handler.cc +++ b/source/particles/particle_handler.cc @@ -406,11 +406,16 @@ namespace Particles { for (auto particle = new_particles.begin(); particle != new_particles.end(); ++particle) - particles.insert( - particles.end(), - std::make_pair(internal::LevelInd(particle->first->level(), - particle->first->index()), - particle->second)); + { + // Insert the particle. Store an iterator to the newly + // inserted particle, and then set its property_pool. + auto it = particles.insert( + particles.end(), + std::make_pair(internal::LevelInd(particle->first->level(), + particle->first->index()), + particle->second)); + it->second.set_property_pool(*property_pool); + } update_cached_numbers(); } -- 2.39.5