]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix creating of boost point 12365/head
authorPeter Munch <peterrmuench@gmail.com>
Mon, 31 May 2021 16:34:01 +0000 (18:34 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Mon, 31 May 2021 17:18:34 +0000 (19:18 +0200)
source/grid/grid_tools.cc

index fcbd2772d1bb05240f3275d7ee60a439efe1ba73..990ada7cacaf00b9757d88bba874cb786f60c5b4 100644 (file)
@@ -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<double, 1, boost::geometry::cs::cartesian>
+    create_boost_point(const Point<1> &p)
+    {
+      return boost::geometry::model::
+        point<double, 1, boost::geometry::cs::cartesian>(p[0]);
+    }
+
+    boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>
+    create_boost_point(const Point<2> &p)
+    {
+      return {p[0], p[1]};
+    }
+
+    boost::geometry::model::point<double, 3, boost::geometry::cs::cartesian>
+    create_boost_point(const Point<3> &p)
+    {
+      return {p[0], p[1], p[2]};
+    }
+
+
   } // namespace internal
 
   template <int dim, template <int, int> 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<double, spacedim, boost::geometry::cs::cartesian>;
-        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;
       }
 

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.