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.
This commit is contained in:
Joakim Hove
2014-08-25 11:20:54 +02:00
parent cebf991210
commit 61cdf7d402
18 changed files with 191 additions and 121 deletions

View File

@@ -99,7 +99,7 @@ size_t MultiRecordTable::getNumFlatItems_(Opm::DeckRecordConstPtr deckRecord)
int result = 0;
for (unsigned i = 0; i < deckRecord->size(); ++ i) {
Opm::DeckItemConstPtr item(deckRecord->getItem(i));
if (i == 0 && item->defaultApplied())
if (i == 0 && !item->setInDeck())
return result;
result += item->size();
}