Commit Graph

600 Commits

Author SHA1 Message Date
Arne Morten Kvarving
b353126acf pass by reference 2017-06-09 17:38:42 +02:00
Arne Morten Kvarving
18f15e7432 mark constructors as explicit 2017-06-09 17:38:42 +02:00
Jørgen Kvalsvik
e884b0664c Redesign cmake
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.
2017-06-01 15:29:23 +02:00
Joakim Hove
39859c8d88 Skip random text when unknown keyword. 2017-03-29 18:25:23 +02:00
Tor Harald Sandve
cdfd54593f Default saturation table_id in completions with cell satnum value
Pass eclGridProperties from EclipseState to Completions in order to set
default saturation table. Most changes are due to interface change in
Schedule(...)
2017-02-16 08:27:29 +01:00
Atgeirr Flø Rasmussen
8936d9ab38 Fix tests: actually check for keyword in deck. 2017-02-13 11:16:32 +01:00
Atgeirr Flø Rasmussen
8527e646a1 Improve tests by checking for present keyword. 2017-02-10 13:02:21 +01:00
Atgeirr Flø Rasmussen
b82d9eb9b3 Add tests and test files with backslashes in INCLUDE paths. 2017-02-09 21:17:14 +01:00
Atgeirr Flø Rasmussen
b52381ca14 In INCLUDE paths, replace backslashes with slashes. 2017-02-09 21:08:16 +01:00
Jørgen Kvalsvik
5986393930 Don't crash keyword compilation on broken locales
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.
2016-12-06 09:39:36 +01:00
Joakim Hove
f3f87b5935 Merge pull request #950 from jokva/stack-allocd-items
Stack allocd items
2016-11-11 11:07:43 +01:00
Jørgen Kvalsvik
a22196546a ParserItem no longer requires heap alloc
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.
2016-11-07 12:24:38 +01:00
Jørgen Kvalsvik
fdb772e075 DeckItem without internal inheritance.
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.
2016-11-07 12:24:38 +01:00
Anders Matheson
eacbade0c1 Remove default Phases from Schedule constructor 2016-11-02 15:50:39 +01:00
Joakim Hove
17ff5847b4 Merge pull request #947 from jokva/heuristic-short-circuit-strip
Short circuit when line terminator is found first
2016-10-21 08:50:32 +02:00
Jørgen Kvalsvik
728a9c2e69 Short circuit when line terminator is found first
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.
2016-10-20 15:11:44 +02:00
Jørgen Kvalsvik
331d61cba5 Parser.parseFile() assumes default parse context 2016-10-19 20:38:28 +02:00
Jørgen Kvalsvik
bf057f157c Deck units no longer unique 2016-10-19 20:38:28 +02:00
Jørgen Kvalsvik
37c04328ca Remove shared_ptr typedefs 2016-10-19 20:38:28 +02:00
Jørgen Kvalsvik
f9cb516b99 Remove DeckPtr+ParserPtr aliases
Remove the deprecated DeckPtr and ParserPtr aliases and removes
shared_ptr<Deck> and friends from all interfaces.
2016-10-19 20:38:28 +02:00
Jørgen Kvalsvik
1906bf4d16 Make EclipseGrid no longer use shared_ptr 2016-10-19 20:38:28 +02:00
Jørgen Kvalsvik
c893a92aa6 Make Dimension+UnitSystem no longer use shared_ptr 2016-10-19 20:38:27 +02:00
Jørgen Kvalsvik
db66f0302c Explicit bool conversion in isRecognizedKeyword 2016-10-06 13:17:23 +02:00
Tor Harald Sandve
5d7d5be679 Add support for control mode in WHISTCTL
-- 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.
2016-09-29 08:29:57 +02:00
Joakim Hove
81b71d5d08 Removed EclipseGrid member from Schedule class. 2016-09-12 21:42:34 +02:00
babrodtk
71133c15a0 Deleted UnitSystem.cpp from Parser (has been moved to Units previously) 2016-09-05 08:27:29 +02:00
Liu Ming
756b4d1edd argument of warning() method is msg, filename, linenumber. 2016-08-29 14:01:14 +08:00
Joakim Hove
9bcdadd443 Merge pull request #890 from pgdr/transmult-and-shared_ptrs
Removing some use of shared_ptr
2016-08-09 09:32:41 +02:00
Pål Grønås Drange
41b158bb2b Shortified names, instead of state.getEclipseConfig().getSummaryConfig(), use state.cfg().summary() 2016-08-08 11:39:59 +02:00
Jørgen Kvalsvik
db33a9cc55 Prefer function objects in Parser::clean
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.
2016-08-08 09:42:41 +02:00
Jørgen Kvalsvik
99570ff72e Add all records to Deck at once
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.
2016-08-05 10:45:31 +02:00
Jørgen Kvalsvik
f571f21171 is_separator includes comma
This deprecates the comma replace function in the reader.
2016-08-04 16:05:53 +02:00
Jørgen Kvalsvik
b2f206d54a Replace RawRecord expanded items; reuse view
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.
2016-08-04 16:05:53 +02:00
Jørgen Kvalsvik
adc602f6aa Manually copy over append in Parser.clean
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.
2016-08-04 16:05:53 +02:00
Jørgen Kvalsvik
ca2985d5a0 Fix warnings in ParserTests 2016-07-13 23:40:09 +02:00
Jørgen Kvalsvik
d85bbf9f2b Fix warnings in ParserKeywordTests 2016-07-13 23:40:09 +02:00
Jørgen Kvalsvik
616e810858 Fix warnings in Parser 2016-07-13 23:40:09 +02:00
Joakim Hove
f2e94061d8 Added Json config for new keywords. 2016-07-13 14:56:15 +02:00
Jørgen Kvalsvik
3696b750cd Remove opm-common dependency
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.
2016-07-08 15:53:40 +02:00
Joakim Hove
d3f415c5aa ParseContext treatment of unknown wells/groups. 2016-07-01 17:04:58 +02:00
Pål Grønås Drange
5b3eaada22 EclipseState demands full deck now, so added D(X|Y|Z) and TOPS to tests 2016-06-21 15:55:04 +02:00
Andreas Lauser
76da7a7429 use boost::regex unconditionally
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`.)
2016-06-16 14:23:39 +02:00
Joakim Hove
10bf441076 Added ParseContext::PARSE_MISSING_INCLUDE 2016-06-15 17:34:44 +02:00
Joakim Hove
0f53084015 Merge pull request #827 from joakim-hove/check-symlinks
Check for symlink() and compile test conditionally
2016-06-15 15:19:29 +02:00
Joakim Hove
8e9dce4bd8 Merge pull request #839 from joakim-hove/ignore-operate
Added keyword OPERATE.
2016-06-15 09:10:26 +02:00
Jørgen Kvalsvik
eeba4f37e6 Expand on possible failure case in parser 2016-06-14 14:44:46 +02:00
Jørgen Kvalsvik
f56a2d61d0 Strip commas from the input deck
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.
2016-06-14 12:57:05 +02:00
Joakim Hove
8cfb73d991 Added keyword OPERATE. 2016-06-14 12:29:31 +02:00
Joakim Hove
774c36c4a9 Check for symlink() and compile test conditionally 2016-06-11 07:45:24 +02:00
Liu Ming
98ed0521b5 fix indentation. 2016-06-08 11:11:16 +02:00