]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix search for a vertex location 5472/head
authorRene Gassmoeller <rene.gassmoeller@mailbox.org>
Wed, 15 Nov 2017 21:10:51 +0000 (14:10 -0700)
committerRene Gassmoeller <rene.gassmoeller@mailbox.org>
Wed, 15 Nov 2017 21:10:51 +0000 (14:10 -0700)
source/grid/grid_tools.cc

index 45317013248a63b9a965391c4890a9203c848dd2..72f3f6128460f0e022083f9c8a699e14480fec07 100644 (file)
@@ -1623,7 +1623,10 @@ next_cell:
             vertex_to_point = p - mesh.get_vertices()[closest_vertex_index];
           }
 
-        vertex_to_point /= vertex_to_point.norm();
+        const double vertex_point_norm = vertex_to_point.norm();
+        if (vertex_point_norm > 0)
+          vertex_to_point /= vertex_point_norm;
+
         const unsigned int n_neighbor_cells = vertex_to_cells[closest_vertex_index].size();
 
         // Create a corresponding map of vectors from vertex to cell center

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.