From 77c3548f24a8d610faddb9e50bd8bec2f7d6e2f3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 9 Oct 2025 14:59:07 +0200 Subject: [PATCH] Fixes active index usage for radial LGR grids Ensures that active cell indexing is always used for temporary local grid refinements (LGRs) of radial multi-grids. The TestCase_Completions_Export loads a grid with several LGRs. This test case failed due to the changes for radial grids. --- .../RigResultAccessorFactory.cpp | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp b/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp index c945ad6395..ea5e04f0eb 100644 --- a/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp +++ b/ApplicationLibCode/ReservoirDataModel/ResultAccessors/RigResultAccessorFactory.cpp @@ -371,9 +371,26 @@ cvf::ref RigResultAccessorFactory::createNativeFromResultAddr bool useGlobalActiveIndex = eclipseCase->results( porosityModel )->isUsingGlobalActiveIndex( resultAddress ); if ( eclipseCase->mainGrid()->gridCount() > 1 ) { - // Always use active cell indexing for multi-grid cases. If all cells in the main grid is active, and a local grid is created, this - // option must be set to true - useGlobalActiveIndex = true; + bool isRadialTempGrid = [&eclipseCase]() -> bool + { + for ( size_t gIdx = 0; gIdx < eclipseCase->gridCount(); gIdx++ ) + { + auto currentGrid = eclipseCase->grid( gIdx ); + if ( currentGrid && currentGrid->isRadial() && currentGrid->isTempGrid() ) + { + return true; + } + } + + return false; + }(); + + if ( isRadialTempGrid ) + { + // Always use active cell indexing for temporary LGRs of radial multi-grids. If all cells in the main grid is active, and a + // local grid is created, this option must be set to true + useGlobalActiveIndex = true; + } } if ( useGlobalActiveIndex ) {