Commit Graph

32 Commits

Author SHA1 Message Date
Joakim Hove
4a22657e76 Added iterator support to GridProperties<T>
- Removed std::vector<> storage of GridProperty<T> objects.
 - Completely removed std::shared_ptr<> from GridProperties<T>.
2016-07-13 23:45:06 +02:00
Joakim Hove
84321ba48d Changes to Properties lookup:
1. The normalizing in keyword names has been moved from
   Eclipse3DProperties to GridProperties.

2. The normalizing does both UPPERCASE and removes trailing
   whitespace.
2016-07-13 14:56:15 +02:00
Joakim Hove
5cf9932b1d Refactored Eclipse3DProperties
- Moved the handling of keywords from Eclipse3DProperties to
   GridProperties<T>.

 - The GridProperty<T> postprocessor is invoked from
   GridProperties<T>::getKeyword() method. The question of whether the
   postprocessor should be invoked or not is determined by the
   overload:

     public:
       const GridProperty<T>& getKeyword(const std::string) const;

     private:
       GridProperty<T>& getKeyword(const std::string);

   The public const overload will run the postprocessor, whereas the
   non-const private overload should (will) be used in the construction
   phase and should not invoke the post processor.

 - The two pass passing where we first internalize integer keywords and
   then floating point keywords has been removed.

 - Code in GridProperties has mainly been moved to GridProperties.cpp
   with explicit instantiation for int and double.
2016-05-24 09:50:15 +02:00
Joakim Hove
1a0a822cbb Renamed member variable. 2016-05-24 08:50:56 +02:00
Joakim Hove
8f70ee7d0b Removed GridProperties::getKeyword( size_t ) 2016-05-24 08:50:56 +02:00
Joakim Hove
c7d4c7fff2 Added ACTNUM postprocessor.
Added a post processor to the ACTNUM property which will set ACTNUM to
zero for all cells with PORV == 0.
2016-05-24 08:50:56 +02:00
Jørgen Kvalsvik
5f22a99a96 Replace Grid*Function with std::function
Replaces the home-grown capturing function object with std::function.
Using the library provided std::function enables creating the objects
via std::bind, enabling non-uniform signatures and relieves us of a
maintenance burden.
2016-04-27 11:51:45 +02:00
Liu Ming
63e54c0157 use message container instead of OpmLog. 2016-04-14 11:03:53 +08:00
Liu Ming
f28dd65142 add MessageContainer object. 2016-04-14 09:39:28 +08:00
Pål Grønås Drange
21f94c0606 TableManager and Deck are now used as references, hid GridProperties
* Added keyword "OPERNUM" to supported keywords in Eclipse3DProperties
* Updated tests to use Eclipse3DProperties API instead of GridProperties
* Moved init sequence of title into constructor
* ThresholdPressure and SimulationConfig now tasks Deck ref instead of shared_ptr
* Removed obsolete test and unused tests that tested gridProperties
* Refactor use of TableManager.  Is now a reference.
* Added non-const GridProperties.getKeyword(size_t i)
2016-04-12 14:42:34 +02:00
Pål Grønås Drange
3680dfcb97 Substantial edits to Eclipse3DProperties and ptr's
* moved region-property from EclipseState to Eclipse3DProperties
* moved initGridopts from EclipseState to Eclipse3DProperties
* made several Eclipse3DProperties methods private
* removed obsolete tests
* replaced log with throw internally in private method---is domain_error
* removed typedef in SatFuncPropertyInitializers
* postprocessors take raw pointers, not shared_ptr---these will be phased out
* fixed return reference instead of copy several places
** gridProperties<T> in Eclipse3DProperties are now references, not shared_ptr
** Eclipse3DProperties takes const Deck&, not shared_ptr
** EclipseGrid and Section are references
2016-04-12 14:42:34 +02:00
Pål Grønås Drange
e48b64c41d Substantial edits to Eclipse3DProperties
* Removed all references to state, need to fix initPORV
* Made TransMult return raw pointer const GridProperty over shared pointer.
* Moved getDirectionProperty and hasDirectionProperty out of API
** Removed tests as these methods are no longer public
* Moved grid properties stuff to new class
* Removed use of deck in SatfuncInitializers, moved to TableManager
* Removed shared_ptr for several members of EclipseState and 3DProperties
* Moved region-property from EclipseState to Eclipse3DProperties
* Moved initGridopts from EclipseState to Eclipse3DProperties
* Made several Eclipse3DProperties methods private
* Postprocessors take raw pointers, not shared_ptr---these will be phased out
* Fixed return reference instead of copy several places
** GridProperties<T> in Eclipse3DProperties are now references, not shared_ptr
** Eclipse3DProperties takes const Deck&, not shared_ptr
* Removed obsolete tests
2016-04-12 14:42:18 +02:00
chflo
f2ed1ba7ea Moved OpmLog from opm-parser to opm-common 2016-03-21 22:07:49 +01:00
Jørgen Kvalsvik
34bfba42d3 Replace initializer classes, refactor PropertyInit
In an effort to make GridPropertyInitializer and
SatfuncPropertyInitializer functionality more maintainble, the
shared-ptr-to-base-class model has been replaced by a specialised
function object and free functions. This means:

