mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Update RifReaderEclipseOutput and RimEclipseCase to use new progress tasks
This commit is contained in:
parent
749e19a879
commit
22f7bf7c21
@ -125,8 +125,9 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigActiveCellInfo* activeCellIn
|
|||||||
mainGrid->nodes().resize(nodeStartIndex + cellCount*8, cvf::Vec3d(0,0,0));
|
mainGrid->nodes().resize(nodeStartIndex + cellCount*8, cvf::Vec3d(0,0,0));
|
||||||
|
|
||||||
int progTicks = 100;
|
int progTicks = 100;
|
||||||
double cellsPrProgressTick = cellCount/(float)progTicks;
|
int cellsPrProgressTick = std::max(1, cellCount/progTicks);
|
||||||
caf::ProgressInfo progInfo(progTicks, "");
|
caf::ProgressInfo progInfo(progTicks, "");
|
||||||
|
|
||||||
size_t computedCellCount = 0;
|
size_t computedCellCount = 0;
|
||||||
// Loop over cells and fill them with data
|
// Loop over cells and fill them with data
|
||||||
|
|
||||||
@ -187,10 +188,11 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigActiveCellInfo* activeCellIn
|
|||||||
//if (!invalid && (cell.isInCoarseCell() || (!cell.isActiveInMatrixModel() && !cell.isActiveInFractureModel()) ) )
|
//if (!invalid && (cell.isInCoarseCell() || (!cell.isActiveInMatrixModel() && !cell.isActiveInFractureModel()) ) )
|
||||||
cell.setInvalid(cell.isLongPyramidCell());
|
cell.setInvalid(cell.isLongPyramidCell());
|
||||||
|
|
||||||
#pragma omp atomic
|
#pragma omp critical
|
||||||
|
{
|
||||||
computedCellCount++;
|
computedCellCount++;
|
||||||
|
if (computedCellCount % cellsPrProgressTick == 0) progInfo.incrementProgress();
|
||||||
progInfo.setProgress((int)(computedCellCount/cellsPrProgressTick));
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -303,12 +305,11 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
|
|||||||
mainGrid->nodes().reserve(8*totalCellCount);
|
mainGrid->nodes().reserve(8*totalCellCount);
|
||||||
|
|
||||||
caf::ProgressInfo progInfo(3 + numLGRs, "");
|
caf::ProgressInfo progInfo(3 + numLGRs, "");
|
||||||
progInfo.setProgressDescription("Main Grid");
|
|
||||||
progInfo.setNextProgressIncrement(3);
|
|
||||||
|
|
||||||
|
{
|
||||||
|
auto task = progInfo.task("Loading Main Grid Data", 3);
|
||||||
transferGridCellData(mainGrid, activeCellInfo, fractureActiveCellInfo, mainGrid, mainEclGrid, 0, 0);
|
transferGridCellData(mainGrid, activeCellInfo, fractureActiveCellInfo, mainGrid, mainEclGrid, 0, 0);
|
||||||
|
}
|
||||||
progInfo.setProgress(3);
|
|
||||||
|
|
||||||
size_t globalMatrixActiveSize = ecl_grid_get_nactive(mainEclGrid);
|
size_t globalMatrixActiveSize = ecl_grid_get_nactive(mainEclGrid);
|
||||||
size_t globalFractureActiveSize = ecl_grid_get_nactive_fracture(mainEclGrid);
|
size_t globalFractureActiveSize = ecl_grid_get_nactive_fracture(mainEclGrid);
|
||||||
@ -324,7 +325,7 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
|
|||||||
|
|
||||||
for (lgrIdx = 0; lgrIdx < numLGRs; ++lgrIdx)
|
for (lgrIdx = 0; lgrIdx < numLGRs; ++lgrIdx)
|
||||||
{
|
{
|
||||||
progInfo.setProgressDescription("LGR number " + QString::number(lgrIdx+1));
|
auto task = progInfo.task("LGR number " + QString::number(lgrIdx + 1), 1);
|
||||||
|
|
||||||
ecl_grid_type* localEclGrid = ecl_grid_iget_lgr(mainEclGrid, lgrIdx);
|
ecl_grid_type* localEclGrid = ecl_grid_iget_lgr(mainEclGrid, lgrIdx);
|
||||||
RigLocalGrid* localGrid = static_cast<RigLocalGrid*>(mainGrid->gridByIndex(lgrIdx+1));
|
RigLocalGrid* localGrid = static_cast<RigLocalGrid*>(mainGrid->gridByIndex(lgrIdx+1));
|
||||||
@ -341,8 +342,6 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
|
|||||||
fractureActiveCellInfo->setGridActiveCellCounts(lgrIdx + 1, fractureActiveCellCount);
|
fractureActiveCellInfo->setGridActiveCellCounts(lgrIdx + 1, fractureActiveCellCount);
|
||||||
|
|
||||||
transferCoarseningInfo(localEclGrid, localGrid);
|
transferCoarseningInfo(localEclGrid, localGrid);
|
||||||
|
|
||||||
progInfo.setProgress(3 + lgrIdx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mainGrid->initAllSubGridsParentGridPointer();
|
mainGrid->initAllSubGridsParentGridPointer();
|
||||||
@ -358,9 +357,7 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
|
|||||||
bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* eclipseCase)
|
bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* eclipseCase)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(eclipseCase);
|
CVF_ASSERT(eclipseCase);
|
||||||
caf::ProgressInfo progInfo(100, "");
|
caf::ProgressInfo progress(100, "Reading Grid");
|
||||||
|
|
||||||
progInfo.setProgressDescription("Reading Grid");
|
|
||||||
|
|
||||||
if (!RifEclipseOutputFileTools::isValidEclipseFileName(fileName))
|
if (!RifEclipseOutputFileTools::isValidEclipseFileName(fileName))
|
||||||
{
|
{
|
||||||
@ -370,15 +367,18 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* e
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get set of files
|
|
||||||
QStringList fileSet;
|
QStringList fileSet;
|
||||||
|
{
|
||||||
|
auto task = progress.task("Get set of files");
|
||||||
|
|
||||||
if (!RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(fileName, &fileSet)) return false;
|
if (!RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(fileName, &fileSet)) return false;
|
||||||
|
|
||||||
m_fileName = fileName;
|
m_fileName = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
progInfo.incrementProgress();
|
ecl_grid_type* mainEclGrid = nullptr;
|
||||||
|
{
|
||||||
progInfo.setNextProgressIncrement(20);
|
auto task = progress.task("Open Init File and Load Main Grid", 19);
|
||||||
// Keep the set of files of interest
|
// Keep the set of files of interest
|
||||||
m_filesWithSameBaseName = fileSet;
|
m_filesWithSameBaseName = fileSet;
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* e
|
|||||||
|
|
||||||
// Read geometry
|
// Read geometry
|
||||||
// Todo: Needs to check existence of file before calling ert, else it will abort
|
// Todo: Needs to check existence of file before calling ert, else it will abort
|
||||||
ecl_grid_type* mainEclGrid = createMainGrid();
|
mainEclGrid = loadMainGrid();
|
||||||
if (!mainEclGrid)
|
if (!mainEclGrid)
|
||||||
{
|
{
|
||||||
QString errorMessage = QString(" Failed to create a main grid from file\n%1").arg(m_fileName);
|
QString errorMessage = QString(" Failed to create a main grid from file\n%1").arg(m_fileName);
|
||||||
@ -394,17 +394,15 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* e
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
progInfo.incrementProgress();
|
{
|
||||||
|
auto task = progress.task("Transferring grid geometry", 10);
|
||||||
progInfo.setNextProgressIncrement(10);
|
|
||||||
progInfo.setProgressDescription("Transferring grid geometry");
|
|
||||||
|
|
||||||
if (!transferGeometry(mainEclGrid, eclipseCase)) return false;
|
if (!transferGeometry(mainEclGrid, eclipseCase)) return false;
|
||||||
|
}
|
||||||
|
|
||||||
progInfo.incrementProgress();
|
{
|
||||||
progInfo.setProgressDescription("Reading faults");
|
auto task = progress.task("Reading faults", 10);
|
||||||
progInfo.setNextProgressIncrement(10);
|
|
||||||
|
|
||||||
if (isFaultImportEnabled())
|
if (isFaultImportEnabled())
|
||||||
{
|
{
|
||||||
@ -415,57 +413,56 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* e
|
|||||||
RigMainGrid* mainGrid = eclipseCase->mainGrid();
|
RigMainGrid* mainGrid = eclipseCase->mainGrid();
|
||||||
mainGrid->setFaults(faults);
|
mainGrid->setFaults(faults);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
progInfo.incrementProgress();
|
|
||||||
|
|
||||||
m_eclipseCase = eclipseCase;
|
m_eclipseCase = eclipseCase;
|
||||||
|
|
||||||
// Build results meta data
|
{
|
||||||
progInfo.setProgressDescription("Reading Result index");
|
auto task = progress.task("Reading Results Meta data", 25);
|
||||||
progInfo.setNextProgressIncrement(25);
|
|
||||||
buildMetaData(mainEclGrid);
|
buildMetaData(mainEclGrid);
|
||||||
progInfo.incrementProgress();
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto task = progress.task("Handling NCC data", 20);
|
||||||
if (isNNCsEnabled())
|
if (isNNCsEnabled())
|
||||||
{
|
{
|
||||||
progInfo.setProgressDescription("Reading NNC data");
|
caf::ProgressInfo nncProgress(10, "");
|
||||||
progInfo.setNextProgressIncrement(4);
|
|
||||||
|
{
|
||||||
|
auto subNncTask = nncProgress.task("Reading static NNC data");
|
||||||
transferStaticNNCData(mainEclGrid, m_ecl_init_file, eclipseCase->mainGrid());
|
transferStaticNNCData(mainEclGrid, m_ecl_init_file, eclipseCase->mainGrid());
|
||||||
progInfo.incrementProgress();
|
}
|
||||||
|
|
||||||
// This test should probably be improved to test more directly for presence of NNC data
|
// This test should probably be improved to test more directly for presence of NNC data
|
||||||
if (m_eclipseCase->results(RiaDefines::MATRIX_MODEL)->hasFlowDiagUsableFluxes())
|
if (m_eclipseCase->results(RiaDefines::MATRIX_MODEL)->hasFlowDiagUsableFluxes())
|
||||||
{
|
{
|
||||||
|
auto subNncTask = nncProgress.task("Reading dynamic NNC data");
|
||||||
transferDynamicNNCData(mainEclGrid, eclipseCase->mainGrid());
|
transferDynamicNNCData(mainEclGrid, eclipseCase->mainGrid());
|
||||||
}
|
}
|
||||||
progInfo.incrementProgress();
|
|
||||||
|
|
||||||
progInfo.setProgressDescription("Processing NNC data");
|
|
||||||
progInfo.setNextProgressIncrement(20);
|
|
||||||
eclipseCase->mainGrid()->nncData()->processConnections( *(eclipseCase->mainGrid()));
|
|
||||||
progInfo.incrementProgress();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
progInfo.setNextProgressIncrement(25);
|
auto subNncTask = nncProgress.task("Processing connections", 8);
|
||||||
progInfo.incrementProgress();
|
eclipseCase->mainGrid()->nncData()->processConnections(*(eclipseCase->mainGrid()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
progInfo.setNextProgressIncrement(8);
|
{
|
||||||
|
auto task = progress.task("Handling well information", 10);
|
||||||
if (!RiaApplication::instance()->preferences()->readerSettings()->skipWellData())
|
if (!RiaApplication::instance()->preferences()->readerSettings()->skipWellData())
|
||||||
{
|
{
|
||||||
progInfo.setProgressDescription("Reading Well information");
|
|
||||||
readWellCells(mainEclGrid, isImportOfCompleteMswDataEnabled());
|
readWellCells(mainEclGrid, isImportOfCompleteMswDataEnabled());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RiaLogging::info("Skipping import of simulation well data");
|
RiaLogging::info("Skipping import of simulation well data");
|
||||||
}
|
}
|
||||||
progInfo.incrementProgress();
|
}
|
||||||
|
|
||||||
progInfo.setProgressDescription("Releasing reader memory");
|
{
|
||||||
|
auto task = progress.task("Releasing reader memory", 5);
|
||||||
ecl_grid_free(mainEclGrid);
|
ecl_grid_free(mainEclGrid);
|
||||||
progInfo.incrementProgress();
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2200,7 +2197,7 @@ bool RifReaderEclipseOutput::isEclipseAndSoursimTimeStepsEqual(const QDateTime&
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
ecl_grid_type* RifReaderEclipseOutput::createMainGrid() const
|
ecl_grid_type* RifReaderEclipseOutput::loadMainGrid() const
|
||||||
{
|
{
|
||||||
ecl_grid_type* mainEclGrid = nullptr;
|
ecl_grid_type* mainEclGrid = nullptr;
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ private:
|
|||||||
|
|
||||||
static bool isEclipseAndSoursimTimeStepsEqual(const QDateTime& eclipseDateTime, const QDateTime& sourSimDateTime);
|
static bool isEclipseAndSoursimTimeStepsEqual(const QDateTime& eclipseDateTime, const QDateTime& sourSimDateTime);
|
||||||
|
|
||||||
ecl_grid_type* createMainGrid() const;
|
ecl_grid_type* loadMainGrid() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_fileName; // Name of file used to start accessing Eclipse output files
|
QString m_fileName; // Name of file used to start accessing Eclipse output files
|
||||||
|
@ -850,7 +850,8 @@ void RimGridCrossPlotCurveSet::exportFormattedData(RifEclipseDataTableFormatter&
|
|||||||
caf::ProgressInfo progress(m_groupedResults.size(), "Gathering Data Points");
|
caf::ProgressInfo progress(m_groupedResults.size(), "Gathering Data Points");
|
||||||
for (auto it = m_groupedResults.begin(); it != m_groupedResults.end(); ++it)
|
for (auto it = m_groupedResults.begin(); it != m_groupedResults.end(); ++it)
|
||||||
{
|
{
|
||||||
int groupIndex = it->first;
|
auto task = progress.task(QString("Exporting Group %1").arg(it->first));
|
||||||
|
|
||||||
RigEclipseCrossPlotResult res = it->second;
|
RigEclipseCrossPlotResult res = it->second;
|
||||||
|
|
||||||
for (size_t i = 0; i < it->second.xValues.size(); ++i)
|
for (size_t i = 0; i < it->second.xValues.size(); ++i)
|
||||||
@ -862,6 +863,7 @@ void RimGridCrossPlotCurveSet::exportFormattedData(RifEclipseDataTableFormatter&
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int groupIndex = it->first;
|
||||||
QString groupName = createGroupName(groupIndex);
|
QString groupName = createGroupName(groupIndex);
|
||||||
formatter.add(res.xValues[i]);
|
formatter.add(res.xValues[i]);
|
||||||
formatter.add(res.yValues[i]);
|
formatter.add(res.yValues[i]);
|
||||||
@ -870,7 +872,6 @@ void RimGridCrossPlotCurveSet::exportFormattedData(RifEclipseDataTableFormatter&
|
|||||||
}
|
}
|
||||||
formatter.rowCompleted();
|
formatter.rowCompleted();
|
||||||
}
|
}
|
||||||
progress.incrementProgress();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,21 +518,24 @@ void RimEclipseCase::computeCachedData()
|
|||||||
if (rigEclipseCase)
|
if (rigEclipseCase)
|
||||||
{
|
{
|
||||||
caf::ProgressInfo pInf(30, "");
|
caf::ProgressInfo pInf(30, "");
|
||||||
pInf.setNextProgressIncrement(1);
|
|
||||||
|
{
|
||||||
|
auto task = pInf.task("", 1);
|
||||||
rigEclipseCase->computeActiveCellBoundingBoxes();
|
rigEclipseCase->computeActiveCellBoundingBoxes();
|
||||||
pInf.incrementProgress();
|
}
|
||||||
|
|
||||||
pInf.setNextProgressIncrement(10);
|
{
|
||||||
pInf.setProgressDescription("Calculating Cell Search Tree");
|
auto task = pInf.task("Calculating Cell Search Tree", 10);
|
||||||
rigEclipseCase->mainGrid()->computeCachedData();
|
rigEclipseCase->mainGrid()->computeCachedData();
|
||||||
pInf.incrementProgress();
|
}
|
||||||
|
|
||||||
pInf.setNextProgressIncrement(17);
|
{
|
||||||
pInf.setProgressDescription("Calculating faults");
|
auto task = pInf.task("Calculating faults", 17);
|
||||||
rigEclipseCase->mainGrid()->calculateFaults(rigEclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL));
|
rigEclipseCase->mainGrid()->calculateFaults(rigEclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL));
|
||||||
pInf.incrementProgress();
|
}
|
||||||
|
|
||||||
pInf.setProgressDescription("Calculating Formation Names Result");
|
{
|
||||||
|
auto task = pInf.task("Calculating Formation Names Result", 2);
|
||||||
if (activeFormationNames())
|
if (activeFormationNames())
|
||||||
{
|
{
|
||||||
rigEclipseCase->setActiveFormationNames(activeFormationNames()->formationNamesData());
|
rigEclipseCase->setActiveFormationNames(activeFormationNames()->formationNamesData());
|
||||||
@ -541,8 +544,7 @@ void RimEclipseCase::computeCachedData()
|
|||||||
{
|
{
|
||||||
rigEclipseCase->setActiveFormationNames(nullptr);
|
rigEclipseCase->setActiveFormationNames(nullptr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
pInf.incrementProgress();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
void incrementProgress();
|
void incrementProgress();
|
||||||
void setNextProgressIncrement(size_t nextStepSize);
|
void setNextProgressIncrement(size_t nextStepSize);
|
||||||
|
|
||||||
ProgressTask task(const QString& description, int stepSize);
|
ProgressTask task(const QString& description, int stepSize = 1);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user