mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#9023 Performance : Temporary fix for axis range aggregation
This commit is contained in:
parent
d36bf11c62
commit
47fb8957c1
@ -948,6 +948,49 @@ RiaSummaryAddressAnalyzer* RimSummaryCaseCollection::addressAnalyzer()
|
||||
return m_analyzer.get();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCaseCollection::computeMinMax( const RifEclipseSummaryAddress& address )
|
||||
{
|
||||
if ( m_minMaxValues.count( address ) > 0 ) return;
|
||||
|
||||
double minimumValue( std::numeric_limits<double>::infinity() );
|
||||
double maximumValue( -std::numeric_limits<double>::infinity() );
|
||||
|
||||
std::vector<double> values;
|
||||
for ( auto s : m_cases() )
|
||||
{
|
||||
if ( !s->summaryReader() ) continue;
|
||||
|
||||
s->summaryReader()->values( address, &values );
|
||||
const auto [min, max] = std::minmax_element( begin( values ), end( values ) );
|
||||
|
||||
minimumValue = std::min( *min, minimumValue );
|
||||
maximumValue = std::max( *max, maximumValue );
|
||||
}
|
||||
|
||||
setMinMax( address, minimumValue, maximumValue );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCaseCollection::setMinMax( const RifEclipseSummaryAddress& address, double min, double max )
|
||||
{
|
||||
m_minMaxValues[address] = std::pair( min, max );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<double, double> RimSummaryCaseCollection::minMax( const RifEclipseSummaryAddress& address )
|
||||
{
|
||||
computeMinMax( address );
|
||||
|
||||
return m_minMaxValues[address];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -114,6 +114,10 @@ public:
|
||||
|
||||
RiaSummaryAddressAnalyzer* addressAnalyzer();
|
||||
|
||||
void computeMinMax( const RifEclipseSummaryAddress& address );
|
||||
void setMinMax( const RifEclipseSummaryAddress& address, double min, double max );
|
||||
std::pair<double, double> minMax( const RifEclipseSummaryAddress& address );
|
||||
|
||||
private:
|
||||
RigEnsembleParameter createEnsembleParameter( const QString& paramName ) const;
|
||||
static void sortByBinnedVariation( std::vector<RigEnsembleParameter>& parameterVector );
|
||||
@ -152,4 +156,6 @@ private:
|
||||
|
||||
mutable std::vector<RigEnsembleParameter> m_cachedSortedEnsembleParameters;
|
||||
std::unique_ptr<RiaSummaryAddressAnalyzer> m_analyzer;
|
||||
|
||||
std::map<RifEclipseSummaryAddress, std::pair<double, double>> m_minMaxValues;
|
||||
};
|
||||
|
@ -1007,7 +1007,27 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
|
||||
{
|
||||
if ( curveSet->axisY() == axis->plotAxisType() )
|
||||
{
|
||||
auto [minimum, maximum] = curveSet->minimumAndMaximumValues();
|
||||
double minimum( std::numeric_limits<double>::infinity() );
|
||||
double maximum( -std::numeric_limits<double>::infinity() );
|
||||
|
||||
auto curves = curveSet->curves();
|
||||
if ( !curves.empty() )
|
||||
{
|
||||
// TODO: Use analyzer as input to addressesForCurve instead of curve
|
||||
|
||||
auto curve = curves.front();
|
||||
|
||||
std::vector<RifEclipseSummaryAddress> addresses =
|
||||
addressesForCurve( curve, m_axisRangeAggregation() );
|
||||
|
||||
for ( auto adr : addresses )
|
||||
{
|
||||
auto [min, max] = curveSet->summaryCaseCollection()->minMax( adr );
|
||||
|
||||
minimum = std::min( min, minimum );
|
||||
maximum = std::max( max, maximum );
|
||||
}
|
||||
}
|
||||
|
||||
if ( axisRanges.count( axis->plotAxisType() ) == 0 )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user