void KeywordContainer::addKeyword(DeckKeywordConstPtr keyword) { m_keywordList.push_back(keyword); if (!hasKeyword(keyword->name())) { m_keywordMap[keyword->name()] = std::vector<DeckKeywordConstPtr>(); } { std::vector<DeckKeywordConstPtr>& keywordList = m_keywordMap[keyword->name()]; keywordList.push_back(keyword); } }
void TimeMap::addFromDATESKeyword( DeckKeywordConstPtr DATESKeyword ) { if (DATESKeyword->name() != "DATES") throw std::invalid_argument("Method requires DATES keyword input."); for (size_t recordIndex = 0; recordIndex < DATESKeyword->size(); recordIndex++) { DeckRecordConstPtr record = DATESKeyword->getRecord( recordIndex ); boost::posix_time::ptime nextTime = TimeMap::timeFromEclipse( record ); addTime( nextTime ); } }
void TimeMap::addFromTSTEPKeyword( DeckKeywordConstPtr TSTEPKeyword ) { if (TSTEPKeyword->name() != "TSTEP") throw std::invalid_argument("Method requires TSTEP keyword input."); { DeckRecordConstPtr record = TSTEPKeyword->getRecord( 0 ); DeckItemConstPtr item = record->getItem( 0 ); for (size_t itemIndex = 0; itemIndex < item->size(); itemIndex++) { double days = item->getRawDouble( itemIndex ); long int wholeSeconds = static_cast<long int>(days * 24*60*60); long int milliSeconds = static_cast<long int>((days * 24*60*60 - wholeSeconds)*1000); boost::posix_time::time_duration step = boost::posix_time::seconds(wholeSeconds) + boost::posix_time::milliseconds(milliSeconds); addTStep( step ); } } }