#7116 Add extrapolation for missing elastic properties.

Also improve error message.
This commit is contained in:
Kristian Bendiksen
2021-03-05 15:07:07 +01:00
committed by Magne Sjaastad
parent c174bf947c
commit 6481813eeb
3 changed files with 33 additions and 21 deletions

View File

@@ -148,7 +148,8 @@ const std::vector<double>& RigElasticProperties::getVector( RiaDefines::CurvePro
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigElasticProperties::getValueForPorosity( RiaDefines::CurveProperty property, double porosity, double scale ) const
std::pair<double, bool>
RigElasticProperties::getValueForPorosity( RiaDefines::CurveProperty property, double porosity, double scale ) const
{
const std::vector<double>& unscaledValues = getVector( property );
std::vector<double> scaledValues;
@@ -157,5 +158,8 @@ double RigElasticProperties::getValueForPorosity( RiaDefines::CurveProperty prop
scaledValues.push_back( unscaled * scale );
}
return RiaInterpolationTools::linear( m_porosity, scaledValues, porosity );
bool isExtrapolated = porosity > porosityMax() || porosity < porosityMin();
double value =
RiaInterpolationTools::linear( m_porosity, scaledValues, porosity, RiaInterpolationTools::ExtrapolationMode::CLOSEST );
return std::make_pair( value, isExtrapolated );
}