* GridPropertyBaseInitializer and everything derived from it is gone
* All SatfuncPropertyInitializer code has been heavily rewritten to
  emphasise dependencies. Now behaves like proper functions.
* EclipseState intialisation code is somewhat simpler
* Code is more declarative. In particular, some maybe unintended
  behaviour has been discovered and described.
2016-03-01 08:46:23 +01:00
Jørgen Kvalsvik
7946f86f29 GridPropertyFunction interface in init/postprocess
The new GridPropertyFunction processes grid cell property vectors and
replaces GridPropertyBase* inheritance model. This implementation
re-uses the old implementations as a transition.
2016-03-01 08:46:23 +01:00
Jørgen Kvalsvik
357e1e0e53 Move GridProperty< T > to source file
GridProperty< T > has only two sensible types to parametrise, int and
double. Moves the implementation and instantiation of GridProperty to
GridProperty.cpp. This also applies to GridPropertyInitializers which
has also been moved to source files.

Results are a cleaner header file (for reading & understanding the
interface) and faster compilations.
2016-03-01 08:46:23 +01:00
Jørgen Kvalsvik
5b2ec6be75 GridProperties stores raw vector of keywords
Changes the type of the stored supported keywords from pointer-to-vector
to vector. This accomplishes the following:

* we avoid an unecessary level of indirection
* we enable initializer list syntax for tests etc.
* GridProperties' interface properly communicates that it takes over
  ownership of the passed keywords.
* it feels more natural in use as generating and returning a vector in a
  free function can be returned and directly passed to the constructor
  (the motivation for this change).

Bundled with this is the move of the supported keyword population into
using loops to exploit the similarities of families of keywords w.r.t.
GridProperties representation.
2016-03-01 08:46:22 +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
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
Joakim Hove
fd87b22f7d Added methods to Deck::getKeyword<T>() 2015-06-08 11:29:19 +02:00
Joakim Hove
bf61731536 Added vector based get of Properties 2015-05-05 19:23:06 +02:00
Joakim Hove
06f2715d10 Added method GridProperties::getInitializedKeyword()
The getKeyword() method will autocreate and initialize a keyword if you
ask for one which is supported, but has not yet been accessed. The new
getInitializedkeyword() method will raise an exception if the keyword
has not already been initialized.
2014-12-18 18:02:10 +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
Joakim Hove
6f4b353fe5 Using shared_ptr<EclipseGrid> instead of bare EclipseGrid * 2014-11-09 23:46:56 +01:00
Andreas Lauser
a7ba8af558 EclipseState: make specifying anything which requires a grid an error if no grid could be instantiated 2014-11-09 17:37:32 +01:00
Andreas Lauser
5b5a3337b0 EclipseState: don't use static vectors to specify supported grid properties
this fixes a really ugly and hard to find bug if EclipseState was
instanced multiple times: The EclipseState object passed to some of
these structures was destroyed, but the arrays stayed even if the next
EclipseState object was at a different location and also could use a
completely different grid...
2014-10-21 13:03:09 +02:00
Andreas Lauser
6f290a750d Grid properties: get rid of the dimension string for integer properties
this uses a small amount of template magic, to automatically change
the API of the GridProperty class depending on wheter it is
instantiated for double or for int.
2014-06-05 10:12:23 +02:00
Andreas Lauser
7c53febf57 fix the ADD and EQUALS grid property modifiers 2014-06-03 22:42:23 +02:00
Joakim Hove
5e56f16369 Added double properties for e.g. PERM and PORO to the EclipseState 2014-06-03 22:42:23 +02:00
Joakim Hove
f5c5722508 ERT-656: Changed GridProperty to take (nx,ny,nz) instead of volume. 2014-06-03 22:42:23 +02:00
Joakim Hove
ce0dc92822 Added grid properties container. 2014-05-16 15:57:47 +02:00