mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-28 02:00:59 -06:00
Merge pull request #1392 from akva2/build_dune26
Fix build with dune 2.6
This commit is contained in:
commit
1e5e3f7ddf
@ -527,12 +527,20 @@ namespace Opm {
|
||||
typedef Dune::CollectiveCommunication< Grid > communication_type;
|
||||
#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 {
|
||||
//! \brief The solver category.
|
||||
category = overlapping ?
|
||||
Dune::SolverCategory::overlapping :
|
||||
Dune::SolverCategory::sequential
|
||||
};
|
||||
#endif
|
||||
|
||||
//! constructor: just store a reference to a matrix
|
||||
WellModelMatrixAdapter (const M& A, const WellModel& wellMod, const boost::any& parallelInformation = boost::any() )
|
||||
|
@ -385,11 +385,19 @@ createAMGPreconditionerPointer( Op& opA, const double relax, const P& comm, std:
|
||||
typedef typename X::field_type field_type;
|
||||
|
||||
// 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 {
|
||||
//! \brief The category the preconditioner is part of.
|
||||
category = std::is_same<P,Dune::Amg::SequentialInformation>::value?
|
||||
Dune::SolverCategory::sequential:Dune::SolverCategory::overlapping
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef ISTLUtility::CPRSelector<M,X,X,P> CPRSelectorType ;
|
||||
|
||||
@ -519,11 +527,15 @@ createAMGPreconditionerPointer( Op& opA, const double relax, const P& comm, std:
|
||||
Dune::InverseOperatorResult result;
|
||||
|
||||
// the scalar product chooser
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
auto sp = Dune::createScalarProduct<X,ParallelInformation>(commAe_, category());
|
||||
#else
|
||||
typedef Dune::ScalarProductChooser<X,ParallelInformation,category>
|
||||
ScalarProductChooser;
|
||||
// the scalar product.
|
||||
std::unique_ptr<typename ScalarProductChooser::ScalarProduct>
|
||||
sp(ScalarProductChooser::construct(commAe_));
|
||||
#endif
|
||||
|
||||
if( amg_ )
|
||||
{
|
||||
|
@ -711,13 +711,20 @@ namespace Opm
|
||||
if( output && output_ecl && grid().comm().size() > 1 )
|
||||
{
|
||||
typedef typename Grid::LeafGridView GridView;
|
||||
using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout>;
|
||||
#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
|
||||
using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
|
||||
#else
|
||||
// Get the owner rank number for each cell
|
||||
using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout>;
|
||||
#endif
|
||||
using Handle = CellOwnerDataHandle<ElementMapper>;
|
||||
const Grid& globalGrid = this->globalGrid();
|
||||
const auto& globalGridView = globalGrid.leafGridView();
|
||||
#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
|
||||
ElementMapper globalMapper(globalGridView, Dune::mcmgElementLayout());
|
||||
#else
|
||||
ElementMapper globalMapper(globalGridView);
|
||||
#endif
|
||||
const auto globalSize = globalGrid.size(0);
|
||||
std::vector<int> ranks(globalSize, -1);
|
||||
Handle handle(globalMapper, ranks);
|
||||
@ -746,8 +753,13 @@ namespace Opm
|
||||
const Grid& globalGrid = this->globalGrid();
|
||||
const auto& globalGridView = globalGrid.leafGridView();
|
||||
typedef typename Grid::LeafGridView GridView;
|
||||
#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
|
||||
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView> ElementMapper;
|
||||
ElementMapper globalElemMapper(globalGridView, Dune::mcmgElementLayout());
|
||||
#else
|
||||
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout> ElementMapper;
|
||||
ElementMapper globalElemMapper(globalGridView);
|
||||
#endif
|
||||
const auto& cartesianCellIdx = globalGrid.globalCell();
|
||||
|
||||
const auto* globalTrans = &(ebosSimulator_->gridManager().globalTransmissibility());
|
||||
@ -816,8 +828,13 @@ namespace Opm
|
||||
const Grid& globalGrid = this->globalGrid();
|
||||
const auto& globalGridView = globalGrid.leafGridView();
|
||||
typedef typename Grid::LeafGridView GridView;
|
||||
#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
|
||||
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView> ElementMapper;
|
||||
ElementMapper globalElemMapper(globalGridView, Dune::mcmgElementLayout());
|
||||
#else
|
||||
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout> ElementMapper;
|
||||
ElementMapper globalElemMapper(globalGridView);
|
||||
#endif
|
||||
|
||||
const auto* globalTrans = &(ebosSimulator_->gridManager().globalTransmissibility());
|
||||
if (grid().comm().size() < 2) {
|
||||
|
@ -380,16 +380,25 @@ namespace Opm
|
||||
/// \brief construct the CPR preconditioner and the solver.
|
||||
/// \tparam P The type of the parallel information.
|
||||
/// \param parallelInformation the information about the parallelization.
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
template<Dune::SolverCategory::Category category=Dune::SolverCategory::sequential,
|
||||
class LinearOperator, class POrComm>
|
||||
#else
|
||||
template<int category=Dune::SolverCategory::sequential, class LinearOperator, class POrComm>
|
||||
#endif
|
||||
void constructPreconditionerAndSolve(LinearOperator& linearOperator,
|
||||
Vector& x, Vector& istlb,
|
||||
const POrComm& parallelInformation_arg,
|
||||
Dune::InverseOperatorResult& result) const
|
||||
{
|
||||
// Construct scalar product.
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
auto sp = Dune::createScalarProduct<Vector,POrComm>(parallelInformation_arg, category);
|
||||
#else
|
||||
typedef Dune::ScalarProductChooser<Vector, POrComm, category> ScalarProductChooser;
|
||||
typedef std::unique_ptr<typename ScalarProductChooser::ScalarProduct> SPPointer;
|
||||
SPPointer sp(ScalarProductChooser::construct(parallelInformation_arg));
|
||||
#endif
|
||||
|
||||
// Communicate if parallel.
|
||||
parallelInformation_arg.copyOwnerToAll(istlb, istlb);
|
||||
|
@ -84,16 +84,25 @@ namespace Opm
|
||||
/// \brief construct the CPR preconditioner and the solver.
|
||||
/// \tparam P The type of the parallel information.
|
||||
/// \param parallelInformation the information about the parallelization.
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
template<Dune::SolverCategory::Category category=Dune::SolverCategory::sequential,
|
||||
class O, class P>
|
||||
#else
|
||||
template<int category=Dune::SolverCategory::sequential, class O, class P>
|
||||
#endif
|
||||
void constructPreconditionerAndSolve(O& opA, DuneMatrix& istlAe,
|
||||
Vector& x, Vector& istlb,
|
||||
const P& parallelInformation_arg,
|
||||
const P& parallelInformationAe,
|
||||
Dune::InverseOperatorResult& result) const
|
||||
{
|
||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 6)
|
||||
auto sp = Dune::createScalarProduct<Vector,P>(parallelInformation_arg, category);
|
||||
#else
|
||||
typedef Dune::ScalarProductChooser<Vector,P,category> ScalarProductChooser;
|
||||
std::unique_ptr<typename ScalarProductChooser::ScalarProduct>
|
||||
sp(ScalarProductChooser::construct(parallelInformation_arg));
|
||||
#endif
|
||||
// Construct preconditioner.
|
||||
// typedef Dune::SeqILU0<Mat,Vector,Vector> Preconditioner;
|
||||
typedef Opm::CPRPreconditioner<Mat,Vector,Vector,P> Preconditioner;
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <dune/common/version.hh>
|
||||
#include <dune/istl/preconditioner.hh>
|
||||
#include <dune/istl/paamg/smoother.hh>
|
||||
#include <dune/istl/paamg/pinfo.hh>
|
||||
@ -227,12 +228,21 @@ protected:
|
||||
};
|
||||
|
||||
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
|
||||
enum {
|
||||
//! \brief The category the preconditioner is part of.
|
||||
category = std::is_same<ParallelInfoT, Dune::Amg::SequentialInformation>::value ?
|
||||
Dune::SolverCategory::sequential : Dune::SolverCategory::overlapping
|
||||
};
|
||||
#endif
|
||||
|
||||
/*! \brief Constructor.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user