diff --git a/opm/core/linalg/LinearSolverIstl.cpp b/opm/core/linalg/LinearSolverIstl.cpp index 69353b10e..d440e7a6d 100644 --- a/opm/core/linalg/LinearSolverIstl.cpp +++ b/opm/core/linalg/LinearSolverIstl.cpp @@ -61,10 +61,10 @@ namespace Opm LinearSolverInterface::LinearSolverReport solveCG_AMG(const Mat& A, Vector& x, Vector& b, double tolerance, int maxit, int verbosity); +#ifdef HAS_DUNE_FAST_AMG LinearSolverInterface::LinearSolverReport solveKAMG(const Mat& A, Vector& x, Vector& b, double tolerance, int maxit, int verbosity); -#ifdef HAS_DUNE_FAST_AMG LinearSolverInterface::LinearSolverReport solveFastAMG(const Mat& A, Vector& x, Vector& b, double tolerance, int maxit, int verbosity); #endif @@ -178,7 +178,11 @@ namespace Opm res = solveCG_AMG(A, x, b, linsolver_residual_tolerance_, maxit, linsolver_verbosity_); break; case KAMG: +#ifdef HAS_DUNE_FAST_AMG res = solveKAMG(A, x, b, linsolver_residual_tolerance_, maxit, linsolver_verbosity_); +#else + throw std::runtime_error("KAMG not supported with this version of DUNE"); +#endif break; case FastAMG: #ifdef HAS_DUNE_FAST_AMG @@ -298,6 +302,7 @@ namespace Opm } +#ifdef HAS_DUNE_FAST_AMG LinearSolverInterface::LinearSolverReport solveKAMG(const Mat& A, Vector& x, Vector& b, double tolerance, int maxit, int verbosity) { @@ -321,8 +326,7 @@ namespace Opm typedef Dune::SeqSOR Smoother; #endif typedef Dune::Amg::CoarsenCriterion Criterion; - typedef Dune::Amg::KAMG, std::allocator > Precond; - + typedef Dune::Amg::KAMG Precond; Operator opA(A); // Construct preconditioner. @@ -351,7 +355,6 @@ namespace Opm return res; } -#ifdef HAS_DUNE_FAST_AMG LinearSolverInterface::LinearSolverReport solveFastAMG(const Mat& A, Vector& x, Vector& b, double tolerance, int maxit, int verbosity) {