Skip to content
Snippets Groups Projects
Commit ab369938 authored by Oliver Sander's avatar Oliver Sander Committed by sander@PCPOOL.MI.FU-BERLIN.DE
Browse files

a test for local geodesic fe functions

[[Imported from SVN: r4147]]
parent 522a79bb
No related branches found
No related tags found
No related merge requests found
......@@ -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
#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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment