#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 = std::map<std::string, std::vector<float>> elementProperties =
m_elementPropertyReader->readAllElementPropertiesInFileContainingField( resVarAddr.fieldName ); 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 ) for ( auto& [addrString, values] : elementProperties )
{ {
RigFemResultAddress addressForElement( RIG_ELEMENT, addrString, "" ); RigFemResultAddress addressForElement( RIG_ELEMENT, addrString, "" );
@ -454,8 +455,19 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult( i
currentFrames->enableAsSingleStepResult(); currentFrames->enableAsSingleStepResult();
currentFrames->frameData( 0, 0 ).swap( values ); currentFrames->frameData( 0, 0 ).swap( values );
} }
// 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 ); return m_femPartResults[partIndex]->createScalarResult( resVarAddr );
} }
}
// We need to read the data as bulk fields, and populate the correct scalar caches // 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 int RigFemScalarResultFrames::frameCount( int timeStepIndex ) const
{ {
if ( m_isSingleStepResult ) return 1;
if ( timeStepIndex >= timeStepCount() ) return 0; if ( timeStepIndex >= timeStepCount() ) return 0;
return static_cast<int>( m_dataForEachFrame[timeStepIndex].size() ); return static_cast<int>( m_dataForEachFrame[timeStepIndex].size() );
@ -70,7 +72,11 @@ std::vector<float>& RigFemScalarResultFrames::frameData( int timeStepIndex, int
{ {
CVF_ASSERT( timeStepIndex < timeStepCount() ); CVF_ASSERT( timeStepIndex < timeStepCount() );
if ( m_isSingleStepResult ) timeStepIndex = 0; if ( m_isSingleStepResult )
{
timeStepIndex = 0;
frameIndex = 0;
}
int availFrames = int( m_dataForEachFrame[timeStepIndex].size() ); int availFrames = int( m_dataForEachFrame[timeStepIndex].size() );