Use Communication instead of CollectiveCommunication for DUNE>=2.7.

The later is removed in 2.9.
This commit is contained in:
Markus Blatt 2022-10-10 21:58:46 +02:00
parent f137d15c65
commit b9b6f7defd
3 changed files with 36 additions and 4 deletions

View File

@ -181,14 +181,22 @@ class NewtonMethod
using ConvergenceWriter = GetPropType<TypeTag, Properties::NewtonConvergenceWriter>;
using Communicator = typename Dune::MPIHelper::MPICommunicator;
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
using CollectiveCommunication = typename Dune::Communication<typename Dune::MPIHelper::MPICommunicator>;
#else
using CollectiveCommunication = Dune::CollectiveCommunication<Communicator>;
#endif
public:
NewtonMethod(Simulator& simulator)
: simulator_(simulator)
, endIterMsgStream_(std::ostringstream::out)
, linearSolver_(simulator)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
, comm_(Dune::MPIHelper::getCommunicator())
#else
, comm_(Dune::MPIHelper::getCollectiveCommunicator())
#endif
, convergenceWriter_(asImp_())
{
lastError_ = 1e100;

View File

@ -47,9 +47,24 @@
#include <string>
#include <memory>
#define EWOMS_CATCH_PARALLEL_EXCEPTIONS_FATAL(code) \
namespace Opm
{
namespace detail
{
inline auto getMPIHelperCommunication()
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
return Dune::MPIHelper::getCommunication();
#else
return Dune::MPIHelper::getCollectiveCommunication();
#endif
}
} // end namespace detail
} // end namespace Opm
#define EWOMS_CATCH_PARALLEL_EXCEPTIONS_FATAL(code) \
{ \
const auto& comm = Dune::MPIHelper::getCollectiveCommunication(); \
const auto& comm = ::Opm::detail::getMPIHelperCommunication(); \
bool exceptionThrown = false; \
try { code; } \
catch (const Dune::Exception& e) { \

View File

@ -43,8 +43,12 @@ class OverlappingScalarProduct
{
public:
using field_type = typename OverlappingBlockVector::field_type;
using CollectiveCommunication = typename Dune::CollectiveCommunication<typename Dune::MPIHelper::MPICommunicator>;
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
using CollectiveCommunication = typename Dune::Communication<typename Dune::MPIHelper::MPICommunicator>;
#else
using CollectiveCommunication = typename Dune::CollectiveCommunication<typename Dune::MPIHelper::MPICommunicator>;
#endif
using real_type = typename Dune::ScalarProduct<OverlappingBlockVector>::real_type;
//! the kind of computations supported by the operator. Either overlapping or non-overlapping
@ -52,7 +56,12 @@ public:
{ return Dune::SolverCategory::overlapping; }
OverlappingScalarProduct(const Overlap& overlap)
: overlap_(overlap), comm_( Dune::MPIHelper::getCollectiveCommunication() )
: overlap_(overlap),
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
comm_( Dune::MPIHelper::getCommunication() )
#else
comm_( Dune::MPIHelper::getCollectiveCommunication() )
#endif
{}
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2,7)