fixed: quell deprecation warnings with dune 2.7

This commit is contained in:
Arne Morten Kvarving 2020-02-07 15:18:11 +01:00
parent 4978e72039
commit cfa0904321
6 changed files with 45 additions and 0 deletions

View File

@ -53,7 +53,11 @@
#include <opm/common/data/SimulationDataContainer.hpp> #include <opm/common/data/SimulationDataContainer.hpp>
#include <dune/istl/owneroverlapcopy.hh> #include <dune/istl/owneroverlapcopy.hh>
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
#include <dune/common/parallel/communication.hh>
#else
#include <dune/common/parallel/collectivecommunication.hh> #include <dune/common/parallel/collectivecommunication.hh>
#endif
#include <dune/common/timer.hh> #include <dune/common/timer.hh>
#include <dune/common/unused.hh> #include <dune/common/unused.hh>

View File

@ -695,7 +695,11 @@ public:
criterion_, true); criterion_, true);
using CommunicationArgs = typename Dune::Amg::ConstructionTraits<Communication>::Arguments; using CommunicationArgs = typename Dune::Amg::ConstructionTraits<Communication>::Arguments;
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
CommunicationArgs commArgs(communication_->communicator(), communication_->category());
#else
CommunicationArgs commArgs(communication_->communicator(), communication_->getSolverCategory()); CommunicationArgs commArgs(communication_->communicator(), communication_->getSolverCategory());
#endif
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7) #if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
coarseLevelCommunication_ = Dune::Amg::ConstructionTraits<Communication>::construct(commArgs); coarseLevelCommunication_ = Dune::Amg::ConstructionTraits<Communication>::construct(commArgs);
#else #else

View File

