Do not terminate when a grid calculation reads a cell index out of range

RigAllGridCellsResultAccessor bounds checked the cell index with an assert that is compiled out in release builds, and then called std::vector::at(), which throws. RimGridCalculation::getActiveCellValues() calls the accessor from an OpenMP loop, using active cell indices from the destination case to read results from the source case, so an index beyond the source result vector threw an exception that could not escape the parallel region and called std::terminate. Return undefined for an out of range index instead, and guard against a null result accessor.
This commit is contained in:
Magne Sjaastad committed 2026-08-10 10:07:32 +02:00
1 parent dd63083c13
commit ff7bf6c7c9
4 files changed
+72 -6

No files matched your search

@@ -635,6 +635,7 @@ std::vector<double> RimGridCalculation::getActiveCellValues( const QString&
size_t gridIndex = 0;
auto resultAccessor =
RigResultAccessorFactory::createFromResultAddress( eclipseCaseData, gridIndex, porosityModel, timeStepToUse, resAddr );
if ( resultAccessor.isNull() ) return {};
#pragma omp parallel for
for ( int i = 0; i < static_cast<int>( activeReservoirCells.size() ); i++ )