From: Rene Gassmoeller Date: Thu, 13 Jan 2022 20:31:27 +0000 (-0500) Subject: Fix lost signal X-Git-Tag: v9.4.0-rc1~619^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ead51f9c6f6d640dceda5107793cef24a337c1cd;p=dealii.git Fix lost signal --- diff --git a/source/particles/particle_handler.cc b/source/particles/particle_handler.cc index caa254fece..1d7a9b703d 100644 --- a/source/particles/particle_handler.cc +++ b/source/particles/particle_handler.cc @@ -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 invalid_reference_point; + Point invalid_point; + invalid_reference_point[0] = std::numeric_limits::infinity(); + invalid_point[0] = std::numeric_limits::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