From 303de1de7540e5e0ab2d3f74c69661bb0deedb49 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Thu, 14 Feb 2013 16:07:54 +0000
Subject: [PATCH] Introduce a new member convexityRadius for target spaces.

And use it in the test.

This patch uses the new 'constexpr' macro.  Hence it is C++11 only.

[[Imported from SVN: r9195]]
---
 dune/gfe/hyperbolichalfspacepoint.hh | 3 +++
 dune/gfe/realtuple.hh                | 3 +++
 dune/gfe/rigidbodymotion.hh          | 3 +++
 dune/gfe/rotation.hh                 | 6 ++++++
 dune/gfe/unitvector.hh               | 3 +++
 test/targetspacetest.cc              | 2 +-
 6 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/dune/gfe/hyperbolichalfspacepoint.hh b/dune/gfe/hyperbolichalfspacepoint.hh
index 3c11048f..185c6fab 100644
--- a/dune/gfe/hyperbolichalfspacepoint.hh
+++ b/dune/gfe/hyperbolichalfspacepoint.hh
@@ -182,6 +182,9 @@ public:
     /** \brief Type of a tangent vector in the embedding space */
     typedef Dune::FieldVector<T,N> EmbeddedTangentVector;
     
+    /** \brief The global convexity radius of the hyberbolic plane */
+    static constexpr T convexityRadius = std::numeric_limits<T>::infinity();
+    
     /** \brief Default constructor */
     HyperbolicHalfspacePoint()
     {}
diff --git a/dune/gfe/realtuple.hh b/dune/gfe/realtuple.hh
index 99fd8dbb..e6e59739 100644
--- a/dune/gfe/realtuple.hh
+++ b/dune/gfe/realtuple.hh
@@ -28,6 +28,9 @@ public:
 
     typedef Dune::FieldVector<T,N> TangentVector;
 
+    /** \brief The global convexity radius of the Euclidean space */
+    static constexpr T convexityRadius = std::numeric_limits<T>::infinity();
+    
     /** \brief Default constructor */
     RealTuple()
     {}
diff --git a/dune/gfe/rigidbodymotion.hh b/dune/gfe/rigidbodymotion.hh
index 8945d178..5653059e 100644
--- a/dune/gfe/rigidbodymotion.hh
+++ b/dune/gfe/rigidbodymotion.hh
@@ -30,6 +30,9 @@ public:
     /** \brief The type used for global coordinates */
     typedef Dune::FieldVector<T,embeddedDim> CoordinateType;
 
+    /** \brief The global convexity radius of the rigid body motions */
+    static constexpr T convexityRadius = Rotation<T,N>::convexityRadius;
+    
     /** \brief Default constructor */
     RigidBodyMotion()
     {}
diff --git a/dune/gfe/rotation.hh b/dune/gfe/rotation.hh
index e23a0cd0..4b655698 100644
--- a/dune/gfe/rotation.hh
+++ b/dune/gfe/rotation.hh
@@ -45,6 +45,9 @@ public:
     This vector is not really embedded in anything.  I have to make my notation more consistent! */
     typedef Dune::FieldVector<T,1> EmbeddedTangentVector;
 
+    /** \brief The global convexity radius of the rotation group */
+    static constexpr T convexityRadius = 0.5 * M_PI;
+    
     /** \brief Default constructor, create the identity rotation */
     Rotation() 
         : angle_(0)
@@ -163,6 +166,9 @@ public:
     /** \brief A tangent vector as a vector in the surrounding coordinate space */
     typedef Quaternion<T> EmbeddedTangentVector;
 
+    /** \brief The global convexity radius of the rotation group */
+    static constexpr T convexityRadius = 0.5 * M_PI;
+    
     /** \brief Default constructor creates the identity element */
     Rotation()
         : Quaternion<T>(0,0,0,1)
diff --git a/dune/gfe/unitvector.hh b/dune/gfe/unitvector.hh
index 060ef865..33ec628d 100644
--- a/dune/gfe/unitvector.hh
+++ b/dune/gfe/unitvector.hh
@@ -78,6 +78,9 @@ public:
 
     typedef Dune::FieldVector<T,N> EmbeddedTangentVector;
     
+    /** \brief The global convexity radius of the unit sphere */
+    static constexpr T convexityRadius = 0.5*M_PI;
+    
     /** \brief Default constructor */
     UnitVector()
     {}
diff --git a/test/targetspacetest.cc b/test/targetspacetest.cc
index ab6a0a0d..971ef9c9 100644
--- a/test/targetspacetest.cc
+++ b/test/targetspacetest.cc
@@ -352,7 +352,7 @@ void test()
             std::vector<TargetSpace> testPointPair(2);
             testPointPair[0] = testPoints[i];
             testPointPair[1] = testPoints[j];
-            if (diameter(testPointPair) > 0.5*M_PI)
+            if (diameter(testPointPair) > TargetSpace::convexityRadius)
                 continue;
             
             testDerivativesOfSquaredDistance<TargetSpace>(testPoints[i], testPoints[j]);
-- 
GitLab