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.
This commit is contained in:
Andreas Lauser
2016-02-16 13:43:46 +01:00
parent f83236588c
commit cfd38b8a66
4 changed files with 27 additions and 22 deletions

View File

@@ -106,7 +106,7 @@ namespace Opm {
} }
} }
if (m_eclipseState.hasDoubleGridProperty("MULTPV")) { if (m_eclipseState.hasDeckDoubleGridProperty("MULTPV")) {
auto multpvData = m_eclipseState.getDoubleGridProperty("MULTPV")->getData(); auto multpvData = m_eclipseState.getDoubleGridProperty("MULTPV")->getData();
for (size_t globalIndex = 0; globalIndex < porv->getCartesianSize(); globalIndex++) { for (size_t globalIndex = 0; globalIndex < porv->getCartesianSize(); globalIndex++) {
values[globalIndex] *= multpvData[globalIndex]; values[globalIndex] *= multpvData[globalIndex];
@@ -267,19 +267,19 @@ namespace Opm {
EclipseGridConstPtr grid = getEclipseGrid(); EclipseGridConstPtr grid = getEclipseGrid();
m_transMult = std::make_shared<TransMult>( grid->getNX() , grid->getNY() , grid->getNZ()); m_transMult = std::make_shared<TransMult>( grid->getNX() , grid->getNY() , grid->getNZ());
if (hasDoubleGridProperty("MULTX")) if (hasDeckDoubleGridProperty("MULTX"))
m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTX"), FaceDir::XPlus); m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTX"), FaceDir::XPlus);
if (hasDoubleGridProperty("MULTX-")) if (hasDeckDoubleGridProperty("MULTX-"))
m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTX-"), FaceDir::XMinus); m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTX-"), FaceDir::XMinus);
if (hasDoubleGridProperty("MULTY")) if (hasDeckDoubleGridProperty("MULTY"))
m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTY"), FaceDir::YPlus); m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTY"), FaceDir::YPlus);
if (hasDoubleGridProperty("MULTY-")) if (hasDeckDoubleGridProperty("MULTY-"))
m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTY-"), FaceDir::YMinus); m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTY-"), FaceDir::YMinus);
if (hasDoubleGridProperty("MULTZ")) if (hasDeckDoubleGridProperty("MULTZ"))
m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTZ"), FaceDir::ZPlus); m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTZ"), FaceDir::ZPlus);
if (hasDoubleGridProperty("MULTZ-")) if (hasDeckDoubleGridProperty("MULTZ-"))
m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTZ-"), FaceDir::ZMinus); m_transMult->applyMULT(m_doubleGridProperties->getKeyword("MULTZ-"), FaceDir::ZMinus);
} }
@@ -425,14 +425,14 @@ namespace Opm {
return result; return result;
} }
bool EclipseState::hasIntGridProperty(const std::string& keyword) const { bool EclipseState::hasDeckIntGridProperty(const std::string& keyword) const {
if (!m_intGridProperties->supportsKeyword( keyword )) if (!m_intGridProperties->supportsKeyword( keyword ))
throw std::logic_error("Integer grid property " + keyword + " is unsupported!"); throw std::logic_error("Integer grid property " + keyword + " is unsupported!");
return m_intGridProperties->hasKeyword( keyword ); 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 )) if (!m_doubleGridProperties->supportsKeyword( keyword ))
throw std::logic_error("Double grid property " + keyword + " is unsupported!"); throw std::logic_error("Double grid property " + keyword + " is unsupported!");

View File

@@ -78,8 +78,13 @@ namespace Opm {
std::shared_ptr<const GridProperty<int> > getDefaultRegion() const; std::shared_ptr<const GridProperty<int> > getDefaultRegion() const;
std::shared_ptr<const GridProperty<int> > getIntGridProperty( const std::string& keyword ) const; std::shared_ptr<const GridProperty<int> > getIntGridProperty( const std::string& keyword ) const;
std::shared_ptr<const GridProperty<double> > getDoubleGridProperty( const std::string& keyword ) const; std::shared_ptr<const GridProperty<double> > getDoubleGridProperty( const std::string& keyword ) const;
bool hasIntGridProperty(const std::string& keyword) const; bool hasDeckIntGridProperty(const std::string& keyword) const;
bool hasDoubleGridProperty(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<const Box> inputBox, void loadGridPropertyFromDeckKeyword(std::shared_ptr<const Box> inputBox,
const DeckKeyword& deckKeyword, const DeckKeyword& deckKeyword,

View File

@@ -355,21 +355,21 @@ BOOST_AUTO_TEST_CASE(GridPropertyInitialization) {
auto eclipseState = std::make_shared<Opm::EclipseState>(deck , parseMode); auto eclipseState = std::make_shared<Opm::EclipseState>(deck , parseMode);
// make sure that EclipseState throws if it is bugged about an _unsupported_ keyword // 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->hasDeckIntGridProperty("ISWU"), std::logic_error);
BOOST_CHECK_THROW(eclipseState->hasDoubleGridProperty("FLUXNUM"), 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 // make sure that EclipseState does not throw if it is asked for a supported grid
// property that is not contained in the deck // property that is not contained in the deck
BOOST_CHECK(!eclipseState->hasDoubleGridProperty("ISWU")); BOOST_CHECK(!eclipseState->hasDeckDoubleGridProperty("ISWU"));
BOOST_CHECK(!eclipseState->hasIntGridProperty("FLUXNUM")); BOOST_CHECK(!eclipseState->hasDeckIntGridProperty("FLUXNUM"));
BOOST_CHECK(eclipseState->hasIntGridProperty("SATNUM")); BOOST_CHECK(eclipseState->hasDeckIntGridProperty("SATNUM"));
BOOST_CHECK(eclipseState->hasIntGridProperty("IMBNUM")); BOOST_CHECK(eclipseState->hasDeckIntGridProperty("IMBNUM"));
BOOST_CHECK(eclipseState->hasDoubleGridProperty("SWU")); BOOST_CHECK(eclipseState->hasDeckDoubleGridProperty("SWU"));
BOOST_CHECK(eclipseState->hasDoubleGridProperty("ISGU")); BOOST_CHECK(eclipseState->hasDeckDoubleGridProperty("ISGU"));
BOOST_CHECK(eclipseState->hasDoubleGridProperty("SGCR")); BOOST_CHECK(eclipseState->hasDeckDoubleGridProperty("SGCR"));
BOOST_CHECK(eclipseState->hasDoubleGridProperty("ISGCR")); BOOST_CHECK(eclipseState->hasDeckDoubleGridProperty("ISGCR"));
const auto& swuPropData = eclipseState->getDoubleGridProperty("SWU")->getData(); const auto& swuPropData = eclipseState->getDoubleGridProperty("SWU")->getData();
BOOST_CHECK_EQUAL(swuPropData[0 * 3*3], 0.93); BOOST_CHECK_EQUAL(swuPropData[0 * 3*3], 0.93);

View File

@@ -256,7 +256,7 @@ BOOST_AUTO_TEST_CASE(IntProperties) {
BOOST_CHECK_EQUAL( false , state.supportsGridProperty("NONO")); BOOST_CHECK_EQUAL( false , state.supportsGridProperty("NONO"));
BOOST_CHECK_EQUAL( true , state.supportsGridProperty("SATNUM")); BOOST_CHECK_EQUAL( true , state.supportsGridProperty("SATNUM"));
BOOST_CHECK_EQUAL( true , state.hasIntGridProperty("SATNUM")); BOOST_CHECK_EQUAL( true , state.hasDeckIntGridProperty("SATNUM"));
} }