From 62b0657336be50f0c8445f4be344ef1252a97c5c Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Mon, 31 May 2021 18:34:01 +0200 Subject: [PATCH] Fix creating of boost point --- source/grid/grid_tools.cc | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index fcbd2772d1..990ada7cac 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -2746,6 +2746,29 @@ namespace GridTools // return if the scalar product of a is larger. return (scalar_product_a > scalar_product_b); } + + + + boost::geometry::model::point + create_boost_point(const Point<1> &p) + { + return boost::geometry::model:: + point(p[0]); + } + + boost::geometry::model::point + create_boost_point(const Point<2> &p) + { + return {p[0], p[1]}; + } + + boost::geometry::model::point + create_boost_point(const Point<3> &p) + { + return {p[0], p[1], p[2]}; + } + + } // namespace internal template class MeshType, int spacedim> @@ -2785,15 +2808,9 @@ namespace GridTools if (relevant_cell_bounding_boxes_rtree != nullptr && !relevant_cell_bounding_boxes_rtree->empty()) { - using point_t = boost::geometry::model:: - point; - const auto pt = - spacedim == 1 ? - point_t(p[0]) : - (spacedim == 2 ? point_t(p[0], p[1]) : point_t(p[0], p[1], p[2])); if (relevant_cell_bounding_boxes_rtree->qbegin( - boost::geometry::index::intersects(pt)) == - relevant_cell_bounding_boxes_rtree->qend()) + boost::geometry::index::intersects(internal::create_boost_point( + p))) == relevant_cell_bounding_boxes_rtree->qend()) return cell_and_position; } -- 2.39.5