diff --git a/src/opm/parser/eclipse/EclipseState/Tables/TableColumn.cpp b/src/opm/parser/eclipse/EclipseState/Tables/TableColumn.cpp
index 1eab5127b..bd637dea0 100644
--- a/src/opm/parser/eclipse/EclipseState/Tables/TableColumn.cpp
+++ b/src/opm/parser/eclipse/EclipseState/Tables/TableColumn.cpp
@@ -16,14 +16,14 @@
You should have received a copy of the GNU General Public License
along with OPM. If not, see .
*/
+
+#include
#include
#include
#include
#include
-#include
-
namespace Opm {
TableColumn::TableColumn(const ColumnSchema& schema) :
@@ -271,33 +271,37 @@ namespace Opm {
for (size_t rowIdx = 0; rowIdx < size(); ++rowIdx) {
if (defaultApplied( rowIdx )) {
// find first row which was not defaulted before the current one
- ssize_t rowBeforeIdx = rowIdx;
+ int rowBeforeIdx = static_cast(rowIdx);
for (; rowBeforeIdx >= 0; -- rowBeforeIdx)
if (!defaultApplied(rowBeforeIdx))
break;
// find first row which was not defaulted after the current one
- ssize_t rowAfterIdx = rowIdx;
- for (; rowAfterIdx < static_cast(size()); ++ rowAfterIdx)
+ int rowAfterIdx = static_cast(rowIdx);
+ for (; rowAfterIdx < static_cast(size()); ++ rowAfterIdx)
if (!defaultApplied(rowAfterIdx))
break;
// switch to extrapolation by a constant at the fringes
- if (rowBeforeIdx < 0 && rowAfterIdx >= static_cast(size()))
+ if (rowBeforeIdx < 0 && rowAfterIdx >= static_cast(size()))
throw std::invalid_argument("Column " + m_schema.name() + " can't be fully defaulted");
else if (rowBeforeIdx < 0)
rowBeforeIdx = rowAfterIdx;
- else if (rowAfterIdx >= static_cast(size()))
+ else if (rowAfterIdx >= static_cast(size()))
rowAfterIdx = rowBeforeIdx;
{
+ const size_t before = static_cast(rowBeforeIdx);
+ const size_t after = static_cast(rowAfterIdx);
+
// linear interpolation
double alpha = 0.0;
if (rowBeforeIdx != rowAfterIdx)
- alpha = (argColumn[rowIdx] - argColumn[rowBeforeIdx]) / (argColumn[rowAfterIdx] - argColumn[rowBeforeIdx]);
+ alpha = (argColumn[rowIdx] - argColumn[before])
+ / (argColumn[after] - argColumn[before]);
- double value = m_values[rowBeforeIdx]*(1-alpha) + m_values[rowAfterIdx]*alpha;
+ double value = m_values[before]*(1-alpha) + m_values[after]*alpha;
updateValue( rowIdx , value );
}