Ensures summary reader addresses are created

This commit is contained in:
Magne Sjaastad committed 2025-08-15 13:00:48 +02:00
1 parent 5d22c7791d
commit 2bcb25f679
2 files changed
+28 -10

No files matched your search

@@ -152,7 +152,7 @@ void RimSummaryTable::setDefaultCaseAndCategoryAndVectorName()
m_case = summaryCases.front();
const auto summaryReader = m_case->summaryReader();
const auto summaryReader = summaryReaderWithAddresses();
if ( !summaryReader ) return;
const auto categoryVectors = getCategoryVectorFromSummaryReader( summaryReader, m_category() );
@@ -215,7 +215,7 @@ void RimSummaryTable::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
{
if ( m_case )
{
auto* summaryReader = m_case->summaryReader();
const auto summaryReader = summaryReaderWithAddresses();
const auto categoryVectors = getCategoryVectorFromSummaryReader( summaryReader, m_category() );
if ( summaryReader && !categoryVectors.empty() )
{
@@ -236,7 +236,7 @@ void RimSummaryTable::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
{
if ( m_case )
{
auto* summaryReader = m_case->summaryReader();
const auto summaryReader = summaryReaderWithAddresses();
const auto categoryVectors = getCategoryVectorFromSummaryReader( summaryReader, m_category() );
if ( summaryReader && !categoryVectors.empty() )
{
@@ -406,7 +406,7 @@ QList<caf::PdmOptionItemInfo> RimSummaryTable::calculateValueOptions( const caf:
}
else if ( fieldNeedingOptions == &m_vector && m_case )
{
auto* summaryReader = m_case->summaryReader();
const auto summaryReader = summaryReaderWithAddresses();
if ( summaryReader )
{
const auto categoryVectorsUnion = getCategoryVectorFromSummaryReader( summaryReader, m_category() );
@@ -447,7 +447,7 @@ void RimSummaryTable::onLoadDataAndUpdate()
return;
}
const auto summaryReader = m_case->summaryReader();
const auto summaryReader = summaryReaderWithAddresses();
if ( !summaryReader )
{
return;
@@ -709,8 +709,7 @@ std::vector<RimSummaryCase*> RimSummaryTable::getToplevelSummaryCases() const
//--------------------------------------------------------------------------------------------------
void RimSummaryTable::initializeDateRange()
{
if ( !m_case ) return;
const auto summaryReader = m_case->summaryReader();
auto summaryReader = summaryReaderWithAddresses();
if ( !summaryReader ) return;
const std::set<RifEclipseSummaryAddress> allResultAddresses = summaryReader->allResultAddresses();
@@ -723,6 +722,25 @@ void RimSummaryTable::initializeDateRange()
m_endDate = RiaQDateTimeTools::fromTime_t( timeSteps.back() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifSummaryReaderInterface* RimSummaryTable::summaryReaderWithAddresses()
{
if ( !m_case ) return nullptr;
if ( auto summaryReader = m_case->summaryReader() )
{
// This is required for ensemble cases, addresses are created on demand
// Consider moving this to the summary reader interface, and make the call as part of the pure virtual method
// virtual RifSummaryReaderInterface* summaryReader() = 0; in RimSummaryCase
summaryReader->createAddressesIfRequired();
return summaryReader;
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -731,9 +749,7 @@ void RimSummaryTable::createTableData()
m_tableData = TableData();
m_tableData.thresholdValue = m_thresholdValue();
if ( !m_case ) return;
const auto summaryReader = m_case->summaryReader();
const auto summaryReader = summaryReaderWithAddresses();
if ( !summaryReader ) return;
// Create time step value for vectors with no values above threshold
@@ -108,6 +108,8 @@ private:
std::vector<RimSummaryCase*> getToplevelSummaryCases() const;
void initializeDateRange();
RifSummaryReaderInterface* summaryReaderWithAddresses();
private:
// Matrix plot for visualizing table data
QPointer<RiuMatrixPlotWidget> m_matrixPlotWidget;