mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-27 15:41:00 -05:00
Fix issue with single realization when using resdata (#12737)
* Moves multi reader initialization * Log error message if not able to open file * Make keywordCount pure virtual The base class `RifSummaryReaderInterface` is changed to be abstract and the `keywordCount` is declared as a pure virtual method, therefore the derived classes must implement the method. This will ensure that all readers are responsible for reporting a keyword count. * Ensures addresses are created if required Calls `createAddressesIfRequired` on the summary reader to ensure addresses are created before accessing keyword count. This prevents potential issues when the addresses haven't been initialized yet.
This commit is contained in:
1 parent
06a3419d2b
commit
c854166be6
27 files changed
+161
-28
No files matched your search
@@ -114,6 +114,14 @@ RimSummaryCalculation* RifCalculatedSummaryCurveReader::findCalculationByName( c
|
||||
return dynamic_cast<RimSummaryCalculation*>( m_calculationCollection->findCalculationById( resultAddress.id() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RifCalculatedSummaryCurveReader::keywordCount() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
|
||||
private:
|
||||
RimSummaryCalculation* findCalculationByName( const RifEclipseSummaryAddress& resultAddress ) const;
|
||||
size_t keywordCount() const override;
|
||||
|
||||
private:
|
||||
RimSummaryCalculationCollection* m_calculationCollection;
|
||||
|
||||
@@ -368,6 +368,14 @@ QString RimDeltaSummaryCase::caseName() const
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimDeltaSummaryCase::keywordCount() const
|
||||
{
|
||||
return m_allResultAddresses.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -88,6 +88,7 @@ public:
|
||||
|
||||
protected:
|
||||
QString caseName() const override;
|
||||
size_t keywordCount() const override;
|
||||
|
||||
private:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
@@ -318,3 +318,18 @@ void RimEnsembleCrossPlotStatisticsCase::clearData()
|
||||
m_meanData.clear();
|
||||
m_firstSummaryCase = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEnsembleCrossPlotStatisticsCase::keywordCount() const
|
||||
{
|
||||
if ( m_firstSummaryCase && m_firstSummaryCase->summaryReader() )
|
||||
{
|
||||
m_firstSummaryCase->summaryReader()->createAddressesIfRequired();
|
||||
|
||||
return m_firstSummaryCase->summaryReader()->keywordCount();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -55,7 +55,8 @@ public:
|
||||
std::string unitName( const RifEclipseSummaryAddress& resultAddress ) const override;
|
||||
|
||||
private:
|
||||
void clearData();
|
||||
void clearData();
|
||||
size_t keywordCount() const override;
|
||||
|
||||
private:
|
||||
std::vector<double> m_p10Data;
|
||||
|
||||
@@ -240,6 +240,21 @@ void RimEnsembleStatisticsCase::clearData()
|
||||
m_firstSummaryCase = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEnsembleStatisticsCase::keywordCount() const
|
||||
{
|
||||
if ( m_firstSummaryCase && m_firstSummaryCase->summaryReader() )
|
||||
{
|
||||
m_firstSummaryCase->summaryReader()->createAddressesIfRequired();
|
||||
|
||||
return m_firstSummaryCase->summaryReader()->keywordCount();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -54,7 +54,8 @@ public:
|
||||
static RiaDefines::DateTimePeriod findBestResamplingPeriod( time_t minTimeStep, time_t maxTimeStep );
|
||||
|
||||
private:
|
||||
void clearData();
|
||||
void clearData();
|
||||
size_t keywordCount() const override;
|
||||
|
||||
private:
|
||||
std::vector<time_t> m_timeSteps;
|
||||
|
||||
@@ -100,7 +100,7 @@ void RimFileSummaryCase::createSummaryReaderInterfaceThreadSafe( RifEnsembleImpo
|
||||
//
|
||||
// https://github.com/OPM/ResInsight/issues/11342
|
||||
|
||||
m_multiSummaryReader = std::make_unique<RifMultipleSummaryReaders>();
|
||||
auto multiReader = std::make_unique<RifMultipleSummaryReaders>();
|
||||
m_fileSummaryReaderId = -1;
|
||||
m_additionalSummaryReaderId = -1;
|
||||
|
||||
@@ -112,6 +112,7 @@ void RimFileSummaryCase::createSummaryReaderInterfaceThreadSafe( RifEnsembleImpo
|
||||
|
||||
m_fileSummaryReaderId = reader->serialNumber();
|
||||
|
||||
m_multiSummaryReader = std::move( multiReader );
|
||||
m_multiSummaryReader->addReader( std::move( reader ) );
|
||||
|
||||
openAndAttachAdditionalReader();
|
||||
|
||||
@@ -179,3 +179,11 @@ void RimSummaryCaseSumo::createAndSetAddresses()
|
||||
m_allResultAddresses = addresses;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimSummaryCaseSumo::keywordCount() const
|
||||
{
|
||||
return m_allResultAddresses.size();
|
||||
}
|
||||
@@ -57,6 +57,7 @@ public:
|
||||
protected:
|
||||
QString caseName() const override;
|
||||
void createAndSetAddresses() override;
|
||||
size_t keywordCount() const override;
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimSummaryEnsembleSumo> m_ensemble;
|
||||
|
||||
Reference in new issue
Block a user