Tune the makefile according to new principles, which adds a few bells
and whistles and for clarity.
Synopsis:
* The dependency on opm-common is completely gone. This is reflected in
travis and appveyor as well. No non-kitware cmake modules are used.
* Directories are flattened, quite a bit - source code is located in the
lib/ directory if it belongs to opm-parser, and external/ if third
party.
* The sibling build feature is implemented through cmake's
export(PACKAGE) rather than implicitly looking through source files.
* Targets explicitly set required public and private include
directories, compile options and definitions, which cmake will handle
and propagate
* opm-parser-config.cmake for downstream users is now provided.
* Dependencies are set up using targets. In the future, when cmake 3.x+
can be used, these should be either targets from newer Find modules,
or interface libraries.
* Fewer system specific assumptions are coded in, instead we assume
cmake or users set up system specific details.
* All module wide configuration and looking up libraries is handled in
the root makefile - all sub directories only set up libraries and
compile options for the module in question.
* Targets are defined and links handled transitively because cmake now
is told about them. ${module_LIBRARIES} variables are gone.
This is largely guided by the principles outlined in
https://rix0r.nl/blog/2015/08/13/cmake-guide/
Most source files are just moved - if they have some content change then
it's nothing more than include fixes or similar in order to make them
compile.
Pass eclGridProperties from EclipseState to Completions in order to set
default saturation table. Most changes are due to interface change in
Schedule(...)
Work around a weakness of older boosts by forcing C locale if
std::locale throws.
The real solution is to not have broken locales, but this should make it
slightly easier to get the JSON keywords compiled.
Redesign of ParserItem so that its sum type nature no longer mandates
indirection, but rather a tag check on all operations. Because of this,
ParserRecords can now store ParserItems directly, and iterators are no
longer iterators to pointers, but behave like normal vector iterators.
Replaces the internal inheritance + unique_ptr scheme to a flat sum type
similar scheme that uses a tag to determine which operations are legal,
rather than using the indirection itself as a tag.
The termination logic would sometimes need to scan the full line to see
if some terminating condition was found inside quotes. Plenty of
comments in a file start on the first character of a line, meaning this
scan is unnecessary.
-- Control mode given by WHISTCTL overwrites control mode given in
WCONHIST
-- option for termination of run if changed to BHP control in not
implemented. But ParseContext is used to inform the user and make
throwing optional.
Implementing these checks as function objects improves performance
slightly (5% or so according to my measurements), probably due to the
functions being inlined rather than reduced to function pointers.
Rather than doing add-item-check-duplicates per DeckItem added to a
record, construct all the items at once, then pass them in full to the
DeckRecord object. The DeckRecord object still check for duplicate
names, but with lower complexity and cost.
Reuses the original records string_view rather than expanding to the
same std::string, we save some allocations, memory cache misses and
simplify the class slightly.
Additionally, the uninteresting add-multiple-identical-records logic
ParserItem did before has been moved into RawRecord and is now performed
by std::deque (which also means it can allocate better for itself). The
addition of prepend deprecates push_front.
Book keeping internally in the string class is rather unnecessary and
performed a lot (once per line in the input). Performing a manual copy
without string encumbered book keeping (essentially using the string as
a raw char* buffer) gives some performance, which scales well with the
lines in each deck.
Severs the code dependency on opm-commmon. There was no actual
functional dependency here, with the exception of some enable/disable
warning headers. To properly make opm-parser a stand-alone module the
usage of these headers have been removed and the dependency on
opm-common is gone.
this fixes opm-simulators#702. which turned out to be a quirk of the
build system which is due to the fact that opm-parser likes to do some
things differently than the rest of OPM. (in this case the culprit was
that it does not generate a `config.h` file which resulted in the
HAVE_REGEX macro to be different between opm-parser and downstream
which in turn causes the ABI to be incompatible.)
Note that it would be nice to use `std::regex` instead of Boost, but
this is currently blocked by the requirement that the oldest supported
compiler is GCC 4.8. (GCC 4.8 only provides a stub implementation of
`std::regex`.)
Some decks use comma to separate items in a record, but the comma adds
no extra information and is essentially ignored. Post-process the file
after cleaning it and replace all commas with whitespace.
Considering the record "foo bar , , , baz" / baz will silently be moved
to the third item, but handling that situation is a **lot** more
difficult and time consuming and not worth the effort for now.
Additionally, we have yet to receive decks that fail in such a manner,
nor are we sure if it is even a valid record in Eclipse.