#14345 Compute ResInsight-calculated results when loading a single time step

findOrLoadKnownScalarResultForTimeStep() tried to read ResInsight-
calculated results like riOILVOLUME from the restart file. For lazily
loaded grid case group members these results are never computed, so
every cell ended up undefined and the grid calculator produced zero
sums for all additional cases.

Delegate to findOrLoadKnownScalarResult(), which dispatches to the
result calculators, for results flagged as must-be-calculated and for
the ri* volume results. Already computed data is not computed again.
This commit is contained in:
Kristian Bendiksen authored and Magne Sjaastad committed 2026-09-07 11:18:09 +02:00
1 parent c2f19344d4
commit 4c143482bb
1 file changed
+11
@@ -1817,6 +1817,17 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResultForTimeStep( const Rig
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T ) return cvf::UNDEFINED_SIZE_T;
if ( type == RiaDefines::ResultCatType::GENERATED ) return scalarResultIndex;
// Results computed by ResInsight (e.g. riOILVOLUME) can not be read from file for a single time step.
// Delegate to findOrLoadKnownScalarResult(), which computes all time steps using the result
// calculators. Data already present is not computed again.
const bool isComputedResult = mustBeCalculated( scalarResultIndex ) || resultName == RiaResultNames::riCellVolumeResultName() ||
resultName == RiaResultNames::riOilVolumeResultName() || resultName == RiaResultNames::riPorvSoil() ||
resultName == RiaResultNames::riPorvSgas() || resultName == RiaResultNames::riPorvSoilSgas();
if ( isComputedResult )
{
return findOrLoadKnownScalarResult( resVarAddr );
}
if ( m_readerInterface.notNull() )
{
size_t timeStepCount = infoForEachResultIndex()[scalarResultIndex].timeStepInfos().size();