Commit Graph

79 Commits

Author SHA1 Message Date
Joakim Hove
0986d49c05 Small test of fun::map and fun::concat. 2016-05-27 09:18:39 +02:00
Jørgen Kvalsvik
a105f3a193 string_view char* constructor 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
bda128ee23 front/back support in string_view 2016-05-03 09:16:27 +02:00
Jørgen Kvalsvik
a93507087d string_view operator< and operator== support
In order for string_view to be useful as container member and sorting,
it has to support operator< and operator==
2016-05-03 09:16:27 +02:00
Jørgen Kvalsvik
2d1075efcb Check argument length in string_view == char*
Not doing this opens up for undefined behaviour when char* is shorter
than view.
2016-04-25 15:20:27 +02:00
Jørgen Kvalsvik
23f01511bd Add string_view::empty() 2016-03-15 16:42:02 +01:00
Atgeirr Flø Rasmussen
32439fa87d Remove unused boost-specific helpers. 2016-03-14 14:54:00 +01:00
Atgeirr Flø Rasmussen
2e1940e5c3 Move string_view ops to Opm namespace. 2016-03-14 13:28:51 +01:00
Jørgen Kvalsvik
8d4863ff86 Introducing string_view
A simple non-mutating view into a string. Implements a shallow reference
to a std::string, replicating its operations to be drop-in replaceable.

Primarily designed for inner loop use, where expensive string
allocations become a performance killer.
2016-03-14 08:29:53 +01:00
Jørgen Kvalsvik
d67a44b19d Include guards for Functional 2016-03-07 09:03:52 +01:00
Joakim Hove
99266809b7 Merge pull request #698 from jokva/equil-keyword-lookup
Equil keyword lookup
2016-03-04 18:19:43 +01:00
chflo
0db3abab94 Added copyright header to files that were without it 2016-03-04 14:56:18 +01:00
Atgeirr Flø Rasmussen
9e0c85dce7 Silence warnings from boost. 2016-03-01 10:12:09 +01:00
Atgeirr Flø Rasmussen
a828991bbc Add missing include directive. 2016-03-01 10:11:55 +01:00
Jørgen Kvalsvik
51df3685f3 Remove EquilWrapper.
This file is deprecated.
2016-03-01 08:44:38 +01:00
Jørgen Kvalsvik
ba743e488c Introduce Utility/Functional
Utility/Functional is a lightweight high level functional-oriented sub
library that attempts to abstract some common uses and boilerplate
around the parser code (and later maybe for other modules to use).

This patch introduce only three functions, but they have proven common
enough to warrant some common implementation.
2016-02-29 13:50:32 +01:00
Jørgen Kvalsvik
f0ae5db131 opm-parser adoption of Deck automatic ownership
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.
2016-02-18 13:27:24 +01:00
Jørgen Kvalsvik
6f417b0a4d Remove unused Utility/Wrapper.hpp
These wrapper classes are not used within any opm project, and can be
removed to reduce maintenance.
2016-02-17 11:48:40 +01:00
Jørgen Kvalsvik
4b98943665 Replaces unecessary header includes with fwd decls
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).
2016-01-26 13:23:22 +01:00
Jørgen Kvalsvik
f404828d63 Cleans up headers to improve build preformance
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.
2016-01-21 09:22:06 +01:00
Andreas Lauser
3b86bfd474 remove dangling file opm/parser/eclipse/Utility/tests/TableTests.cpp
somehow this fell through the cracks when doing the big tables overhaul.
2014-10-13 18:41:52 +02:00
Andreas Lauser
7ad309d3b3 move the table classes from .../Utility to .../EclipseState/Tables 2014-09-19 15:12:21 +02:00
Andreas Lauser
a057280492 tables: remove trailing underscores from the protected and private methods
opm-parser does not follow this convention...
2014-09-19 14:33:35 +02:00
Andreas Lauser
f6b2797e23 tables: make them instantiable exclusively by EclipseState
since tables can be tricky, we now enforce that the compiler bails out
if the user tries to instantiate a table class manually.

Note that a bit of trickery is needed to keep the low-level unit
tests working...
2014-09-19 14:33:35 +02:00
Andreas Lauser
e994d7314e endpoint scaling tables: make the bare-metal getColumn(index) method public
it is _strongly_ encuraged to use the properly named methods to access
the respective columns, but opm-core's current endpoint scaling code
makes it hard to use these...
2014-09-19 12:24:54 +02:00
Andreas Lauser
59d35de3af add table classes for RSVD and RVVD
these keywords are used by opm-core, albeit currently in a
"bare-metal" way.
2014-09-19 12:24:54 +02:00
Andreas Lauser
f544c926df tables: propertly handle defaults and monotonicity of columns
for some kinds of tables this means linear interpolation for some
columns, constant for other columns and some tables do not allow to
specify default. Since there is no clear rule, this patch involved
checking the reference manual for every single f****** table keyword
plus some guess-work if the reference manual is unclear about
monotonicity and/or defaults.
2014-09-19 12:07:06 +02:00
Andreas Lauser
fd6209a34d make it possible to evaluate some tables using linear interpolation
... and constant interpolation at the fringes. this kind of evaluation
in between sampling point only makes sense for tables where the first
column is strictly monotonic, though.
2014-09-19 12:07:06 +02:00
Andreas Lauser
1bbe775831 make all table classes default constructible
this allows to store them in std::vectors, but requires to call the
init() method after construction...
2014-09-19 12:07:06 +02:00
Andreas Lauser
0055703aef remove PvcdoTable
because PVCDO is not a table keyword.
2014-09-19 12:07:06 +02:00
Andreas Lauser
0d423b83f4 remove the PvtwTable
because PVTW is not a table keyword...
2014-09-19 12:07:06 +02:00
Andreas Lauser
f440f34788 remove RockTable
because ROCK is not a table keyword
2014-09-19 12:07:06 +02:00
Andreas Lauser
c5f78788e0 add the IMPTVD and IMKRVD keywords and table classes
basically they are just renamed copies of the EN* variants...
2014-09-19 12:07:05 +02:00
Andreas Lauser
b72df6f406 make ParserItems always defaultable
i.e. remove the defaultSet() method and its friends. this is required
to be able to specify defaults in DATA items like grid properties or
saturation tables. e.g.

