#10488 Element property values not shown in geomech view

Make sure element results are created only once
Make sure single element results access data for time step 0 and frame 0
This commit is contained in:
Magne Sjaastad 2023-08-15 15:50:25 +02:00
parent ef2de3e5c6
commit 002b7af350
2 changed files with 20 additions and 2 deletions

View File

@ -447,6 +447,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult( i
std::map<std::string, std::vector<float>> elementProperties =
m_elementPropertyReader->readAllElementPropertiesInFileContainingField( resVarAddr.fieldName );
// We are supposed to get here only once. Create result containers for all imported element results in one go
for ( auto& [addrString, values] : elementProperties )
{
RigFemResultAddress addressForElement( RIG_ELEMENT, addrString, "" );
@ -454,7 +455,18 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult( i
currentFrames->enableAsSingleStepResult();
currentFrames->frameData( 0, 0 ).swap( values );
}
return m_femPartResults[partIndex]->createScalarResult( resVarAddr );
// Try to find the element result and return it
frames = m_femPartResults[partIndex]->findScalarResult( resVarAddr );
if ( frames )
{
return frames;
}
else
{
// Create a dummy empty result
return m_femPartResults[partIndex]->createScalarResult( resVarAddr );
}
}
// We need to read the data as bulk fields, and populate the correct scalar caches

View File

@ -58,6 +58,8 @@ int RigFemScalarResultFrames::timeStepCount() const
//--------------------------------------------------------------------------------------------------
int RigFemScalarResultFrames::frameCount( int timeStepIndex ) const
{
if ( m_isSingleStepResult ) return 1;
if ( timeStepIndex >= timeStepCount() ) return 0;
return static_cast<int>( m_dataForEachFrame[timeStepIndex].size() );
@ -70,7 +72,11 @@ std::vector<float>& RigFemScalarResultFrames::frameData( int timeStepIndex, int
{
CVF_ASSERT( timeStepIndex < timeStepCount() );
if ( m_isSingleStepResult ) timeStepIndex = 0;
if ( m_isSingleStepResult )
{
timeStepIndex = 0;
frameIndex = 0;
}
int availFrames = int( m_dataForEachFrame[timeStepIndex].size() );