Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
paraphase
dune-fracture-phasefields
Commits
aaf814f1
Commit
aaf814f1
authored
Nov 13, 2016
by
Sander, Oliver
Browse files
Finish the implementation of the 'gradient' method
No real way to test it though, yet.
parent
72150e55
Changes
1
Hide whitespace changes
Inline
Side-by-side
dune/fracture-phasefields/elasticenergyfunctional.hh
View file @
aaf814f1
...
...
@@ -485,24 +485,18 @@ public:
Vector
gradient
(
const
Vector
&
v
)
{
typedef
typename
Vector
::
block_type
LocalGradientVector
;
// TODO: I don't really know what to replace the '3' with
typedef
typename
Dune
::
FieldVector
<
double
,
3
>
FunctionalGradient
;
Vector
result
;
LocalGradientVector
BiXv
;
FunctionalGradient
Dgamma
;
Solvers
::
resizeInitializeZero
(
result
,
v
);
typename
LocalEnergy
::
Domain
BiXv
;
for
(
std
::
size_t
i
=
0
;
i
<
evaluationMatrix
().
N
();
++
i
)
{
BiXv
=
0.0
;
addRowXVector
(
evaluationMatrix
()[
i
],
v
,
BiXv
);
// TODO: What happens to the 'variants' in the following line stolen from couplednonlinearity.hh?
// Dgamma = gamma_[i % variants]->d(BiXv);
auto
localEnergyDerivative
=
derivative
(
localEnergy
());
// TODO: The following line does not compile -- I must be getting one of the types wrong
//Dgamma = localEnergyDerivative(BiXv);
auto
Dgamma
=
localEnergyDerivative
(
BiXv
);
Dgamma
*=
(
*
weightVector_
)[
i
];
addRowTransposedXVector
(
evaluationMatrix
()[
i
],
Dgamma
,
result
);
...
...
@@ -516,7 +510,7 @@ protected:
static
void
addRowXVector
(
const
typename
EvaluationMatrix
::
row_type
&
evaluationMatrixRow
,
const
Vector
&
x
,
typename
Vector
::
block_type
&
y
)
typename
LocalEnergy
::
Domain
&
y
)
{
auto
it
=
evaluationMatrixRow
.
begin
();
auto
end
=
evaluationMatrixRow
.
end
();
...
...
@@ -525,7 +519,7 @@ protected:
}
static
void
addRowTransposedXVector
(
const
typename
EvaluationMatrix
::
row_type
&
evaluationMatrixRow
,
const
Dune
::
FieldVector
<
double
,
3
>&
x
,
const
typename
LocalEnergy
::
Domain
&
x
,
// Actually: the range of the gradient
Vector
&
y
)
{
auto
it
=
evaluationMatrixRow
.
begin
();
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment