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
602fe9c9
Commit
602fe9c9
authored
9 years ago
by
Sander, Oliver
Browse files
Options
Downloads
Patches
Plain Diff
Adapt to recent interface changes
parent
cee64db4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/gfe/localgeodesicfefdstiffness.hh
+25
-21
25 additions, 21 deletions
dune/gfe/localgeodesicfefdstiffness.hh
with
25 additions
and
21 deletions
dune/gfe/localgeodesicfefdstiffness.hh
+
25
−
21
View file @
602fe9c9
...
...
@@ -8,12 +8,15 @@
/** \brief Assembles energy gradient and Hessian with ADOL-C (automatic differentiation)
*/
template
<
class
GridView
,
class
LocalFiniteElement
,
class
TargetSpace
,
class
field_type
=
double
>
template
<
class
Basis
,
class
TargetSpace
,
class
field_type
=
double
>
class
LocalGeodesicFEFDStiffness
:
public
LocalGeodesicFEStiffness
<
GridView
,
LocalFiniteElement
,
TargetSpace
>
:
public
LocalGeodesicFEStiffness
<
Basis
,
TargetSpace
>
{
// grid types
typedef
typename
GridView
::
Grid
::
ctype
DT
;
typedef
typename
Basis
::
GridView
GridView
;
typedef
typename
Basis
::
LocalView
::
Tree
::
FiniteElement
LocalFiniteElement
;
typedef
typename
GridView
::
ctype
DT
;
typedef
typename
TargetSpace
::
ctype
RT
;
typedef
typename
GridView
::
template
Codim
<
0
>
::
Entity
Entity
;
typedef
typename
TargetSpace
::
template
rebind
<
field_type
>
::
other
ATargetSpace
;
...
...
@@ -29,12 +32,12 @@ public:
//! Dimension of the embedding space
enum
{
embeddedBlocksize
=
TargetSpace
::
EmbeddedTangentVector
::
dimension
};
LocalGeodesicFEFDStiffness
(
const
LocalGeodesicFEStiffness
<
GridView
,
LocalFiniteElement
,
ATargetSpace
>*
energy
)
LocalGeodesicFEFDStiffness
(
const
LocalGeodesicFEStiffness
<
Basis
,
ATargetSpace
>*
energy
)
:
localEnergy_
(
energy
)
{}
/** \brief Compute the energy at the current configuration */
virtual
double
energy
(
const
Entity
&
element
,
virtual
RT
energy
(
const
Entity
&
element
,
const
LocalFiniteElement
&
localFiniteElement
,
const
std
::
vector
<
TargetSpace
>&
localSolution
)
const
{
...
...
@@ -49,18 +52,17 @@ public:
const
std
::
vector
<
TargetSpace
>&
solution
,
std
::
vector
<
typename
TargetSpace
::
TangentVector
>&
gradient
)
const
;
/** \brief Assemble the local
stiffness matrix
at the current position
/** \brief Assemble the local
tangent matrix and gradient
at the current position
This
default
implementation use
d
finite-difference approximations
to compute the second derivatives
This implementation use
s
finite-difference approximations
The formula for the Riemannian Hessian has been taken from Absil, Mahony, Sepulchre:
'Optimization algorithms on matrix manifolds', page 107. There it says that
\f[
The formula for the Riemannian Hessian has been taken from Absil, Mahony, Sepulchre:
'Optimization algorithms on matrix manifolds', page 107. There it says that
\f[
\langle Hess f(x)[\xi], \eta \rangle
= \frac 12 \frac{d^2}{dt^2} \Big(f(\exp_x(t(\xi + \eta))) - f(\exp_x(t\xi)) - f(\exp_x(t\eta))\Big)\Big|_{t=0}.
\f]
We compute that using a finite difference approximation.
\f]
We compute that using a finite difference approximation.
*/
virtual
void
assembleGradientAndHessian
(
const
Entity
&
e
,
const
LocalFiniteElement
&
localFiniteElement
,
...
...
@@ -68,12 +70,12 @@ public:
std
::
vector
<
typename
TargetSpace
::
TangentVector
>&
localGradient
);
const
LocalGeodesicFEStiffness
<
GridView
,
LocalFiniteElement
,
ATargetSpace
>*
localEnergy_
;
const
LocalGeodesicFEStiffness
<
Basis
,
ATargetSpace
>*
localEnergy_
;
};
template
<
class
GridView
,
class
LocalFiniteElement
,
class
TargetSpace
,
class
field_type
>
void
LocalGeodesicFEFDStiffness
<
GridView
,
LocalFiniteElement
,
TargetSpace
,
field_type
>::
template
<
class
Basis
,
class
TargetSpace
,
class
field_type
>
void
LocalGeodesicFEFDStiffness
<
Basis
,
TargetSpace
,
field_type
>::
assembleGradient
(
const
Entity
&
element
,
const
LocalFiniteElement
&
localFiniteElement
,
const
std
::
vector
<
TargetSpace
>&
localSolution
,
...
...
@@ -133,11 +135,13 @@ assembleGradient(const Entity& element,
}
// ///////////////////////////////////////////////////////////
// Compute gradient by finite-difference approximation
// ///////////////////////////////////////////////////////////
template
<
class
GridType
,
class
LocalFiniteElement
,
class
TargetSpace
,
class
field_type
>
void
LocalGeodesicFEFDStiffness
<
GridType
,
LocalFiniteElement
,
TargetSpace
,
field_type
>::
/////////////////////////////////////////////////////////////////////////////////
// Compute gradient and Hessian together
// To compute the Hessian we need to compute the gradient anyway, so we may
// as well return it. This saves assembly time.
/////////////////////////////////////////////////////////////////////////////////
template
<
class
Basis
,
class
TargetSpace
,
class
field_type
>
void
LocalGeodesicFEFDStiffness
<
Basis
,
TargetSpace
,
field_type
>::
assembleGradientAndHessian
(
const
Entity
&
element
,
const
LocalFiniteElement
&
localFiniteElement
,
const
std
::
vector
<
TargetSpace
>&
localSolution
,
...
...
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