Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-gfe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sander, Oliver
dune-gfe
Commits
59e21bfe
Commit
59e21bfe
authored
15 years ago
by
Oliver Sander
Committed by
sander@PCPOOL.MI.FU-BERLIN.DE
15 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add tests for the derivative
[[Imported from SVN: r5699]]
parent
526182ec
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/localgeodesicfefunctiontest.cc
+58
-0
58 additions, 0 deletions
test/localgeodesicfefunctiontest.cc
with
58 additions
and
0 deletions
test/localgeodesicfefunctiontest.cc
+
58
−
0
View file @
59e21bfe
...
...
@@ -16,6 +16,31 @@ const int dim = 2;
using
namespace
Dune
;
void
testDerivativeTangentiality
(
const
RealTuple
<
1
>&
x
,
const
FieldMatrix
<
double
,
1
,
dim
>&
derivative
)
{
// By construction, derivatives of RealTuples are always tangent
}
// the columns of the derivative must be tangential to the manifold
void
testDerivativeTangentiality
(
const
UnitVector
<
3
>&
x
,
const
FieldMatrix
<
double
,
3
,
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
++
)
sp
+=
x
.
globalCoordinates
()[
j
]
*
derivative
[
j
][
i
];
std
::
cout
<<
"Column: "
<<
i
<<
", product: "
<<
sp
<<
std
::
endl
;
}
}
/** \brief Test whether interpolation is invariant under permutation of the simplex vertices
*/
template
<
class
TargetSpace
>
...
...
@@ -68,6 +93,36 @@ void testPermutationInvariance(const std::vector<TargetSpace>& corners)
}
template
<
class
TargetSpace
>
void
testDerivative
(
const
std
::
vector
<
TargetSpace
>&
corners
)
{
// Make local fe function to be tested
LocalGeodesicFEFunction
<
2
,
double
,
TargetSpace
>
f
(
corners
);
// A quadrature rule as a set of test points
int
quadOrder
=
3
;
const
Dune
::
QuadratureRule
<
double
,
dim
>&
quad
=
Dune
::
QuadratureRules
<
double
,
dim
>::
rule
(
GeometryType
(
GeometryType
::
simplex
,
dim
),
quadOrder
);
for
(
size_t
pt
=
0
;
pt
<
quad
.
size
();
pt
++
)
{
const
Dune
::
FieldVector
<
double
,
dim
>&
quadPos
=
quad
[
pt
].
position
();
// evaluate actual derivative
Dune
::
FieldMatrix
<
double
,
TargetSpace
::
EmbeddedTangentVector
::
size
,
dim
>
derivative
=
f
.
evaluateDerivative
(
quadPos
);
// evaluate fd approximation of derivative
Dune
::
FieldMatrix
<
double
,
TargetSpace
::
EmbeddedTangentVector
::
size
,
dim
>
fdDerivative
=
f
.
evaluateDerivativeFD
(
quadPos
);
std
::
cout
<<
"Analytical: "
<<
std
::
endl
<<
derivative
<<
std
::
endl
;
std
::
cout
<<
"FD: "
<<
std
::
endl
<<
fdDerivative
<<
std
::
endl
;
testDerivativeTangentiality
(
f
.
evaluate
(
quadPos
),
derivative
);
}
}
void
testRealTuples
()
{
typedef
RealTuple
<
1
>
TargetSpace
;
...
...
@@ -77,6 +132,7 @@ void testRealTuples()
TargetSpace
(
3
)};
testPermutationInvariance
(
corners
);
testDerivative
(
corners
);
}
void
testUnitVectors
()
...
...
@@ -94,6 +150,7 @@ void testUnitVectors()
corners
[
2
]
=
input
;
testPermutationInvariance
(
corners
);
testDerivative
(
corners
);
}
void
testRotations
()
...
...
@@ -114,6 +171,7 @@ void testRotations()
corners
[
2
]
=
Rotation
<
3
,
double
>
(
zAxis
,
0.1
);
testPermutationInvariance
(
corners
);
//testDerivative(corners);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment