changed: expose category as member for dune 2.6

the enum can only be used with a define, and that would
just be a temporary solution in any case
This commit is contained in:
Arne Morten Kvarving 2018-01-22 17:23:22 +01:00
parent 3c5510c879
commit 4315665b64
3 changed files with 26 additions and 0 deletions

View File

@ -527,12 +527,20 @@ namespace Opm {
typedef Dune::CollectiveCommunication< Grid > communication_type; typedef Dune::CollectiveCommunication< Grid > communication_type;
#endif #endif
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
Dune::SolverCategory::Category category() const override
{
return overlapping ?
Dune::SolverCategory::overlapping : Dune::SolverCategory::sequential;
}
#else
enum { enum {
//! \brief The solver category. //! \brief The solver category.
category = overlapping ? category = overlapping ?
Dune::SolverCategory::overlapping : Dune::SolverCategory::overlapping :
Dune::SolverCategory::sequential Dune::SolverCategory::sequential
}; };
#endif
//! constructor: just store a reference to a matrix //! constructor: just store a reference to a matrix
WellModelMatrixAdapter (const M& A, const WellModel& wellMod, const boost::any& parallelInformation = boost::any() ) WellModelMatrixAdapter (const M& A, const WellModel& wellMod, const boost::any& parallelInformation = boost::any() )

View File

@ -385,11 +385,19 @@ createAMGPreconditionerPointer( Op& opA, const double relax, const P& comm, std:
typedef typename X::field_type field_type; typedef typename X::field_type field_type;
// define the category // define the category
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
Dune::SolverCategory::Category category() const override
{
return std::is_same<P,Dune::Amg::SequentialInformation>::value ?
Dune::SolverCategory::sequential : Dune::SolverCategory::overlapping;
}
#else
enum { enum {
//! \brief The category the preconditioner is part of. //! \brief The category the preconditioner is part of.
category = std::is_same<P,Dune::Amg::SequentialInformation>::value? category = std::is_same<P,Dune::Amg::SequentialInformation>::value?
Dune::SolverCategory::sequential:Dune::SolverCategory::overlapping Dune::SolverCategory::sequential:Dune::SolverCategory::overlapping
}; };
#endif
typedef ISTLUtility::CPRSelector<M,X,X,P> CPRSelectorType ; typedef ISTLUtility::CPRSelector<M,X,X,P> CPRSelectorType ;

View File

@ -22,6 +22,7 @@
#include <opm/common/Exceptions.hpp> #include <opm/common/Exceptions.hpp>
#include <dune/common/version.hh>
#include <dune/istl/preconditioner.hh> #include <dune/istl/preconditioner.hh>
#include <dune/istl/paamg/smoother.hh> #include <dune/istl/paamg/smoother.hh>
#include <dune/istl/paamg/pinfo.hh> #include <dune/istl/paamg/pinfo.hh>
@ -227,12 +228,21 @@ protected:
}; };
public: public:
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
Dune::SolverCategory::Category category() const override
{
return std::is_same<ParallelInfoT, Dune::Amg::SequentialInformation>::value ?
Dune::SolverCategory::sequential : Dune::SolverCategory::overlapping;
}
#else
// define the category // define the category
enum { enum {
//! \brief The category the preconditioner is part of. //! \brief The category the preconditioner is part of.
category = std::is_same<ParallelInfoT, Dune::Amg::SequentialInformation>::value ? category = std::is_same<ParallelInfoT, Dune::Amg::SequentialInformation>::value ?
Dune::SolverCategory::sequential : Dune::SolverCategory::overlapping Dune::SolverCategory::sequential : Dune::SolverCategory::overlapping
}; };
#endif
/*! \brief Constructor. /*! \brief Constructor.