From cfd38b8a66489a4cea969e1dd5732acc8b997ba7 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Tue, 16 Feb 2016 13:43:46 +0100 Subject: [PATCH] EclipseState: rename the has*GridProperty() methods to hasDeck*GridProperty() the intend is to better reflect that these properties where explicitly created in the deck. The old method names can still be used, but they will result in deprecation warnings. --- .../eclipse/EclipseState/EclipseState.cpp | 18 ++++++++--------- .../eclipse/EclipseState/EclipseState.hpp | 9 +++++++-- .../Grid/tests/GridPropertyTests.cpp | 20 +++++++++---------- .../EclipseState/tests/EclipseStateTests.cpp | 2 +- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/EclipseState.cpp b/opm/parser/eclipse/EclipseState/EclipseState.cpp index d8a929a13..4e8967612 100644 --- a/opm/parser/eclipse/EclipseState/EclipseState.cpp +++ b/opm/parser/eclipse/EclipseState/EclipseState.cpp @@ -106,7 +106,7 @@ namespace Opm { } } - if (m_eclipseState.hasDoubleGridProperty("MULTPV")) { + if (m_eclipseState.hasDeckDoubleGridProperty("MULTPV")) { auto multpvData = m_eclipseState.getDoubleGridProperty("MULTPV")->getData(); for (size_t globalIndex = 0; globalIndex < porv->getCartesianSize(); globalIndex++) { values[globalIndex] *= multpvData[globalIndex]; @@ -267,19 +267,19 @@ namespace Opm { EclipseGridConstPtr grid = getEclipseGrid(); m_transMult = std::make_shared( grid->getNX() , grid->getNY() , grid->getNZ()); - if (hasDoubleGridProperty("MULTX")) + if (hasDeckDoubleGridProperty("MULTX")) m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTX"), FaceDir::XPlus); - if (hasDoubleGridProperty("MULTX-")) + if (hasDeckDoubleGridProperty("MULTX-")) m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTX-"), FaceDir::XMinus); - if (hasDoubleGridProperty("MULTY")) + if (hasDeckDoubleGridProperty("MULTY")) m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTY"), FaceDir::YPlus); - if (hasDoubleGridProperty("MULTY-")) + if (hasDeckDoubleGridProperty("MULTY-")) m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTY-"), FaceDir::YMinus); - if (hasDoubleGridProperty("MULTZ")) + if (hasDeckDoubleGridProperty("MULTZ")) m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTZ"), FaceDir::ZPlus); - if (hasDoubleGridProperty("MULTZ-")) + if (hasDeckDoubleGridProperty("MULTZ-")) m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTZ-"), FaceDir::ZMinus); } @@ -425,14 +425,14 @@ namespace Opm { return result; } - bool EclipseState::hasIntGridProperty(const std::string& keyword) const { + bool EclipseState::hasDeckIntGridProperty(const std::string& keyword) const { if (!m_intGridProperties->supportsKeyword( keyword )) throw std::logic_error("Integer grid property " + keyword + " is unsupported!"); return m_intGridProperties->hasKeyword( keyword ); } - bool EclipseState::hasDoubleGridProperty(const std::string& keyword) const { + bool EclipseState::hasDeckDoubleGridProperty(const std::string& keyword) const { if (!m_doubleGridProperties->supportsKeyword( keyword )) throw std::logic_error("Double grid property " + keyword + " is unsupported!"); diff --git a/opm/parser/eclipse/EclipseState/EclipseState.hpp b/opm/parser/eclipse/EclipseState/EclipseState.hpp index 692cda538..0e5015993 100644 --- a/opm/parser/eclipse/EclipseState/EclipseState.hpp +++ b/opm/parser/eclipse/EclipseState/EclipseState.hpp @@ -78,8 +78,13 @@ namespace Opm { std::shared_ptr > getDefaultRegion() const; std::shared_ptr > getIntGridProperty( const std::string& keyword ) const; std::shared_ptr > getDoubleGridProperty( const std::string& keyword ) const; - bool hasIntGridProperty(const std::string& keyword) const; - bool hasDoubleGridProperty(const std::string& keyword) const; + bool hasDeckIntGridProperty(const std::string& keyword) const; + bool hasDeckDoubleGridProperty(const std::string& keyword) const; + + bool hasIntGridProperty(const std::string& keyword) const __attribute__((deprecated("use hasDeckIntGridProperty() instead"))) + { return hasDeckIntGridProperty(keyword); } + bool hasDoubleGridProperty(const std::string& keyword) const __attribute__((deprecated("use hasDeckDoubleGridProperty() instead"))) + { return hasDeckDoubleGridProperty(keyword); } void loadGridPropertyFromDeckKeyword(std::shared_ptr inputBox, const DeckKeyword& deckKeyword, diff --git a/opm/parser/eclipse/EclipseState/Grid/tests/GridPropertyTests.cpp b/opm/parser/eclipse/EclipseState/Grid/tests/GridPropertyTests.cpp index f9d2b7a2f..c8c38cc5d 100644 --- a/opm/parser/eclipse/EclipseState/Grid/tests/GridPropertyTests.cpp +++ b/opm/parser/eclipse/EclipseState/Grid/tests/GridPropertyTests.cpp @@ -355,21 +355,21 @@ BOOST_AUTO_TEST_CASE(GridPropertyInitialization) { auto eclipseState = std::make_shared(deck , parseMode); // make sure that EclipseState throws if it is bugged about an _unsupported_ keyword - BOOST_CHECK_THROW(eclipseState->hasIntGridProperty("ISWU"), std::logic_error); - BOOST_CHECK_THROW(eclipseState->hasDoubleGridProperty("FLUXNUM"), std::logic_error); + BOOST_CHECK_THROW(eclipseState->hasDeckIntGridProperty("ISWU"), std::logic_error); + BOOST_CHECK_THROW(eclipseState->hasDeckDoubleGridProperty("FLUXNUM"), std::logic_error); // make sure that EclipseState does not throw if it is asked for a supported grid // property that is not contained in the deck - BOOST_CHECK(!eclipseState->hasDoubleGridProperty("ISWU")); - BOOST_CHECK(!eclipseState->hasIntGridProperty("FLUXNUM")); + BOOST_CHECK(!eclipseState->hasDeckDoubleGridProperty("ISWU")); + BOOST_CHECK(!eclipseState->hasDeckIntGridProperty("FLUXNUM")); - BOOST_CHECK(eclipseState->hasIntGridProperty("SATNUM")); - BOOST_CHECK(eclipseState->hasIntGridProperty("IMBNUM")); + BOOST_CHECK(eclipseState->hasDeckIntGridProperty("SATNUM")); + BOOST_CHECK(eclipseState->hasDeckIntGridProperty("IMBNUM")); - BOOST_CHECK(eclipseState->hasDoubleGridProperty("SWU")); - BOOST_CHECK(eclipseState->hasDoubleGridProperty("ISGU")); - BOOST_CHECK(eclipseState->hasDoubleGridProperty("SGCR")); - BOOST_CHECK(eclipseState->hasDoubleGridProperty("ISGCR")); + BOOST_CHECK(eclipseState->hasDeckDoubleGridProperty("SWU")); + BOOST_CHECK(eclipseState->hasDeckDoubleGridProperty("ISGU")); + BOOST_CHECK(eclipseState->hasDeckDoubleGridProperty("SGCR")); + BOOST_CHECK(eclipseState->hasDeckDoubleGridProperty("ISGCR")); const auto& swuPropData = eclipseState->getDoubleGridProperty("SWU")->getData(); BOOST_CHECK_EQUAL(swuPropData[0 * 3*3], 0.93); diff --git a/opm/parser/eclipse/EclipseState/tests/EclipseStateTests.cpp b/opm/parser/eclipse/EclipseState/tests/EclipseStateTests.cpp index c72aa6334..c76f46ba2 100644 --- a/opm/parser/eclipse/EclipseState/tests/EclipseStateTests.cpp +++ b/opm/parser/eclipse/EclipseState/tests/EclipseStateTests.cpp @@ -256,7 +256,7 @@ BOOST_AUTO_TEST_CASE(IntProperties) { BOOST_CHECK_EQUAL( false , state.supportsGridProperty("NONO")); BOOST_CHECK_EQUAL( true , state.supportsGridProperty("SATNUM")); - BOOST_CHECK_EQUAL( true , state.hasIntGridProperty("SATNUM")); + BOOST_CHECK_EQUAL( true , state.hasDeckIntGridProperty("SATNUM")); }