Added SimulationConfig::hasThresholdPressure()

This commit is contained in:
Joakim Hove
2015-08-25 11:45:04 +02:00
parent f7283eb238
commit 451fb97439
3 changed files with 28 additions and 1 deletions

View File

@@ -39,4 +39,9 @@ namespace Opm {
return m_ThresholdPressure;
}
bool SimulationConfig::hasThresholdPressure() const {
return m_ThresholdPressure->size() > 0;
}
} //namespace Opm

View File

@@ -33,7 +33,7 @@ namespace Opm {
SimulationConfig(const ParseMode& parseMode , DeckConstPtr deck, std::shared_ptr<GridProperties<int>> gridProperties);
std::shared_ptr<const ThresholdPressure> getThresholdPressure() const;
bool hasThresholdPressure() const;
private:

View File

@@ -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<const SimulationConfig>(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());
}