From 03254765e5060fb0099b2cd88c012370067b6a6f Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Fri, 2 Feb 2018 07:28:40 +0100 Subject: [PATCH] [linearSolver] Add version check to avoid deprecation warning * dune-istl has unified SeqILU0 and SeqILUn to SeqILU --- dumux/linear/seqsolverbackend.hh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/dumux/linear/seqsolverbackend.hh b/dumux/linear/seqsolverbackend.hh index 659b893c96..867b528f7d 100644 --- a/dumux/linear/seqsolverbackend.hh +++ b/dumux/linear/seqsolverbackend.hh @@ -30,6 +30,7 @@ #include <dune/istl/solvers.hh> #include <dune/istl/superlu.hh> #include <dune/istl/umfpack.hh> +#include <dune/common/version.hh> #include <dumux/common/parameters.hh> #include <dumux/common/properties.hh> @@ -177,7 +178,11 @@ public: template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { +#if DUNE_VERSION_NEWER(DUNE_ISTL,2,6) + using Preconditioner = Dune::SeqILU<Matrix, Vector, Vector, precondBlockLevel>; +#else using Preconditioner = Dune::SeqILUn<Matrix, Vector, Vector, precondBlockLevel>; +#endif using Solver = Dune::BiCGSTABSolver<Vector>; return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); @@ -365,7 +370,11 @@ public: template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { +#if DUNE_VERSION_NEWER(DUNE_ISTL,2,6) + using Preconditioner = Dune::SeqILU<Matrix, Vector, Vector, precondBlockLevel>; +#else using Preconditioner = Dune::SeqILUn<Matrix, Vector, Vector, precondBlockLevel>; +#endif using Solver = Dune::CGSolver<Vector>; return IterativePreconditionedSolverImpl::template solve<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); @@ -587,7 +596,11 @@ public: template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { +#if DUNE_VERSION_NEWER(DUNE_ISTL,2,6) + using Preconditioner = Dune::SeqILU<Matrix, Vector, Vector, precondBlockLevel>; +#else using Preconditioner = Dune::SeqILU0<Matrix, Vector, Vector, precondBlockLevel>; +#endif using Solver = Dune::BiCGSTABSolver<Vector>; return IterativePreconditionedSolverImpl::template solveWithILU0Prec<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); @@ -623,7 +636,11 @@ public: template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { +#if DUNE_VERSION_NEWER(DUNE_ISTL,2,6) + using Preconditioner = Dune::SeqILU<Matrix, Vector, Vector, precondBlockLevel>; +#else using Preconditioner = Dune::SeqILU0<Matrix, Vector, Vector, precondBlockLevel>; +#endif using Solver = Dune::CGSolver<Vector>; return IterativePreconditionedSolverImpl::template solveWithILU0Prec<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); @@ -660,7 +677,11 @@ public: template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { +#if DUNE_VERSION_NEWER(DUNE_ISTL,2,6) + using Preconditioner = Dune::SeqILU<Matrix, Vector, Vector, precondBlockLevel>; +#else using Preconditioner = Dune::SeqILU0<Matrix, Vector, Vector, precondBlockLevel>; +#endif using Solver = Dune::RestartedGMResSolver<Vector>; return IterativePreconditionedSolverImpl::template solveWithILU0PrecGMRes<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); @@ -698,7 +719,11 @@ public: template<int precondBlockLevel = 1, class Matrix, class Vector> bool solve(const Matrix& A, Vector& x, const Vector& b) { +#if DUNE_VERSION_NEWER(DUNE_ISTL,2,6) + using Preconditioner = Dune::SeqILU<Matrix, Vector, Vector, precondBlockLevel>; +#else using Preconditioner = Dune::SeqILUn<Matrix, Vector, Vector, precondBlockLevel>; +#endif using Solver = Dune::RestartedGMResSolver<Vector>; return IterativePreconditionedSolverImpl::template solveWithGMRes<Preconditioner, Solver>(*this, A, x, b, this->paramGroup()); -- GitLab