mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Summary performance improvements
* Check flag before rebuilding summary address nodes * Performance: Use vector instead of set and map locally in thread * Performance: Skip looking for restart summary filenames for opm-common * Move adding of case realization parameters to OpenMP loop * Add unit test for file path operations * Performance: Avoid using cdUp() function when splitting path into strings
This commit is contained in:
@@ -58,6 +58,8 @@ void RimSummaryCalculationCollection::updateDataDependingOnCalculations()
|
||||
{
|
||||
if ( !summaryCase ) continue;
|
||||
|
||||
if ( !summaryCase->showRealizationDataSources() ) continue;
|
||||
|
||||
if ( auto reader = summaryCase->summaryReader() )
|
||||
{
|
||||
reader->buildMetaData();
|
||||
@@ -93,11 +95,3 @@ void RimSummaryCalculationCollection::rebuildCaseMetaData()
|
||||
ensureValidCalculationIds();
|
||||
updateDataDependingOnCalculations();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCalculationCollection::initAfterRead()
|
||||
{
|
||||
rebuildCaseMetaData();
|
||||
}
|
||||
|
||||
@@ -43,5 +43,4 @@ public:
|
||||
|
||||
private:
|
||||
void updateDataDependingOnCalculations();
|
||||
void initAfterRead() override;
|
||||
};
|
||||
|
||||
@@ -20,14 +20,12 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
#include "RiaPreferencesSummary.h"
|
||||
|
||||
#include "RifEclipseSummaryTools.h"
|
||||
#include "RifMultipleSummaryReaders.h"
|
||||
#include "RifOpmCommonSummary.h"
|
||||
#include "RifProjectSummaryDataWriter.h"
|
||||
#include "RifReaderEclipseRft.h"
|
||||
#include "RifReaderEclipseSummary.h"
|
||||
#include "RifReaderOpmRft.h"
|
||||
#include "RifSummaryReaderMultipleFiles.h"
|
||||
@@ -36,7 +34,6 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimRftCase.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
@@ -102,8 +99,18 @@ QString RimFileSummaryCase::caseName() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFileSummaryCase::createSummaryReaderInterfaceThreadSafe( RiaThreadSafeLogger* threadSafeLogger )
|
||||
{
|
||||
m_fileSummaryReader =
|
||||
RimFileSummaryCase::findRelatedFilesAndCreateReader( summaryHeaderFilename(), m_includeRestartFiles, threadSafeLogger );
|
||||
bool lookForRestartFiles = false;
|
||||
|
||||
if ( RiaPreferencesSummary::current()->summaryDataReader() == RiaPreferencesSummary::SummaryReaderMode::LIBECL )
|
||||
{
|
||||
// It is only the libecl reader that requires manual search for referenced restart files
|
||||
// opm-common reader handles restart files internally based on m_includeRestartFiles in RifOpmCommonEclipseSummary::openFileReader
|
||||
//
|
||||
// The performance of the function looking for restart files is bad, and will affect the performance significantly
|
||||
lookForRestartFiles = m_includeRestartFiles;
|
||||
}
|
||||
|
||||
m_fileSummaryReader = RimFileSummaryCase::findRelatedFilesAndCreateReader( summaryHeaderFilename(), lookForRestartFiles, threadSafeLogger );
|
||||
|
||||
m_multiSummaryReader = new RifMultipleSummaryReaders;
|
||||
m_multiSummaryReader->addReader( m_fileSummaryReader.p() );
|
||||
@@ -159,10 +166,10 @@ void RimFileSummaryCase::createRftReaderInterface()
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifSummaryReaderInterface* RimFileSummaryCase::findRelatedFilesAndCreateReader( const QString& headerFileName,
|
||||
bool includeRestartFiles,
|
||||
bool lookForRestartFiles,
|
||||
RiaThreadSafeLogger* threadSafeLogger )
|
||||
{
|
||||
if ( includeRestartFiles )
|
||||
if ( lookForRestartFiles )
|
||||
{
|
||||
std::vector<QString> warnings;
|
||||
std::vector<RifRestartFileInfo> restartFileInfos = RifEclipseSummaryTools::getRestartFiles( headerFileName, warnings );
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
void onProjectBeingSaved();
|
||||
|
||||
static RifSummaryReaderInterface*
|
||||
findRelatedFilesAndCreateReader( const QString& headerFileName, bool includeRestartFiles, RiaThreadSafeLogger* threadSafeLogger );
|
||||
findRelatedFilesAndCreateReader( const QString& headerFileName, bool lookForRestartFiles, RiaThreadSafeLogger* threadSafeLogger );
|
||||
|
||||
protected:
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
@@ -406,6 +406,9 @@ void RimSummaryCase::refreshMetaData()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCase::onCalculationUpdated()
|
||||
{
|
||||
// NB! Performance critical method
|
||||
if ( !m_showSubNodesInTree ) return;
|
||||
|
||||
// Delete all calculated address objects
|
||||
m_dataVectorFolders->deleteCalculatedObjects();
|
||||
|
||||
|
||||
@@ -248,7 +248,9 @@ void RimSummaryCaseCollection::ensureNameIsUpdated()
|
||||
RiaEnsembleNameTools::EnsembleGroupingMode groupingMode = RiaEnsembleNameTools::EnsembleGroupingMode::FMU_FOLDER_STRUCTURE;
|
||||
|
||||
QString ensembleName = RiaEnsembleNameTools::findSuitableEnsembleName( fileNames, groupingMode );
|
||||
m_name = ensembleName;
|
||||
if ( m_name == ensembleName ) return;
|
||||
|
||||
m_name = ensembleName;
|
||||
caseNameChanged.send();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,6 +460,7 @@ void RimSummaryCaseMainCollection::loadFileSummaryCaseData( std::vector<RimFileS
|
||||
if ( fileSummaryCase )
|
||||
{
|
||||
fileSummaryCase->createSummaryReaderInterfaceThreadSafe( &threadSafeLogger );
|
||||
addCaseRealizationParametersIfFound( *fileSummaryCase, fileSummaryCase->summaryHeaderFilename() );
|
||||
}
|
||||
|
||||
progInfo.setProgress( cIdx );
|
||||
@@ -482,7 +483,6 @@ void RimSummaryCaseMainCollection::loadFileSummaryCaseData( std::vector<RimFileS
|
||||
if ( fileSummaryCase )
|
||||
{
|
||||
fileSummaryCase->createRftReaderInterface();
|
||||
addCaseRealizationParametersIfFound( *fileSummaryCase, fileSummaryCase->summaryHeaderFilename() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -648,9 +648,13 @@ void RimSummaryCaseMainCollection::updateAutoShortName()
|
||||
//
|
||||
// https://github.com/OPM/ResInsight/issues/7438
|
||||
|
||||
for ( auto s : allSummaryCases() )
|
||||
auto sumCases = allSummaryCases();
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int cIdx = 0; cIdx < static_cast<int>( sumCases.size() ); ++cIdx )
|
||||
{
|
||||
s->updateAutoShortName();
|
||||
auto sumCase = sumCases[cIdx];
|
||||
sumCase->updateAutoShortName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user