Commit Graph

84 Commits

Author SHA1 Message Date
Tor Harald Sandve
4ae5049639 Add <algorithm> to make it compile for gcc 4-6 2015-08-05 08:48:03 +02:00
Andreas Lauser
e32f8b5742 make the 'd' exponent specifier the slow path
i.e. first try to convert it normally and only if this fails, replace
'd' by 'e' and try again.

this is because the slowdown when always taking the second path was
about 7 to 9% for the Norne deck on my machine. (I think this is quite
surprising.)

thanks to [at]joakim-hove for the hint.
2015-07-24 11:36:36 +02:00
Andreas Lauser
1d388b3b78 implement support for fortran-style 'd' exponent indicators
also, extend the corresponding unit test.
2015-07-23 16:18:07 +02:00
Arne Morten Kvarving
2acd2db5d0 changed: rename Parser to opmparser for consistency 2015-05-26 13:53:54 +02:00
Arne Morten Kvarving
9e96127705 change how tests are added in the build system
- use a opm-macro to reduce code duplication
- add a 'test-suite' target which builds tests. for use if BUILD_TESTING
  is 0.
- add a 'check' target which builds tests, then executes them
2015-05-26 13:07:44 +02:00
Andreas Lauser
e12a0aab1b parser main loop: handle unknown sized keywords in a better way 2014-12-19 10:59:12 +01:00
Andreas Lauser
017e582e5a handle comments and empty lines directly in the parser's main loop
note that comment handling is currently a bit too simplistic as stuff
like

FOO
'-- hello' /

won't work. as far as I can see, this is not different from the state
before this patch, though.
2014-12-09 11:54:55 +01:00
Andreas Lauser
ea38a25af4 remove all trailing white space
this is just the result of

```
find -iname "*.[ch]pp" | xargs sed -i "s/ *$//"
find opm/parser/share/keywords -type f |  xargs sed -i "s/ *$//"
```

so if it causes conflicts with other patches, the others should get
priority. The rationale behind this patch is that some people tell
their editor to remove white space which leads to larger than
necessary patches...
2014-12-08 16:34:28 +01:00
Andreas Lauser
ead7e0a8c9 make the parser case-insensitive
i.e., make keywords ALL_UPPERCASE before using them because Eclipse
seems to be case-insensitive (although this is one of its undocumented
features...)
2014-11-07 14:24:12 +01:00
Andreas Lauser
fff0c9cdf0 Revert "also eat keywords containing lowercase letters"
this was inadvertedly merged. the real fix is to make the parser
case-insensitive...
2014-11-07 14:23:08 +01:00
Andreas Lauser
382d449ebb also eat keywords containing lowercase letters
The Norne deck actually exhibits this atrocity in form of the
'fluxnum' keyword in the file 'INCLUDE/PETRO/FLUXNUM_0704.prop'.

I don't know if Eclipse cares about the case of the keywords, but
opm-parser currently does for sure. (If Eclipse turns out to be
case-insensitive, the easiest fix for us is to just make all keywords
ALL_UPPERCASE...)
2014-11-07 12:58:04 +01:00
Andreas Lauser
f8946b9e7e RawKeyword: rename tryParseKeyword() to isKeywordPrefix()
because the method never tried to *parse* the data as a keyword but always
returned whether the *calling* code should try to parse it...
2014-11-05 13:11:52 +01:00
Andreas Lauser
6eb3421f38 Handle quotes better
This allows to arbitrary characters like stars into strings. e.g.

MYKEYWORD
'123*456' 2*'Hello, World! (*)' /

is now a valid record with three strings while it threw an exception
before.

This patch works by transferring the removal of the quotes from the
RawDeck class to the readValueToken<T>() function which now has a
specialization for strings that deals with quotes. One small
complication is that the RawDeck needs to be adapted in order not to
split tokens in the middle of strings.

Finally, the StarToken class does not deal with the conversion from
string to the value type of the item anymore which allows it to become
a normal class instead of a template...
2014-11-05 13:05:22 +01:00
Andreas Lauser
435e6aa6c5 extend "StarToken" class
that's because not every token which contains a star represents an
repetion, e.g.

'PROD*'

and

'123*456'

