Added parse functions for Parser, for simpler creation of state and grids

This commit is contained in:
Pål Grønås Drange
2016-05-06 10:00:58 +02:00
parent b8b1ba9528
commit 091dc196f3
7 changed files with 97 additions and 9 deletions

View File

@@ -100,6 +100,19 @@ namespace Opm {
return m_errorContexts.end();
}
ParseContext ParseContext::withKey(const std::string& key, InputError::Action action) const {
ParseContext pc(*this);
pc.addKey(key);
pc.updateKey(key, action);
return pc;
}
ParseContext& ParseContext::withKey(const std::string& key, InputError::Action action) {
this->addKey(key);
this->updateKey(key, action);
return *this;
}
bool ParseContext::hasKey(const std::string& key) const {
if (m_errorContexts.find( key ) == m_errorContexts.end())
return false;
@@ -218,6 +231,8 @@ namespace Opm {
const std::string ParseContext::UNSUPPORTED_INITIAL_THPRES = "UNSUPPORTED_INITIAL_THPRES";
const std::string ParseContext::INTERNAL_ERROR_UNINITIALIZED_THPRES = "INTERNAL_ERROR_UNINITIALIZED_THPRES";
const std::string ParseContext::PARSE_MISSING_SECTIONS = "PARSE_MISSING_SECTIONS";
}