Commit Graph

1725 Commits

Author SHA1 Message Date
Atgeirr Flø Rasmussen
b026c55c3b Honor the ACTNUM keyword also for cartesian grids. 2016-03-01 14:40:36 +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
Joakim Hove
36b42ec160 Merge pull request #696 from jokva/functional
Introduce Utility/Functional
2016-03-01 07:12:03 +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
Atgeirr Flø Rasmussen
8c9d57d7a7 Silence warning from inconsistently using override spec.
Also fix minor whitespace (tab) issue.
2016-02-29 10:30:24 +01:00
Atgeirr Flø Rasmussen
7b19c37585 Silence brace-init warning.
Double braces should be used for std::array until C++14.
2016-02-29 10:27:00 +01:00
Atgeirr Flø Rasmussen
ca94a5b792 Silence unused argument warning. 2016-02-29 10:26:43 +01:00
Atgeirr Flø Rasmussen
c4be826212 Silence shadowing warnings. 2016-02-29 10:25:35 +01:00
Atgeirr Flø Rasmussen
2518d08aa1 Add missing include directives. 2016-02-29 10:10:14 +01:00
Joakim Hove
1c32ef5562 Merge pull request #682 from jokva/summary
Internalise SUMMARY section
2016-02-22 14:30:07 +01:00
Joakim Hove
a8f47b4dd5 Merge pull request #694 from jokva/minor-improvements
Simplify DeckRecord::addItem implementation
2016-02-22 10:45:52 +01:00
Jørgen Kvalsvik
a8d7b250ca Simplify DeckRecord::addItem implementation 2016-02-22 10:18:22 +01:00
Jørgen Kvalsvik
7bc3c79301 PATHS keyword has global scope.
ECLIPSE resolves path aliases defined in an included file globally, i.e.
/
|> include.inc
|-- PATHS 'alias' 'path/to/dir'
|> main.data
|-- INCLUDE 'include.inc' /
| [...]
|-- INCLUDE '$alias/file.inc' /

will resolve as 'path/to/dir/file.inc'. This behaviour is now adopted by
opm-parser.
2016-02-22 10:16:12 +01:00
Joakim Hove
7b5bc29d81 Merge pull request #691 from jokva/parser-keywords-unique
Parser stores keywords as unique_ptr
2016-02-22 09:09:03 +01:00
Jørgen Kvalsvik
78e1ab9db5 Parser stores keywords as unique_ptr
Removes shared_ptr< ParserKeyword > exchange in Parser interface and
replaces it with unique_ptr storage and raw pointers for return values.
This has some implications:

* addParserKeyword() no longer takes shared_ptr<>, but unique_ptr&&
  addParserKeyword has been modified to create unique_ptr instead of
  shared_ptr.

* generated-source/ParserKeyword* no longer use make_shared which had a
  -massive- impact on compile times, which are now more-or-less
  trivialised (on my machine: 7.5s -> 1s per file). This because the
  compiler no longer generates a bunch of forwarding make_shared
  instances of subclasses that are immediately thrown away, but rather
  uses an inline make_unique that instantiates the -parent- class
  unique_ptr.
2016-02-19 14:19:41 +01:00
Jørgen Kvalsvik
a187d58502 Removes unused function in ParserTests 2016-02-19 14:04:17 +01:00
Andreas Lauser
cfd38b8a66 EclipseState: rename the has*GridProperty() methods to hasDeck*GridProperty()
the intend is to better reflect that these properties where explicitly
created in the deck. The old method names can still be used, but they
will result in deprecation warnings.
2016-02-19 13:36:57 +01:00
Andreas Lauser
f83236588c GridProperties: print a (hopefully scary) warning if a grid property looses its ad-hoc status
I'm pretty sure that most users do not expect this. If that behaviour
was really intentional, one can add a

```
FOO
$NUM_CELLS*
```

