mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improved progress bar smoothness.
Particularily when having many result files p4#: 20392
This commit is contained in:
parent
de8a959ad5
commit
6fef9994db
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "RifEclipseRestartFilesetAccess.h"
|
#include "RifEclipseRestartFilesetAccess.h"
|
||||||
#include "RifEclipseOutputFileTools.h"
|
#include "RifEclipseOutputFileTools.h"
|
||||||
|
#include "cafProgressInfo.h"
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -44,13 +45,20 @@ bool RifEclipseRestartFilesetAccess::open(const QStringList& fileSet)
|
|||||||
close();
|
close();
|
||||||
|
|
||||||
int numFiles = fileSet.size();
|
int numFiles = fileSet.size();
|
||||||
|
|
||||||
|
caf::ProgressInfo progInfo(numFiles,"");
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < numFiles; i++)
|
for (i = 0; i < numFiles; i++)
|
||||||
{
|
{
|
||||||
|
progInfo.setProgressDescription(fileSet[i]);
|
||||||
|
|
||||||
ecl_file_type* ecl_file = ecl_file_open(fileSet[i].toAscii().data());
|
ecl_file_type* ecl_file = ecl_file_open(fileSet[i].toAscii().data());
|
||||||
if (!ecl_file) return false;
|
if (!ecl_file) return false;
|
||||||
|
|
||||||
m_ecl_files.push_back(ecl_file);
|
m_ecl_files.push_back(ecl_file);
|
||||||
|
|
||||||
|
progInfo.incrementProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -326,7 +326,7 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
|
|||||||
bool RifReaderEclipseOutput::open(const QString& fileName, RigReservoir* reservoir)
|
bool RifReaderEclipseOutput::open(const QString& fileName, RigReservoir* reservoir)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(reservoir);
|
CVF_ASSERT(reservoir);
|
||||||
caf::ProgressInfo progInfo(10, "");
|
caf::ProgressInfo progInfo(100, "");
|
||||||
|
|
||||||
progInfo.setProgressDescription("Reading Grid");
|
progInfo.setProgressDescription("Reading Grid");
|
||||||
|
|
||||||
@ -336,25 +336,30 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigReservoir* reservo
|
|||||||
// Get set of files
|
// Get set of files
|
||||||
QStringList fileSet;
|
QStringList fileSet;
|
||||||
if (!RifEclipseOutputFileTools::fileSet(fileName, &fileSet)) return false;
|
if (!RifEclipseOutputFileTools::fileSet(fileName, &fileSet)) return false;
|
||||||
|
|
||||||
|
progInfo.incrementProgress();
|
||||||
|
|
||||||
|
progInfo.setNextProgressIncrement(20);
|
||||||
// Keep the set of files of interest
|
// Keep the set of files of interest
|
||||||
m_fileSet = fileSet;
|
m_fileSet = fileSet;
|
||||||
|
|
||||||
// Read geometry
|
// Read geometry
|
||||||
ecl_grid_type * mainEclGrid = ecl_grid_alloc( fileName.toAscii().data() );
|
ecl_grid_type * mainEclGrid = ecl_grid_alloc( fileName.toAscii().data() );
|
||||||
|
|
||||||
progInfo.setProgress(1);
|
progInfo.incrementProgress();
|
||||||
progInfo.setNextProgressIncrement(6);
|
|
||||||
|
progInfo.setNextProgressIncrement(10);
|
||||||
progInfo.setProgressDescription("Transferring grid geometry");
|
progInfo.setProgressDescription("Transferring grid geometry");
|
||||||
|
|
||||||
if (!transferGeometry(mainEclGrid, reservoir)) return false;
|
if (!transferGeometry(mainEclGrid, reservoir)) return false;
|
||||||
progInfo.setProgress(7);
|
progInfo.incrementProgress();
|
||||||
|
|
||||||
progInfo.setProgressDescription("Releasing reader memory");
|
progInfo.setProgressDescription("Releasing reader memory");
|
||||||
ecl_grid_free( mainEclGrid );
|
ecl_grid_free( mainEclGrid );
|
||||||
|
progInfo.incrementProgress();
|
||||||
|
|
||||||
progInfo.setProgress(8);
|
|
||||||
progInfo.setProgressDescription("Reading Result index");
|
progInfo.setProgressDescription("Reading Result index");
|
||||||
|
progInfo.setNextProgressIncrement(60);
|
||||||
|
|
||||||
m_mainGrid = reservoir->mainGrid();
|
m_mainGrid = reservoir->mainGrid();
|
||||||
|
|
||||||
@ -363,8 +368,9 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigReservoir* reservo
|
|||||||
|
|
||||||
// Build results meta data
|
// Build results meta data
|
||||||
if (!buildMetaData(reservoir)) return false;
|
if (!buildMetaData(reservoir)) return false;
|
||||||
|
progInfo.incrementProgress();
|
||||||
|
|
||||||
progInfo.setProgress(9);
|
progInfo.setNextProgressIncrement(8);
|
||||||
progInfo.setProgressDescription("Reading Well information");
|
progInfo.setProgressDescription("Reading Well information");
|
||||||
|
|
||||||
readWellCells(reservoir);
|
readWellCells(reservoir);
|
||||||
@ -381,7 +387,9 @@ bool RifReaderEclipseOutput::buildMetaData(RigReservoir* reservoir)
|
|||||||
CVF_ASSERT(reservoir);
|
CVF_ASSERT(reservoir);
|
||||||
CVF_ASSERT(m_fileSet.size() > 0);
|
CVF_ASSERT(m_fileSet.size() > 0);
|
||||||
|
|
||||||
caf::ProgressInfo progInfo(2,"");
|
caf::ProgressInfo progInfo(m_fileSet.size() + 3,"");
|
||||||
|
|
||||||
|
progInfo.setNextProgressIncrement(m_fileSet.size());
|
||||||
|
|
||||||
// Create access object for dynamic results
|
// Create access object for dynamic results
|
||||||
m_dynamicResultsAccess = dynamicResultsAccess(m_fileSet);
|
m_dynamicResultsAccess = dynamicResultsAccess(m_fileSet);
|
||||||
@ -390,6 +398,8 @@ bool RifReaderEclipseOutput::buildMetaData(RigReservoir* reservoir)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progInfo.incrementProgress();
|
||||||
|
|
||||||
RigReservoirCellResults* matrixModelResults = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS);
|
RigReservoirCellResults* matrixModelResults = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS);
|
||||||
RigReservoirCellResults* fractureModelResults = reservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS);
|
RigReservoirCellResults* fractureModelResults = reservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS);
|
||||||
|
|
||||||
@ -424,7 +434,7 @@ bool RifReaderEclipseOutput::buildMetaData(RigReservoir* reservoir)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
progInfo.setProgress(1);
|
progInfo.incrementProgress();
|
||||||
|
|
||||||
QString initFileName = RifEclipseOutputFileTools::fileNameByType(m_fileSet, ECL_INIT_FILE);
|
QString initFileName = RifEclipseOutputFileTools::fileNameByType(m_fileSet, ECL_INIT_FILE);
|
||||||
if (initFileName.size() > 0)
|
if (initFileName.size() > 0)
|
||||||
@ -432,6 +442,8 @@ bool RifReaderEclipseOutput::buildMetaData(RigReservoir* reservoir)
|
|||||||
ecl_file_type* ecl_file = ecl_file_open(initFileName.toAscii().data());
|
ecl_file_type* ecl_file = ecl_file_open(initFileName.toAscii().data());
|
||||||
if (!ecl_file) return false;
|
if (!ecl_file) return false;
|
||||||
|
|
||||||
|
progInfo.incrementProgress();
|
||||||
|
|
||||||
QStringList resultNames;
|
QStringList resultNames;
|
||||||
std::vector<size_t> resultNamesDataItemCounts;
|
std::vector<size_t> resultNamesDataItemCounts;
|
||||||
RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(ecl_file, &resultNames, &resultNamesDataItemCounts);
|
RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(ecl_file, &resultNames, &resultNamesDataItemCounts);
|
||||||
@ -574,6 +586,7 @@ void RifReaderEclipseOutput::readWellCells(RigReservoir* reservoir)
|
|||||||
reservoir->allGrids(&grids);
|
reservoir->allGrids(&grids);
|
||||||
|
|
||||||
cvf::Collection<RigWellResults> wells;
|
cvf::Collection<RigWellResults> wells;
|
||||||
|
caf::ProgressInfo progress(well_info_get_num_wells(ert_well_info), "");
|
||||||
|
|
||||||
int wellIdx;
|
int wellIdx;
|
||||||
for (wellIdx = 0; wellIdx < well_info_get_num_wells(ert_well_info); wellIdx++)
|
for (wellIdx = 0; wellIdx < well_info_get_num_wells(ert_well_info); wellIdx++)
|
||||||
@ -738,6 +751,8 @@ void RifReaderEclipseOutput::readWellCells(RigReservoir* reservoir)
|
|||||||
wellResults->computeMappingFromResultTimeIndicesToWellTimeIndices(m_timeSteps);
|
wellResults->computeMappingFromResultTimeIndicesToWellTimeIndices(m_timeSteps);
|
||||||
|
|
||||||
wells.push_back(wellResults.p());
|
wells.push_back(wellResults.p());
|
||||||
|
|
||||||
|
progress.incrementProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
well_info_free(ert_well_info);
|
well_info_free(ert_well_info);
|
||||||
|
@ -44,10 +44,10 @@ RimResultReservoir::RimResultReservoir()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimResultReservoir::openEclipseGridFile()
|
bool RimResultReservoir::openEclipseGridFile()
|
||||||
{
|
{
|
||||||
caf::ProgressInfo progInfo(20, "Reading Eclipse Grid File");
|
caf::ProgressInfo progInfo(50, "Reading Eclipse Grid File");
|
||||||
|
|
||||||
progInfo.setProgressDescription("Open Grid File");
|
progInfo.setProgressDescription("Open Grid File");
|
||||||
progInfo.setNextProgressIncrement(19);
|
progInfo.setNextProgressIncrement(48);
|
||||||
// Early exit if reservoir data is created
|
// Early exit if reservoir data is created
|
||||||
if (m_rigReservoir.notNull()) return true;
|
if (m_rigReservoir.notNull()) return true;
|
||||||
|
|
||||||
@ -107,13 +107,15 @@ bool RimResultReservoir::openEclipseGridFile()
|
|||||||
m_rigReservoir = reservoir;
|
m_rigReservoir = reservoir;
|
||||||
}
|
}
|
||||||
|
|
||||||
progInfo.setProgress(19);
|
progInfo.incrementProgress();
|
||||||
|
|
||||||
CVF_ASSERT(m_rigReservoir.notNull());
|
CVF_ASSERT(m_rigReservoir.notNull());
|
||||||
CVF_ASSERT(readerInterface.notNull());
|
CVF_ASSERT(readerInterface.notNull());
|
||||||
|
|
||||||
progInfo.setProgressDescription("Computing Faults");
|
progInfo.setProgressDescription("Computing Faults");
|
||||||
m_rigReservoir->computeFaults();
|
m_rigReservoir->computeFaults();
|
||||||
|
|
||||||
|
progInfo.incrementProgress();
|
||||||
progInfo.setProgressDescription("Computing Cache");
|
progInfo.setProgressDescription("Computing Cache");
|
||||||
m_rigReservoir->mainGrid()->computeCachedData();
|
m_rigReservoir->mainGrid()->computeCachedData();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user