Commit Graph

35 Commits

Author SHA1 Message Date
Jørgen Kvalsvik
8a4eb5279c Splitting records with string_view; test updates
The splitting of RawRecords into individual symbols uses string_view.
Also updates tests since RawRecord now assumes that the record string it
receives is complete and does *not* contain the terminating slash.
2016-05-03 09:16:28 +02:00
Jørgen Kvalsvik
07eea89c34 Remove redundant overloads
These overloads were written to allow testing, but with string_view
accepting char* they're unecessary and confusing.
2016-05-03 09:16:28 +02:00
Jørgen Kvalsvik
6b64796d49 Add char* constructor to string_view
Mostly relevant for testing, this enables string_view to work as
expected with string literals.
2016-05-03 09:16:28 +02:00
Jørgen Kvalsvik
b648719513 Base string_view on char*, not string::iterator
By representing string_view as char* instead of
std::string::const_iterator the string_view class bring possibly
slightly lower overhead, but mostly enables some optimisations.
2016-05-03 09:16:27 +02:00
Jørgen Kvalsvik
bfb7f6ec0c RawRecord internals use ranges over string methods
Rewrites the internal string mainpulation functions of RawRecord to use
std::algorithm and ranges over string methods.
2016-05-03 09:15:22 +02:00
Jørgen Kvalsvik
9e76ec5f78 Inline hot-but-trivial functions
These functions are called a lot and are trivial accessors to the
underlying containers. By opening them for inlining we get a decent
performance benefit "for free" via optimisation opportunities.
2016-03-22 14:45:17 +01:00
Jørgen Kvalsvik
0da5cadc75 RawRecords auto store, strings moved to RawRecord
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.
2016-03-22 08:58:48 +01:00
Jørgen Kvalsvik
2a650d5972 RawRecord refactoring
Some simple refactoring to remove a redundant check and clean up some
initialisation routines.
2016-03-14 08:29:54 +01:00
Jørgen Kvalsvik
dc094cbb16 More efficient findTerminatingSlash
Uses some heuristics and quick exists to avoid always paying worst case
cost for finding terminating slash.
2016-03-14 08:29:54 +01:00
Jørgen Kvalsvik
1d1715b421 RawConsts::is_separator function
This replaces the inefficient RawConsts::separators.find( char ) with an
availble, efficient and inlinable is_separator.
2016-03-14 08:29:53 +01:00
Jørgen Kvalsvik
e4ddf884f1 Using operator+ and stream operators 2016-03-14 08:29:53 +01:00
Jørgen Kvalsvik
798084676a RawRecord uses string_view internally
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.
2016-03-14 08:29:53 +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
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
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
Joakim Hove
acff0a4127 Changed "header" to <opm/parser/eclipse/xx/header>. 2013-12-08 19:17:33 +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
Kristian Flikka
e42a7a3a97 Refactoring the main function, added submethod. Removed valgrind uninitialized error 2013-08-21 14:29:46 +02:00
Joakim Hove
5c3de27077 1. Implemented support for inferring size from another kewyord - i.e EQLDIMS + EQUIL.
2. Cleaned up the main parser loop considerably; the RawKeyword instance now itself knows whether it is complete or not.
2013-08-11 12:36:16 +02:00
Kristian Flikka
b43d95c5a2 Starting to wrap up from the top, added the missing DeckKW, and refactored a bit in some of the Raw classes that returned the internal structure 2013-06-03 15:54:16 +02:00
Joakim Hove
f178691831 Added size() method to the RawRecord class 2013-05-12 21:37:22 +02:00
Joakim Hove
a9cd24f628 Added operator[] and method push_front() to RawDeck 2013-05-10 13:55:00 +02:00
Kristian Flikka
2a331e1a3a ParserIntItem's scan function now supports ITEM_FIXED parsing 2013-05-08 15:29:58 +02:00
Kristian Flikka
2088c3e96d Simple scan implementation in ParserIntItem added. DeckIntItem now support push_back 2013-05-08 14:31:20 +02:00
Kristian Flikka
2d6e6842d6 Changed ParserItem from template based to a base-inheritance based system. Corresponds to and creates DeckItem objects 2013-05-07 21:55:49 +02:00
Kristian Flikka
bf3be4695d Refactoring, prefixing parser setup classes with Parser. 4 space indent. 2013-05-06 12:13:49 +02:00
Kristian Flikka
8b32658e54 Refactoring, more consts, etc. Comments from Joakim 2013-04-08 14:32:17 +02:00
Kristian Flikka
f89b8362ff Changed to tabsize 2 after discussion with Joakim. I vote for real tabs. 2013-04-08 10:36:14 +02:00
Kristian Flikka
1868615a4a Moved some consts for the Raw classes to a separate file, characters and sizes 2013-04-08 10:31:54 +02:00
Kristian Flikka
c76767b9aa Adding recursive reading of Include files. Fixed a performance bug when appending strings to a record 2013-04-05 16:14:43 +02:00
Kristian Flikka
b200d74c9d Rename variable 2013-04-04 15:57:21 +02:00
Kristian Flikka
aa8cd7b4ca Added a thin container for knowledge about keywords with fixed number of records. Changed some getter methods to return reference 2013-04-04 13:30:50 +02:00
Kristian Flikka
3adb09cb5a Review updates: Keyword can have numbers, comment lines can start with space, data can start at pos 0 on line, must explicitly have end-of-keyword control 2013-04-04 09:56:00 +02:00
Kristian Flikka
d24f487d18 Refactoring for readability. Added a couple of unit tests 2013-04-02 15:42:19 +02:00
Kristian Flikka
2be8700e66 Moved data to RawDeck, added gmon.out to gitignore 2013-04-02 13:39:41 +02:00