line to the deck before the keyword which requires FOO to initialize
itself.
2016-02-19 13:36:53 +01:00
Andreas Lauser
442cdafeda EclipseState: make the grid properties returned by get*GridProperty() constant
that's because they are not supposed to be modified outside of the
EclipseState. (if they are, why? I'd consider that *very* bad style
since it is also possible to copy these objects and modify the copy
and also this was used nowhere within the OPM project.)

also, the has*Property() is now working as expected: if e.g.,

```c++
bool hasSatnum = eclipseState->hasIntProperty("SATNUM");
eclipseState->getIntProperty("SATNUM");
assert(hasSatnum == eclipseState->hasIntProperty("SATNUM"));
```

will now work for decks which does not explicitly specify
SATNUM. (before the getIntProperty() method silently created the
SATNUM property which caused hasIntProperty() to change its
opinion. With this patch, the property will still be silently created,
but has*Property() ignores it, i.e., that method could be renamed to
hasExplicit*Property() which -- as far as I understand this -- was its
intention from start.)
2016-02-19 13:35:45 +01:00
Jørgen Kvalsvik
74136ab348 Interalise Summary section of Deck
Builds an internal representation, based on ERT's smspec_node, of the
SUMMARY section of an input file, that can be used to determine what
data from a simulation to output.

In essence, this is a simple map from DeckKeyword to smspec_node that
carries over the interesting data. Introduces two higher order functions
(map and concat) to aid in this, thoroughly isolating each case.

Depends on ert pull request #1013
https://github.com/Ensembles/ert/pull/1013
2016-02-19 13:04:59 +01:00
Jørgen Kvalsvik
7eb52f1023 Removes DeckKeyword's dependency on ParserKeyword
The completely constructed Deck isn't supposed to have any relationship
with the Parser structures (which are completely stateless in terms of
input data), and ParserKeyword in DeckKeyword was an anomaly. With
recent refactorings this lead to subtle lifetime issues.

This patch breaks this dependency and cleans up DeckKeyword accordingly,
while changing checkDeck to now take the parser as an additional
argument, to look up whether or not some DeckKeyword is in the right
section. This now also means that Parser* objects can be destroyed once
the Deck is created.

The Section::checkSectionTopology has been moved to Parser.cpp. It is a
temporary home for the feature to make the project compile nicely (i.e.
createKeywordList can be compiled as before, without introducing a
circular dependency on itself via Parser.cpp), until some proper cleanup
of the parser code has been done. It never really fully belonged in
Section.cpp anyway, so this is a first step in the direction of some
slight renaming.
2016-02-18 13:27:24 +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
9c577d8645 Deck uses automatic memory
The deck no longer exposes shared_ptrs, but uses automatically managed
memory, meaning ownership of DeckKeywords are now obvious and clear.
shared_ptr in the interface has been replaced by references.
2016-02-18 13:26:56 +01:00
Jørgen Kvalsvik
a0a063e386 Split Deck into RO/RW interfaces
This refactoring reflects the ownership semantics of Deck* classes -
Section and Section-derived classes no longer claim ownership over
partial decks, but rather provide a -view- into an already
established Deck.

The Deck class itself is now unique in the sense that it is the only
supporter of write operations, meaning a DeckView derived instance can
never modify the deck it's viewing.
2016-02-18 13:26:56 +01:00
Jørgen Kvalsvik
23007dd193 DeckKeyword uses automatic storage for records
DeckKeyword now internally uses a vector of records instead of a vector
of shared_ptr< DeckRecord >. Updates the interface to reflect this, by
returning references over shared_ptr. DeckKeyword is now the sole owner
of its own record resources.
2016-02-18 13:26:56 +01:00
Jørgen Kvalsvik
d4b909e885 DeckRecord uses automatic memory
Replaces shared_ptr use in DeckRecord with automatically allocated
DeckItem, as the DeckRecord itself owns and manages the lifetime of
DeckItems. To reflect this, methods and queries no longer return
shared_ptrs, but (const) references.
2016-02-18 13:26:56 +01:00
Jørgen Kvalsvik
3f9e6a7be5 DeckItem can be automatically allocated.
Using a virtual base class DeckItem that exposed DeckInt/Double/String
types means it cannot be held in a vector and managed automatically
without unique_ptr, which is clunky and makes iterator aliases
impossible. This patch moves the unique_ptr details into DeckItem which
now behaves as if it was virtual, except it only forwards calls to its
inner, managed object (much like private implementation).