(with the quotes) are strings...
2014-09-15 12:27:28 +02:00
Andreas Lauser
c2329b72ba add a few missing includes
these includes are required by the headers. If the affected files
would have been included without the headers included before, a
compiler error would have been produced.
2014-08-25 14:07:28 +02:00
Andreas Lauser
523d5d049f fix ugly bug which prevented deck keyword names from having a minus in them
i.e. MULT[XYZ]- was trimmed to MULT[XYZ]. Also, the RawKeyword now
uses ParserKeyword::isValidDeckName() instead of a regular expression
which makes it automatically consistent and also should make it
slightly faster...
2014-07-15 16:47:31 +02:00
Kristian Flikka
697c273c19 OPM-94: Removed specialized int,double,string implementations, one generic covers the same 2014-07-10 13:24:49 +02:00
Arne Morten Kvarving
d85782d9f5 fixed: keep a copy instead of a reference
storing string references are not a good idea, since temporaries are
often used. fixes RawRecordTest on my box
2014-06-05 11:48:17 +02:00
Kristian Flikka
82a38c1cc8 Merge pull request #208 from AtleH/wellnamewithwildcard
Added wildcard support in WCONINJE and WCONPROD
2014-05-16 12:28:39 +02:00
Arne Morten Kvarving
8cb2646995 fixed: initialize members 2014-05-15 14:46:16 +02:00
Atle Haugan
344d02ad1c Add support for wildcard in WCONPROD and WCONINJE keywords. 2014-05-06 09:54:37 +02:00
Atgeirr Flø Rasmussen
e3d167048f Commented out unused function arguments. 2014-04-15 09:48:19 +02:00
Joakim Hove
5becf79dd1 The ParserKeyword->parse() method will throw if the raw input argument is not finished.
Requires several changes to assure that the rawkeyword instances are
marked as finished before reacing the ParserKeyword->parse method.
2014-04-11 13:42:22 +02:00
Atgeirr Flø Rasmussen
2df1761922 Deleted unneeded default constructor.
Its implementation was buggy, initialising references to temporary objects.
2014-04-04 10:05:04 +02:00
Atle Haugan
9ac0401af5 Support for PATHS keyword - first take 2014-02-21 12:56:20 +01:00
Kristian Flikka
15682a71df Merge pull request #114 from joakim-hove/valgrind
Valgrind
2014-02-06 16:39:30 +01:00
Arne Morten Kvarving
4a9c18ac9f run tests through valgrind 2014-01-27 15:16:34 +01:00
Atle Haugan
ef11a2331f OPM-17: First attempt to handle END and ENDINC keywords 2014-01-24 10:01:17 +01:00
Kristian Flikka
c74a86b3f5 Merge pull request #68 from joakim-hove/units
Units
2013-12-09 01:12:33 -08:00
Joakim Hove
acff0a4127 Changed "header" to <opm/parser/eclipse/xx/header>. 2013-12-08 19:17:33 +01:00
Joakim Hove
9ccc70b58d Added enum for size of rawkeywords. 2013-12-04 17:21:54 +01:00
Kristian Flikka
ce692159c9 Trimming right side of each read line, to avoid line ending problems.
Removed C style parsing of numbers, using boost::lexical_cast instead.
2013-12-03 10:15:22 +01:00
Kristian Flikka
1d0135da5e Removed use of boost::shared_ptr, replaced with std::shared_ptr 2013-12-02 13:07:01 +01:00
Kristian Flikka
9fddf998cf Fixed a bug with comments after keywords, right-side trims away dashes and spaces from the 8 char candidate 2013-11-20 14:35:48 +01:00
Kristian Flikka
006ab6d35d Added keywordName and dataFilename to RawRecord. Using these in the ParserRecord to give better error message when throwing on too long RawRecords 2013-11-07 12:32:07 +01:00
Roland Kaufmann
0a69727bf7 Add missing header for function used inline in class 2013-10-22 22:38:08 +02:00
Joakim Hove
2d68ebe94c Merge remote-tracking branch 'upstream/master' into track-default 2013-10-15 14:24:42 +02:00
Joakim Hove
dabfdb922b Added loose function tokenCOntainsStar to StarToken.cpp 2013-10-14 21:27:20 +02:00
Joakim Hove
7ec4be5b47 Including StarTokenTest 2013-10-14 21:13:24 +02:00
Joakim Hove
a7078ba687 Implemented StarToken specializations in cpp file 2013-10-14 21:05:10 +02:00
Joakim Hove
ccae60777d Ensure that StarToken() will throw for missing multiplier 2013-10-14 17:49:07 +02:00
Joakim Hove
aae260c47d Added class StarToken() to treat tokens with a multiplier/default 2013-10-14 16:54:43 +02:00
Joakim Hove
f0770f47fb Added filename and line nr to RawRecord 2013-10-08 15:23:45 +02:00
Joakim Hove
2913b526d7 Added isTableCollection attribute on Parser and Raw keyword - mainly to parse PVTG keyword 2013-10-01 16:35:55 +02:00
Joakim Hove
ff715812c0 isTerminatedRecordString() will inspect the partial input - and not the whole string 2013-09-30 11:13:23 +02:00
Kristian Flikka
297c719a1c Cleanup of some remaining Logger stuff 2013-09-19 10:57:46 +02:00
Joakim Hove
d8dff84cb3 Removed Logger class 2013-09-16 14:36:14 +02:00
Kristian Flikka
e42a7a3a97 Refactoring the main function, added submethod. Removed valgrind uninitialized error 2013-08-21 14:29:46 +02:00
Joakim Hove
7786f296d8 Removed RawKeyword::lineContainsData() and RawKeyword::lineTerminatesKeyword() 2013-08-13 14:49:01 +02:00
Joakim Hove
c1ff0a6eb0 Removed RawDeckTests from CMakeLists.txt 2013-08-13 14:47:42 +02:00