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
36cbc7f7
Commit
36cbc7f7
authored
11 years ago
by
Oliver Sander
Committed by
sander
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
remove trailing whitespace
[[Imported from SVN: r9303]]
parent
ba5bc321
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/gfe/targetspacertrsolver.cc
+21
-21
21 additions, 21 deletions
dune/gfe/targetspacertrsolver.cc
dune/gfe/targetspacertrsolver.hh
+5
-5
5 additions, 5 deletions
dune/gfe/targetspacertrsolver.hh
with
26 additions
and
26 deletions
dune/gfe/targetspacertrsolver.cc
+
21
−
21
View file @
36cbc7f7
...
@@ -55,10 +55,10 @@ void TargetSpaceRiemannianTRSolver<TargetSpace>::solve()
...
@@ -55,10 +55,10 @@ void TargetSpaceRiemannianTRSolver<TargetSpace>::solve()
// Trust-Region Solver
// Trust-Region Solver
// /////////////////////////////////////////////////////
// /////////////////////////////////////////////////////
for
(
int
i
=
0
;
i
<
maxTrustRegionSteps_
;
i
++
)
{
for
(
int
i
=
0
;
i
<
maxTrustRegionSteps_
;
i
++
)
{
if
(
this
->
verbosity_
==
Solver
::
FULL
)
{
if
(
this
->
verbosity_
==
Solver
::
FULL
)
{
std
::
cout
<<
"----------------------------------------------------"
<<
std
::
endl
;
std
::
cout
<<
"----------------------------------------------------"
<<
std
::
endl
;
std
::
cout
<<
" Trust-Region Step Number: "
<<
i
std
::
cout
<<
" Trust-Region Step Number: "
<<
i
<<
", radius: "
<<
trustRegion
.
radius
()
<<
", radius: "
<<
trustRegion
.
radius
()
<<
", energy: "
<<
assembler_
->
value
(
x_
)
<<
std
::
endl
;
<<
", energy: "
<<
assembler_
->
value
(
x_
)
<<
std
::
endl
;
std
::
cout
<<
"----------------------------------------------------"
<<
std
::
endl
;
std
::
cout
<<
"----------------------------------------------------"
<<
std
::
endl
;
...
@@ -77,19 +77,19 @@ void TargetSpaceRiemannianTRSolver<TargetSpace>::solve()
...
@@ -77,19 +77,19 @@ void TargetSpaceRiemannianTRSolver<TargetSpace>::solve()
rhs
*=
-
1
;
rhs
*=
-
1
;
dynamic_cast
<
LinearIterationStep
<
MatrixType
,
CorrectionType
>*>
(
innerSolver_
->
iterationStep_
)
->
setProblem
(
hesseMatrix
,
corr
,
rhs
);
dynamic_cast
<
LinearIterationStep
<
MatrixType
,
CorrectionType
>*>
(
innerSolver_
->
iterationStep_
)
->
setProblem
(
hesseMatrix
,
corr
,
rhs
);
dynamic_cast
<
TrustRegionGSStep
<
MatrixType
,
CorrectionType
>*>
(
innerSolver_
->
iterationStep_
)
->
obstacles_
=
&
trustRegion
.
obstacles
();
dynamic_cast
<
TrustRegionGSStep
<
MatrixType
,
CorrectionType
>*>
(
innerSolver_
->
iterationStep_
)
->
obstacles_
=
&
trustRegion
.
obstacles
();
innerSolver_
->
preprocess
();
innerSolver_
->
preprocess
();
// /////////////////////////////
// /////////////////////////////
// Solve !
// Solve !
// /////////////////////////////
// /////////////////////////////
innerSolver_
->
solve
();
innerSolver_
->
solve
();
corr
=
innerSolver_
->
iterationStep_
->
getSol
();
corr
=
innerSolver_
->
iterationStep_
->
getSol
();
if
(
this
->
verbosity_
==
NumProc
::
FULL
)
if
(
this
->
verbosity_
==
NumProc
::
FULL
)
std
::
cout
<<
"Infinity norm of the correction: "
<<
corr
.
infinity_norm
()
<<
std
::
endl
;
std
::
cout
<<
"Infinity norm of the correction: "
<<
corr
.
infinity_norm
()
<<
std
::
endl
;
...
@@ -101,18 +101,18 @@ void TargetSpaceRiemannianTRSolver<TargetSpace>::solve()
...
@@ -101,18 +101,18 @@ void TargetSpaceRiemannianTRSolver<TargetSpace>::solve()
std
::
cout
<<
i
+
1
<<
" trust-region steps were taken."
<<
std
::
endl
;
std
::
cout
<<
i
+
1
<<
" trust-region steps were taken."
<<
std
::
endl
;
break
;
break
;
}
}
// ////////////////////////////////////////////////////
// ////////////////////////////////////////////////////
// Check whether trust-region step can be accepted
// Check whether trust-region step can be accepted
// ////////////////////////////////////////////////////
// ////////////////////////////////////////////////////
TargetSpace
newIterate
=
x_
;
TargetSpace
newIterate
=
x_
;
newIterate
=
TargetSpace
::
exp
(
newIterate
,
corr
[
0
]);
newIterate
=
TargetSpace
::
exp
(
newIterate
,
corr
[
0
]);
/** \todo Don't always recompute oldEnergy */
/** \todo Don't always recompute oldEnergy */
double
oldEnergy
=
assembler_
->
value
(
x_
);
double
oldEnergy
=
assembler_
->
value
(
x_
);
double
energy
=
assembler_
->
value
(
newIterate
);
double
energy
=
assembler_
->
value
(
newIterate
);
// compute the model decrease
// compute the model decrease
// It is $ m(x) - m(x+s) = -<g,s> - 0.5 <s, Hs>
// It is $ m(x) - m(x+s) = -<g,s> - 0.5 <s, Hs>
// Note that rhs = -g
// Note that rhs = -g
...
@@ -120,16 +120,16 @@ void TargetSpaceRiemannianTRSolver<TargetSpace>::solve()
...
@@ -120,16 +120,16 @@ void TargetSpaceRiemannianTRSolver<TargetSpace>::solve()
tmp
=
0
;
tmp
=
0
;
hesseMatrix
.
umv
(
corr
,
tmp
);
hesseMatrix
.
umv
(
corr
,
tmp
);
double
modelDecrease
=
(
rhs
*
corr
)
-
0.5
*
(
corr
*
tmp
);
double
modelDecrease
=
(
rhs
*
corr
)
-
0.5
*
(
corr
*
tmp
);
if
(
this
->
verbosity_
==
NumProc
::
FULL
)
{
if
(
this
->
verbosity_
==
NumProc
::
FULL
)
{
std
::
cout
<<
"Absolute model decrease: "
<<
modelDecrease
std
::
cout
<<
"Absolute model decrease: "
<<
modelDecrease
<<
", functional decrease: "
<<
oldEnergy
-
energy
<<
std
::
endl
;
<<
", functional decrease: "
<<
oldEnergy
-
energy
<<
std
::
endl
;
std
::
cout
<<
"Relative model decrease: "
<<
modelDecrease
/
energy
std
::
cout
<<
"Relative model decrease: "
<<
modelDecrease
/
energy
<<
", functional decrease: "
<<
(
oldEnergy
-
energy
)
/
energy
<<
std
::
endl
;
<<
", functional decrease: "
<<
(
oldEnergy
-
energy
)
/
energy
<<
std
::
endl
;
}
}
assert
(
modelDecrease
>=
0
);
assert
(
modelDecrease
>=
0
);
if
(
energy
>=
oldEnergy
)
{
if
(
energy
>=
oldEnergy
)
{
if
(
this
->
verbosity_
==
NumProc
::
FULL
)
if
(
this
->
verbosity_
==
NumProc
::
FULL
)
printf
(
"Richtung ist keine Abstiegsrichtung!
\n
"
);
printf
(
"Richtung ist keine Abstiegsrichtung!
\n
"
);
...
@@ -152,22 +152,22 @@ void TargetSpaceRiemannianTRSolver<TargetSpace>::solve()
...
@@ -152,22 +152,22 @@ void TargetSpaceRiemannianTRSolver<TargetSpace>::solve()
// //////////////////////////////////////////////
// //////////////////////////////////////////////
if
(
(
oldEnergy
-
energy
)
/
modelDecrease
>
0.9
)
{
if
(
(
oldEnergy
-
energy
)
/
modelDecrease
>
0.9
)
{
// very successful iteration
// very successful iteration
x_
=
newIterate
;
x_
=
newIterate
;
trustRegion
.
scale
(
2
);
trustRegion
.
scale
(
2
);
}
else
if
(
(
oldEnergy
-
energy
)
/
modelDecrease
>
0.01
}
else
if
(
(
oldEnergy
-
energy
)
/
modelDecrease
>
0.01
||
std
::
abs
(
oldEnergy
-
energy
)
<
1e-12
)
{
||
std
::
abs
(
oldEnergy
-
energy
)
<
1e-12
)
{
// successful iteration
// successful iteration
x_
=
newIterate
;
x_
=
newIterate
;
}
else
{
}
else
{
// unsuccessful iteration
// unsuccessful iteration
trustRegion
.
scale
(
0.5
);
trustRegion
.
scale
(
0.5
);
if
(
this
->
verbosity_
==
NumProc
::
FULL
)
if
(
this
->
verbosity_
==
NumProc
::
FULL
)
std
::
cout
<<
"Unsuccessful iteration!"
<<
std
::
endl
;
std
::
cout
<<
"Unsuccessful iteration!"
<<
std
::
endl
;
}
}
// Write current energy
// Write current energy
if
(
this
->
verbosity_
==
NumProc
::
FULL
)
if
(
this
->
verbosity_
==
NumProc
::
FULL
)
std
::
cout
<<
"--- Current energy: "
<<
energy
<<
" ---"
<<
std
::
endl
;
std
::
cout
<<
"--- Current energy: "
<<
energy
<<
" ---"
<<
std
::
endl
;
...
...
This diff is collapsed.
Click to expand it.
dune/gfe/targetspacertrsolver.hh
+
5
−
5
View file @
36cbc7f7
...
@@ -8,13 +8,13 @@
...
@@ -8,13 +8,13 @@
#include
<dune/solvers/iterationsteps/trustregiongsstep.hh>
#include
<dune/solvers/iterationsteps/trustregiongsstep.hh>
#include
<dune/solvers/norms/energynorm.hh>
#include
<dune/solvers/norms/energynorm.hh>
/** \brief Riemannian trust-region solver for geodesic finite-element problems
/** \brief Riemannian trust-region solver for geodesic finite-element problems
\tparam TargetSpace The manifold that our functions take values in
\tparam TargetSpace The manifold that our functions take values in
*/
*/
template
<
class
TargetSpace
>
template
<
class
TargetSpace
>
class
TargetSpaceRiemannianTRSolver
class
TargetSpaceRiemannianTRSolver
:
public
NumProc
:
public
NumProc
{
{
const
static
int
blocksize
=
TargetSpace
::
TangentVector
::
dimension
;
const
static
int
blocksize
=
TargetSpace
::
TangentVector
::
dimension
;
// Centralize the field type here
// Centralize the field type here
...
@@ -77,10 +77,10 @@ protected:
...
@@ -77,10 +77,10 @@ protected:
/** \brief The iteration step for the quadratic inner problems */
/** \brief The iteration step for the quadratic inner problems */
std
::
auto_ptr
<
TrustRegionGSStep
<
MatrixType
,
CorrectionType
>
>
innerSolverStep_
;
std
::
auto_ptr
<
TrustRegionGSStep
<
MatrixType
,
CorrectionType
>
>
innerSolverStep_
;
/** \brief Norm for the quadratic inner problems */
/** \brief Norm for the quadratic inner problems */
std
::
auto_ptr
<
EnergyNorm
<
MatrixType
,
CorrectionType
>
>
energyNorm_
;
std
::
auto_ptr
<
EnergyNorm
<
MatrixType
,
CorrectionType
>
>
energyNorm_
;
};
};
#include
"targetspacertrsolver.cc"
#include
"targetspacertrsolver.cc"
...
...
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