mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 06:38:13 -05:00
#12495 Refactors ensemble statistics handling
Removes the dedicated `SUMMARY_ENSEMBLE_STATISTICS` category and instead uses a `statisticsType` field within `RifEclipseSummaryAddress` to represent ensemble statistics. This change simplifies the code and avoids potential confusion by representing statistics as attributes of existing summary types, rather than a separate category. It also improves code robustness.
This commit is contained in:
1 parent
84f9ad0dcd
commit
dc4cd33c6e
19 files changed
+165
-157
No files matched your search
@@ -116,8 +116,6 @@ caf::PdmOptionItemInfo RiaOptionItemFactory::optionItemFromSummaryType( RifEclip
|
||||
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_IMPORTED:
|
||||
iconText = ":/summary/components/images/others.svg";
|
||||
break;
|
||||
case RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS:
|
||||
break;
|
||||
}
|
||||
|
||||
if ( iconText.isEmpty() )
|
||||
|
||||
@@ -239,6 +239,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode( const ecl::smspec_node& ertSu
|
||||
}
|
||||
|
||||
return RifEclipseSummaryAddress( sumCategory,
|
||||
RifEclipseSummaryAddressDefines::StatisticsType::NONE,
|
||||
quantityName,
|
||||
regionNumber,
|
||||
regionNumber2,
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress::RifEclipseSummaryAddress( SummaryCategory category, std::map<SummaryIdentifierType, std::string>& identifiers )
|
||||
: m_category( category )
|
||||
, m_statisticsType( StatisticsType::NONE )
|
||||
, m_number0( -1 )
|
||||
, m_number1( -1 )
|
||||
, m_number2( -1 )
|
||||
@@ -101,6 +102,7 @@ RifEclipseSummaryAddress::RifEclipseSummaryAddress( SummaryCategory category, st
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress::RifEclipseSummaryAddress( SummaryCategory category,
|
||||
StatisticsType statisticsType,
|
||||
const std::string& vectorName,
|
||||
int regionNumber,
|
||||
int regionNumber2,
|
||||
@@ -117,6 +119,7 @@ RifEclipseSummaryAddress::RifEclipseSummaryAddress( SummaryCategory category,
|
||||
bool isErrorResult,
|
||||
int id )
|
||||
: m_category( category )
|
||||
, m_statisticsType( statisticsType )
|
||||
, m_vectorName( vectorName )
|
||||
, m_lgrName( lgrName )
|
||||
, m_number0( -1 )
|
||||
@@ -178,7 +181,8 @@ RifEclipseSummaryAddress::RifEclipseSummaryAddress( SummaryCategory category,
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress::RifEclipseSummaryAddress()
|
||||
: m_category( RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_INVALID )
|
||||
: m_category( SummaryCategory::SUMMARY_INVALID )
|
||||
, m_statisticsType( StatisticsType::NONE )
|
||||
, m_number0( -1 )
|
||||
, m_number1( -1 )
|
||||
, m_number2( -1 )
|
||||
@@ -460,17 +464,6 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::importedAddress( const std::s
|
||||
return addr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RifEclipseSummaryAddress::ensembleStatisticsAddress( const std::string& vectorName, const std::string& dataQuantityName )
|
||||
{
|
||||
RifEclipseSummaryAddress addr;
|
||||
addr.m_category = SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS;
|
||||
addr.m_vectorName = vectorName + ":" + dataQuantityName;
|
||||
return addr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -517,7 +510,7 @@ bool RifEclipseSummaryAddress::isDependentOnWellName( SummaryCategory category )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddressDefines::SummaryCategory RifEclipseSummaryAddress::category() const
|
||||
SummaryCategory RifEclipseSummaryAddress::category() const
|
||||
{
|
||||
return m_category;
|
||||
}
|
||||
@@ -647,15 +640,6 @@ int RifEclipseSummaryAddress::id() const
|
||||
return m_id;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RifEclipseSummaryAddress::ensembleStatisticsVectorName() const
|
||||
{
|
||||
QString qName = QString::fromStdString( m_vectorName );
|
||||
return qName.split( ":" )[0].toStdString();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -673,6 +657,12 @@ std::string RifEclipseSummaryAddress::uiText() const
|
||||
text += ":" + itemText;
|
||||
}
|
||||
|
||||
if ( isStatistics() )
|
||||
{
|
||||
auto prefix = RifEclipseSummaryAddressDefines::statisticsTypeToString( statisticsType() );
|
||||
text = prefix + ":" + text;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
@@ -783,7 +773,7 @@ std::string RifEclipseSummaryAddress::toEclipseTextAddress() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Returns the stringified address component requested
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RifEclipseSummaryAddress::addressComponentUiText( RifEclipseSummaryAddressDefines::SummaryIdentifierType identifierType ) const
|
||||
std::string RifEclipseSummaryAddress::addressComponentUiText( SummaryIdentifierType identifierType ) const
|
||||
{
|
||||
switch ( identifierType )
|
||||
{
|
||||
@@ -1034,14 +1024,7 @@ bool RifEclipseSummaryAddress::hasAccumulatedData() const
|
||||
{
|
||||
if ( !isValidEclipseCategory() ) return false;
|
||||
|
||||
QString quantityForInspection = QString::fromStdString( vectorName() );
|
||||
if ( category() == SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS )
|
||||
{
|
||||
// Remove statistics text prefix
|
||||
quantityForInspection = quantityForInspection.mid( quantityForInspection.indexOf( ":" ) + 1 );
|
||||
}
|
||||
|
||||
QString qBaseName = QString::fromStdString( baseVectorName( quantityForInspection.toStdString() ) );
|
||||
QString qBaseName = QString::fromStdString( baseVectorName( vectorName() ) );
|
||||
|
||||
if ( RiaTextStringTools::isTextEqual( qBaseName, QString( "TCPU" ) ) ) return true;
|
||||
if ( RiaTextStringTools::isTextEqual( qBaseName, QString( "ELAPSED" ) ) ) return true;
|
||||
@@ -1264,7 +1247,6 @@ bool RifEclipseSummaryAddress::isValidEclipseCategory() const
|
||||
case SummaryCategory::SUMMARY_WELL_SEGMENT:
|
||||
case SummaryCategory::SUMMARY_BLOCK:
|
||||
case SummaryCategory::SUMMARY_BLOCK_LGR:
|
||||
case SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -1341,6 +1323,30 @@ std::pair<int, int> RifEclipseSummaryAddress::regionToRegionPairFromUiText( cons
|
||||
RiaStdStringTools::toInt16( r2r[1].trimmed().toStdString() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifEclipseSummaryAddress::isStatistics() const
|
||||
{
|
||||
return m_statisticsType != StatisticsType::NONE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
StatisticsType RifEclipseSummaryAddress::statisticsType() const
|
||||
{
|
||||
return m_statisticsType;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseSummaryAddress::setStatisticsType( StatisticsType type )
|
||||
{
|
||||
m_statisticsType = type;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
RifEclipseSummaryAddress();
|
||||
|
||||
RifEclipseSummaryAddress( SummaryCategory category,
|
||||
StatisticsType statisticsType,
|
||||
const std::string& vectorName,
|
||||
int regionNumber,
|
||||
int regionNumber2,
|
||||
@@ -90,7 +91,6 @@ public:
|
||||
static RifEclipseSummaryAddress
|
||||
blockLgrAddress( const std::string& vectorName, const std::string& lgrName, int i, int j, int k, int calculationId = -1 );
|
||||
static RifEclipseSummaryAddress importedAddress( const std::string& vectorName, int calculationId = -1 );
|
||||
static RifEclipseSummaryAddress ensembleStatisticsAddress( const std::string& vectorName, const std::string& datavectorName );
|
||||
|
||||
// Special address when time is used as x-axis
|
||||
static RifEclipseSummaryAddress timeAddress();
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
static std::string generateStringFromAddresses( const std::vector<RifEclipseSummaryAddress>& addressVector,
|
||||
const std::string jointString = "; " );
|
||||
|
||||
static bool isDependentOnWellName( RifEclipseSummaryAddressDefines::SummaryCategory category );
|
||||
static bool isDependentOnWellName( SummaryCategory category );
|
||||
|
||||
// Access methods
|
||||
|
||||
@@ -106,6 +106,10 @@ public:
|
||||
std::string vectorName() const;
|
||||
bool isHistoryVector() const;
|
||||
|
||||
bool isStatistics() const;
|
||||
StatisticsType statisticsType() const;
|
||||
void setStatisticsType( StatisticsType type );
|
||||
|
||||
int regionNumber() const;
|
||||
int regionNumber2() const;
|
||||
|
||||
@@ -123,8 +127,6 @@ public:
|
||||
std::string blockAsString() const;
|
||||
std::string connectionAsString() const;
|
||||
|
||||
std::string ensembleStatisticsVectorName() const;
|
||||
|
||||
std::string toEclipseTextAddress() const;
|
||||
|
||||
// Derived properties
|
||||
@@ -176,6 +178,7 @@ private:
|
||||
// evaluated first. This concept is used by <=> operator.
|
||||
|
||||
SummaryCategory m_category;
|
||||
StatisticsType m_statisticsType;
|
||||
std::string m_vectorName;
|
||||
std::string m_name;
|
||||
std::string m_lgrName;
|
||||
|
||||
@@ -43,37 +43,6 @@ void caf::AppEnum<RifEclipseSummaryAddressDefines::CurveType>::setUp()
|
||||
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RifEclipseSummaryAddressDefines::statisticsNameP10()
|
||||
{
|
||||
return statisticsTypeToString( StatisticsType::P10 );
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RifEclipseSummaryAddressDefines::statisticsNameP50()
|
||||
{
|
||||
return statisticsTypeToString( StatisticsType::P50 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RifEclipseSummaryAddressDefines::statisticsNameP90()
|
||||
{
|
||||
return statisticsTypeToString( StatisticsType::P90 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RifEclipseSummaryAddressDefines::statisticsNameMean()
|
||||
{
|
||||
return statisticsTypeToString( StatisticsType::MEAN );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -46,7 +46,6 @@ enum class SummaryCategory
|
||||
SUMMARY_BLOCK,
|
||||
SUMMARY_BLOCK_LGR,
|
||||
SUMMARY_IMPORTED,
|
||||
SUMMARY_ENSEMBLE_STATISTICS,
|
||||
SUMMARY_TIME // Used to represent time as along the x-axis
|
||||
};
|
||||
|
||||
@@ -81,10 +80,6 @@ enum class CurveType
|
||||
RATE
|
||||
};
|
||||
|
||||
std::string statisticsNameP10();
|
||||
std::string statisticsNameP50();
|
||||
std::string statisticsNameP90();
|
||||
std::string statisticsNameMean();
|
||||
std::string statisticsTypeToString( StatisticsType type );
|
||||
|
||||
std::string differenceIdentifier();
|
||||
|
||||
@@ -291,6 +291,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con
|
||||
}
|
||||
|
||||
return RifEclipseSummaryAddress( category,
|
||||
RifEclipseSummaryAddressDefines::StatisticsType::NONE,
|
||||
quantityName,
|
||||
regionNumber,
|
||||
regionNumber2,
|
||||
|
||||
@@ -166,6 +166,7 @@ RifEclipseSummaryAddress RifReaderObservedData::address( const QString&
|
||||
}
|
||||
|
||||
return RifEclipseSummaryAddress( summaryCategory,
|
||||
RifEclipseSummaryAddressDefines::StatisticsType::NONE,
|
||||
stdVectorName,
|
||||
regionNumber,
|
||||
regionNumber2,
|
||||
|
||||
+13
-10
@@ -49,16 +49,19 @@ std::pair<bool, std::vector<double>> RimEnsembleCrossPlotStatisticsCase::values(
|
||||
}
|
||||
}
|
||||
|
||||
auto quantityName = resultAddress.ensembleStatisticsVectorName();
|
||||
|
||||
if ( quantityName == RifEclipseSummaryAddressDefines::statisticsNameP10() )
|
||||
return { true, m_p10Data };
|
||||
else if ( quantityName == RifEclipseSummaryAddressDefines::statisticsNameP50() )
|
||||
return { true, m_p50Data };
|
||||
else if ( quantityName == RifEclipseSummaryAddressDefines::statisticsNameP90() )
|
||||
return { true, m_p90Data };
|
||||
else if ( quantityName == RifEclipseSummaryAddressDefines::statisticsNameMean() )
|
||||
return { true, m_meanData };
|
||||
switch ( resultAddress.statisticsType() )
|
||||
{
|
||||
case RifEclipseSummaryAddressDefines::StatisticsType::P10:
|
||||
return { true, m_p10Data };
|
||||
case RifEclipseSummaryAddressDefines::StatisticsType::P50:
|
||||
return { true, m_p50Data };
|
||||
case RifEclipseSummaryAddressDefines::StatisticsType::P90:
|
||||
return { true, m_p90Data };
|
||||
case RifEclipseSummaryAddressDefines::StatisticsType::MEAN:
|
||||
return { true, m_meanData };
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return { true, {} };
|
||||
}
|
||||
|
||||
@@ -717,8 +717,7 @@ void RimEnsembleCurveSet::deleteEnsembleCurves()
|
||||
for ( size_t c = 0; c < m_curves.size(); c++ )
|
||||
{
|
||||
RimSummaryCurve* curve = m_curves[c];
|
||||
if ( curve->summaryAddressY().category() != RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS )
|
||||
curvesIndexesToDelete.push_back( c );
|
||||
if ( !curve->summaryAddressY().isStatistics() ) curvesIndexesToDelete.push_back( c );
|
||||
}
|
||||
|
||||
while ( !curvesIndexesToDelete.empty() )
|
||||
@@ -739,8 +738,7 @@ void RimEnsembleCurveSet::deleteStatisticsCurves()
|
||||
for ( size_t c = 0; c < m_curves.size(); c++ )
|
||||
{
|
||||
RimSummaryCurve* curve = m_curves[c];
|
||||
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS )
|
||||
curvesIndexesToDelete.push_back( c );
|
||||
if ( curve->summaryAddressY().isStatistics() ) curvesIndexesToDelete.push_back( c );
|
||||
}
|
||||
|
||||
while ( !curvesIndexesToDelete.empty() )
|
||||
@@ -2079,8 +2077,7 @@ void RimEnsembleCurveSet::updateCurveColors()
|
||||
std::vector<RimSummaryCase*> summaryCases;
|
||||
for ( auto& curve : m_curves )
|
||||
{
|
||||
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS )
|
||||
continue;
|
||||
if ( curve->summaryAddressY().isStatistics() ) continue;
|
||||
|
||||
curvesToColor.push_back( curve );
|
||||
summaryCases.push_back( curve->summaryCaseY() );
|
||||
@@ -2261,8 +2258,6 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vector<RimSummaryCase
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSet::updateStatisticsCurves( const std::vector<RimSummaryCase*>& sumCases )
|
||||
{
|
||||
using SAddr = RifEclipseSummaryAddress;
|
||||
|
||||
RimSummaryEnsemble* group = m_yValuesSummaryEnsemble();
|
||||
RimSummaryAddress* addr = m_yValuesSummaryAddress();
|
||||
|
||||
@@ -2303,45 +2298,49 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vector<RimSummaryCa
|
||||
RifEclipseSummaryAddress dataAddressY = m_yValuesSummaryAddress->address();
|
||||
RifEclipseSummaryAddress dataAddressX = m_xAddressSelector->summaryAddress();
|
||||
|
||||
auto getStatisticsAddress = []( const std::string& statisticsVectorName,
|
||||
const RifEclipseSummaryAddress& addrX,
|
||||
const RifEclipseSummaryAddress& addrY ) -> RiaSummaryCurveAddress
|
||||
auto getStatisticsAddress = []( RifEclipseSummaryAddressDefines::StatisticsType statisticsType,
|
||||
const RifEclipseSummaryAddress& addrX,
|
||||
const RifEclipseSummaryAddress& addrY ) -> RiaSummaryCurveAddress
|
||||
{
|
||||
auto xStatAddress = SAddr::ensembleStatisticsAddress( statisticsVectorName, addrX.toEclipseTextAddress() );
|
||||
auto yStatAddress = SAddr::ensembleStatisticsAddress( statisticsVectorName, addrY.toEclipseTextAddress() );
|
||||
auto xStatAddress = addrX;
|
||||
xStatAddress.setStatisticsType( statisticsType );
|
||||
auto yStatAddress = addrY;
|
||||
yStatAddress.setStatisticsType( statisticsType );
|
||||
|
||||
return RiaSummaryCurveAddress( xStatAddress, yStatAddress );
|
||||
};
|
||||
|
||||
if ( m_statistics->showP10Curve() && m_ensembleStatCaseXY->hasP10Data() )
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::statisticsNameP10(), dataAddressX, dataAddressY ) );
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::StatisticsType::P10, dataAddressX, dataAddressY ) );
|
||||
if ( m_statistics->showP50Curve() && m_ensembleStatCaseXY->hasP50Data() )
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::statisticsNameP50(), dataAddressX, dataAddressY ) );
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::StatisticsType::P50, dataAddressX, dataAddressY ) );
|
||||
if ( m_statistics->showP90Curve() && m_ensembleStatCaseXY->hasP90Data() )
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::statisticsNameP90(), dataAddressX, dataAddressY ) );
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::StatisticsType::P90, dataAddressX, dataAddressY ) );
|
||||
if ( m_statistics->showMeanCurve() && m_ensembleStatCaseXY->hasMeanData() )
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::statisticsNameMean(), dataAddressX, dataAddressY ) );
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::StatisticsType::MEAN, dataAddressX, dataAddressY ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
RifEclipseSummaryAddress dataAddressY = m_yValuesSummaryAddress->address();
|
||||
|
||||
auto getStatisticsAddress = []( const std::string& statisticsVectorName, const RifEclipseSummaryAddress& addrY ) -> RiaSummaryCurveAddress
|
||||
auto getStatisticsAddress = []( RifEclipseSummaryAddressDefines::StatisticsType statisticsType,
|
||||
const RifEclipseSummaryAddress& addrY ) -> RiaSummaryCurveAddress
|
||||
{
|
||||
auto xStatAddress = RifEclipseSummaryAddress::timeAddress();
|
||||
auto yStatAddress = SAddr::ensembleStatisticsAddress( statisticsVectorName, addrY.toEclipseTextAddress() );
|
||||
auto yStatAddress = addrY;
|
||||
yStatAddress.setStatisticsType( statisticsType );
|
||||
|
||||
return RiaSummaryCurveAddress( xStatAddress, yStatAddress );
|
||||
};
|
||||
|
||||
if ( m_statistics->showP10Curve() && m_ensembleStatCaseY->hasP10Data() )
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::statisticsNameP10(), dataAddressY ) );
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::StatisticsType::P10, dataAddressY ) );
|
||||
if ( m_statistics->showP50Curve() && m_ensembleStatCaseY->hasP50Data() )
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::statisticsNameP50(), dataAddressY ) );
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::StatisticsType::P50, dataAddressY ) );
|
||||
if ( m_statistics->showP90Curve() && m_ensembleStatCaseY->hasP90Data() )
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::statisticsNameP90(), dataAddressY ) );
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::StatisticsType::P90, dataAddressY ) );
|
||||
if ( m_statistics->showMeanCurve() && m_ensembleStatCaseY->hasMeanData() )
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::statisticsNameMean(), dataAddressY ) );
|
||||
addresses.push_back( getStatisticsAddress( RifEclipseSummaryAddressDefines::StatisticsType::MEAN, dataAddressY ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2376,7 +2375,8 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vector<RimSummaryCa
|
||||
|
||||
if ( m_statistics->showCurveLabels() )
|
||||
{
|
||||
curve->setSymbolLabel( QString::fromStdString( address.summaryAddressY().ensembleStatisticsVectorName() ) );
|
||||
curve->setSymbolLabel( QString::fromStdString(
|
||||
RifEclipseSummaryAddressDefines::statisticsTypeToString( address.summaryAddressY().statisticsType() ) ) );
|
||||
}
|
||||
curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID );
|
||||
}
|
||||
@@ -2674,16 +2674,17 @@ void RimEnsembleCurveSet::updateLegendMappingMode()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuPlotCurveSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseSummaryAddress& address )
|
||||
{
|
||||
auto qName = address.vectorName();
|
||||
|
||||
if ( qName.find( RifEclipseSummaryAddressDefines::statisticsNameP10() ) != std::string::npos )
|
||||
return RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE;
|
||||
if ( qName.find( RifEclipseSummaryAddressDefines::statisticsNameP50() ) != std::string::npos )
|
||||
return RiuPlotCurveSymbol::SYMBOL_DIAMOND;
|
||||
if ( qName.find( RifEclipseSummaryAddressDefines::statisticsNameP90() ) != std::string::npos )
|
||||
return RiuPlotCurveSymbol::SYMBOL_TRIANGLE;
|
||||
|
||||
return RiuPlotCurveSymbol::SYMBOL_ELLIPSE;
|
||||
switch ( address.statisticsType() )
|
||||
{
|
||||
case RifEclipseSummaryAddressDefines::StatisticsType::P10:
|
||||
return RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE;
|
||||
case RifEclipseSummaryAddressDefines::StatisticsType::P50:
|
||||
return RiuPlotCurveSymbol::SYMBOL_DIAMOND;
|
||||
case RifEclipseSummaryAddressDefines::StatisticsType::P90:
|
||||
return RiuPlotCurveSymbol::SYMBOL_TRIANGLE;
|
||||
default:
|
||||
return RiuPlotCurveSymbol::SYMBOL_ELLIPSE;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -2691,10 +2692,16 @@ RiuPlotCurveSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifE
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int statisticsCurveSymbolSize( RiuPlotCurveSymbol::PointSymbolEnum symbol )
|
||||
{
|
||||
if ( symbol == RiuPlotCurveSymbol::SYMBOL_DIAMOND ) return 8;
|
||||
if ( symbol == RiuPlotCurveSymbol::SYMBOL_TRIANGLE ) return 7;
|
||||
if ( symbol == RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE ) return 7;
|
||||
return 6;
|
||||
switch ( symbol )
|
||||
{
|
||||
case RiuPlotCurveSymbol::SYMBOL_DIAMOND:
|
||||
return 8;
|
||||
case RiuPlotCurveSymbol::SYMBOL_TRIANGLE:
|
||||
case RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE:
|
||||
return 7;
|
||||
default:
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -72,18 +72,19 @@ bool RimEnsembleStatisticsCase::hasMeanData() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<bool, std::vector<double>> RimEnsembleStatisticsCase::values( const RifEclipseSummaryAddress& resultAddress ) const
|
||||
{
|
||||
auto quantityName = resultAddress.ensembleStatisticsVectorName();
|
||||
|
||||
if ( quantityName == RifEclipseSummaryAddressDefines::statisticsNameP10() )
|
||||
return { true, m_p10Data };
|
||||
else if ( quantityName == RifEclipseSummaryAddressDefines::statisticsNameP50() )
|
||||
return { true, m_p50Data };
|
||||
else if ( quantityName == RifEclipseSummaryAddressDefines::statisticsNameP90() )
|
||||
return { true, m_p90Data };
|
||||
else if ( quantityName == RifEclipseSummaryAddressDefines::statisticsNameMean() )
|
||||
return { true, m_meanData };
|
||||
|
||||
return { true, {} };
|
||||
switch ( resultAddress.statisticsType() )
|
||||
{
|
||||
case RifEclipseSummaryAddressDefines::StatisticsType::P10:
|
||||
return { true, m_p10Data };
|
||||
case RifEclipseSummaryAddressDefines::StatisticsType::P50:
|
||||
return { true, m_p50Data };
|
||||
case RifEclipseSummaryAddressDefines::StatisticsType::P90:
|
||||
return { true, m_p90Data };
|
||||
case RifEclipseSummaryAddressDefines::StatisticsType::MEAN:
|
||||
return { true, m_meanData };
|
||||
default:
|
||||
return { true, {} };
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -46,7 +46,6 @@ void caf::AppEnum<RifEclipseSummaryAddressDefines::SummaryCategory>::setUp()
|
||||
addItem( RifAdr::SUMMARY_BLOCK, "SUMMARY_BLOCK", RiaDefines::summaryBlock() );
|
||||
addItem( RifAdr::SUMMARY_BLOCK_LGR, "SUMMARY_BLOCK_LGR", RiaDefines::summaryLgrBlock() );
|
||||
addItem( RifAdr::SUMMARY_IMPORTED, "SUMMARY_IMPORTED", "Imported" );
|
||||
addItem( RifAdr::SUMMARY_ENSEMBLE_STATISTICS, "SUMMARY_ENSEMBLE_STATISTICS", "Ensemble Statistics" );
|
||||
setDefault( RifAdr::SUMMARY_FIELD );
|
||||
}
|
||||
|
||||
@@ -62,6 +61,7 @@ RimSummaryAddress::RimSummaryAddress()
|
||||
CAF_PDM_InitObject( "SummaryAddress", ":/DataVector.svg", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_category, "SummaryVarType", "Type" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_statistics, "StatisticsType", "StatisticsType" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_vectorName, "SummaryQuantityName", "Vector" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_regionNumber, "SummaryRegion", "Region" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_regionNumber2, "SummaryRegion2", "Region2" );
|
||||
@@ -82,6 +82,7 @@ RimSummaryAddress::RimSummaryAddress()
|
||||
CAF_PDM_InitField( &m_ensembleId, "EnsembleId", -1, "EnsembleId" );
|
||||
|
||||
m_category = RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_INVALID;
|
||||
m_statistics = RifEclipseSummaryAddressDefines::StatisticsType::NONE;
|
||||
m_regionNumber = -1;
|
||||
m_regionNumber2 = -1;
|
||||
m_wellSegmentNumber = -1;
|
||||
@@ -120,6 +121,7 @@ RimSummaryAddress*
|
||||
void RimSummaryAddress::setAddress( const RifEclipseSummaryAddress& addr )
|
||||
{
|
||||
m_category = addr.category();
|
||||
m_statistics = addr.statisticsType();
|
||||
m_vectorName = addr.vectorName().c_str();
|
||||
m_regionNumber = addr.regionNumber();
|
||||
m_regionNumber2 = addr.regionNumber2();
|
||||
@@ -147,6 +149,7 @@ void RimSummaryAddress::setAddress( const RifEclipseSummaryAddress& addr )
|
||||
RifEclipseSummaryAddress RimSummaryAddress::address() const
|
||||
{
|
||||
return RifEclipseSummaryAddress( m_category(),
|
||||
m_statistics(),
|
||||
m_vectorName().toStdString(),
|
||||
m_regionNumber(),
|
||||
m_regionNumber2(),
|
||||
|
||||
@@ -66,6 +66,7 @@ protected:
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddressDefines::SummaryCategory>> m_category;
|
||||
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddressDefines::StatisticsType>> m_statistics;
|
||||
|
||||
caf::PdmField<QString> m_vectorName;
|
||||
caf::PdmField<int> m_regionNumber;
|
||||
|
||||
@@ -609,7 +609,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
|
||||
if ( m_xAxisType == RiaDefines::HorizontalAxisType::SUMMARY_VECTOR )
|
||||
{
|
||||
if ( m_xValuesSummaryAddress()->address().category() == SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS )
|
||||
if ( m_xValuesSummaryAddress()->address().isStatistics() )
|
||||
{
|
||||
// Read x and y values from ensemble statistics (not time steps are read)
|
||||
if ( RifSummaryReaderInterface* reader = valuesSummaryReaderX() )
|
||||
@@ -819,7 +819,7 @@ double RimSummaryCurve::computeCurveZValue()
|
||||
{
|
||||
zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_OBSERVED );
|
||||
}
|
||||
else if ( sumAddr.category() == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS )
|
||||
else if ( sumAddr.isStatistics() )
|
||||
{
|
||||
zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_STAT_CURVE );
|
||||
}
|
||||
|
||||
@@ -249,9 +249,10 @@ QString RimSummaryCurveAutoName::buildCurveName( const RifEclipseSummaryAddress&
|
||||
}
|
||||
}
|
||||
|
||||
if ( summaryAddress.category() == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS )
|
||||
if ( summaryAddress.isStatistics() )
|
||||
{
|
||||
text = summaryAddress.vectorName();
|
||||
auto prefix = RifEclipseSummaryAddressDefines::statisticsTypeToString( summaryAddress.statisticsType() );
|
||||
text = prefix + ":" + summaryAddress.vectorName();
|
||||
}
|
||||
|
||||
if ( m_unit && !unitText.empty() )
|
||||
|
||||
@@ -263,28 +263,20 @@ void RimSummaryRegressionAnalysisCurve::extractSourceCurveData()
|
||||
|
||||
if ( m_dataSourceForRegression() == DataSource::ENSEMBLE )
|
||||
{
|
||||
auto findStatisticsCurve = []( RimEnsembleCurveSet* curveSet, const QString& statisticsCurveName ) -> RimSummaryCurve*
|
||||
auto findStatisticsCurve = []( RimEnsembleCurveSet* curveSet,
|
||||
RifEclipseSummaryAddressDefines::StatisticsType statisticsType ) -> RimSummaryCurve*
|
||||
{
|
||||
if ( curveSet == nullptr ) return nullptr;
|
||||
|
||||
auto allCurves = curveSet->curves();
|
||||
for ( auto curve : allCurves )
|
||||
for ( auto curve : curveSet->curves() )
|
||||
{
|
||||
auto yAddr = curve->summaryAddressY();
|
||||
|
||||
if ( yAddr.category() == RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS )
|
||||
{
|
||||
auto statisticsName = QString::fromStdString( yAddr.ensembleStatisticsVectorName() );
|
||||
if ( statisticsName == statisticsCurveName )
|
||||
{
|
||||
return curve;
|
||||
}
|
||||
}
|
||||
if ( yAddr.statisticsType() == statisticsType ) return curve;
|
||||
}
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
auto curve = findStatisticsCurve( m_ensembleCurveSet(), m_ensembleStatisticsType().uiText() );
|
||||
auto curve = findStatisticsCurve( m_ensembleCurveSet(), m_ensembleStatisticsType() );
|
||||
if ( curve )
|
||||
{
|
||||
yValues = curve->valuesY();
|
||||
|
||||
@@ -106,7 +106,7 @@ std::pair<std::string, std::string> RimSummaryEnsembleSumo::nameKeys() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryEnsembleSumo::loadSummaryData( const RifEclipseSummaryAddress& resultAddress )
|
||||
{
|
||||
if ( resultAddress.category() == SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS ) return;
|
||||
if ( resultAddress.isStatistics() ) return;
|
||||
|
||||
if ( !m_sumoDataSource() ) return;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
#include "RimSummaryAddress.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
@@ -595,3 +596,31 @@ TEST( RifEclipseSummaryAddressTest, ConversionFromTextToAddress )
|
||||
EXPECT_EQ( "B-2H", adr.wellName() );
|
||||
}
|
||||
}
|
||||
|
||||
TEST( RifEclipseSummaryAddressTest, Conversion_RifEclipseSummaryAddress_RimSummaryAddress_RoundTrip )
|
||||
{
|
||||
// Create a RifEclipseSummaryAddress with various fields set
|
||||
RifEclipseSummaryAddress original = RifEclipseSummaryAddress::wellConnectionAddress( "WOPR", "B-2H", 10, 20, 30 );
|
||||
original.setStatisticsType( RifEclipseSummaryAddressDefines::StatisticsType::P50 );
|
||||
original.setAsErrorResult();
|
||||
original.setId( 42 );
|
||||
|
||||
// Convert to RimSummaryAddress
|
||||
RimSummaryAddress rimAddr;
|
||||
rimAddr.setAddress( original );
|
||||
|
||||
// Convert back to RifEclipseSummaryAddress
|
||||
RifEclipseSummaryAddress roundTrip = rimAddr.address();
|
||||
|
||||
// Check that all relevant fields are preserved
|
||||
EXPECT_TRUE( roundTrip.isValid() );
|
||||
EXPECT_EQ( original.category(), roundTrip.category() );
|
||||
EXPECT_EQ( original.vectorName(), roundTrip.vectorName() );
|
||||
EXPECT_EQ( original.wellName(), roundTrip.wellName() );
|
||||
EXPECT_EQ( original.cellI(), roundTrip.cellI() );
|
||||
EXPECT_EQ( original.cellJ(), roundTrip.cellJ() );
|
||||
EXPECT_EQ( original.cellK(), roundTrip.cellK() );
|
||||
EXPECT_EQ( original.statisticsType(), roundTrip.statisticsType() );
|
||||
EXPECT_EQ( original.isErrorResult(), roundTrip.isErrorResult() );
|
||||
EXPECT_EQ( original.id(), roundTrip.id() );
|
||||
}
|
||||
@@ -662,7 +662,7 @@ void RiuSummaryVectorSelectionUi::setSelectedCurveDefinitions( const std::vector
|
||||
RifEclipseSummaryAddress summaryAddress = curveDef.summaryAddressY();
|
||||
|
||||
// Ignore ensemble statistics curves
|
||||
if ( summaryAddress.category() == SummaryCategory::SUMMARY_ENSEMBLE_STATISTICS ) continue;
|
||||
if ( summaryAddress.isStatistics() ) continue;
|
||||
|
||||
// Select summary category if not already selected
|
||||
auto& selectedCategories = m_selectedSummaryCategories();
|
||||
@@ -1414,9 +1414,6 @@ void RiuSummaryVectorSelectionUi::appendOptionItemsForCategories( QList<caf::Pdm
|
||||
|
||||
sortedCategoriesForUi.push_back( SummaryCategory::SUMMARY_IMPORTED );
|
||||
|
||||
// NB SUMMARY_ENSEMBLE_STATISTICS is intentionally excluded
|
||||
// categoriesForUiDisplay.push_back(SummaryVarCategory::SUMMARY_ENSEMBLE_STATISTICS);
|
||||
|
||||
for ( auto category : sortedCategoriesForUi )
|
||||
{
|
||||
auto option = RiaOptionItemFactory::optionItemFromSummaryType( category );
|
||||
|
||||
Reference in new issue
Block a user