opm-common
Loading...
Searching...
No Matches
Opm::Parser Class Reference

The hub of the parsing process. More...

#include <Parser.hpp>

Public Member Functions

 Parser (bool addDefault=true)
 Parser (std::shared_ptr< Python > python, bool addDefault=true)
Deck parseFile (const std::string &dataFile, const ParseContext &, ErrorGuard &errors, const std::vector< Opm::Ecl::SectionType > &sections={}) const
 The starting point of the parsing process. The supplied file is parsed, and the resulting Deck is returned.
Deck parseFile (const std::string &, const ParseContext &) const
Deck parseFile (const std::string &, const ParseContext &, const std::vector< Opm::Ecl::SectionType > &sections) const
Deck parseFile (const std::string &datafile) const
Deck parseString (const std::string &data, const ParseContext &, ErrorGuard &errors) const
Deck parseString (const std::string &data, const ParseContext &) const
Deck parseString (const std::string &data) const
Deck parseStream (std::unique_ptr< std::istream > &&inputStream, const ParseContext &parseContext, ErrorGuard &errors) const
void addParserKeyword (const Json::JsonObject &jsonKeyword)
 Method to add ParserKeyword instances, these holding type and size information about the keywords and their data.
void addParserKeyword (ParserKeyword parserKeyword)
bool hasKeyword (const std::string &) const
 Returns whether the parser knows about a keyword.
const ParserKeywordgetKeyword (const std::string &name) const
bool isRecognizedKeyword (std::string_view deckKeywordName) const
 Whether or not string is a valid keyword.
bool isBaseRecognizedKeyword (std::string_view deckKeywordName) const
 Whether or not string is a valid keyword.
const ParserKeywordgetParserKeywordFromDeckName (const std::string_view &deckKeywordName) const
std::vector< std::string > getAllDeckNames () const
void loadKeywords (const Json::JsonObject &jsonKeywords)
bool loadKeywordFromFile (const std::filesystem::path &configFile)
void loadKeywordsFromDirectory (const std::filesystem::path &directory, bool recursive=true)
void applyUnitsToDeck (Deck &deck) const
size_t size () const
 Returns the approximate number of recognized keywords in decks.
template<class T>
void addKeyword ()
const std::vector< std::pair< std::string, std::string > > codeKeywords () const
bool silent () const
void silent (bool newSilentMode)

Static Public Member Functions

static std::string stripComments (const std::string &inputString)
static EclipseState parse (const Deck &deck, const ParseContext &context)
static EclipseState parse (const std::string &filename, const ParseContext &context, ErrorGuard &errors)
static EclipseState parseData (const std::string &data, const ParseContext &context, ErrorGuard &errors)
static EclipseGrid parseGrid (const std::string &filename, const ParseContext &context, ErrorGuard &errors)
 Parses the deck specified in filename.
static EclipseGrid parseGrid (const Deck &deck, const ParseContext &context)
 Parses the provided deck.
static EclipseGrid parseGridData (const std::string &data, const ParseContext &context, ErrorGuard &errors)
 Parses the provided deck string.

Static Public Attributes

static constexpr int SILENT_MODE_MIN_DEBUG_VERBOSITY_LEVEL {3}

Detailed Description

The hub of the parsing process.

An input file in the eclipse data format is specified, several steps of parsing is performed and the semantically parsed result is returned.

Member Function Documentation

◆ isBaseRecognizedKeyword()

bool Opm::Parser::isBaseRecognizedKeyword ( std::string_view deckKeywordName) const

Whether or not string is a valid keyword.

First checks that the input string looks like a valid keyword and, if so, matches the string against the builtin set of known keywords.

Parameters
[in]deckKeywordNamePotential deck keyword.
Returns
Whether or not deckKeywordName is a builtin deck keyword.

◆ isRecognizedKeyword()

bool Opm::Parser::isRecognizedKeyword ( std::string_view deckKeywordName) const

Whether or not string is a valid keyword.

The full keyword recognition process first verifies that the input string looks like a valid keyword and, if so matches that string against the builtin set of known keywords. The function additionally includes those keywords that match against keyword collections, typically the SUMMARY section "meta" keywords in the *_PROBE files.

Returns
Whether or not deckKeywordName is a builtin deck keyword or a known summary keyword.

◆ parseGrid() [1/2]

EclipseGrid Opm::Parser::parseGrid ( const Deck & deck,
const ParseContext & context )
static

Parses the provided deck.

If context contains ParseContext::PARSE_PARTIAL_DECK, we construct only a lean grid, otherwise, we construct a full EclipseState and return the fully constructed InputGrid

◆ parseGrid() [2/2]

EclipseGrid Opm::Parser::parseGrid ( const std::string & filename,
const ParseContext & context,
ErrorGuard & errors )
static

Parses the deck specified in filename.

If context contains ParseContext::PARSE_PARTIAL_DECK, we construct only a lean grid, otherwise, we construct a full EclipseState and return the fully constructed InputGrid

◆ parseGridData()

EclipseGrid Opm::Parser::parseGridData ( const std::string & data,
const ParseContext & context,
ErrorGuard & errors )
static

Parses the provided deck string.

If context contains ParseContext::PARSE_PARTIAL_DECK, we construct only a lean grid, otherwise, we construct a full EclipseState and return the fully constructed InputGrid

◆ size()

size_t Opm::Parser::size ( ) const

Returns the approximate number of recognized keywords in decks.

This is an approximate number because regular expresions are disconsidered.


The documentation for this class was generated from the following files:
  • opm/input/eclipse/Parser/Parser.hpp
  • opm/input/eclipse/Parser/Parser.cpp