From d77e362491382df3a204fe6b20b61b4ae95cf20f Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Wed, 15 Nov 2017 14:10:51 -0700 Subject: [PATCH] Fix search for a vertex location --- source/grid/grid_tools.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 4531701324..72f3f61284 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -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 -- 2.39.5