From 29aaa9f46b60cc89859d8f1a60ec22202dc6ae71 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Wed, 10 Mar 2010 16:17:11 +0000
Subject: [PATCH] also test UnitVector<2>

[[Imported from SVN: r5735]]
---
 test/localgeodesicfefunctiontest.cc | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/test/localgeodesicfefunctiontest.cc b/test/localgeodesicfefunctiontest.cc
index 1b13c37e..06c2aa23 100644
--- a/test/localgeodesicfefunctiontest.cc
+++ b/test/localgeodesicfefunctiontest.cc
@@ -24,15 +24,16 @@ void testDerivativeTangentiality(const RealTuple<1>& x,
 }
 
 // the columns of the derivative must be tangential to the manifold
-void testDerivativeTangentiality(const UnitVector<3>& x,
-                                 const FieldMatrix<double,3,dim>& derivative)
+template <int vectorDim>
+void testDerivativeTangentiality(const UnitVector<vectorDim>& x,
+                                 const FieldMatrix<double,vectorDim,dim>& derivative)
 {
     for (int i=0; i<dim; i++) {
 
         // The i-th column is a tangent vector if its scalar product with the global coordinates
         // of x vanishes.
         double sp = 0;
-        for (int j=0; j<3; j++)
+        for (int j=0; j<vectorDim; j++)
             sp += x.globalCoordinates()[j] * derivative[j][i];
 
 
@@ -150,6 +151,24 @@ void testUnitVectors()
     testDerivative(corners);
 }
 
+void testUnitVectors2()
+{
+    typedef UnitVector<2> TargetSpace;
+
+    std::vector<TargetSpace> corners(dim+1);
+
+    FieldVector<double,2> input;
+    input[0] = 1;  input[1] = 0;
+    corners[0] = input;
+    input[0] = 1;  input[1] = 0;
+    corners[1] = input;
+    input[0] = 0;  input[1] = 1;
+    corners[2] = input;
+
+    testPermutationInvariance(corners);
+    testDerivative(corners);
+}
+
 void testRotations()
 {
     typedef Rotation<3,double> TargetSpace;
@@ -179,5 +198,6 @@ int main()
 
     //testRealTuples();
     testUnitVectors();
+    testUnitVectors2();
     //testRotations();
 }
-- 
GitLab