Commit 54faab07 authored by Patrick Jaap's avatar Patrick Jaap
Browse files

Bugfix: Set empty ignore nodes for IterativeSolver/LinearSolver

This was missing after the code shift to the external class.
It caused a segmentation fault when TNNMG is used with an
IterativeSolver/LinearSolver object.
parent 33bb42ad
......@@ -7,6 +7,7 @@
#include <dune/solvers/iterationsteps/lineariterationstep.hh>
#include <dune/solvers/solvers/iterativesolver.hh>
#include <dune/solvers/solvers/linearsolver.hh>
#include <dune/solvers/common/canignore.hh>
namespace Dune {
namespace TNNMG {
......@@ -40,6 +41,12 @@ LinearCorrection<Matrix, Vector>
makeLinearCorrection(std::shared_ptr< Solvers::LinearSolver<Matrix, Vector> > linearSolver)
{
return [=](const Matrix& A, Vector& x, const Vector& b) {
auto canIgnoreCast = std::dynamic_pointer_cast<CanIgnore<Solvers::DefaultBitVector_t<Vector>>>( linearSolver );
auto emptyIgnore = Impl::emptyIgnore(x);
if (canIgnoreCast)
canIgnoreCast->setIgnore(emptyIgnore);
linearSolver->setProblem(A, x, b);
linearSolver->preprocess();
linearSolver->solve();
......@@ -59,6 +66,7 @@ makeLinearCorrection(std::shared_ptr< Solvers::IterativeSolver<Vector> > iterati
if (not linearIterationStep)
DUNE_THROW(Exception, "iterative solver must use a linear iteration step");
linearIterationStep->setIgnore(emptyIgnore);
linearIterationStep->setProblem(A, x, b);
iterativeSolver->preprocess();
iterativeSolver->solve();
......
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