fix the "DATES" keyword

The time of the day field was missing. The defaults for it are those
of E100.
This commit is contained in:
Andreas Lauser
2014-02-19 14:49:34 +01:00
parent d49ff37891
commit 6b70634f94
3 changed files with 11 additions and 4 deletions

View File

@@ -94,13 +94,15 @@ namespace Opm {
boost::gregorian::date TimeMap::dateFromEclipse(DeckRecordConstPtr dateRecord) {
static const std::string errorMsg("The datarecord must consists of three values: \"DAY(int) MONTH(string) YEAR(int)\".\n");
if (dateRecord->size() != 3)
static const std::string errorMsg("The datarecord must consist of the three values "
"\"DAY(int) MONTH(string) YEAR(int)\" plus the optional value \"TIME(string)\".\n");
if (dateRecord->size() < 3 || dateRecord->size() > 4)
throw std::invalid_argument( errorMsg);
DeckItemConstPtr dayItem = dateRecord->getItem( 0 );
DeckItemConstPtr monthItem = dateRecord->getItem( 1 );
DeckItemConstPtr yearItem = dateRecord->getItem( 2 );
//DeckItemConstPtr timeItem = dateRecord->getItem( 3 );
try {
int day = dayItem->getInt(0);

View File

@@ -98,6 +98,7 @@ BOOST_AUTO_TEST_CASE( dateFromEclipseThrowsInvalidRecord ) {
Opm::DeckIntItemPtr dayItem( new Opm::DeckIntItem("DAY") );
Opm::DeckStringItemPtr monthItem(new Opm::DeckStringItem("MONTH") );
Opm::DeckIntItemPtr yearItem(new Opm::DeckIntItem("YEAR"));
Opm::DeckStringItemPtr timeItem(new Opm::DeckStringItem("TIME") );
Opm::DeckIntItemPtr extraItem(new Opm::DeckIntItem("EXTRA"));
dayItem->push_back( 10 );
@@ -114,6 +115,9 @@ BOOST_AUTO_TEST_CASE( dateFromEclipseThrowsInvalidRecord ) {
startRecord->addItem( yearItem );
BOOST_CHECK_NO_THROW(Opm::TimeMap::dateFromEclipse( startRecord ));
startRecord->addItem( timeItem );
BOOST_CHECK_NO_THROW(Opm::TimeMap::dateFromEclipse( startRecord ));
startRecord->addItem( extraItem );
BOOST_CHECK_THROW( Opm::TimeMap::dateFromEclipse( startRecord ) , std::invalid_argument );

View File

@@ -1,5 +1,6 @@
{"name" : "DATES", "items" : [
{"name" : "DAY" , "value_type" : "INT"},
{"name" : "DAY" , "value_type" : "INT" },
{"name" : "MONTH" , "value_type" : "STRING"},
{"name" : "YEAR" , "value_type" : "INT"}]
{"name" : "YEAR" , "value_type" : "INT" },
{"name" : "TIME" , "value_type" : "STRING", "default":"00:00:00.000"} ]
}