This gives the benefit of automatic/stack allocation, and no particular
drawback aside from slightly less obvious implementation. Clients can
still call get< int > on a DeckItem::double, but that was also possible
with the virtual solution (i.e. nothing lost).
2016-02-18 13:26:55 +01:00
Jørgen Kvalsvik
0781ec968d Change static private methods to static functions
Since these really aren't a part of the class, they're moved to the more
approperiate static function to not pollute the header.
2016-02-18 13:26:55 +01:00
Jørgen Kvalsvik
6aa251b97d Remove std::map from DeckRecord
The map was used as an implementation detail for name-based lookup,
which has been re-implemented on top of linear searches over the vector.
2016-02-18 13:26:55 +01:00
Jørgen Kvalsvik
dc5afd5236 DeckKeyword::ParserKeyword to regular pointer 2016-02-18 13:26:55 +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
Tor Harald Sandve
710df504e2 Add support for MISCNUM
- MISCNUM is used to specify miscibility regions
2016-02-15 15:04:59 +01:00
Atgeirr Flø Rasmussen
31961cc193 Silence unused function argument warning. 2016-02-15 00:10:13 +01:00
Atgeirr Flø Rasmussen
6064d7757b Add missing override. 2016-02-14 23:38:34 +01:00
Atgeirr Flø Rasmussen
e1301fa32e Add missing #include directives. 2016-02-14 23:38:24 +01:00
Jørgen Kvalsvik
3143643299 Removes push_back( deque ) from DeckItem
This feature is not used at all.
2016-02-11 15:09:02 +01:00
Joakim Hove
c82dca0dd0 Added update constructor to Messages. 2016-02-05 17:35:23 +01:00
Joakim Hove
3e8c065c58 Merge pull request #675 from joakim-hove/use-ert-unique-ptr
Using unique_ptr in EclipseGrid.
2016-02-05 10:46:04 +01:00
Joakim Hove
551e65eca4 Internalize MESSAGES keyword. 2016-02-04 15:14:32 +01:00
Joakim Hove
ff1802ebb7 Reformatted test adding. 2016-02-04 15:13:40 +01:00
Joakim Hove
31c69e6702 Using unique_ptr in EclipseGrid. 2016-02-03 16:18:31 +01:00
Jørgen Kvalsvik
8b12fda9c3 Remove unused FloatItem classes
ParserItemFloat and DeckItemFloat is never used within the project.
2016-02-03 12:22:41 +01:00
Jørgen Kvalsvik
b7d1e45f99 Move Deck<*>Item implementation into Deck.cpp
Due to their template base, separate source files are trivial and rather
unecessary, so the type-specific implementations are moved into
Deck.cpp.
2016-02-03 09:39:19 +01:00
Jørgen Kvalsvik
3a43509d04 Unify Deck<type>Item implementations.
The Deck<*> classes are mostly straight-up copies of eachother, but with
a different type parameter. Re-implementation of this into common
template implementations with local specialisations where necessary.

Functionally the implementation is identical.
2016-02-03 09:39:18 +01:00
Jørgen Kvalsvik
381e419329 Adds Schedule::getGroups()
Similar to the already-existant Schedule::getWells, this simple method
returns (const) pointers to all groups, suitable for iteration, maps and
for-all-in operations.
2016-02-01 14:20:05 +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
34eee09fc1 Removes unused header file 2016-01-25 18:47:55 +01:00
Joakim Hove
6892dcc619 Merge pull request #654 from chflo/prediction_keywords
Internalized GEFAC keyword, added support for WCONPROD controlmode option GRUP
2016-01-25 13:20:41 +01:00
Joakim Hove
cd0336c679 Fixup: fix install path 2016-01-25 12:42:10 +01:00