Added deckIndex property to deckKeyword

This commit is contained in:
Joakim Hove
2013-10-22 11:40:45 +02:00
parent 63fb47515b
commit 0598e9122a
3 changed files with 23 additions and 1 deletions

View File

@@ -24,11 +24,21 @@ namespace Opm {
DeckKeyword::DeckKeyword(const std::string& keywordName) {
m_knownKeyword = true;
m_keywordName = keywordName;
m_deckIndex = -1;
}
DeckKeyword::DeckKeyword(const std::string& keywordName, bool knownKeyword) {
m_knownKeyword = knownKeyword;
m_keywordName = keywordName;
m_deckIndex = -1;
}
ssize_t DeckKeyword::getDeckIndex() const {
return m_deckIndex;
}
void DeckKeyword::setDeckIndex(size_t deckIndex) {
m_deckIndex = deckIndex;
}
std::string DeckKeyword::name() const {

View File

@@ -28,6 +28,9 @@ namespace Opm {
DeckRecordConstPtr getDataRecord() const;
bool isKnown() const;
ssize_t getDeckIndex() const;
void setDeckIndex(size_t deckIndex);
const std::vector<int>& getIntData() const;
const std::vector<double>& getDoubleData() const;
const std::vector<std::string>& getStringData() const;
@@ -36,7 +39,7 @@ namespace Opm {
std::string m_keywordName;
std::vector<DeckRecordConstPtr> m_recordList;
bool m_knownKeyword;
ssize_t m_deckIndex;
};
typedef boost::shared_ptr<DeckKeyword> DeckKeywordPtr;
typedef boost::shared_ptr<const DeckKeyword> DeckKeywordConstPtr;

View File

@@ -69,6 +69,15 @@ BOOST_AUTO_TEST_CASE(setUnknown_wasknown_nowunknown) {
}
BOOST_AUTO_TEST_CASE(DeckIndex) {
DeckKeywordPtr deckKeyword(new DeckKeyword("KW"));
BOOST_CHECK_EQUAL( -1 , deckKeyword->getDeckIndex());
deckKeyword->setDeckIndex( 10);
BOOST_CHECK_EQUAL(10 , deckKeyword->getDeckIndex());
}