SGL
10*0.1 10* 10*0.2 /

would not be possible without this. If no meaningful default for an
item is defined, float and double items get NaN, int items get -1 and
string ones get an empty string. The hope is that if these values get
used in the simulation, they will make the result obviously
incorrect. (Whether a data point of an item was defaulted can be
queried using item->defaultApplied(index).)
2014-09-15 12:17:03 +02:00
Andreas Lauser
e6fa1e01a8 DeckItem: add indices to the methods which allow to query the defaulted status
also, this renames DeckItem::setInDeck() to DeckItem::wasSetInDeck()
because the former method can easily be confused with a setter method
(which it is not, it is a 'getter').

note that there is a small semantical difference now: the old
signatures specified the status of the whole *item* while the new
variants are specific for a single *data point* of an item. Though at
this point the index passed to the methods is still disregarded..
2014-09-15 12:17:03 +02:00
Joakim Hove
61cdf7d402 Default: defaultApplied -> setInDeck()
The data values in a deck item can be in three different states, given
by the DeckValue enum in DeckItem.hpp. The three values are:

  SET_IN_DECK : The value has been set explictly in the deck.
  DEFAULT     : The value was not present in the input deck, but a default
                value has been supplied in the configuration and that value
                has been set.
  NOT_SET     : No value has been set for this item; it was not explicitly
                set in the deck and also not included in the configuration.

If you ask for DeckItem->value which is in state NOT_SET you will get an
exception. The method setInDeck() can be used to check if a value has
been set explicitly in the deck; the method defaultApplied() will check
if a default value has been applied.

Observe that the system for handling defaults is not really well suited
for multi valued data items, as it is only a scalar state variable. In
the case of multi valued data items both defaultApplied() and
setInDeck() might return true.
2014-09-03 10:37:01 +02:00
Andreas Lauser
ad1dfab8d7 fix spurious GCC warnings
The root cause are pretty (too?) strict flags w.r.t. compiler
warnings. In this case, the offenders are "-Wmissing-declarations" and
"-Wtype-limits".
2014-06-02 13:01:56 +02:00
Arne Morten Kvarving
eef7b53fdd fixed: don't check for unsigned values being positive
they definitely are. quells warnings
2014-05-15 14:46:16 +02:00
Andreas Lauser
1909e22f48 fix the "number of table" calculation for multi-record tables
It turns out that the empty-record detection worked fine, but that the
last empty record of a keyword is ignored by opm-parser for reasons
which are not clear to me...

Now all unit tests pass.
2014-04-28 21:12:38 +02:00
Andreas Lauser
808e2d3717 rename SimpleTable to SingleRecordTable and SimpleMultiRecordTable to MultiRecordTable
because what's simple is in the eye of the beholder...
2014-04-28 18:29:44 +02:00
Andreas Lauser
de38673ce4 table tests: expand them considerably and actually run them
In the current version, the runTimeMapTest binary was run because of a
copy-and-pasto. oops.

Also, not all of the tests pass but that is because of another problem
of opm-parser for which I don't know a good fix: It currently seems to
be impossible to specify empty records if there are non-defaulted
items in the JSON keyword specification, but such empty records are
used as table separators by Eclipse...
2014-04-28 18:16:23 +02:00
Andreas Lauser
0713a3a767 add some comments to the capillary pressure retrival methods of S{g,w}ofTable
that's because the Eclipse capillary pressure definitions
inconsistent: SWOF specifies the "water-oil capillary pressure" as $p_o
- p_w$, while SGOF uses $p_g - p_o$ as the "oil-gas capillary pressure".
2014-04-28 17:05:31 +02:00
Andreas Lauser
4b2ab72eef add numTables() method to the table classes
For SimpleTable, that is simply the number of records in a keyword, for
MultiRecordTables, it is the number of _empty_ records.

this patch makes supporting multi-PVT easier and cleaner.
2014-04-28 17:05:31 +02:00
Andreas Lauser
406f294026 add table utility classes for the PLY{ADS,MAX,ROCK,VISC} and TLMIXPAR keywords
these are not really used as tables in the current opm-polymer code,
but the Eclipse RM says they are tables, so we should add these
classes...
2014-04-14 16:18:37 +02:00
Joakim Hove
6a1b887323 Merge pull request #178 from joakim-hove/data-with-default
Data with default
2014-04-11 13:45:02 +02:00
Joakim Hove
f59fd25668 Added boolan flag scalar = true to DeckItem.
The purpose of this flag is to keep track of whether a keyword is
supposed to have only one element, i.e. scalar, or several. The
defaultApplied method only makes sense in the case of scalar items, this
method will now throw if it is called on a non-scalar item.
2014-04-11 13:42:22 +02:00
Andreas Lauser
7eb19083ea add PVCDO keyword and fix typo pvdco -> pvcdo
this is used in opm-core but I doubt that these code paths have
actually been tested recently because the parser would have thrown up
as soon as it had encountered PVCDO...
2014-04-11 11:57:32 +02:00
Atgeirr Flø Rasmussen
3ab6a5388c Suppress unused argument warnings. 2014-03-03 11:06:44 +01:00