]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add assert for ParticleHandler
authorDaniel Arndt <arndtd@ornl.gov>
Mon, 17 May 2021 16:59:59 +0000 (12:59 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Mon, 17 May 2021 18:27:31 +0000 (14:27 -0400)
source/particles/particle_handler.cc

index 48c760bed590af721094f0f3e853c0086304ceec..cbc3f868e77ff783182d744e542565b97417e427 100644 (file)
@@ -16,6 +16,8 @@
 #include <deal.II/grid/grid_tools.h>
 #include <deal.II/grid/grid_tools_cache.h>
 
+#include <deal.II/numerics/vector_tools.h>
+
 #include <deal.II/particles/particle_handler.h>
 
 #include <memory>
@@ -437,11 +439,19 @@ namespace Particles
     local_start_index += local_next_particle_index;
 
     auto point_locations =
-      GridTools::compute_point_locations(*triangulation_cache, positions);
+      GridTools::compute_point_locations_try_all(*triangulation_cache,
+                                                 positions);
 
     auto &cells           = std::get<0>(point_locations);
     auto &local_positions = std::get<1>(point_locations);
     auto &index_map       = std::get<2>(point_locations);
+    auto &missing_points  = std::get<3>(point_locations);
+    // If a point was not found, throwing an error, as the old
+    // implementation of compute_point_locations would have done
+    AssertThrow(std::get<3>(point_locations).size() == 0,
+                VectorTools::ExcPointNotAvailableHere());
+
+    (void)missing_points;
 
     if (cells.size() == 0)
       return;

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.