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
75150c48
Commit
75150c48
authored
13 years ago
by
Oliver Sander
Committed by
sander@FU-BERLIN.DE
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
reimplement evaluateFDDerivativeOfValueWRTCoefficient actually using the exponential map
[[Imported from SVN: r7412]]
parent
9460750d
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
dune/gfe/localgeodesicfefunction.hh
+31
-13
31 additions, 13 deletions
dune/gfe/localgeodesicfefunction.hh
with
31 additions
and
13 deletions
dune/gfe/localgeodesicfefunction.hh
+
31
−
13
View file @
75150c48
...
...
@@ -57,6 +57,8 @@ class LocalGeodesicFEFunction
typedef
typename
TargetSpace
::
EmbeddedTangentVector
EmbeddedTangentVector
;
static
const
int
embeddedDim
=
EmbeddedTangentVector
::
size
;
static
const
int
spaceDim
=
TargetSpace
::
TangentVector
::
size
;
public:
...
...
@@ -377,28 +379,44 @@ evaluateFDDerivativeOfValueWRTCoefficient(const Dune::FieldVector<ctype, dim>& l
Dune
::
FieldMatrix
<
double
,
embeddedDim
,
embeddedDim
>&
result
)
const
{
double
eps
=
1e-6
;
for
(
int
j
=
0
;
j
<
TargetSpace
::
EmbeddedTangentVector
::
size
;
j
++
)
{
std
::
vector
<
TargetSpace
>
cornersPlus
=
coefficients_
;
std
::
vector
<
TargetSpace
>
cornersMinus
=
coefficients_
;
typename
TargetSpace
::
CoordinateType
aPlus
=
coefficients_
[
coefficient
].
globalCoordinates
();
typename
TargetSpace
::
CoordinateType
aMinus
=
coefficients_
[
coefficient
].
globalCoordinates
();
aPlus
[
j
]
+=
eps
;
aMinus
[
j
]
-=
eps
;
cornersPlus
[
coefficient
]
=
TargetSpace
(
aPlus
);
cornersMinus
[
coefficient
]
=
TargetSpace
(
aMinus
);
// the function value at the point where we are evaluating the derivative
const
Dune
::
FieldMatrix
<
double
,
spaceDim
,
embeddedDim
>
B
=
coefficients_
[
coefficient
].
orthonormalFrame
();
Dune
::
FieldMatrix
<
double
,
spaceDim
,
embeddedDim
>
interimResult
;
std
::
vector
<
TargetSpace
>
cornersPlus
=
coefficients_
;
std
::
vector
<
TargetSpace
>
cornersMinus
=
coefficients_
;
for
(
int
j
=
0
;
j
<
spaceDim
;
j
++
)
{
typename
TargetSpace
::
EmbeddedTangentVector
forwardVariation
=
B
[
j
];
forwardVariation
*=
eps
;
typename
TargetSpace
::
EmbeddedTangentVector
backwardVariation
=
B
[
j
];
backwardVariation
*=
-
eps
;
cornersPlus
[
coefficient
]
=
TargetSpace
::
exp
(
coefficients_
[
coefficient
],
forwardVariation
);
cornersMinus
[
coefficient
]
=
TargetSpace
::
exp
(
coefficients_
[
coefficient
],
backwardVariation
);
LocalGeodesicFEFunction
<
dim
,
double
,
TargetSpace
>
fPlus
(
cornersPlus
);
LocalGeodesicFEFunction
<
dim
,
double
,
TargetSpace
>
fMinus
(
cornersMinus
);
TargetSpace
hPlus
=
fPlus
.
evaluate
(
local
);
TargetSpace
hMinus
=
fMinus
.
evaluate
(
local
);
r
esult
[
j
]
=
hPlus
.
globalCoordinates
();
r
esult
[
j
]
-=
hMinus
.
globalCoordinates
();
r
esult
[
j
]
/=
2
*
eps
;
interimR
esult
[
j
]
=
hPlus
.
globalCoordinates
();
interimR
esult
[
j
]
-=
hMinus
.
globalCoordinates
();
interimR
esult
[
j
]
/=
2
*
eps
;
}
for
(
int
i
=
0
;
i
<
embeddedDim
;
i
++
)
for
(
int
j
=
0
;
j
<
embeddedDim
;
j
++
)
{
result
[
i
][
j
]
=
0
;
for
(
int
k
=
0
;
k
<
spaceDim
;
k
++
)
result
[
i
][
j
]
+=
B
[
k
][
i
]
*
interimResult
[
k
][
j
];
}
}
...
...
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