From e33bfc895fa08707af9fb26d26d4d82d06d3182d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 24 Oct 2018 11:28:40 +0200 Subject: [PATCH] #3531 Temporary LGR : Reorganize clearing of cache data --- .../Commands/RicCreateTemporaryLgrFeature.cpp | 44 +++++++++++++++++-- .../Commands/RicCreateTemporaryLgrFeature.h | 1 + 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.cpp b/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.cpp index 7b1639a2a5..24760a8c75 100644 --- a/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.cpp +++ b/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.cpp @@ -142,11 +142,8 @@ void RicCreateTemporaryLgrFeature::onActionTriggered(bool isChecked) } } - eclipseCase->results(RiaDefines::MATRIX_MODEL)->freeAllocatedResultsData(); - eclipseCase->results(RiaDefines::FRACTURE_MODEL)->freeAllocatedResultsData(); + deleteAllCachedData(eclipseCase); - eclipseCase->eclipseCaseData()->clearWellCellsInGridCache(); - eclipseCase->eclipseCaseData()->mainGrid()->computeCachedData(); activeView->loadDataAndUpdate(); if (intersectsExistingLgr) @@ -254,6 +251,45 @@ void RicCreateTemporaryLgrFeature::createLgr(LgrInfo& lgrInfo, RigMainGrid* main localGrid->setParentGrid(mainGrid); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateTemporaryLgrFeature::deleteAllCachedData(RimEclipseCase* eclipseCase) +{ + if (eclipseCase) + { + RigCaseCellResultsData* cellResultsDataMatrix = eclipseCase->results(RiaDefines::MATRIX_MODEL); + if (cellResultsDataMatrix) + { + cellResultsDataMatrix->freeAllocatedResultsData(); + } + + RigCaseCellResultsData* cellResultsDataFracture = eclipseCase->results(RiaDefines::FRACTURE_MODEL); + if (cellResultsDataFracture) + { + cellResultsDataFracture->freeAllocatedResultsData(); + } + + RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); + if (eclipseCaseData) + { + eclipseCaseData->clearWellCellsInGridCache(); + eclipseCaseData->mainGrid()->computeCachedData(); + eclipseCaseData->computeActiveCellBoundingBoxes(); + } + + if (cellResultsDataMatrix) + { + cellResultsDataMatrix->computeDepthRelatedResults(); + } + + if (cellResultsDataFracture) + { + cellResultsDataFracture->computeDepthRelatedResults(); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.h b/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.h index 080d1b2bab..1398045eb0 100644 --- a/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.h +++ b/ApplicationCode/Commands/RicCreateTemporaryLgrFeature.h @@ -48,6 +48,7 @@ protected: private: static void createLgr(LgrInfo& lgrInfo, RigMainGrid* mainGrid); + static void deleteAllCachedData(RimEclipseCase* eclipseCase); static std::vector selectedWellPaths(); static bool containsAnyNonMainGridCells(const std::vector& cells);