From 451fb97439c93e6b2e33152690196f2fe9f91de3 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Tue, 25 Aug 2015 11:45:04 +0200 Subject: [PATCH] Added SimulationConfig::hasThresholdPressure() --- .../SimulationConfig/SimulationConfig.cpp | 5 +++++ .../SimulationConfig/SimulationConfig.hpp | 2 +- .../tests/SimulationConfigTest.cpp | 22 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.cpp b/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.cpp index 3f04645d7..b794f1d4c 100644 --- a/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.cpp +++ b/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.cpp @@ -39,4 +39,9 @@ namespace Opm { return m_ThresholdPressure; } + + bool SimulationConfig::hasThresholdPressure() const { + return m_ThresholdPressure->size() > 0; + } + } //namespace Opm diff --git a/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp b/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp index 7560d727d..8a8df93d5 100644 --- a/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp +++ b/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp @@ -33,7 +33,7 @@ namespace Opm { SimulationConfig(const ParseMode& parseMode , DeckConstPtr deck, std::shared_ptr> gridProperties); std::shared_ptr getThresholdPressure() const; - + bool hasThresholdPressure() const; private: diff --git a/opm/parser/eclipse/EclipseState/SimulationConfig/tests/SimulationConfigTest.cpp b/opm/parser/eclipse/EclipseState/SimulationConfig/tests/SimulationConfigTest.cpp index b58cbf7c0..0789f2ecf 100644 --- a/opm/parser/eclipse/EclipseState/SimulationConfig/tests/SimulationConfigTest.cpp +++ b/opm/parser/eclipse/EclipseState/SimulationConfig/tests/SimulationConfigTest.cpp @@ -54,6 +54,20 @@ const std::string& inputStr = "RUNSPEC\n" "/\n" "\n"; +const std::string& inputStr_noTHPRES = "RUNSPEC\n" + "EQLOPTS\n" + "DIMENS\n" + "10 3 4 /\n" + "\n" + "GRID\n" + "REGIONS\n" + "EQLNUM\n" + "10*1 10*2 100*3 /\n " + "\n" + "SOLUTION\n" + "\n"; + + static DeckPtr createDeck(const ParseMode& parseMode , const std::string& input) { Opm::Parser parser; @@ -77,7 +91,15 @@ BOOST_AUTO_TEST_CASE(SimulationConfigGetThresholdPressureTableTest) { DeckPtr deck = createDeck(parseMode , inputStr); SimulationConfigConstPtr simulationConfigPtr; BOOST_CHECK_NO_THROW(simulationConfigPtr = std::make_shared(parseMode , deck, getGridProperties())); + BOOST_CHECK_EQUAL( true , simulationConfigPtr->hasThresholdPressure()); } +BOOST_AUTO_TEST_CASE(SimulationConfigNOTHPRES) { + ParseMode parseMode; + DeckPtr deck = createDeck(parseMode , inputStr_noTHPRES); + SimulationConfig simulationConfig(parseMode , deck, getGridProperties()); + BOOST_CHECK_EQUAL( false , simulationConfig.hasThresholdPressure()); +} +