Early return if data already is available

If not checking if data is available, data is read from file and appended to result vector.
This commit is contained in:
Magne Sjaastad committed 2024-04-15 10:33:56 +02:00
1 parent d6a1db843f
commit 274d4fc0db
1 file changed
+7 -1
@@ -1587,6 +1587,13 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResultByResultTypeOrder( con
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
size_t RigCaseCellResultsData::findOrLoadKnownScalarResultForTimeStep( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex ) size_t RigCaseCellResultsData::findOrLoadKnownScalarResultForTimeStep( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex )
{ {
size_t scalarResultIndex = findScalarResultIndexFromAddress( resVarAddr );
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T )
{
return cvf::UNDEFINED_SIZE_T;
}
if ( isDataPresent( scalarResultIndex ) ) return scalarResultIndex;
RiaDefines::ResultCatType type = resVarAddr.resultCatType(); RiaDefines::ResultCatType type = resVarAddr.resultCatType();
QString resultName = resVarAddr.resultName(); QString resultName = resVarAddr.resultName();
@@ -1615,7 +1622,6 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResultForTimeStep( const Rig
return completionTypeScalarResultIndex; return completionTypeScalarResultIndex;
} }
size_t scalarResultIndex = findScalarResultIndexFromAddress( resVarAddr );
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T ) return cvf::UNDEFINED_SIZE_T; if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T ) return cvf::UNDEFINED_SIZE_T;
if ( type == RiaDefines::ResultCatType::GENERATED ) if ( type == RiaDefines::ResultCatType::GENERATED )