added: support dune-istl >= 2.7
This commit is contained in:
@@ -335,7 +335,11 @@ static ISTL::Preconditioner* setupAMG2_smoother(const LinSolParams& params, size
|
||||
{
|
||||
std::string smoother = params.getBlock(block).getStringValue("multigrid_smoother");
|
||||
if (smoother == "ilu")
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
return setupAMG2_full<ISTL::ILU>(params, block, op, solver, fsmooth);
|
||||
#else
|
||||
return setupAMG2_full<ISTL::ILU0>(params, block, op, solver, fsmooth);
|
||||
#endif
|
||||
else if (smoother == "sor")
|
||||
return setupAMG2_full<ISTL::SOR>(params, block, op, solver, fsmooth);
|
||||
else if (smoother == "ssor")
|
||||
@@ -355,7 +359,11 @@ static ISTL::Preconditioner* setupAMG2(const LinSolParams& params, size_t block,
|
||||
{
|
||||
std::string smoother = params.getBlock(block).getStringValue("multigrid_finesmoother");
|
||||
if (params.getBlock(block).getStringValue("multigrid_finesmoother") == "ilu") {
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
auto fsmooth = new ISTL::ILU(op.getmat(), 1.0);
|
||||
#else
|
||||
auto fsmooth = new ISTL::ILU0(op.getmat(), 1.0);
|
||||
#endif
|
||||
return setupAMG2_smoother(params, block, op, solver, fsmooth);
|
||||
} else if (params.getBlock(block).getStringValue("multigrid_finesmoother") == "sor") {
|
||||
auto fsmooth = new ISTL::SOR(op.getmat(), 1, 1.0);
|
||||
@@ -399,10 +407,19 @@ ISTL::Preconditioner* ISTLSolParams::setupPCInternal(ISTL::Mat& A,
|
||||
if (prec == "ilu") {
|
||||
int fill_level = solParams.getBlock(block).getIntValue("ilu_fill_level");
|
||||
if (fill_level == 0)
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
return setupSolver(new ISTL::ILU(A, 1.0), op, solParams, solver);
|
||||
#else
|
||||
return setupSolver(new ISTL::ILU0(A, 1.0), op, solParams, solver);
|
||||
#endif
|
||||
else
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
return setupSolver(new ISTL::ILU(A, fill_level, 1.0),
|
||||
op, solParams, solver);
|
||||
#else
|
||||
return setupSolver(new ISTL::ILUn(A, fill_level, 1.0),
|
||||
op, solParams, solver);
|
||||
#endif
|
||||
} else if (prec == "lu")
|
||||
return setupSolver(new ISTL::LU(new ISTL::LUType(A)),
|
||||
op, solParams, solver);
|
||||
@@ -457,7 +474,11 @@ ISTL::Preconditioner* ISTLSolParams::setupPCInternal(ISTL::Mat& A,
|
||||
smoother = "ilu";
|
||||
}
|
||||
if (smoother == "ilu")
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
return setupAMG<ISTL::ILU>(solParams, block, op, solver);
|
||||
#else
|
||||
return setupAMG<ISTL::ILU0>(solParams, block, op, solver);
|
||||
#endif
|
||||
else if (smoother == "sor")
|
||||
return setupAMG<ISTL::SOR>(solParams, block, op, solver);
|
||||
else if (smoother == "ssor")
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <vector>
|
||||
|
||||
#ifdef HAS_ISTL
|
||||
#include <dune/common/version.hh>
|
||||
#include <dune/istl/bcrsmatrix.hh>
|
||||
#include <dune/istl/overlappingschwarz.hh>
|
||||
#include <dune/istl/preconditioners.hh>
|
||||
@@ -60,8 +61,12 @@ namespace ISTL
|
||||
#endif
|
||||
|
||||
// Preconditioner types
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
|
||||
using ILU = Dune::SeqILU<Mat, Vec, Vec>; //!< Sequential ILU
|
||||
#else
|
||||
typedef Dune::SeqILU0<Mat, Vec, Vec> ILU0; //!< Sequential ILU(0)
|
||||
typedef Dune::SeqILUn<Mat, Vec, Vec> ILUn; //!< Sequential ILU(n)
|
||||
#endif
|
||||
typedef Dune::SeqSOR<Mat, Vec, Vec> SOR; //!< Sequential SOR
|
||||
typedef Dune::SeqSSOR<Mat, Vec,Vec> SSOR; //!< Sequential SSOR
|
||||
typedef Dune::SeqJac<Mat, Vec, Vec> GJ; //!< Sequential Gauss-Jacobi
|
||||
|
||||
Reference in New Issue
Block a user