Export static function to check month name validity
This commit is contained in:
@@ -78,6 +78,7 @@ namespace Opm {
|
||||
static std::time_t mkdate(int year, int month, int day);
|
||||
static std::time_t mkdatetime(int year, int month, int day, int hour, int minute, int second);
|
||||
static const std::map<std::string, int>& eclipseMonthIndices();
|
||||
static bool valid_month(const std::string& month_name);
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
|
||||
@@ -246,6 +246,11 @@ struct TimeMapContext {
|
||||
}
|
||||
|
||||
|
||||
bool TimeMap::valid_month(const std::string& month_name) {
|
||||
return (month_indices.count(month_name) != 0);
|
||||
}
|
||||
|
||||
|
||||
std::time_t TimeMap::timeFromEclipse(const DeckRecord &dateRecord) {
|
||||
const auto &dayItem = dateRecord.getItem(0);
|
||||
const auto &monthItem = dateRecord.getItem(1);
|
||||
|
||||
@@ -815,4 +815,8 @@ TSTEP
|
||||
BOOST_CHECK_NO_THROW( Opm::TimeMap(deck2, restart) );
|
||||
BOOST_CHECK_NO_THROW( Opm::TimeMap(deck3, restart) );
|
||||
BOOST_CHECK_THROW( Opm::TimeMap(deck4, restart) , std::exception);
|
||||
|
||||
|
||||
BOOST_CHECK(Opm::TimeMap::valid_month("MAR"));
|
||||
BOOST_CHECK(!Opm::TimeMap::valid_month("Tulleogtøys"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user