diff --git a/opm/input/eclipse/EclipseState/Tables/SimpleTable.hpp b/opm/input/eclipse/EclipseState/Tables/SimpleTable.hpp index bdb444d87..c9c5c14e6 100644 --- a/opm/input/eclipse/EclipseState/Tables/SimpleTable.hpp +++ b/opm/input/eclipse/EclipseState/Tables/SimpleTable.hpp @@ -42,8 +42,10 @@ namespace Opm { static SimpleTable serializeObject(); void addColumns(); - void init(const DeckItem& deckItem ); - void init( const DeckItem& deckItem, double scaling_factor); + //! \brief Initialize deck item. + //! \param deckItem item to initialize + //! \param scaling_factor If zero use SI value, else use value scaled by scaling factor + void init( const DeckItem& deckItem, double scaling_factor = 0.0); size_t numColumns() const; size_t numRows() const; void addRow( const std::vector& row); diff --git a/src/opm/input/eclipse/EclipseState/Tables/SimpleTable.cpp b/src/opm/input/eclipse/EclipseState/Tables/SimpleTable.cpp index 1f4e77a20..a1922c9ac 100644 --- a/src/opm/input/eclipse/EclipseState/Tables/SimpleTable.cpp +++ b/src/opm/input/eclipse/EclipseState/Tables/SimpleTable.cpp @@ -82,31 +82,6 @@ namespace Opm { return col[row]; } - void SimpleTable::init( const DeckItem& deckItem ) { - this->addColumns(); - - if ( (deckItem.data_size() % numColumns()) != 0) - throw std::runtime_error("Number of columns in the data file is" - "inconsistent with the ones specified"); - - size_t rows = deckItem.data_size() / numColumns(); - for (size_t colIdx = 0; colIdx < numColumns(); ++colIdx) { - auto& column = getColumn( colIdx ); - for (size_t rowIdx = 0; rowIdx < rows; rowIdx++) { - size_t deckItemIdx = rowIdx*numColumns() + colIdx; - if (deckItem.defaultApplied(deckItemIdx)) - column.addDefault( ); - else if (m_jfunc) { - column.addValue( deckItem.getData()[deckItemIdx] ); - } - else - column.addValue( deckItem.getSIDouble(deckItemIdx) ); - } - if (colIdx > 0) - column.applyDefaults(getColumn( 0 )); - } - } - void SimpleTable::init( const DeckItem& deckItem, double scaling_factor) { this->addColumns(); @@ -124,8 +99,12 @@ namespace Opm { else if (m_jfunc) { column.addValue( deckItem.getData()[deckItemIdx] ); } - else - column.addValue( scaling_factor * deckItem.get(deckItemIdx) ); + else { + if (scaling_factor > 0.0) + column.addValue( scaling_factor * deckItem.get(deckItemIdx) ); + else + column.addValue( deckItem.getSIDouble(deckItemIdx) ); + } } if (colIdx > 0) column.applyDefaults(getColumn( 0 ));