20 #ifndef OPM_PARSER_HPP 21 #define OPM_PARSER_HPP 23 #include <opm/input/eclipse/Parser/ParserKeyword.hpp> 44 RUNSPEC, GRID, EDIT, PROPS, REGIONS, SOLUTION, SUMMARY, SCHEDULE
62 explicit Parser(
bool addDefault =
true);
63 explicit Parser(std::shared_ptr<Python> python,
bool addDefault =
true);
65 static std::string stripComments(
const std::string& inputString);
71 const std::vector<Opm::Ecl::SectionType>& sections = {})
const;
78 const std::vector<Opm::Ecl::SectionType>& sections
83 Deck parseString(
const std::string &data,
87 Deck parseString(
const std::string &data)
const;
99 const ParserKeyword& getKeyword(
const std::string& name)
const;
125 const ParserKeyword& getParserKeywordFromDeckName(
const std::string_view& deckKeywordName)
const;
126 std::vector<std::string> getAllDeckNames ()
const;
129 bool loadKeywordFromFile(
const std::filesystem::path& configFile);
131 void loadKeywordsFromDirectory(
const std::filesystem::path& directory ,
bool recursive =
true);
132 void applyUnitsToDeck(
Deck& deck)
const;
139 std::size_t
size()
const;
170 const std::vector<std::pair<std::string,std::string>> codeKeywords()
const;
172 bool silent()
const {
return silentMode; }
173 void silent(
bool newSilentMode) { silentMode = newSilentMode; }
175 static constexpr
int SILENT_MODE_MIN_DEBUG_VERBOSITY_LEVEL {3};
178 std::shared_ptr<Python> m_python{};
180 bool silentMode {
false};
183 std::list<ParserKeyword> keyword_storage{};
186 std::map<std::string_view, const ParserKeyword*> m_deckParserKeywords{};
190 std::map<std::string_view, const ParserKeyword*> m_wildCardKeywords{};
192 std::vector<std::pair<std::string,std::string>> code_keywords{};
194 bool hasWildCardKeyword(
const std::string& keyword)
const;
196 const ParserKeyword* matchingKeyword(
const std::string_view& keyword)
const;
197 void addDefaultKeywords();
static EclipseGrid parseGridData(const std::string &data, const ParseContext &context, ErrorGuard &errors)
Parses the provided deck string.
Definition: Parser.cpp:1657
bool hasKeyword(const std::string &) const
Returns whether the parser knows about a keyword.
Definition: Parser.cpp:1837
The hub of the parsing process.
Definition: Parser.hpp:60
bool isRecognizedKeyword(std::string_view deckKeywordName) const
Whether or not string is a valid keyword.
Definition: Parser.cpp:1782
About cell information and dimension: The actual grid information is held in a pointer to an ERT ecl_...
Definition: EclipseGrid.hpp:63
std::size_t size() const
Returns the approximate number of recognized keywords in decks.
Definition: Parser.cpp:1766
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
bool isBaseRecognizedKeyword(std::string_view deckKeywordName) const
Whether or not string is a valid keyword.
Definition: Parser.cpp:1792
Definition: EclipseState.hpp:66
void addParserKeyword(const Json::JsonObject &jsonKeyword)
Method to add ParserKeyword instances, these holding type and size information about the keywords and...
Definition: Parser.cpp:1833
Definition: Parser.hpp:35
Definition: ParserKeyword.hpp:86
static EclipseGrid parseGrid(const std::string &filename, const ParseContext &context, ErrorGuard &errors)
Parses the deck specified in filename.
Definition: Parser.cpp:1644
Control parser behaviour in failure conditions.
Definition: ParseContext.hpp:114
Deck parseFile(const std::string &dataFile, const ParseContext &, ErrorGuard &errors, const std::vector< Opm::Ecl::SectionType > §ions={}) const
The starting point of the parsing process. The supplied file is parsed, and the resulting Deck is ret...
Definition: Parser.cpp:1666
Definition: JsonObject.hpp:31
Definition: ErrorGuard.hpp:30