Added methods to Deck::getKeyword<T>()
This commit is contained in:
@@ -50,6 +50,23 @@ namespace Opm {
|
||||
std::vector<DeckKeywordConstPtr>::const_iterator begin() const;
|
||||
std::vector<DeckKeywordConstPtr>::const_iterator end() const;
|
||||
|
||||
|
||||
template <class Keyword>
|
||||
bool hasKeyword() const {
|
||||
return hasKeyword( Keyword::keywordName );
|
||||
}
|
||||
|
||||
template <class Keyword>
|
||||
DeckKeywordConstPtr getKeyword(size_t index) const {
|
||||
return getkeyword( Keyword::keywordName , index );
|
||||
}
|
||||
|
||||
template <class Keyword>
|
||||
DeckKeywordConstPtr getKeyword() const {
|
||||
return getKeyword( Keyword::keywordName );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::shared_ptr<UnitSystem> m_defaultUnits;
|
||||
std::shared_ptr<UnitSystem> m_activeUnits;
|
||||
|
||||
@@ -37,6 +37,14 @@ namespace Opm {
|
||||
DeckItemPtr getItem(size_t index) const;
|
||||
DeckItemPtr getItem(const std::string& name) const;
|
||||
DeckItemPtr getDataItem() const;
|
||||
|
||||
|
||||
template <class Item>
|
||||
DeckItemPtr getItem() const {
|
||||
return getItem( Item::itemName );
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::vector<DeckItemPtr> m_items;
|
||||
std::map<std::string, DeckItemPtr> m_itemMap;
|
||||
|
||||
@@ -60,11 +60,11 @@ public:
|
||||
}
|
||||
|
||||
|
||||
bool supportsKeyword(const std::string& keyword) {
|
||||
bool supportsKeyword(const std::string& keyword) const {
|
||||
return m_supportedKeywords.count( keyword ) > 0;
|
||||
}
|
||||
|
||||
bool hasKeyword(const std::string& keyword) {
|
||||
bool hasKeyword(const std::string& keyword) const {
|
||||
return m_properties.count( keyword ) > 0;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<GridProperty<T> > getInitializedKeyword(const std::string& keyword) {
|
||||
std::shared_ptr<GridProperty<T> > getInitializedKeyword(const std::string& keyword) const {
|
||||
if (hasKeyword(keyword))
|
||||
return m_properties.at( keyword );
|
||||
else {
|
||||
@@ -120,6 +120,22 @@ public:
|
||||
}
|
||||
|
||||
|
||||
template <class Keyword>
|
||||
bool hasKeyword() const {
|
||||
return hasKeyword( Keyword::keywordName );
|
||||
}
|
||||
|
||||
template <class Keyword>
|
||||
std::shared_ptr<GridProperty<T> > getKeyword() {
|
||||
return getKeyword( Keyword::keywordName );
|
||||
}
|
||||
|
||||
template <class Keyword>
|
||||
std::shared_ptr<GridProperty<T> > getInitializedKeyword() const {
|
||||
return getInitializedKeyword( Keyword::keywordName );
|
||||
}
|
||||
|
||||
|
||||
|
||||
private:
|
||||
std::shared_ptr<const EclipseGrid> m_eclipseGrid;
|
||||
|
||||
Reference in New Issue
Block a user