mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
Avoid progress window staying behind on Linux when loading summary data (#9774)
Adjust progress info usage in summary file loading
This commit is contained in:
parent
82b538719e
commit
33e908dd94
@ -471,20 +471,23 @@ void RimSummaryCaseMainCollection::loadSummaryCaseData( std::vector<RimSummaryCa
|
||||
loadFileSummaryCaseData( fileSummaryCases );
|
||||
}
|
||||
|
||||
caf::ProgressInfo progInfo( otherSummaryCases.size(), "Loading Summary Cases" );
|
||||
|
||||
for ( int cIdx = 0; cIdx < static_cast<int>( otherSummaryCases.size() ); ++cIdx )
|
||||
if ( !otherSummaryCases.empty() )
|
||||
{
|
||||
RimSummaryCase* sumCase = otherSummaryCases[cIdx];
|
||||
if ( sumCase )
|
||||
{
|
||||
sumCase->createSummaryReaderInterface();
|
||||
sumCase->createRftReaderInterface();
|
||||
addCaseRealizationParametersIfFound( *sumCase, sumCase->summaryHeaderFilename() );
|
||||
}
|
||||
caf::ProgressInfo progInfo( otherSummaryCases.size(), "Loading Summary Cases" );
|
||||
|
||||
for ( int cIdx = 0; cIdx < static_cast<int>( otherSummaryCases.size() ); ++cIdx )
|
||||
{
|
||||
progInfo.incrementProgress();
|
||||
RimSummaryCase* sumCase = otherSummaryCases[cIdx];
|
||||
if ( sumCase )
|
||||
{
|
||||
sumCase->createSummaryReaderInterface();
|
||||
sumCase->createRftReaderInterface();
|
||||
addCaseRealizationParametersIfFound( *sumCase, sumCase->summaryHeaderFilename() );
|
||||
}
|
||||
|
||||
{
|
||||
progInfo.incrementProgress();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -531,30 +534,33 @@ void RimSummaryCaseMainCollection::loadFileSummaryCaseData( std::vector<RimFileS
|
||||
// RimSummaryCase, as it is difficult to make sure all variants of the leaf classes are thread safe.
|
||||
// Only open the summary file reader in parallel loop to reduce risk of multi threading issues
|
||||
|
||||
caf::ProgressInfo progInfo( fileSummaryCases.size(), "Loading Summary Cases" );
|
||||
{
|
||||
caf::ProgressInfo progInfo( fileSummaryCases.size(), "Loading Summary Cases" );
|
||||
|
||||
RifOpmCommonEclipseSummary::resetEnhancedSummaryFileCount();
|
||||
RifOpmCommonEclipseSummary::resetEnhancedSummaryFileCount();
|
||||
|
||||
RiaThreadSafeLogger threadSafeLogger;
|
||||
RiaThreadSafeLogger threadSafeLogger;
|
||||
QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
|
||||
|
||||
// The HDF5 reader requires a special configuration to be thread safe. Disable threading for HDF reader.
|
||||
bool canUseMultipleTreads = ( prefs->summaryDataReader() != RiaPreferencesSummary::SummaryReaderMode::HDF5_OPM_COMMON );
|
||||
// The HDF5 reader requires a special configuration to be thread safe. Disable threading for HDF reader.
|
||||
bool canUseMultipleTreads =
|
||||
( prefs->summaryDataReader() != RiaPreferencesSummary::SummaryReaderMode::HDF5_OPM_COMMON );
|
||||
|
||||
#pragma omp parallel for schedule( dynamic ) if ( canUseMultipleTreads )
|
||||
for ( int cIdx = 0; cIdx < static_cast<int>( fileSummaryCases.size() ); ++cIdx )
|
||||
{
|
||||
RimFileSummaryCase* fileSummaryCase = fileSummaryCases[cIdx];
|
||||
if ( fileSummaryCase )
|
||||
for ( int cIdx = 0; cIdx < static_cast<int>( fileSummaryCases.size() ); ++cIdx )
|
||||
{
|
||||
fileSummaryCase->createSummaryReaderInterfaceThreadSafe( &threadSafeLogger );
|
||||
RimFileSummaryCase* fileSummaryCase = fileSummaryCases[cIdx];
|
||||
if ( fileSummaryCase )
|
||||
{
|
||||
fileSummaryCase->createSummaryReaderInterfaceThreadSafe( &threadSafeLogger );
|
||||
}
|
||||
|
||||
progInfo.setProgress( cIdx );
|
||||
}
|
||||
for ( const auto& txt : threadSafeLogger.messages() )
|
||||
{
|
||||
RiaLogging::info( txt );
|
||||
}
|
||||
|
||||
progInfo.setProgress( cIdx );
|
||||
}
|
||||
|
||||
for ( const auto& txt : threadSafeLogger.messages() )
|
||||
{
|
||||
RiaLogging::info( txt );
|
||||
}
|
||||
|
||||
auto numberOfEsmryFilesCreated = RifOpmCommonEclipseSummary::numberOfEnhancedSummaryFileCreated();
|
||||
@ -649,6 +655,8 @@ std::vector<RimSummaryCase*> RimSummaryCaseMainCollection::createSummaryCasesFro
|
||||
|
||||
for ( const RifSummaryCaseFileResultInfo& fileInfo : summaryHeaderFileInfos )
|
||||
{
|
||||
QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
|
||||
|
||||
RimEclipseCase* eclCase = nullptr;
|
||||
QString gridCaseFile =
|
||||
RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile( fileInfo.summaryFileName() );
|
||||
@ -694,6 +702,8 @@ std::vector<RimSummaryCase*> RimSummaryCaseMainCollection::createSummaryCasesFro
|
||||
|
||||
if ( progress != nullptr ) progress->incrementProgress();
|
||||
}
|
||||
|
||||
QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
|
||||
}
|
||||
|
||||
RimSummaryCaseMainCollection::loadSummaryCaseData( sumCases );
|
||||
|
@ -652,6 +652,8 @@ void ProgressInfoStatic::finished()
|
||||
dialog->setLabelText( currentComposedLabel() );
|
||||
}
|
||||
|
||||
QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
|
||||
|
||||
// If we are finishing the last level, clean up
|
||||
if ( maxProgressStack_v.empty() )
|
||||
{
|
||||
@ -662,12 +664,6 @@ void ProgressInfoStatic::finished()
|
||||
s_running = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make sure the Gui is repainted
|
||||
QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
|
||||
// if (progressDialog()) progressDialog()->repaint();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user