From 7826c824eef0b7a9cdcc4a5227d88528bf469687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de> Date: Wed, 7 Dec 2022 09:47:08 +0100 Subject: [PATCH] [opm] support version 2022.10 --- config.h.cmake | 6 ++++++ dumux/io/grid/cpgridmanager.hh | 11 ++++++++++ .../2p/cornerpoint/spatialparams.hh | 20 ++++++++++++++++--- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/config.h.cmake b/config.h.cmake index 199c9f972d..df3a0c8625 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -43,6 +43,12 @@ /* Define the path to dumux */ #define DUMUX_SOURCE_DIR "${CMAKE_SOURCE_DIR}" +/* Define the major version of opm-grid */ +#define OPM_GRID_VERSION_MAJOR ${OPM_GRID_VERSION_MAJOR} + +/* Define the minor version of opm-grid */ +#define OPM_GRID_VERSION_MINOR ${OPM_GRID_VERSION_MINOR} + /* Define to 1 if gnuplot was found */ #cmakedefine HAVE_GNUPLOT 1 diff --git a/dumux/io/grid/cpgridmanager.hh b/dumux/io/grid/cpgridmanager.hh index 53c357e9fa..2e7f9fe59e 100644 --- a/dumux/io/grid/cpgridmanager.hh +++ b/dumux/io/grid/cpgridmanager.hh @@ -24,14 +24,25 @@ #ifndef DUMUX_IO_GRID_CPGRIDMANAGER_HH #define DUMUX_IO_GRID_CPGRIDMANAGER_HH +#include <config.h> + #if HAVE_OPM_GRID +#include <dune/common/version.hh> #include <dune/common/parallel/mpihelper.hh> #include <opm/grid/CpGrid.hpp> + +#if DUNE_VERSION_GTE(OPM_GRID, 2022, 10) +#include <opm/input/eclipse/Parser/Parser.hpp> +#include <opm/input/eclipse/Parser/ParseContext.hpp> +#include <opm/input/eclipse/Deck/Deck.hpp> +#include <opm/input/eclipse/EclipseState/EclipseState.hpp> +#else #include <opm/parser/eclipse/Parser/Parser.hpp> #include <opm/parser/eclipse/Parser/ParseContext.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/EclipseState/EclipseState.hpp> +#endif #include <dumux/common/parameters.hh> diff --git a/test/porousmediumflow/2p/cornerpoint/spatialparams.hh b/test/porousmediumflow/2p/cornerpoint/spatialparams.hh index 2ed63a93c2..c7cfba6d88 100644 --- a/test/porousmediumflow/2p/cornerpoint/spatialparams.hh +++ b/test/porousmediumflow/2p/cornerpoint/spatialparams.hh @@ -26,7 +26,13 @@ #define DUMUX_TWOP_CORNERPOINT_TEST_SPATIAL_PARAMS_HH #if HAVE_OPM_GRID +#include <dune/common/version.hh> + +#if DUNE_VERSION_GTE(OPM_GRID, 2022, 10) +#include <opm/input/eclipse/Deck/Deck.hpp> +#else #include <opm/parser/eclipse/Deck/Deck.hpp> +#endif #include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh> @@ -66,11 +72,19 @@ public: { homogeneous_ = getParam<bool>("Problem.Homogeneous"); + const auto getDeckData = [&] (const auto& name) { +#if DUNE_VERSION_GTE(OPM_GRID, 2022, 10) + return (*deck_)[deck->index(name)[0]].getRawDoubleData(); +#else + return deck_->getKeyword(name).getRawDoubleData(); +#endif + }; + const std::vector<int>& globalCell = this->gridGeometry().gridView().grid().globalCell(); if (deck_->hasKeyword("PORO")) { std::cout << "Found PORO..." << std::endl; - std::vector<double> eclVector = deck_->getKeyword("PORO").getRawDoubleData(); + std::vector<double> eclVector = getDeckData("PORO"); porosity_.resize(globalCell.size()); for (size_t i = 0; i < globalCell.size(); ++i) { @@ -83,7 +97,7 @@ public: if (deck_->hasKeyword("PERMX")) { std::cout << "Found PERMX..." << std::endl; - std::vector<double> eclVector = deck_->getKeyword("PERMX").getRawDoubleData(); + std::vector<double> eclVector = getDeckData("PERMX"); permX_.resize(globalCell.size()); for (size_t i = 0; i < globalCell.size(); ++i) { @@ -97,7 +111,7 @@ public: if (deck_->hasKeyword("PERMZ")) { std::cout << "Found PERMZ..." << std::endl; - std::vector<double> eclVector = deck_->getKeyword("PERMZ").getRawDoubleData(); + std::vector<double> eclVector = getDeckData("PERMZ"); permZ_.resize(globalCell.size()); for (size_t i = 0; i < globalCell.size(); ++i) { -- GitLab