Skip to content
Snippets Groups Projects
Commit b49a879c authored by Elias Pipping's avatar Elias Pipping
Browse files

CGStepTest: Use symmetric BlockGS preconditioner

parent 7f34d049
Branches
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <dune/solvers/norms/energynorm.hh> #include <dune/solvers/norms/energynorm.hh>
#include <dune/solvers/solvers/loopsolver.hh> #include <dune/solvers/solvers/loopsolver.hh>
#include <dune/solvers/iterationsteps/blockgsstep.hh>
#include <dune/solvers/iterationsteps/cgstep.hh> #include <dune/solvers/iterationsteps/cgstep.hh>
#include <dune/solvers/solvers/cgsolver.hh> #include <dune/solvers/solvers/cgsolver.hh>
...@@ -111,6 +112,25 @@ struct CGTestSuite ...@@ -111,6 +112,25 @@ struct CGTestSuite
passed = passed and analyser.analyse(u_copy, testCase); passed = passed and analyser.analyse(u_copy, testCase);
} }
{
std::string const testCase = "CGSolver, preconditioned ";
Vector u_copy = u;
Vector rhs_copy = rhs;
using BGS = BlockGSStep<Matrix,Vector,BitVector>;
BGS blockgs(BGS::Direction::SYMMETRIC);
blockgs.ignoreNodes_ = new BitVector(u.size(), false);
CGSolver<Matrix,Vector> solver(&A, &u_copy, &rhs_copy, &blockgs,
maxIterations, stepTol, &energyNorm,
verbosity, relativeErrors);
solver.check();
solver.preprocess();
solver.solve();
passed = passed and analyser.analyse(u_copy, testCase);
}
{ {
std::string const testCase = "Dune::Solvers::CGStep "; std::string const testCase = "Dune::Solvers::CGStep ";
...@@ -126,6 +146,25 @@ struct CGTestSuite ...@@ -126,6 +146,25 @@ struct CGTestSuite
passed = passed and analyser.analyse(u_copy, testCase); passed = passed and analyser.analyse(u_copy, testCase);
} }
{
std::string const testCase = "Dune::Solvers::CGStep, preconditioned";
Vector u_copy = u;
Vector rhs_copy = rhs;
using BGS = BlockGSStep<Matrix,Vector,BitVector>;
BGS blockgs(BGS::Direction::SYMMETRIC);
blockgs.ignoreNodes_ = new BitVector(u.size(), false);
Dune::Solvers::CGStep<Matrix,Vector> cgStep(A, u_copy, rhs_copy, blockgs);
::LoopSolver<Vector> solver(&cgStep, maxIterations, stepTol, &energyNorm,
verbosity, relativeErrors);
solver.check();
solver.preprocess();
solver.solve();
passed = passed and analyser.analyse(u_copy, testCase);
}
return passed; return passed;
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment