Commit Graph

126 Commits

Author SHA1 Message Date
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
Joakim Hove
725fb4fba5 Removed commented out code 2015-05-05 19:22:10 +02:00
Joakim Hove
b02e536ad8 Added ability to check index of keyword from Deck. 2015-04-20 14:56:52 +02:00
Joakim Hove
7bd566d6a6 Changed Deck & Section implementation
- Removed the KeywordContainer class; and implemented the behaviour
   directly in the Deck.

 - Added begin() and end() iterators to the Deck.

 - Section class inherits from Deck.
2015-04-20 14:56:52 +02:00
Joakim Hove
9fb229ccd7 Replaced references to logger with OpmLog::addMessage() 2015-03-04 22:14:31 +01:00
Joakim Hove
3a60605d99 Removed most of the functionality from CounterLog 2015-03-04 22:12:53 +01:00
Joakim Hove
25bff6480d Renamed MessageCounter -> CounterLog 2015-03-04 22:12:52 +01:00
Joakim Hove
e6c6209991 Added StreamLog backend. 2015-03-04 22:09:57 +01:00
Joakim Hove
245b91d0c2 Introduced LogUtil file + Logger class
- The new LogUtil.cpp / LogUtil.hpp files contain the enum definitions
  for MessageType and formatting functions.

- The Logger class is meant to be the instance which is held by the
  static OpmLog singleton class.
2015-03-04 22:09:55 +01:00
Joakim Hove
d3277543ec Renamed existing Logger -> MessageCounter 2015-03-04 22:09:54 +01:00
Joakim Hove
738fb0c05c Moved MessageType enum to OpmLog 2015-03-04 22:07:04 +01:00
Joakim Hove
ecac5fc691 Added DeckItem::hasValue() method 2015-01-02 16:53:25 +01:00
Joakim Hove
cf97b3bbe6 Revert "Revert "make the parsing stage pass even if non-defaultable items have been defaulted""
This reverts commit 13d31809e8ca7b9f283bf29a0871110071263449.
2015-01-02 16:51:15 +01:00
Andreas Lauser
e0706524e0 Revert "make the parsing stage pass even if non-defaultable items have been defaulted"
This reverts commit 5ce5a3539641ac6eac9362d9c2b8a09084f9c35b.
2014-12-19 19:02:53 +01:00
Andreas Lauser
231cf39d47 make the parsing stage pass even if non-defaultable items have been defaulted
... but throw later when trying to access the data of the item in
question.

Note that this was demanded by [at] joakim-hove and that I do not want
to be held responsible for any issues which are caused by this
approach. (read: please direct your barks to Joakim if you fell on
your nose because of this...)
2014-12-18 11:43:52 +01:00
Andreas Lauser
0262b333fd make items which do not have a default un-defaultable
this was a much more common problem than it seemed initially...
2014-12-18 11:43:52 +01:00
Joakim Hove
b585655a5c Changes in the log class:
1. Moved to from eclipse/Parser -> eclipse/Log
 2. Renamed ParserLog -> OpmLog