@ -156,7 +156,11 @@ private:
using C = Comm; using C = Comm;
doAddCreator("ILU0", [](const O& op, const P& prm, const C& comm) { doAddCreator("ILU0", [](const O& op, const P& prm, const C& comm) {
const double w = prm.get<double>("relaxation"); const double w = prm.get<double>("relaxation");
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
return wrapBlockPreconditioner<DummyUpdatePreconditioner<SeqILU<M, V, V>>>(comm, op.getmat(), w);
#else
return wrapBlockPreconditioner<DummyUpdatePreconditioner<SeqILU0<M, V, V>>>(comm, op.getmat(), w); return wrapBlockPreconditioner<DummyUpdatePreconditioner<SeqILU0<M, V, V>>>(comm, op.getmat(), w);
#endif
}); });
doAddCreator("ParOverILU0", [](const O& op, const P& prm, const C& comm) { doAddCreator("ParOverILU0", [](const O& op, const P& prm, const C& comm) {
const double w = prm.get<double>("relaxation"); const double w = prm.get<double>("relaxation");
@ -167,7 +171,11 @@ private:
doAddCreator("ILUn", [](const O& op, const P& prm, const C& comm) { doAddCreator("ILUn", [](const O& op, const P& prm, const C& comm) {
const int n = prm.get<int>("ilulevel"); const int n = prm.get<int>("ilulevel");
const double w = prm.get<double>("relaxation"); const double w = prm.get<double>("relaxation");
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
return wrapBlockPreconditioner<DummyUpdatePreconditioner<SeqILU<M, V, V>>>(comm, op.getmat(), n, w);
#else
return wrapBlockPreconditioner<DummyUpdatePreconditioner<SeqILUn<M, V, V>>>(comm, op.getmat(), n, w); return wrapBlockPreconditioner<DummyUpdatePreconditioner<SeqILUn<M, V, V>>>(comm, op.getmat(), n, w);
#endif
}); });
doAddCreator("Jac", [](const O& op, const P& prm, const C& comm) { doAddCreator("Jac", [](const O& op, const P& prm, const C& comm) {
const int n = prm.get<int>("repeats"); const int n = prm.get<int>("repeats");
@ -221,7 +229,11 @@ private:
using P = boost::property_tree::ptree; using P = boost::property_tree::ptree;
doAddCreator("ILU0", [](const O& op, const P& prm) { doAddCreator("ILU0", [](const O& op, const P& prm) {
const double w = prm.get<double>("relaxation"); const double w = prm.get<double>("relaxation");
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
return wrapPreconditioner<SeqILU<M, V, V>>(op.getmat(), w);
#else
return wrapPreconditioner<SeqILU0<M, V, V>>(op.getmat(), w); return wrapPreconditioner<SeqILU0<M, V, V>>(op.getmat(), w);
#endif
}); });
doAddCreator("ParOverILU0", [](const O& op, const P& prm) { doAddCreator("ParOverILU0", [](const O& op, const P& prm) {
const double w = prm.get<double>("relaxation"); const double w = prm.get<double>("relaxation");
@ -230,7 +242,11 @@ private:
doAddCreator("ILUn", [](const O& op, const P& prm) { doAddCreator("ILUn", [](const O& op, const P& prm) {
const int n = prm.get<int>("ilulevel"); const int n = prm.get<int>("ilulevel");
const double w = prm.get<double>("relaxation"); const double w = prm.get<double>("relaxation");
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
return wrapPreconditioner<SeqILU<M, V, V>>(op.getmat(), n, w);
#else
return wrapPreconditioner<SeqILUn<M, V, V>>(op.getmat(), n, w); return wrapPreconditioner<SeqILUn<M, V, V>>(op.getmat(), n, w);
#endif
}); });
doAddCreator("Jac", [](const O& op, const P& prm) { doAddCreator("Jac", [](const O& op, const P& prm) {
const int n = prm.get<int>("repeats"); const int n = prm.get<int>("repeats");
@ -255,7 +271,11 @@ private:
doAddCreator("amg", [](const O& op, const P& prm) { doAddCreator("amg", [](const O& op, const P& prm) {
const std::string smoother = prm.get<std::string>("smoother"); const std::string smoother = prm.get<std::string>("smoother");
if (smoother == "ILU0") { if (smoother == "ILU0") {
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
using Smoother = SeqILU<M, V, V>;
#else
using Smoother = SeqILU0<M, V, V>; using Smoother = SeqILU0<M, V, V>;
#endif
return makeAmgPreconditioner<Smoother>(op, prm); return makeAmgPreconditioner<Smoother>(op, prm);
} else if (smoother == "Jac") { } else if (smoother == "Jac") {
using Smoother = SeqJac<M, V, V>; using Smoother = SeqJac<M, V, V>;
@ -267,7 +287,11 @@ private:
using Smoother = SeqSSOR<M, V, V>; using Smoother = SeqSSOR<M, V, V>;
return makeAmgPreconditioner<Smoother>(op, prm); return makeAmgPreconditioner<Smoother>(op, prm);
} else if (smoother == "ILUn") { } else if (smoother == "ILUn") {
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
using Smoother = SeqILU<M, V, V>;
#else
using Smoother = SeqILUn<M, V, V>; using Smoother = SeqILUn<M, V, V>;
#endif
return makeAmgPreconditioner<Smoother>(op, prm); return makeAmgPreconditioner<Smoother>(op, prm);
} else { } else {
std::string msg("No such smoother: "); std::string msg("No such smoother: ");

View File

@ -92,7 +92,11 @@ namespace mswellhelpers
Dune::MatrixAdapter<MatrixType, VectorType, VectorType> linearOperator(D); Dune::MatrixAdapter<MatrixType, VectorType, VectorType> linearOperator(D);
// Sequential incomplete LU decomposition as the preconditioner // Sequential incomplete LU decomposition as the preconditioner
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
Dune::SeqILU<MatrixType, VectorType, VectorType> preconditioner(D, 1.0);
#else
Dune::SeqILU0<MatrixType, VectorType, VectorType> preconditioner(D, 1.0); Dune::SeqILU0<MatrixType, VectorType, VectorType> preconditioner(D, 1.0);
#endif
// Dune::SeqILUn<MatrixType, VectorType, VectorType> preconditioner(D, 1, 0.92); // Dune::SeqILUn<MatrixType, VectorType, VectorType> preconditioner(D, 1, 0.92);
// Dune::SeqGS<MatrixType, VectorType, VectorType> preconditioner(D, 1, 1); // Dune::SeqGS<MatrixType, VectorType, VectorType> preconditioner(D, 1, 1);
// Dune::SeqJac<MatrixType, VectorType, VectorType> preconditioner(D, 1, 1); // Dune::SeqJac<MatrixType, VectorType, VectorType> preconditioner(D, 1, 1);

View File

@ -30,8 +30,13 @@
#endif #endif
#include <dune/common/version.hh> #include <dune/common/version.hh>
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
#include <dune/common/parallel/mpicommunication.hh>
#include <dune/common/parallel/communication.hh>
#else
#include <dune/common/parallel/mpicollectivecommunication.hh> #include <dune/common/parallel/mpicollectivecommunication.hh>
#include <dune/common/parallel/collectivecommunication.hh> #include <dune/common/parallel/collectivecommunication.hh>
#endif
#include <dune/common/parallel/indexset.hh> #include <dune/common/parallel/indexset.hh>
#include <dune/common/parallel/communicator.hh> #include <dune/common/parallel/communicator.hh>

View File

@ -28,7 +28,11 @@
#include <dune/common/unused.hh> #include <dune/common/unused.hh>
#include <dune/common/parallel/indexset.hh> #include <dune/common/parallel/indexset.hh>
#include <dune/common/parallel/plocalindex.hh> #include <dune/common/parallel/plocalindex.hh>
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
#include <dune/common/parallel/communication.hh>
#else
#include <dune/common/parallel/collectivecommunication.hh> #include <dune/common/parallel/collectivecommunication.hh>
#endif
#include <dune/istl/bcrsmatrix.hh> #include <dune/istl/bcrsmatrix.hh>
#include <dune/istl/owneroverlapcopy.hh> #include <dune/istl/owneroverlapcopy.hh>