Table interpolation for default values improved.

If there were no non-defaulted elements in the table, we would crash.
Now, all defaulted elements get the value 0.0 instead.

The usage pattern was encountered for the capillary pressure column
of a SWOF table.
This commit is contained in:
Atgeirr Flø Rasmussen 2012-10-10 14:13:13 +02:00
parent 0243aebcfa
commit 2ded7e7dfe

View File

@ -398,10 +398,17 @@ namespace
yv.push_back(table[k][i]);
}
}
// Interpolate
for (int i=0; i<int(indx.size()); ++i) {
table[k][indx[i]] = linearInterpolationExtrap(xv, yv, x[i]);
}
if (xv.empty()) {
// Nothing specified, insert zeros.
for (int i=0; i<int(indx.size()); ++i) {
table[k][indx[i]] = 0.0;
}
} else {
// Interpolate
for (int i=0; i<int(indx.size()); ++i) {
table[k][indx[i]] = linearInterpolationExtrap(xv, yv, x[i]);
}
}
}
}
}