Merge pull request #2184 from joakim-hove/timemap-allow-rst

Timemap allow rst
This commit is contained in:
Joakim Hove
2021-01-04 22:13:24 +01:00
committed by GitHub
3 changed files with 3 additions and 13 deletions

View File

@@ -406,14 +406,7 @@ struct TimeMapContext {
std::time_t TimeMap::operator[] (size_t index) const {
if (index >= m_timeList.size())
throw std::invalid_argument("Index out of range");
if (index > 0 && index < this->m_restart_offset) {
printf("What the f... \n");
throw std::invalid_argument(fmt::format("Tried to get time information from the base case in restarted run index:{} restart_offset:{}", index, this->m_restart_offset));
}
return m_timeList[index];
return m_timeList.at(index);
}
std::time_t TimeMap::mkdate(int in_year, int in_month, int in_day) {

View File

@@ -194,7 +194,7 @@ WELOPEN
'BAN' OPEN /
/
DATES -- 4
DATES -- 5
10 NOV 2007 /
/
@@ -1142,7 +1142,6 @@ COMPDAT
for(size_t i = 0; i < cs4.size(); i++ )
BOOST_CHECK_EQUAL(cs4.get( i ).CF(), cs1.get(i).CF());
BOOST_CHECK_THROW(schedule.simTime(10000), std::invalid_argument);
auto sim_time1 = TimeStampUTC{ schedule.simTime(1) };
BOOST_CHECK_EQUAL(sim_time1.day(), 10);
BOOST_CHECK_EQUAL(sim_time1.month(), 10);

View File

@@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(AddStepSizeCorrect) {
Opm::TimeMap timeMap(time_points);
BOOST_CHECK_EQUAL(3U, timeMap.size());
BOOST_CHECK_THROW(timeMap[3] , std::invalid_argument );
BOOST_CHECK_THROW(timeMap[3] , std::exception );
BOOST_CHECK_EQUAL(timeMap[0] , Opm::TimeMap::mkdate(2010, 1, 1 ));
BOOST_CHECK_EQUAL(timeMap[2] , Opm::TimeMap::mkdate(2010, 1, 3 ));
}
@@ -685,8 +685,6 @@ DATES
BOOST_CHECK_THROW( Opm::TimeMap(deck1, invalid_restart) , std::exception);
Opm::TimeMap tm1(deck1, valid_restart);
BOOST_CHECK_THROW( tm1[1], std::invalid_argument );
BOOST_CHECK_THROW( tm1[4], std::invalid_argument );
auto start = tm1[0];
BOOST_CHECK_EQUAL(start , Opm::asTimeT(Opm::TimeStampUTC(2000,1,1)));
BOOST_CHECK_EQUAL(tm1[5] , Opm::asTimeT(Opm::TimeStampUTC(2005,1,1)));