]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix lost signal 13202/head
authorRene Gassmoeller <rene.gassmoeller@mailbox.org>
Thu, 13 Jan 2022 20:31:27 +0000 (15:31 -0500)
committerRene Gassmoeller <rene.gassmoeller@mailbox.org>
Thu, 13 Jan 2022 20:31:27 +0000 (15:31 -0500)
source/particles/particle_handler.cc

index caa254fece11ed684ed1acb34f4be923c39d4d40..1d7a9b703d77c79b1ae6873f517a9b9e534baa68 100644 (file)
@@ -1312,8 +1312,12 @@ namespace Particles
 
       // Reuse these vectors below, but only with a single element.
       // Avoid resizing for every particle.
-      reference_locations.resize(1);
-      real_locations.resize(1);
+      Point<dim>      invalid_reference_point;
+      Point<spacedim> invalid_point;
+      invalid_reference_point[0] = std::numeric_limits<double>::infinity();
+      invalid_point[0]           = std::numeric_limits<double>::infinity();
+      reference_locations.resize(1, invalid_reference_point);
+      real_locations.resize(1, invalid_point);
 
       // Find the cells that the particles moved to.
       for (auto &out_particle : particles_out_of_cell)
@@ -1409,19 +1413,20 @@ namespace Particles
                         reference_locations[0]))
                     {
                       current_cell = cell;
+                      found_cell   = true;
                       break;
                     }
                 }
+            }
 
-              if (current_cell.state() != IteratorState::valid)
-                {
-                  // We can find no cell for this particle. It has left the
-                  // domain due to an integration error or an open boundary.
-                  // Signal the loss and move on.
-                  signals.particle_lost(out_particle,
-                                        out_particle->get_surrounding_cell());
-                  continue;
-                }
+          if (!found_cell)
+            {
+              // We can find no cell for this particle. It has left the
+              // domain due to an integration error or an open boundary.
+              // Signal the loss and move on.
+              signals.particle_lost(out_particle,
+                                    out_particle->get_surrounding_cell());
+              continue;
             }
 
           // If we are here, we found a cell and reference position for this

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.