From ef51196fb1272fc927a62d7f877bb6ab92aa0dfe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Fritze?= <rene.fritze@wwu.de>
Date: Wed, 5 Aug 2020 10:23:22 +0200
Subject: [PATCH] [intersection] simplify contains

this actually works with just function overloads
---
 dune/xt/grid/intersection.hh | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/dune/xt/grid/intersection.hh b/dune/xt/grid/intersection.hh
index 0a5f423ad..ec8a7a4b1 100644
--- a/dune/xt/grid/intersection.hh
+++ b/dune/xt/grid/intersection.hh
@@ -85,10 +85,9 @@ double diameter(const Intersection<G, I>& intersection)
  *        Returns true, if global_point and intersection coincide.
  */
 template <class G, class I, class D>
-typename std::enable_if<G::dimension == 1, bool>::type
-contains(const Dune::Intersection<G, I>& intersection,
-         const Dune::FieldVector<D, 1>& global_point,
-         const D& tolerance = Common::FloatCmp::DefaultEpsilon<D>::value())
+bool contains(const Dune::Intersection<G, I>& intersection,
+              const Dune::FieldVector<D, 1>& global_point,
+              const D& tolerance = Common::FloatCmp::DefaultEpsilon<D>::value())
 {
   return Common::FloatCmp::eq(intersection.geometry().center(), global_point, tolerance);
 }
@@ -100,10 +99,9 @@ contains(const Dune::Intersection<G, I>& intersection,
  *        Returns true if global_point lies on the line between the corners of intersection.
  */
 template <class G, class I, class D>
-typename std::enable_if<G::dimension == 2, bool>::type
-contains(const Dune::Intersection<G, I>& intersection,
-         const Dune::FieldVector<D, 2>& global_point,
-         const D& tolerance = Common::FloatCmp::DefaultEpsilon<D>::value())
+bool contains(const Dune::Intersection<G, I>& intersection,
+              const Dune::FieldVector<D, 2>& global_point,
+              const D& tolerance = Common::FloatCmp::DefaultEpsilon<D>::value())
 {
   const auto& geometry = intersection.geometry();
   // get the global coordinates of the intersections corners
@@ -139,10 +137,9 @@ contains(const Dune::Intersection<G, I>& intersection,
  * http://math.stackexchange.com/questions/684141/check-if-a-point-is-on-a-plane-minimize-the-use-of-multiplications-and-divisio
  */
 template <class G, class I, class D>
-typename std::enable_if<G::dimension == 3, bool>::type
-contains(const Dune::Intersection<G, I>& intersection,
-         const Dune::FieldVector<D, 3>& global_point,
-         const D& tolerance = Common::FloatCmp::DefaultEpsilon<D>::value())
+bool contains(const Dune::Intersection<G, I>& intersection,
+              const Dune::FieldVector<D, 3>& global_point,
+              const D& tolerance = Common::FloatCmp::DefaultEpsilon<D>::value())
 {
   const auto& geometry = intersection.geometry();
   // get the global coordinates of the intersections corners, there should be at least 3 (ignore the fourth if there is
-- 
GitLab