30 #include <opm/parser/eclipse/Deck/DeckTree.hpp>
31 #include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
32 #include <opm/parser/eclipse/Units/UnitSystem.hpp>
34 #ifdef OPM_PARSER_DECK_API_WARNING
35 #ifndef OPM_PARSER_DECK_API
36 #pragma message "\n\n" \
37 " ----------------------------------------------------------------------------------\n" \
38 " The current compilation unit includes the header Deck.hpp. Outside of opm-parser \n" \
39 " you are encouraged to use the EclipseState API instead of the low level Deck API. \n" \
40 " If use of the Deck API is absolutely necessary you can silence this warning with \n" \
41 " #define OPM_PARSER_DECK_API before including the Deck.hpp header. \n" \
42 " ----------------------------------------------------------------------------------\n" \
61 typedef std::vector< DeckKeyword >::const_iterator const_iterator;
63 bool hasKeyword(
const DeckKeyword& keyword )
const;
64 bool hasKeyword(
const std::string& keyword )
const;
65 template<
class Keyword >
66 bool hasKeyword()
const {
67 return hasKeyword( Keyword::keywordName );
70 const DeckKeyword& getKeyword(
const std::string& keyword,
size_t index )
const;
71 const DeckKeyword& getKeyword(
const std::string& keyword )
const;
72 const DeckKeyword& getKeyword(
size_t index )
const;
74 const DeckKeyword& operator[](std::size_t index)
const;
76 template<
class Keyword >
78 return getKeyword( Keyword::keywordName );
80 template<
class Keyword >
81 const DeckKeyword& getKeyword(
size_t index )
const {
82 return getKeyword( Keyword::keywordName, index );
84 template<
class Keyword >
85 std::size_t count()
const {
86 return count( Keyword::keywordName );
89 const std::vector< const DeckKeyword* > getKeywordList(
const std::string& keyword )
const;
90 template<
class Keyword >
91 const std::vector< const DeckKeyword* > getKeywordList()
const {
92 return getKeywordList( Keyword::keywordName );
95 size_t count(
const std::string& keyword)
const;
98 const_iterator begin()
const;
99 const_iterator end()
const;
103 void add(
const DeckKeyword*, const_iterator, const_iterator );
105 const std::vector< size_t >& offsets(
const std::string& )
const;
107 DeckView( const_iterator first, const_iterator last );
108 explicit DeckView( std::pair< const_iterator, const_iterator > );
110 void init( const_iterator, const_iterator );
113 const_iterator first;
115 std::map< std::string, std::vector< size_t > > keywordMap;
121 using DeckView::const_iterator;
122 using DeckView::hasKeyword;
123 using DeckView::getKeyword;
124 using DeckView::getKeywordList;
125 using DeckView::count;
126 using DeckView::size;
127 using DeckView::begin;
129 using DeckView::operator[];
131 using iterator = std::vector< DeckKeyword >::iterator;
137 static Deck serializeObject();
140 bool operator==(
const Deck& data)
const;
147 const UnitSystem& getDefaultUnitSystem()
const;
148 const UnitSystem& getActiveUnitSystem()
const;
151 void selectActiveUnitSystem( UnitSystem::UnitType unit_type );
153 const std::string& getInputPath()
const;
154 std::string getDataFile()
const;
155 void setDataFile(
const std::string& dataFile);
156 std::string makeDeckPath(
const std::string& path)
const;
160 std::size_t size()
const;
165 friend std::ostream& operator<<(std::ostream& os,
const Deck& deck);
167 template<
class Serializer>
170 serializer.vector(keywordList);
171 defaultUnits.serializeOp(serializer);
172 serializer(activeUnits);
173 serializer(m_dataFile);
174 serializer(input_path);
175 serializer(unit_system_access_count);
176 if (!serializer.isSerializing())
177 this->init(this->keywordList.begin(), this->keywordList.end());
181 Deck(std::vector<DeckKeyword>&& keywordList);
183 std::vector< DeckKeyword > keywordList;
185 std::unique_ptr<UnitSystem> activeUnits;
187 std::optional<std::string> m_dataFile;
188 std::string input_path;
190 mutable std::size_t unit_system_access_count = 0;
Definition: DeckKeyword.hpp:36
Definition: DeckOutput.hpp:29
Definition: DeckTree.hpp:38
Definition: Serializer.hpp:38
Definition: UnitSystem.hpp:34
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29