Added name() property to section objects.
This commit is contained in:
committed by
Andreas Lauser
parent
6b29eb5176
commit
7269924543
@@ -25,7 +25,7 @@
|
||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||
|
||||
namespace Opm {
|
||||
Section::Section(DeckConstPtr deck, const std::string& startKeyword, const std::vector<std::string>& stopKeywords ) {
|
||||
Section::Section(DeckConstPtr deck, const std::string& startKeyword, const std::vector<std::string>& stopKeywords ) : m_name( startKeyword ) {
|
||||
populateKeywords(deck, startKeyword, stopKeywords);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,10 @@ namespace Opm {
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& Section::name() const {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
bool Section::hasKeyword( const std::string& keyword ) const {
|
||||
return m_keywords.hasKeyword(keyword);
|
||||
}
|
||||
|
||||
@@ -35,9 +35,10 @@ namespace Opm {
|
||||
DeckKeywordConstPtr getKeyword(const std::string& keyword, size_t index) const;
|
||||
DeckKeywordConstPtr getKeyword(const std::string& keyword) const;
|
||||
DeckKeywordConstPtr getKeyword(size_t index) const;
|
||||
const std::string& name() const;
|
||||
|
||||
static bool hasSCHEDULE(DeckConstPtr deck) { return hasSection( deck , "SCHEDULE" ); }
|
||||
static bool hasSOLUTIONS(DeckConstPtr deck) { return hasSection( deck , "SOLUTIONS" ); }
|
||||
static bool hasSOLUTION(DeckConstPtr deck) { return hasSection( deck , "SOLUTION" ); }
|
||||
static bool hasREGIONS(DeckConstPtr deck) { return hasSection( deck , "REGIONS" ); }
|
||||
static bool hasPROPS(DeckConstPtr deck) { return hasSection( deck , "PROPS" ); }
|
||||
static bool hasEDIT(DeckConstPtr deck) { return hasSection( deck , "EDIT" ); }
|
||||
@@ -45,6 +46,7 @@ namespace Opm {
|
||||
static bool hasRUNSPEC(DeckConstPtr deck) { return hasSection( deck , "RUNSPEC" ); }
|
||||
private:
|
||||
KeywordContainer m_keywords;
|
||||
std::string m_name;
|
||||
static bool hasSection(DeckConstPtr deck, const std::string& startKeyword);
|
||||
void populateKeywords(DeckConstPtr deck, const std::string& startKeyword, const std::vector<std::string>& stopKeywords);
|
||||
};
|
||||
|
||||
@@ -43,6 +43,8 @@ BOOST_AUTO_TEST_CASE(SectionTest) {
|
||||
BOOST_CHECK_EQUAL(true, section.hasKeyword("TEST2"));
|
||||
BOOST_CHECK_EQUAL(false, section.hasKeyword("TEST3"));
|
||||
BOOST_CHECK_EQUAL(false, section.hasKeyword("TEST4"));
|
||||
|
||||
BOOST_CHECK_EQUAL( section.name() , "TEST1" );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(IteratorTest) {
|
||||
|
||||
Reference in New Issue
Block a user