Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
agnumpde
dune-tnnmg
Commits
c8db999d
Commit
c8db999d
authored
Jun 25, 2018
by
Ansgar Burchardt
Browse files
tests: pass iteration step and norm as `shared_ptr`
This addresses warnings that passing a raw pointer is deprecated.
parent
87549c6b
Changes
3
Hide whitespace changes
Inline
Side-by-side
dune/tnnmg/test/multitypegstest.cc
View file @
c8db999d
...
...
@@ -86,11 +86,11 @@ void solveProblem(const MatrixType& mat, VectorType& x, const VectorType& rhs, c
using
Step
=
typename
Dune
::
TNNMG
::
NonlinearGSStep
<
Functional
,
decltype
(
localSolver
)
>
;
using
Solver
=
::
LoopSolver
<
Vector
>
;
auto
step
=
Step
(
J
,
x
,
localSolver
);
auto
norm
=
EnergyNorm
<
Matrix
,
Vector
>
(
mat
);
auto
solver
=
Solver
(
&
step
,
100
,
0
,
&
norm
,
Solver
::
FULL
);
auto
step
=
std
::
make_shared
<
Step
>
(
J
,
x
,
localSolver
);
auto
norm
=
std
::
make_shared
<
EnergyNorm
<
Matrix
,
Vector
>
>
(
mat
);
auto
solver
=
Solver
(
step
,
100
,
0
,
norm
,
Solver
::
FULL
);
step
.
setIgnore
(
ignore
);
step
->
setIgnore
(
ignore
);
solver
.
addCriterion
(
[
&
](){
...
...
@@ -126,7 +126,7 @@ void solveProblem(const MatrixType& mat, VectorType& x, const VectorType& rhs, c
" #tr(0*0) #tr(0*1) #tr(1*0)"
);
std
::
vector
<
double
>
correctionNorms
;
solver
.
addCriterion
(
Dune
::
Solvers
::
correctionNormCriterion
(
step
,
norm
,
1e-10
,
correctionNorms
));
solver
.
addCriterion
(
Dune
::
Solvers
::
correctionNormCriterion
(
*
step
,
*
norm
,
1e-10
,
correctionNorms
));
solver
.
preprocess
();
solver
.
solve
();
...
...
dune/tnnmg/test/nonlineargsperformancetest.cc
View file @
c8db999d
...
...
@@ -83,11 +83,11 @@ void performanceTest(const MatrixType& mat, VectorType& x, const VectorType& rhs
using
Solver
=
LoopSolver
<
Vector
>
;
using
Norm
=
EnergyNorm
<
Matrix
,
Vector
>
;
auto
step
=
Step
(
J
,
x
,
localSolver
);
auto
norm
=
Norm
(
mat
);
auto
solver
=
Solver
(
&
step
,
100
,
0
,
&
norm
,
Solver
::
FULL
);
auto
step
=
std
::
make_shared
<
Step
>
(
J
,
x
,
localSolver
);
auto
norm
=
std
::
make_shared
<
Norm
>
(
mat
);
auto
solver
=
Solver
(
step
,
100
,
0
,
norm
,
Solver
::
FULL
);
step
.
ignoreNodes_
=
&
ignore
;
step
->
ignoreNodes_
=
&
ignore
;
solver
.
preprocess
();
...
...
@@ -117,11 +117,11 @@ void performanceTest(const MatrixType& mat, VectorType& x, const VectorType& rhs
using
Solver
=
LoopSolver
<
Vector
>
;
using
Norm
=
EnergyNorm
<
Matrix
,
Vector
>
;
auto
step
=
Step
(
J
,
x
,
localSolver
);
auto
norm
=
Norm
(
mat
);
auto
solver
=
Solver
(
&
step
,
100
,
0
,
&
norm
,
Solver
::
FULL
);
auto
step
=
std
::
make_shared
<
Step
>
(
J
,
x
,
localSolver
);
auto
norm
=
std
::
make_shared
<
Norm
>
(
mat
);
auto
solver
=
Solver
(
*
step
,
100
,
0
,
*
norm
,
Solver
::
FULL
);
step
.
ignoreNodes_
=
&
ignore
;
step
->
ignoreNodes_
=
&
ignore
;
solver
.
preprocess
();
...
...
@@ -141,11 +141,11 @@ void performanceTest(const MatrixType& mat, VectorType& x, const VectorType& rhs
using
Solver
=
LoopSolver
<
Vector
>
;
using
Norm
=
EnergyNorm
<
Matrix
,
Vector
>
;
auto
step
=
Step
(
mat
,
x
,
rhs
);
auto
norm
=
Norm
(
mat
);
auto
solver
=
Solver
(
&
step
,
100
,
0
,
&
norm
,
Solver
::
FULL
);
auto
step
=
std
::
make_shared
<
Step
>
(
mat
,
x
,
rhs
);
auto
norm
=
std
::
make_shared
<
Norm
>
(
mat
);
auto
solver
=
Solver
(
step
,
100
,
0
,
norm
,
Solver
::
FULL
);
step
.
ignoreNodes_
=
&
ignore
;
step
->
ignoreNodes_
=
&
ignore
;
solver
.
preprocess
();
...
...
dune/tnnmg/test/nonlineargstest.cc
View file @
c8db999d
...
...
@@ -144,13 +144,13 @@ void solveProblem(const MatrixType& mat, VectorType& x, const VectorType& rhs, c
using
Solver
=
LoopSolver
<
Vector
>
;
using
Norm
=
EnergyNorm
<
Matrix
,
Vector
>
;
auto
step
=
Step
(
J
,
x
,
localSolver
,
acceleration
);
auto
norm
=
Norm
(
mat
);
auto
solver
=
Solver
(
&
step
,
1e9
,
0
,
&
norm
,
Solver
::
FULL
);
auto
step
=
std
::
make_shared
<
Step
>
(
J
,
x
,
localSolver
,
acceleration
);
auto
norm
=
std
::
make_shared
<
Norm
>
(
mat
);
auto
solver
=
Solver
(
step
,
1e9
,
0
,
norm
,
Solver
::
FULL
);
step
.
setIgnore
(
ignore
);
step
.
setPreSmoothingSteps
(
3
);
step
.
setPostSmoothingSteps
(
3
);
step
->
setIgnore
(
ignore
);
step
->
setPreSmoothingSteps
(
3
);
step
->
setPostSmoothingSteps
(
3
);
solver
.
addCriterion
(
[
&
](){
...
...
@@ -171,14 +171,14 @@ void solveProblem(const MatrixType& mat, VectorType& x, const VectorType& rhs, c
solver
.
addCriterion
(
[
&
](){
return
Dune
::
formatString
(
" % 12.5e"
,
step
.
accelerationStep
().
lastDampingFactor
());
return
Dune
::
formatString
(
" % 12.5e"
,
step
->
accelerationStep
().
lastDampingFactor
());
},
" damping "
);
solver
.
addCriterion
(
[
&
](){
return
Dune
::
formatString
(
" % 12d"
,
step
.
accelerationStep
().
linearization
().
truncated
().
count
());
return
Dune
::
formatString
(
" % 12d"
,
step
->
accelerationStep
().
linearization
().
truncated
().
count
());
},
" truncated "
);
...
...
@@ -219,7 +219,7 @@ void solveProblem(const MatrixType& mat, VectorType& x, const VectorType& rhs, c
// solver.addCriterion(Dune::Solvers::maxIterCriterion(solver, maxIterations) | gradientCriterion);
std
::
vector
<
double
>
correctionNorms
;
solver
.
addCriterion
(
Dune
::
Solvers
::
correctionNormCriterion
(
step
,
norm
,
1e-10
,
correctionNorms
));
solver
.
addCriterion
(
Dune
::
Solvers
::
correctionNormCriterion
(
*
step
,
*
norm
,
1e-10
,
correctionNorms
));
// solver.addCriterion(Dune::Solvers::correctionNormCriterion(step, norm, 1e-4));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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