mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
#4788 Ensemble RFT: fix missing statistics curves by having better bounds calculation for the curves.
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
#include <algorithm>
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -51,7 +50,6 @@ bool XValueComparator<XValueType>::equals(const XValueType& lhs, const XValueTyp
|
||||
return lhs == rhs;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -155,7 +153,9 @@ void RiaCurveMerger<XValueType>::computeInterpolatedValues(bool includeValuesFro
|
||||
|
||||
for ( size_t valueIndex = 0; valueIndex < dataValueCount; valueIndex++ )
|
||||
{
|
||||
double interpolValue = interpolatedYValue(m_allXValues[valueIndex], m_originalValues[curveIdx].first, m_originalValues[curveIdx].second);
|
||||
double interpolValue = interpolatedYValue( m_allXValues[valueIndex],
|
||||
m_originalValues[curveIdx].first,
|
||||
m_originalValues[curveIdx].second );
|
||||
if ( !RiaCurveDataTools::isValidValue( interpolValue, false ) )
|
||||
{
|
||||
accumulatedValidValues[valueIndex] = HUGE_VAL;
|
||||
@@ -178,12 +178,15 @@ void RiaCurveMerger<XValueType>::computeUnionOfXValues(bool includeValuesForPart
|
||||
|
||||
std::set<XValueType, XComparator> unionOfXValues;
|
||||
|
||||
std::vector<std::pair<XValueType, XValueType>> originalXBounds;
|
||||
for ( const auto& curveData : m_originalValues )
|
||||
{
|
||||
for ( const auto& x : curveData.first )
|
||||
{
|
||||
unionOfXValues.insert( x );
|
||||
}
|
||||
auto minmax_it = std::minmax_element( curveData.first.begin(), curveData.first.end() );
|
||||
originalXBounds.push_back( std::make_pair( *( minmax_it.first ), *( minmax_it.second ) ) );
|
||||
}
|
||||
|
||||
if ( !includeValuesForPartialCurves )
|
||||
@@ -191,11 +194,9 @@ void RiaCurveMerger<XValueType>::computeUnionOfXValues(bool includeValuesForPart
|
||||
for ( auto it = unionOfXValues.begin(); it != unionOfXValues.end(); )
|
||||
{
|
||||
bool outsideBounds = false;
|
||||
for (const auto& curveData : m_originalValues)
|
||||
for ( const auto& curveXBounds : originalXBounds )
|
||||
{
|
||||
if (curveData.first.empty()) continue;
|
||||
|
||||
if (*it < curveData.first.front() || *it > curveData.first.back())
|
||||
if ( *it < curveXBounds.first || *it > curveXBounds.second )
|
||||
{
|
||||
outsideBounds = true;
|
||||
break;
|
||||
@@ -283,4 +284,3 @@ double RiaCurveMerger<XValueType>::interpolatedYValue(const XValueType&
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user