#3531 Temporary LGR : Simplify adding of grid to active cell info

This commit is contained in:
Magne Sjaastad 2018-10-24 12:07:36 +02:00
parent e33bfc895f
commit 6445ab05fe
5 changed files with 38 additions and 26 deletions

View File

@ -69,20 +69,14 @@ public:
sizes.k() / (mainGridEndCell.k() - mainGridStartCell.k() + 1)); sizes.k() / (mainGridEndCell.k() - mainGridStartCell.k() + 1));
} }
int cellCount() const size_t cellCount() const
{ {
return (int)(sizes.i() * sizes.j() * sizes.k()); return sizes.i() * sizes.j() * sizes.k();
}
int cellCountPerMainGridCell() const
{
auto s = sizesPerMainGridCell();
return (int)(s.i() * s.j() * s.k());
} }
int id; int id;
QString name; QString name;
caf::VecIjk sizes; caf::VecIjk sizes;
//std::vector<double> values;
caf::VecIjk mainGridStartCell; caf::VecIjk mainGridStartCell;
caf::VecIjk mainGridEndCell; caf::VecIjk mainGridEndCell;

View File

@ -124,14 +124,12 @@ void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked)
for (auto lgr : lgrs) for (auto lgr : lgrs)
{ {
int totalCellCountBeforLgr = (int)mainGrid->globalCellArray().size();
createLgr(lgr, eclipseCase->eclipseCaseData()->mainGrid()); createLgr(lgr, eclipseCase->eclipseCaseData()->mainGrid());
int lgrCellCount = lgr.cellCount(); size_t lgrCellCount = lgr.cellCount();
activeCellInfo->addLgr(totalCellCountBeforLgr, lgrCellCount); activeCellInfo->addLgr(lgrCellCount);
fractureActiveCellInfo->addLgr(totalCellCountBeforLgr, lgrCellCount); fractureActiveCellInfo->addLgr(lgrCellCount);
} }
mainGrid->calculateFaults(activeCellInfo, true); mainGrid->calculateFaults(activeCellInfo, true);
@ -143,6 +141,7 @@ void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked)
} }
deleteAllCachedData(eclipseCase); deleteAllCachedData(eclipseCase);
computeCachedData(eclipseCase);
activeView->loadDataAndUpdate(); activeView->loadDataAndUpdate();
@ -274,6 +273,23 @@ void RicCreateTemporaryLgrFeature::deleteAllCachedData(RimEclipseCase* eclipseCa
if (eclipseCaseData) if (eclipseCaseData)
{ {
eclipseCaseData->clearWellCellsInGridCache(); 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->mainGrid()->computeCachedData();
eclipseCaseData->computeActiveCellBoundingBoxes(); eclipseCaseData->computeActiveCellBoundingBoxes();
} }
@ -282,12 +298,13 @@ void RicCreateTemporaryLgrFeature::deleteAllCachedData(RimEclipseCase* eclipseCa
{ {
cellResultsDataMatrix->computeDepthRelatedResults(); cellResultsDataMatrix->computeDepthRelatedResults();
} }
if (cellResultsDataFracture) if (cellResultsDataFracture)
{ {
cellResultsDataFracture->computeDepthRelatedResults(); cellResultsDataFracture->computeDepthRelatedResults();
} }
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -49,6 +49,7 @@ protected:
private: private:
static void createLgr(LgrInfo& lgrInfo, RigMainGrid* mainGrid); static void createLgr(LgrInfo& lgrInfo, RigMainGrid* mainGrid);
static void deleteAllCachedData(RimEclipseCase* eclipseCase); static void deleteAllCachedData(RimEclipseCase* eclipseCase);
static void computeCachedData(RimEclipseCase* eclipseCase);
static std::vector<RimWellPath*> selectedWellPaths(); static std::vector<RimWellPath*> selectedWellPaths();
static bool containsAnyNonMainGridCells(const std::vector<RigCompletionDataGridCell>& cells); static bool containsAnyNonMainGridCells(const std::vector<RigCompletionDataGridCell>& cells);

View File

@ -196,21 +196,21 @@ void RigActiveCellInfo::clear()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigActiveCellInfo::addLgr(int lgrStartIndex, int cellCount) void RigActiveCellInfo::addLgr(size_t cellCount)
{ {
GridActiveCellCounts count; size_t currentGridCount = m_perGridActiveCellInfo.size();
count.setActiveCellCount(cellCount); size_t currentActiveCellCount = reservoirActiveCellCount();
m_perGridActiveCellInfo.push_back(count); size_t currentReservoirCellCount = reservoirCellCount();
auto prevActiveCount = m_reservoirActiveCellCount; setGridCount(currentGridCount + 1);
auto newActiveCount = prevActiveCount + cellCount; setGridActiveCellCounts(currentGridCount, cellCount);
m_cellIndexToResultIndex.resize(lgrStartIndex + cellCount, cvf::UNDEFINED_SIZE_T); setReservoirCellCount(currentReservoirCellCount + cellCount);
m_reservoirActiveCellCount = newActiveCount;
m_reservoirCellResultCount = newActiveCount;
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);
} }
} }

View File

@ -56,7 +56,7 @@ public:
void clear(); void clear();
void addLgr(int lgrStartIndex, int cellCount); void addLgr(size_t cellCount);
private: private:
class GridActiveCellCounts class GridActiveCellCounts