mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3531 Temporary LGR : Simplify adding of grid to active cell info
This commit is contained in:
parent
e33bfc895f
commit
6445ab05fe
@ -69,20 +69,14 @@ public:
|
||||
sizes.k() / (mainGridEndCell.k() - mainGridStartCell.k() + 1));
|
||||
}
|
||||
|
||||
int cellCount() const
|
||||
size_t cellCount() const
|
||||
{
|
||||
return (int)(sizes.i() * sizes.j() * sizes.k());
|
||||
}
|
||||
int cellCountPerMainGridCell() const
|
||||
{
|
||||
auto s = sizesPerMainGridCell();
|
||||
return (int)(s.i() * s.j() * s.k());
|
||||
return sizes.i() * sizes.j() * sizes.k();
|
||||
}
|
||||
|
||||
int id;
|
||||
QString name;
|
||||
caf::VecIjk sizes;
|
||||
//std::vector<double> values;
|
||||
|
||||
caf::VecIjk mainGridStartCell;
|
||||
caf::VecIjk mainGridEndCell;
|
||||
|
@ -124,14 +124,12 @@ void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
for (auto lgr : lgrs)
|
||||
{
|
||||
int totalCellCountBeforLgr = (int)mainGrid->globalCellArray().size();
|
||||
|
||||
createLgr(lgr, eclipseCase->eclipseCaseData()->mainGrid());
|
||||
|
||||
int lgrCellCount = lgr.cellCount();
|
||||
size_t lgrCellCount = lgr.cellCount();
|
||||
|
||||
activeCellInfo->addLgr(totalCellCountBeforLgr, lgrCellCount);
|
||||
fractureActiveCellInfo->addLgr(totalCellCountBeforLgr, lgrCellCount);
|
||||
activeCellInfo->addLgr(lgrCellCount);
|
||||
fractureActiveCellInfo->addLgr(lgrCellCount);
|
||||
}
|
||||
|
||||
mainGrid->calculateFaults(activeCellInfo, true);
|
||||
@ -143,6 +141,7 @@ void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked)
|
||||
}
|
||||
|
||||
deleteAllCachedData(eclipseCase);
|
||||
computeCachedData(eclipseCase);
|
||||
|
||||
activeView->loadDataAndUpdate();
|
||||
|
||||
@ -274,6 +273,23 @@ void RicCreateTemporaryLgrFeature::deleteAllCachedData(RimEclipseCase* eclipseCa
|
||||
if (eclipseCaseData)
|
||||
{
|
||||
eclipseCaseData->clearWellCellsInGridCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTemporaryLgrFeature::computeCachedData(RimEclipseCase* eclipseCase)
|
||||
{
|
||||
if (eclipseCase)
|
||||
{
|
||||
RigCaseCellResultsData* cellResultsDataMatrix = eclipseCase->results(RiaDefines::MATRIX_MODEL);
|
||||
RigCaseCellResultsData* cellResultsDataFracture = eclipseCase->results(RiaDefines::FRACTURE_MODEL);
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
|
||||
if (eclipseCaseData)
|
||||
{
|
||||
eclipseCaseData->mainGrid()->computeCachedData();
|
||||
eclipseCaseData->computeActiveCellBoundingBoxes();
|
||||
}
|
||||
@ -282,12 +298,13 @@ void RicCreateTemporaryLgrFeature::deleteAllCachedData(RimEclipseCase* eclipseCa
|
||||
{
|
||||
cellResultsDataMatrix->computeDepthRelatedResults();
|
||||
}
|
||||
|
||||
|
||||
if (cellResultsDataFracture)
|
||||
{
|
||||
cellResultsDataFracture->computeDepthRelatedResults();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -49,6 +49,7 @@ protected:
|
||||
private:
|
||||
static void createLgr(LgrInfo& lgrInfo, RigMainGrid* mainGrid);
|
||||
static void deleteAllCachedData(RimEclipseCase* eclipseCase);
|
||||
static void computeCachedData(RimEclipseCase* eclipseCase);
|
||||
|
||||
static std::vector<RimWellPath*> selectedWellPaths();
|
||||
static bool containsAnyNonMainGridCells(const std::vector<RigCompletionDataGridCell>& cells);
|
||||
|
@ -196,21 +196,21 @@ void RigActiveCellInfo::clear()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigActiveCellInfo::addLgr(int lgrStartIndex, int cellCount)
|
||||
void RigActiveCellInfo::addLgr(size_t cellCount)
|
||||
{
|
||||
GridActiveCellCounts count;
|
||||
count.setActiveCellCount(cellCount);
|
||||
m_perGridActiveCellInfo.push_back(count);
|
||||
size_t currentGridCount = m_perGridActiveCellInfo.size();
|
||||
size_t currentActiveCellCount = reservoirActiveCellCount();
|
||||
size_t currentReservoirCellCount = reservoirCellCount();
|
||||
|
||||
auto prevActiveCount = m_reservoirActiveCellCount;
|
||||
auto newActiveCount = prevActiveCount + cellCount;
|
||||
m_cellIndexToResultIndex.resize(lgrStartIndex + cellCount, cvf::UNDEFINED_SIZE_T);
|
||||
m_reservoirActiveCellCount = newActiveCount;
|
||||
m_reservoirCellResultCount = newActiveCount;
|
||||
setGridCount(currentGridCount + 1);
|
||||
setGridActiveCellCounts(currentGridCount, cellCount);
|
||||
setReservoirCellCount(currentReservoirCellCount + cellCount);
|
||||
|
||||
for (int i = 0; i < cellCount; i++)
|
||||
computeDerivedData();
|
||||
|
||||
for (size_t i = 0; i < cellCount; i++)
|
||||
{
|
||||
m_cellIndexToResultIndex[lgrStartIndex + i] = prevActiveCount + i;
|
||||
setCellResultIndex(currentReservoirCellCount + i, currentActiveCellCount + i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
|
||||
void clear();
|
||||
|
||||
void addLgr(int lgrStartIndex, int cellCount);
|
||||
void addLgr(size_t cellCount);
|
||||
|
||||
private:
|
||||
class GridActiveCellCounts
|
||||
|
Loading…
Reference in New Issue
Block a user