From ab369938f3ee41df79270a1a3f67435809fd78ac Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Tue, 5 May 2009 14:07:36 +0000
Subject: [PATCH] a test for local geodesic fe functions

[[Imported from SVN: r4147]]
---
 test/Makefile.am                    |  4 +-
 test/localgeodesicfefunctiontest.cc | 70 +++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100644 test/localgeodesicfefunctiontest.cc

diff --git a/test/Makefile.am b/test/Makefile.am
index 8e88968d..bfbe41e2 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -4,7 +4,7 @@
 LDADD = $(UG_LDFLAGS) $(AMIRAMESH_LDFLAGS) $(UG_LIBS) $(AMIRAMESH_LIBS)
 AM_CPPFLAGS += $(UG_CPPFLAGS) $(AMIRAMESH_CPPFLAGS) -Wall
 
-check_PROGRAMS = frameinvariancetest rotationtest fdcheck
+check_PROGRAMS = frameinvariancetest rotationtest fdcheck localgeodesicfefunctiontest
 
 frameinvariancetest_SOURCES = frameinvariancetest.cc
 
@@ -12,6 +12,8 @@ rotationtest_SOURCES = rotationtest.cc
 
 fdcheck_SOURCES = fdcheck.cc
 
+localgeodesicfefunctiontest_SOURCES = localgeodesicfefunctiontest.cc
+
 # don't follow the full GNU-standard
 # we need automake 1.5
 AUTOMAKE_OPTIONS = foreign 1.5
diff --git a/test/localgeodesicfefunctiontest.cc b/test/localgeodesicfefunctiontest.cc
new file mode 100644
index 00000000..32df6ebc
--- /dev/null
+++ b/test/localgeodesicfefunctiontest.cc
@@ -0,0 +1,70 @@
+#include <config.h>
+
+#include <iostream>
+
+#include <dune/common/fvector.hh>
+#include <dune/grid/common/quadraturerules.hh>
+
+#include <dune/src/rotation.hh>
+#include <dune/src/localgeodesicfefunction.hh>
+
+using namespace Dune;
+
+int main()
+{
+    typedef Rotation<3,double> TargetSpace;
+
+    const int dim = 2;
+
+    FieldVector<double,3> xAxis(0);
+    xAxis[0] = 1;
+    FieldVector<double,3> yAxis(0);
+    yAxis[1] = 1;
+    FieldVector<double,3> zAxis(0);
+    zAxis[2] = 1;
+
+
+
+    TargetSpace v0 = Rotation<3,double>(xAxis,1);
+    TargetSpace v1 = Rotation<3,double>(yAxis,2);
+    TargetSpace v2 = Rotation<3,double>(zAxis,3);
+
+    std::vector<TargetSpace> coef0(3), coef1(3), coef2(3);
+    coef0[0] = v0;  coef0[1] = v1;  coef0[2] = v2;
+    coef1[0] = v2;  coef1[1] = v0;  coef1[2] = v1;
+    coef2[0] = v1;  coef2[1] = v2;  coef2[2] = v0;
+
+    GeometryType triangle;
+    triangle.makeTriangle();
+
+    LocalGeodesicFEFunction<2,double,TargetSpace> f0(triangle, coef0);
+    LocalGeodesicFEFunction<2,double,TargetSpace> f1(triangle, coef1);
+    LocalGeodesicFEFunction<2,double,TargetSpace> f2(triangle, coef2);
+
+    int quadOrder = 1;
+
+    const Dune::QuadratureRule<double, dim>& quad 
+        = Dune::QuadratureRules<double, dim>::rule(triangle, quadOrder);
+    
+    for (size_t pt=0; pt<quad.size(); pt++) {
+        const Dune::FieldVector<double,dim>& quadPos = quad[pt].position();
+
+        Dune::FieldVector<double,dim> l0 = quadPos;
+        Dune::FieldVector<double,dim> l1, l2;
+
+        l1[0] = 1-quadPos[0]-quadPos[1];
+        l1[1] = quadPos[0];
+
+        l2[0] = quadPos[1];
+        l2[1] = 1-quadPos[0]-quadPos[1];
+
+        
+        std::cout << f0.evaluate(l0) << std::endl;
+        std::cout << f1.evaluate(l1) << std::endl;
+        std::cout << f2.evaluate(l2) << std::endl;
+
+    }
+
+
+
+}
-- 
GitLab