mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -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
5118ed36e5
commit
0c70a92f16
@ -471,20 +471,23 @@ void RimSummaryCaseMainCollection::loadSummaryCaseData( std::vector<RimSummaryCa
|
|||||||
loadFileSummaryCaseData( fileSummaryCases );
|
loadFileSummaryCaseData( fileSummaryCases );
|
||||||
}
|
}
|
||||||
|
|
||||||
caf::ProgressInfo progInfo( otherSummaryCases.size(), "Loading Summary Cases" );
|
if ( !otherSummaryCases.empty() )
|
||||||
|
|
||||||
for ( int cIdx = 0; cIdx < static_cast<int>( otherSummaryCases.size() ); ++cIdx )
|
|
||||||
{
|
{
|
||||||
RimSummaryCase* sumCase = otherSummaryCases[cIdx];
|
caf::ProgressInfo progInfo( otherSummaryCases.size(), "Loading Summary Cases" );
|
||||||
if ( sumCase )
|
|
||||||
{
|
|
||||||
sumCase->createSummaryReaderInterface();
|
|
||||||
sumCase->createRftReaderInterface();
|
|
||||||
addCaseRealizationParametersIfFound( *sumCase, sumCase->summaryHeaderFilename() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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.
|
// 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
|
// 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.
|
// 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 );
|
bool canUseMultipleTreads =
|
||||||
|
( prefs->summaryDataReader() != RiaPreferencesSummary::SummaryReaderMode::HDF5_OPM_COMMON );
|
||||||
|
|
||||||
#pragma omp parallel for schedule( dynamic ) if ( canUseMultipleTreads )
|
#pragma omp parallel for schedule( dynamic ) if ( canUseMultipleTreads )
|
||||||
for ( int cIdx = 0; cIdx < static_cast<int>( fileSummaryCases.size() ); ++cIdx )
|
for ( int cIdx = 0; cIdx < static_cast<int>( fileSummaryCases.size() ); ++cIdx )
|
||||||
{
|
|
||||||
RimFileSummaryCase* fileSummaryCase = fileSummaryCases[cIdx];
|
|
||||||
if ( fileSummaryCase )
|
|
||||||
{
|
{
|
||||||
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();
|
auto numberOfEsmryFilesCreated = RifOpmCommonEclipseSummary::numberOfEnhancedSummaryFileCreated();
|
||||||
@ -649,6 +655,8 @@ std::vector<RimSummaryCase*> RimSummaryCaseMainCollection::createSummaryCasesFro
|
|||||||
|
|
||||||
for ( const RifSummaryCaseFileResultInfo& fileInfo : summaryHeaderFileInfos )
|
for ( const RifSummaryCaseFileResultInfo& fileInfo : summaryHeaderFileInfos )
|
||||||
{
|
{
|
||||||
|
QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
|
||||||
|
|
||||||
RimEclipseCase* eclCase = nullptr;
|
RimEclipseCase* eclCase = nullptr;
|
||||||
QString gridCaseFile =
|
QString gridCaseFile =
|
||||||
RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile( fileInfo.summaryFileName() );
|
RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile( fileInfo.summaryFileName() );
|
||||||
@ -694,6 +702,8 @@ std::vector<RimSummaryCase*> RimSummaryCaseMainCollection::createSummaryCasesFro
|
|||||||
|
|
||||||
if ( progress != nullptr ) progress->incrementProgress();
|
if ( progress != nullptr ) progress->incrementProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
|
||||||
}
|
}
|
||||||
|
|
||||||
RimSummaryCaseMainCollection::loadSummaryCaseData( sumCases );
|
RimSummaryCaseMainCollection::loadSummaryCaseData( sumCases );
|
||||||
|
@ -652,6 +652,8 @@ void ProgressInfoStatic::finished()
|
|||||||
dialog->setLabelText( currentComposedLabel() );
|
dialog->setLabelText( currentComposedLabel() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
|
||||||
|
|
||||||
// If we are finishing the last level, clean up
|
// If we are finishing the last level, clean up
|
||||||
if ( maxProgressStack_v.empty() )
|
if ( maxProgressStack_v.empty() )
|
||||||
{
|
{
|
||||||
@ -662,12 +664,6 @@ void ProgressInfoStatic::finished()
|
|||||||
s_running = false;
|
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