diff --git a/opm/autodiff/ISTLSolver.hpp b/opm/autodiff/ISTLSolver.hpp index 37c30376f..520e90a16 100644 --- a/opm/autodiff/ISTLSolver.hpp +++ b/opm/autodiff/ISTLSolver.hpp @@ -289,7 +289,14 @@ namespace Opm } } +#if DUNE_VERSION_NEWER(DUNE_ISTL, 2 , 5) typedef ParallelOverlappingILU0 SeqPreconditioner; +#else + typedef ParallelOverlappingILU0 >, + Vector, Vector> SeqPreconditioner; +#endif template std::unique_ptr constructPrecond(Operator& opA, const Dune::Amg::SequentialInformation&) const @@ -302,7 +309,14 @@ namespace Opm #if HAVE_MPI typedef Dune::OwnerOverlapCopyCommunication Comm; +#if DUNE_VERSION_NEWER(DUNE_ISTL, 2 , 5) typedef ParallelOverlappingILU0 ParPreconditioner; +#else + typedef ParallelOverlappingILU0 >, + Vector, Vector, Comm> ParPreconditioner; +#endif template std::unique_ptr constructPrecond(Operator& opA, const Comm& comm) const diff --git a/opm/autodiff/ParallelOverlappingILU0.hpp b/opm/autodiff/ParallelOverlappingILU0.hpp index 78f755ed3..8c048f401 100644 --- a/opm/autodiff/ParallelOverlappingILU0.hpp +++ b/opm/autodiff/ParallelOverlappingILU0.hpp @@ -165,6 +165,7 @@ class ParallelOverlappingILU0 { typedef ParallelInfoT ParallelInfo; + public: //! \brief The matrix type the preconditioner is for. typedef typename Dune::remove_const::type matrix_type; @@ -238,14 +239,18 @@ public: \param n ILU fill in level (for testing). This does not work in parallel. \param w The relaxation factor. */ - ParallelOverlappingILU0 (const Matrix& A, const int n, const field_type w ) + template + ParallelOverlappingILU0 (const Dune::BCRSMatrix& A, + const int n, const field_type w ) : lower_(), upper_(), inv_(), comm_(nullptr), w_(w), relaxation_( std::abs( w - 1.0 ) > 1e-15 ) { - init( A, n ); + // BlockMatrix is a Subclass of FieldMatrix that just adds + // methods. Therefore this cast should be safe. + init( reinterpret_cast(A), n ); } /*! \brief Constructor. @@ -254,7 +259,9 @@ public: \param A The matrix to operate on. \param w The relaxation factor. */ - ParallelOverlappingILU0 (const Matrix& A, const field_type w) + template + ParallelOverlappingILU0 (const Dune::BCRSMatrix& A, + const field_type w) : ParallelOverlappingILU0( A, 0, w ) { } @@ -266,14 +273,18 @@ public: \param comm communication object, e.g. Dune::OwnerOverlapCopyCommunication \param w The relaxation factor. */ - ParallelOverlappingILU0 (const Matrix& A, const ParallelInfo& comm, const field_type w) + template + ParallelOverlappingILU0 (const Dune::BCRSMatrix& A, + const ParallelInfo& comm, const field_type w) : lower_(), upper_(), inv_(), comm_(&comm), w_(w), relaxation_( std::abs( w - 1.0 ) > 1e-15 ) { - init( A, 0 ); + // BlockMatrix is a Subclass of FieldMatrix that just adds + // methods. Therefore this cast should be safe. + init( reinterpret_cast(A), 0 ); } /*!