Commit c8db999d authored by Ansgar Burchardt's avatar 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
......@@ -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();
......
......@@ -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();
......
......@@ -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));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment