mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve summary case import performance (#8897)
* Improve summary case import performance
This commit is contained in:
parent
7d440a9c2f
commit
65827f9c1c
@ -104,10 +104,9 @@ RimSummaryMultiPlot* RicSummaryPlotTemplateTools::create( const QString& fileNam
|
||||
{
|
||||
auto caseCollection = sumCaseCollections.front();
|
||||
|
||||
if ( !caseCollection->allSummaryCases().empty() )
|
||||
auto firstCase = caseCollection->firstSummaryCase();
|
||||
if ( firstCase != nullptr )
|
||||
{
|
||||
auto firstCase = caseCollection->allSummaryCases().front();
|
||||
|
||||
analyzer.appendAddresses( firstCase->summaryReader()->allResultAddresses() );
|
||||
}
|
||||
}
|
||||
|
@ -675,10 +675,13 @@ std::vector<RimSummaryCase*> RimProject::allSummaryCases() const
|
||||
if ( sumCaseMainColl )
|
||||
{
|
||||
std::vector<RimSummaryCase*> allSummaryCases = sumCaseMainColl->allSummaryCases();
|
||||
sumCases.insert( sumCases.end(), allSummaryCases.begin(), allSummaryCases.end() );
|
||||
if ( !allSummaryCases.empty() )
|
||||
{
|
||||
sumCases.insert( sumCases.end(), allSummaryCases.begin(), allSummaryCases.end() );
|
||||
}
|
||||
}
|
||||
|
||||
auto observedDataColl = oilField->observedDataCollection();
|
||||
auto& observedDataColl = oilField->observedDataCollection();
|
||||
if ( observedDataColl != nullptr && observedDataColl->allObservedSummaryData().size() > 0 )
|
||||
{
|
||||
auto observedData = observedDataColl->allObservedSummaryData();
|
||||
|
@ -169,7 +169,7 @@ void RimSummaryCaseCollection::removeCase( RimSummaryCase* summaryCase )
|
||||
calculateEnsembleParametersIntersectionHash();
|
||||
}
|
||||
|
||||
buildChildNodes();
|
||||
clearChildNodes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -201,7 +201,7 @@ void RimSummaryCaseCollection::addCase( RimSummaryCase* summaryCase )
|
||||
|
||||
updateReferringCurveSets();
|
||||
|
||||
buildChildNodes();
|
||||
clearChildNodes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -212,6 +212,16 @@ std::vector<RimSummaryCase*> RimSummaryCaseCollection::allSummaryCases() const
|
||||
return m_cases.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCase* RimSummaryCaseCollection::firstSummaryCase() const
|
||||
{
|
||||
if ( !m_cases.empty() ) return m_cases[0];
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -891,7 +901,7 @@ void RimSummaryCaseCollection::onLoadDataAndUpdate()
|
||||
if ( m_isEnsemble )
|
||||
{
|
||||
calculateEnsembleParametersIntersectionHash();
|
||||
buildChildNodes();
|
||||
clearChildNodes();
|
||||
}
|
||||
}
|
||||
|
||||
@ -953,8 +963,6 @@ void RimSummaryCaseCollection::initAfterRead()
|
||||
}
|
||||
|
||||
updateIcon();
|
||||
|
||||
buildChildNodes();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -999,10 +1007,8 @@ void RimSummaryCaseCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiT
|
||||
{
|
||||
if ( m_isEnsemble() )
|
||||
{
|
||||
if ( m_dataVectorFolders->isEmpty() )
|
||||
{
|
||||
buildChildNodes();
|
||||
}
|
||||
buildChildNodes();
|
||||
|
||||
m_dataVectorFolders->updateUiTreeOrdering( uiTreeOrdering );
|
||||
|
||||
if ( !m_cases.empty() )
|
||||
@ -1063,13 +1069,14 @@ bool RimSummaryCaseCollection::hasEnsembleParameters() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCaseCollection::buildChildNodes()
|
||||
{
|
||||
m_dataVectorFolders->clear();
|
||||
|
||||
for ( auto& smcase : m_cases )
|
||||
if ( m_dataVectorFolders->isEmpty() )
|
||||
{
|
||||
m_dataVectorFolders->updateFolderStructure( smcase->summaryReader()->allResultAddresses(),
|
||||
smcase->caseId(),
|
||||
m_ensembleId );
|
||||
for ( auto& smcase : m_cases )
|
||||
{
|
||||
m_dataVectorFolders->updateFolderStructure( smcase->summaryReader()->allResultAddresses(),
|
||||
smcase->caseId(),
|
||||
m_ensembleId );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1078,6 +1085,15 @@ void RimSummaryCaseCollection::buildChildNodes()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCaseCollection::refreshMetaData()
|
||||
{
|
||||
clearChildNodes();
|
||||
buildChildNodes();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCaseCollection::clearChildNodes()
|
||||
{
|
||||
m_dataVectorFolders->clear();
|
||||
}
|
||||
|
@ -58,21 +58,25 @@ public:
|
||||
RimSummaryCaseCollection();
|
||||
~RimSummaryCaseCollection() override;
|
||||
|
||||
void removeCase( RimSummaryCase* summaryCase );
|
||||
void addCase( RimSummaryCase* summaryCase );
|
||||
virtual std::vector<RimSummaryCase*> allSummaryCases() const;
|
||||
void setName( const QString& name );
|
||||
QString name() const;
|
||||
void removeCase( RimSummaryCase* summaryCase );
|
||||
void addCase( RimSummaryCase* summaryCase );
|
||||
virtual std::vector<RimSummaryCase*> allSummaryCases() const;
|
||||
RimSummaryCase* firstSummaryCase() const;
|
||||
|
||||
void setName( const QString& name );
|
||||
QString name() const;
|
||||
|
||||
bool isEnsemble() const;
|
||||
void setAsEnsemble( bool isEnsemble );
|
||||
virtual std::set<RifEclipseSummaryAddress> ensembleSummaryAddresses() const;
|
||||
virtual std::set<time_t> ensembleTimeSteps() const;
|
||||
std::set<QString> wellsWithRftData() const;
|
||||
std::set<QDateTime> rftTimeStepsForWell( const QString& wellName ) const;
|
||||
RifReaderRftInterface* rftStatisticsReader();
|
||||
void setEnsembleId( int ensembleId );
|
||||
int ensembleId() const;
|
||||
bool hasEnsembleParameters() const;
|
||||
|
||||
std::set<QString> wellsWithRftData() const;
|
||||
std::set<QDateTime> rftTimeStepsForWell( const QString& wellName ) const;
|
||||
RifReaderRftInterface* rftStatisticsReader();
|
||||
void setEnsembleId( int ensembleId );
|
||||
int ensembleId() const;
|
||||
bool hasEnsembleParameters() const;
|
||||
|
||||
std::vector<RigEnsembleParameter> variationSortedEnsembleParameters( bool excludeNoVariation = false ) const;
|
||||
std::vector<std::pair<RigEnsembleParameter, double>>
|
||||
@ -119,6 +123,7 @@ private:
|
||||
void onCaseNameChanged( const SignalEmitter* emitter );
|
||||
|
||||
void buildChildNodes();
|
||||
void clearChildNodes();
|
||||
|
||||
protected:
|
||||
virtual void onLoadDataAndUpdate();
|
||||
|
@ -223,8 +223,10 @@ void RimSummaryCaseMainCollection::addCases( const std::vector<RimSummaryCase*>
|
||||
{
|
||||
for ( RimSummaryCase* sumCase : cases )
|
||||
{
|
||||
addCase( sumCase );
|
||||
m_cases.push_back( sumCase );
|
||||
sumCase->nameChanged.connect( this, &RimSummaryCaseMainCollection::onCaseNameChanged );
|
||||
}
|
||||
dataSourceHasChanged.send();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -355,7 +357,15 @@ size_t RimSummaryCaseMainCollection::summaryCaseCount() const
|
||||
std::vector<RimSummaryCase*> RimSummaryCaseMainCollection::allSummaryCases() const
|
||||
{
|
||||
std::vector<RimSummaryCase*> cases;
|
||||
this->descendantsIncludingThisOfType( cases );
|
||||
|
||||
if ( !m_cases.empty() ) cases.insert( cases.end(), m_cases.begin(), m_cases.end() );
|
||||
|
||||
for ( auto& coll : m_caseCollections )
|
||||
{
|
||||
auto collCases = coll->allSummaryCases();
|
||||
if ( collCases.empty() ) continue;
|
||||
cases.insert( cases.end(), collCases.begin(), collCases.end() );
|
||||
}
|
||||
|
||||
return cases;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user