From dd3203aa6b22c595f830700ba66d11d93b02d5bf Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Sat, 24 Sep 2022 11:08:39 +0200 Subject: [PATCH] Use FloatingPointComparator in TriangulationDescription --- source/grid/tria_description.cc | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/source/grid/tria_description.cc b/source/grid/tria_description.cc index 4de96bb503..ed35ad410d 100644 --- a/source/grid/tria_description.cc +++ b/source/grid/tria_description.cc @@ -13,6 +13,7 @@ // // --------------------------------------------------------------------- +#include #include #include #include @@ -153,20 +154,12 @@ namespace TriangulationDescription if (vertices_have_unique_ids == false) // need to compare points { - // comparator of points - const auto comp = [](const auto &a, const auto &b) { - const double tolerance = 1e-10; - - for (unsigned int i = 0; i < spacedim; ++i) - if (std::abs(a[i] - b[i]) > tolerance) - return a[i] < b[i]; - - return false; - }; - // map point to local vertex index - std::map, unsigned int, decltype(comp)> - map_point_to_local_vertex_index(comp); + std::map, + unsigned int, + FloatingPointComparator> + map_point_to_local_vertex_index( + FloatingPointComparator(1e-10)); // ... initialize map with existing points for (unsigned int i = 0; i < this->coarse_cell_vertices.size(); -- 2.39.5