]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid infinities in another place. 17940/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 18 Dec 2024 04:51:20 +0000 (21:51 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 18 Dec 2024 04:51:20 +0000 (21:51 -0700)
source/particles/particle_handler.cc

index 149dfc699bff3411b1dedc5733bd961907eb2529..a73bb65abcd0539ecb96166f892faf3048f30331 100644 (file)
@@ -12,6 +12,8 @@
 //
 // ------------------------------------------------------------------------
 
+#include <deal.II/base/signaling_nan.h>
+
 #include <deal.II/grid/grid_tools.h>
 #include <deal.II/grid/grid_tools_cache.h>
 
@@ -1324,12 +1326,8 @@ namespace Particles
 
       // Reuse these vectors below, but only with a single element.
       // Avoid resizing for every particle.
-      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);
+      reference_locations.resize(1, numbers::signaling_nan<Point<dim>>());
+      real_locations.resize(1, numbers::signaling_nan<Point<spacedim>>());
 
       // Find the cells that the particles moved to.
       for (auto &out_particle : particles_out_of_cell)

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.