Added hasValue() protection

This commit is contained in:
Joakim Hove
2015-01-02 16:39:50 +01:00
parent ecac5fc691
commit b1a30272a2
3 changed files with 15 additions and 3 deletions

View File

@@ -74,8 +74,11 @@ namespace Opm {
if (!connectionTransmissibilityFactorItem->defaultApplied(0))
connectionTransmissibilityFactor.setValue(connectionTransmissibilityFactorItem->getSIDouble(0));
diameter.setValue( diameterItem->getSIDouble(0));
skinFactor.setValue( skinFactorItem->getRawDouble(0));
if (diameterItem->hasValue(0))
diameter.setValue( diameterItem->getSIDouble(0));
if (skinFactorItem->hasValue(0))
skinFactor.setValue( skinFactorItem->getRawDouble(0));
}
const CompletionDirection::DirectionEnum& direction = CompletionDirection::DirectionEnumFromString(compdatRecord->getItem("DIR")->getTrimmedString(0));

View File

@@ -192,6 +192,15 @@ BOOST_AUTO_TEST_CASE(WellTesting) {
}
}
BOOST_AUTO_TEST_CASE(WellTestCOMPDAT_DEFAULTED_ITEMS) {
ParserPtr parser(new Parser());
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_COMPDAT1");
DeckPtr deck = parser->parseFile(scheduleFile.string());
ScheduleConstPtr sched(new Schedule(deck));
}
BOOST_AUTO_TEST_CASE(WellTestCOMPDAT) {
ParserPtr parser(new Parser());
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2");

View File

@@ -54,6 +54,6 @@ COMPDAT
'W_3' 31 18 2 2 'OPEN' 1* 55.195 0.311 4923.842 2* 'Y' 18.524 /
'W_3' 31 18 3 3 'OPEN' 1* 18.032 0.311 1608.615 2* 'Y' 18.526 /
'W_3' 31 17 3 3 'OPEN' 1* 56.817 0.311 5047.177 2* 'Y' 18.155 /
'W_3' 31 17 4 4 'OPEN' 1* 4.728 0.311 420.067 2* 'Y' 18.162 /
'W_3' 31 17 4 4 'OPEN' 1* 4.728 1* 420.067 2* 'Y' 18.162 /
/