#5920 Allan Diagrams : Avoid computation until required

This commit is contained in:
Magne Sjaastad
2020-05-13 10:34:54 +02:00
parent 24d58e3a98
commit 87f1535888
2 changed files with 17 additions and 6 deletions

View File

@@ -1937,6 +1937,8 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen
int frmIdx2 = it->first.second; int frmIdx2 = it->first.second;
int combIndex = it->second; int combIndex = it->second;
if ( frmIdx1 >= fnVector.size() || frmIdx2 >= fnVector.size() ) continue;
QString frmName1 = fnVector[frmIdx1]; QString frmName1 = fnVector[frmIdx1];
QString frmName2 = fnVector[frmIdx2]; QString frmName2 = fnVector[frmIdx2];

View File

@@ -1420,6 +1420,12 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
computeOilVolumes(); computeOilVolumes();
} }
// Allan results
if ( resultName == RiaDefines::formationAllanResultName() || resultName == RiaDefines::formationBinaryAllanResultName() )
{
computeAllanResults( this, m_ownerMainGrid );
}
// Handle SourSimRL reading // Handle SourSimRL reading
if ( type == RiaDefines::ResultCatType::SOURSIMRL ) if ( type == RiaDefines::ResultCatType::SOURSIMRL )
@@ -2961,7 +2967,11 @@ void RigCaseCellResultsData::setActiveFormationNames( RigFormationNames* activeF
} }
} }
computeAllanResults( this, m_ownerMainGrid ); // As the Allan formation diagram is depending on formation results, we need to clear the data set
// Will be recomputed when required
auto fnNamesResAddr =
RigEclipseResultAddress( RiaDefines::ResultCatType::ALLAN_DIAGRAMS, RiaDefines::formationAllanResultName() );
clearScalarResult( fnNamesResAddr );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -3078,12 +3088,11 @@ void RigCaseCellResultsData::computeAllanResults( RigCaseCellResultsData* cellRe
CVF_ASSERT( mainGrid ); CVF_ASSERT( mainGrid );
CVF_ASSERT( cellResultsData ); CVF_ASSERT( cellResultsData );
auto fnNamesResAddr = RigEclipseResultAddress( RiaDefines::ResultCatType::FORMATION_NAMES, if ( cellResultsData && cellResultsData->activeFormationNames() &&
RiaDefines::activeFormationNamesResultName() ); !cellResultsData->activeFormationNames()->formationNames().empty() )
bool hasFormationData = cellResultsData->hasResultEntry( fnNamesResAddr );
if ( hasFormationData )
{ {
auto fnNamesResAddr = RigEclipseResultAddress( RiaDefines::ResultCatType::FORMATION_NAMES,
RiaDefines::activeFormationNamesResultName() );
auto fnAllanResultResAddr = auto fnAllanResultResAddr =
RigEclipseResultAddress( RiaDefines::ResultCatType::ALLAN_DIAGRAMS, RiaDefines::formationAllanResultName() ); RigEclipseResultAddress( RiaDefines::ResultCatType::ALLAN_DIAGRAMS, RiaDefines::formationAllanResultName() );
auto fnBinAllanResAddr = RigEclipseResultAddress( RiaDefines::ResultCatType::ALLAN_DIAGRAMS, auto fnBinAllanResAddr = RigEclipseResultAddress( RiaDefines::ResultCatType::ALLAN_DIAGRAMS,