2014-12-15 17:36:10 +01:00
Joakim Hove
b924f6cd02 DeckKeyword is immutable. 2014-12-09 11:56:05 +01:00
Joakim Hove
081b87b5b4 Removed m_deckIndex property from DeckKeyword 2014-12-09 11:56:05 +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
b1de0bf338 unit system: add temperature
this requires the possibility of specifying an offset for the SI
conversion because Eclipse in its eternal wisdom chooses to specify
temperatures using degrees Celsius and degrees Fahrenheit instead of
using Kelvin an Rankine...
2014-12-03 16:56:25 +01:00
Andreas Lauser
ee9b7d2cae Extend deck grooming functions to detect keywords which are in invalid sections 2014-10-13 16:06:09 +02:00
Andreas Lauser
d94097617b ParserKeyword: add the glue code so that it knows its sections 2014-10-13 16:05:59 +02:00
Andreas Lauser
ff90fe71c0 replace the deck-internal logging system by ParserLog 2014-10-07 15:39:14 +02:00
Andreas Lauser
6736213bae Section::checkSectionTopology(): report more than the first error
i.e. don't return uppon encountering an error, just set a flag.
2014-10-07 14:22:56 +02:00
Andreas Lauser
f76113f2b1 DeckKeyword: retain the ParserKeyword object
this is useful because DeckKeywords can have almost arbitrary names
(which match a regular expression) which makes it hard to retrieve
additional information about the keyword after it has been created...
2014-10-07 14:22:47 +02:00
Andreas Lauser
38797ea534 DeckKeyword: retain the location of keywords
this is useful for log messages.
2014-10-07 14:22:47 +02:00
Andreas Lauser
ef6e76562b Deck: mark numKeywords() and getKeywordList() as const
this was probably an oversight...
2014-09-19 12:07:05 +02:00
Andreas Lauser
6dbe6ae5ac remove the "value status" concept from deck items
I know it was only added recently, but all of the "setInDeck()" calls
can now be substituted by a combination of item->size() and
item->defaultApplied(index)...
2014-09-15 12:17:04 +02:00
Andreas Lauser
539c7a23ae make the defaults of an item settable per data point
instead of for the whole item...
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
544b6db1c0 Default: Added method hasValue() 2014-09-03 10:37:02 +02:00
Joakim Hove
aa36738f04 Default: DeckItem will throw if you ask for missing data 2014-09-03 10:37:01 +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
Joakim Hove
be0558607c Default: Changed defaultApplied bool to enum
We now have an enum which can keep track of three possible states for
the data in a deck item:

  VALID   : A valid value has been set
  DEFAULT : The default value has been applied
  NOT_SET : The value has not been set.

The intention is to throw if/when a DeckItem with status == NOT_SET is
accessed.
2014-09-03 10:37:00 +02:00
Atgeirr Flø Rasmussen
5300f75c05 Fix the NullStream class.
It is the std::streambuf that should be inherited from.
The NullStream class is just a convenience class.
2014-08-22 19:46:02 +02:00
Andreas Lauser
166cd965e9 considerably extend the unit test for sections
for this, an Section::isDeckValid() method is introduced which checks
that a given deck is valid when it comes to the sections
(i.e. presence of mandatory sections and section ordering)
2014-08-22 17:26:01 +02:00
Andreas Lauser
3566b99b85 relax strictness of the section handling and fix/work around a few bugs
We now do not require the sections to be correctly ordered and the
presence of the mandatory sections since even the unit tests did not
always specify all mandatory sections, which lead to a section
containing the rest of the deck if one of the expected next sections
was not specified.

also it seems like the DeckKeyword::getDeckIndex() does not correctly
work in some situations which lead

assert(deck->getKeyword(i)->name() == startKeyword);

to fail in the Section::populateKeywords() method. now the deck is
always sequentially traversed to find the position of a section's
start keyword. (This is necessary anyway if one wants to make sure
that the deck does not specify the same section more than once, a
feature which this patch also adds.)
2014-08-22 17:25:44 +02:00
Joakim Hove
29df8e9f89 Added count() method to Section class 2014-07-08 17:16:02 +02:00
Joakim Hove
7269924543 Added name() property to section objects. 2014-06-03 22:42:23 +02:00
Joakim Hove
22ed38b319 Added iterators begin() and end() to DeckKeyword class. 2014-06-03 22:42:23 +02:00
Arne Morten Kvarving
463eae9b07 fixed: don't mix member names and function parameters 2014-05-19 13:15:09 +02:00
Joakim Hove
2786b5e87b Added isDataKeyword() property to deckKeyword. 2014-05-16 15:29:54 +02:00
Joakim Hove
30fe203932 Utility functions to check if deck has sections. 2014-05-16 13:10:20 +02:00
Arne Morten Kvarving
670e8b692b changed: don't use parameter names that conflicts with member function names
quells warnings (with gcc 4.8)
2014-05-15 14:46:16 +02:00
Joakim Hove
4672e386f0 Added getDataSize() method to DeckKeyword. 2014-04-27 23:51:43 +02:00
Atgeirr Flø Rasmussen
b0d93977b9 Comment out unused function argument. 2014-04-15 09:26:04 +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
Joakim Hove
3087f33fd8 Merge pull request #155 from andlaus/schedule_trim_names
schedule: do not let us be disturbed by leading or trailing white space in names
2014-04-03 20:22:10 +02:00