From 6a5dc782497e2162fe2c358c84c5390c81108e1a Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Wed, 11 Oct 2017 15:53:45 +0200 Subject: [PATCH 1/2] [cleanup] Removes unnecessary if clauses for unsupported DUNE versions. We are targetting DUNE 2.4.* and 2.5.* currently. Therefore this commit removes the if checks for lower versions to cleanup the code. --- opm/autodiff/BlackoilModelEbos.hpp | 4 ---- opm/autodiff/DuneMatrix.hpp | 15 +++------------ .../ExtractParallelGridInformationToISTL.cpp | 4 ++-- opm/autodiff/FlowMain.hpp | 4 ---- opm/autodiff/FlowMainEbos.hpp | 10 ---------- .../SimulatorFullyImplicitBlackoilOutput.cpp | 4 ---- 6 files changed, 5 insertions(+), 36 deletions(-) diff --git a/opm/autodiff/BlackoilModelEbos.hpp b/opm/autodiff/BlackoilModelEbos.hpp index ac8d94630..d304be757 100644 --- a/opm/autodiff/BlackoilModelEbos.hpp +++ b/opm/autodiff/BlackoilModelEbos.hpp @@ -413,11 +413,7 @@ namespace Opm { if (elem.partitionType() != Dune::InteriorEntity) continue; -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,4) unsigned globalElemIdx = elemMapper.index(elem); -#else - unsigned globalElemIdx = elemMapper.map(elem); -#endif const auto& priVarsNew = ebosSimulator_.model().solution(/*timeIdx=*/0)[globalElemIdx]; Scalar pressureNew; diff --git a/opm/autodiff/DuneMatrix.hpp b/opm/autodiff/DuneMatrix.hpp index f35b274c5..c5ebec79c 100644 --- a/opm/autodiff/DuneMatrix.hpp +++ b/opm/autodiff/DuneMatrix.hpp @@ -33,14 +33,7 @@ #include #include -#if DUNE_VERSION_NEWER(DUNE_ISTL,2,4) #include -#else -// Include matrix header with hackery to make it possible to inherit. -#define private protected -#include -#undef private -#endif #include @@ -90,15 +83,13 @@ namespace Opm nnz = ia[rows]; -#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 3) - #if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 5) +#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 5) this->allocationSize_ = nnz; - #else +#else this->allocationSize = nnz; - #endif +#endif this->avg = 0; this->overflowsize = -1.0; -#endif // make sure to use the allocators of this matrix // because the same allocators are used to deallocate the data diff --git a/opm/autodiff/ExtractParallelGridInformationToISTL.cpp b/opm/autodiff/ExtractParallelGridInformationToISTL.cpp index 40337c6ad..3efece143 100644 --- a/opm/autodiff/ExtractParallelGridInformationToISTL.cpp +++ b/opm/autodiff/ExtractParallelGridInformationToISTL.cpp @@ -25,7 +25,7 @@ namespace Opm { #if defined(HAVE_OPM_GRID) -#if defined(HAVE_MPI) && defined(HAVE_DUNE_ISTL) && DUNE_VERSION_NEWER(DUNE_GRID, 2, 3) +#if defined(HAVE_MPI) && defined(HAVE_DUNE_ISTL) // Extracts the information about the data decomposition from the grid for dune-istl void extractParallelGridInformationToISTL(const Dune::CpGrid& grid, boost::any& anyComm) { @@ -44,6 +44,6 @@ void extractParallelGridInformationToISTL(const Dune::CpGrid& grid, boost::any& // Missing support for MPI or dune-istl -> do nothing. void extractParallelGridInformationToISTL(const Dune::CpGrid&, boost::any&) {} -#endif //defined(HAVE_MPI) && defined(HAVE_DUNE_ISTL) && DUNE_VERSION_NEWER(DUNE_GRID, 2, 3) +#endif //defined(HAVE_MPI) && defined(HAVE_DUNE_ISTL) #endif //defined(HAVE_OPM_GRID) } // end namespace Opm diff --git a/opm/autodiff/FlowMain.hpp b/opm/autodiff/FlowMain.hpp index 4a03d5301..82de897f6 100644 --- a/opm/autodiff/FlowMain.hpp +++ b/opm/autodiff/FlowMain.hpp @@ -27,11 +27,7 @@ #include -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) #include -#else -#include -#endif #include diff --git a/opm/autodiff/FlowMainEbos.hpp b/opm/autodiff/FlowMainEbos.hpp index 4334d988e..fc91f4674 100755 --- a/opm/autodiff/FlowMainEbos.hpp +++ b/opm/autodiff/FlowMainEbos.hpp @@ -837,13 +837,8 @@ namespace Opm continue; // intersection is on the domain boundary } -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,4) unsigned c1 = globalElemMapper.index(is.inside()); unsigned c2 = globalElemMapper.index(is.outside()); -#else - unsigned c1 = globalElemMapper.map(is.inside()); - unsigned c2 = globalElemMapper.map(is.outside()); -#endif if (c1 > c2) { @@ -909,13 +904,8 @@ namespace Opm continue; // intersection is on the domain boundary } -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,4) unsigned c1 = globalElemMapper.index(is.inside()); unsigned c2 = globalElemMapper.index(is.outside()); -#else - unsigned c1 = globalElemMapper.map(is.inside()); - unsigned c2 = globalElemMapper.map(is.outside()); -#endif if (c1 > c2) { diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp index 3e9288618..9549af79c 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp @@ -151,11 +151,7 @@ namespace Opm vtkpath << "/output-" << std::setw(3) << std::setfill('0') << step; ensureDirectoryExists(vtkpath.str()); vtkfilename << "output-" << std::setw(3) << std::setfill('0') << step; -#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 3) Dune::VTKWriter writer(grid.leafGridView(), Dune::VTK::nonconforming); -#else - Dune::VTKWriter writer(grid.leafView(), Dune::VTK::nonconforming); -#endif writer.addCellData(state.saturation(), "saturation", state.numPhases()); writer.addCellData(state.pressure(), "pressure", 1); From 56cd0f5d248541d248325f2290923799e25e21a4 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Wed, 11 Oct 2017 16:20:36 +0200 Subject: [PATCH 2/2] Removed unnecessary version if in transmult test --- tests/test_transmissibilitymultipliers.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/test_transmissibilitymultipliers.cpp b/tests/test_transmissibilitymultipliers.cpp index 2d3c2764d..35d76f801 100644 --- a/tests/test_transmissibilitymultipliers.cpp +++ b/tests/test_transmissibilitymultipliers.cpp @@ -37,11 +37,7 @@ #if HAVE_OPM_GRID #include -#if DUNE_VERSION_NEWER(DUNE_GRID, 2,3) #include -#else -#include -#endif #include #endif