]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Do not forget to set the property pool of a particle.
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 23 Jun 2020 23:27:25 +0000 (17:27 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 24 Jun 2020 02:24:59 +0000 (20:24 -0600)
When inserting multiple particles at once, we forget one step that we do when inserting
a single particle.

source/particles/particle_handler.cc

index 9a0438458cdb228befa1afe6ce1a964cf62cbec2..e699041786e41fb4cb8cde39cbc108b796e1b9d0 100644 (file)
@@ -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();
   }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.