Since RawRecords now has automatic storage, managed by std::list,
offering iterators is feasible. The random access
RawKeyword::getRecord's real use was accessing the records in order,
which now is handled via iterators.
The accumulated strings are moved into RawRecords, which reduces
execution time (rough measurements indicates 4-8%). To facilitate this,
RawRecords are stored directly in the vector in favour of via
shared_ptrs.
boost::trim_right loses a lot of performance from being locale aware.
Since this is not a problem for our ASCII fortran-type files, ignore
this issue and use isspace for trimming.
Modifies RawRecord to internally use string_view instead of copies of
the substrings. This *vastly* reduces copying in the processing of each
record and subsequently improves performance. Reduces total memory usage
in Deck construction.
ECLIPSE resolves path aliases defined in an included file globally, i.e.
/
|> include.inc
|-- PATHS 'alias' 'path/to/dir'
|> main.data
|-- INCLUDE 'include.inc' /
| [...]
|-- INCLUDE '$alias/file.inc' /
will resolve as 'path/to/dir/file.inc'. This behaviour is now adopted by
opm-parser.
Removes shared_ptr< ParserKeyword > exchange in Parser interface and
replaces it with unique_ptr storage and raw pointers for return values.
This has some implications:
* addParserKeyword() no longer takes shared_ptr<>, but unique_ptr&&
addParserKeyword has been modified to create unique_ptr instead of
shared_ptr.
* generated-source/ParserKeyword* no longer use make_shared which had a
-massive- impact on compile times, which are now more-or-less
trivialised (on my machine: 7.5s -> 1s per file). This because the
compiler no longer generates a bunch of forwarding make_shared
instances of subclasses that are immediately thrown away, but rather
uses an inline make_unique that instantiates the -parent- class
unique_ptr.
The completely constructed Deck isn't supposed to have any relationship
with the Parser structures (which are completely stateless in terms of
input data), and ParserKeyword in DeckKeyword was an anomaly. With
recent refactorings this lead to subtle lifetime issues.
This patch breaks this dependency and cleans up DeckKeyword accordingly,
while changing checkDeck to now take the parser as an additional
argument, to look up whether or not some DeckKeyword is in the right
section. This now also means that Parser* objects can be destroyed once
the Deck is created.
The Section::checkSectionTopology has been moved to Parser.cpp. It is a
temporary home for the feature to make the project compile nicely (i.e.
createKeywordList can be compiled as before, without introducing a
circular dependency on itself via Parser.cpp), until some proper cleanup
of the parser code has been done. It never really fully belonged in
Section.cpp anyway, so this is a first step in the direction of some
slight renaming.
Since the Deck* family of classes have changed their interfaces to no
longer use shared_ptr, a lot of code broke. This patch fixes all
problems in tests, other signatures and accesses to now use the new Deck
interfaces.
Every header is self-contained and includes only what it must to
function, relying on users include what they need in source files,
adopting a pay-what-you-use model (in particular for internal
dependencies).
This is an effort to improve build performance. Several includes
scattered across the project are either unused or partially used (i.e.
just used to import a type name, not depending on the actual contents of
the header file).
Replaces a lot of these includes with forward declarations.
Completely reimplemented the ParseMode class. Now the main datastructure
is a map<string,action> where the possible error situations are the
keys. This approach allows for a much more flexible
setting/filtering/querying of the ParseMode settings.
Previously random text in the input deck which was not formatted as a
valid keyword header was simply ignored; i.e. this
DIMENS
10 10 10 /
Mohaha random gibbersih - not according to any Spec.
GRID
Would suprisingly parse just fine. This will now be handled according
to the ParseMode::randomText setting. Observe that as a side effect of
this it turned out that many of the test datasets had additional
terminating slashes which were now detected as 'ranomdText'.
- Introduce a very simple class ParseMode which will become a simple
value object which can be used to control the behavior when errors
and inconsistencies are encountered in the parse and EclipseState
construction phases.
- Added ParseMode instance as second argument to all parseXXX()
methods.
Have added a new bool strict flag to the parsing functions, if the
strict flag is set to false the parser will just skip lines with unknwon
keywords, including pure garbage in the input. I.e. for a deck like:
TABDIMS
1 1 1 /
Crap - not a keyword at all
-- Correctly formatted - unknown keyword
IGNORED
0 1 /
The parser will load the TABDIMS keyword correctly, and skip the rest.
With this commit the generation of built in keywords is completely
changed. The most important changes include:
1) We have autogenerated a class for each keyword in the new
ParserKeywords { ... } namespace.
2) The autogenerated classes derive from ParserKeyword, and the
default constructor will build of a fully initialized
ParserKeyword instance, i.e. the keyword used to parse the EQUIL
keyword can be instantiated as simple as:
ParserKeywords::EQUIL kw;
3) The generated keywords have built in static constants for keyword
and item names, and item default values. That way it should be
possible for the compiler to catch trivial errors like trying to
access the keyword "PoRO"; also the the access to default values
means that properties can be initialized without actually
insantiating a DeckKeyword.
4) Two new classes Generator/KeywordLoader and
Generator/KeywordGenerator have been created, with the help of
these classes the keyword generation code is significantly
simplified.
For some keywords the number of records is given as the value of an item
in another keyword, for instance the number of records in the EQUIL
keyword is given by NTEQUL item in the EQLDIMS keyword.
If the EQLDIMS keyword is not given in the deck the Parser will consult
the default values of EQLDIMS keyword; i.e. a missing keyword is treated
as all-defaulted.