Use the last frame for each timestep.

This commit is contained in:
jonjenssen 2021-10-15 16:55:55 +02:00 committed by jonjenssen
parent b169900c41
commit ae7139e18d
3 changed files with 32 additions and 32 deletions

View File

@ -503,36 +503,35 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult( i
{
std::vector<double> frameTimes = m_readerInterface->frameTimes( stepIndex );
for ( int fIdx = 1; (size_t)fIdx < frameTimes.size() && fIdx < 2; ++fIdx ) // Read only the second frame
{
std::vector<std::vector<float>*> componentDataVectors;
for ( auto& componentResult : resultsForEachComponent )
{
componentDataVectors.push_back( &( componentResult->frameData( stepIndex ) ) );
}
int fIdx = (int)( frameTimes.size() - 1 );
switch ( resVarAddr.resultPosType )
{
case RIG_NODAL:
m_readerInterface->readNodeField( resVarAddr.fieldName, partIndex, stepIndex, fIdx, &componentDataVectors );
break;
case RIG_ELEMENT_NODAL:
m_readerInterface->readElementNodeField( resVarAddr.fieldName,
partIndex,
stepIndex,
fIdx,
&componentDataVectors );
break;
case RIG_INTEGRATION_POINT:
m_readerInterface->readIntegrationPointField( resVarAddr.fieldName,
partIndex,
stepIndex,
fIdx,
&componentDataVectors );
break;
default:
break;
}
std::vector<std::vector<float>*> componentDataVectors;
for ( auto& componentResult : resultsForEachComponent )
{
componentDataVectors.push_back( &( componentResult->frameData( stepIndex ) ) );
}
switch ( resVarAddr.resultPosType )
{
case RIG_NODAL:
m_readerInterface->readNodeField( resVarAddr.fieldName, partIndex, stepIndex, fIdx, &componentDataVectors );
break;
case RIG_ELEMENT_NODAL:
m_readerInterface->readElementNodeField( resVarAddr.fieldName,
partIndex,
stepIndex,
fIdx,
&componentDataVectors );
break;
case RIG_INTEGRATION_POINT:
m_readerInterface->readIntegrationPointField( resVarAddr.fieldName,
partIndex,
stepIndex,
fIdx,
&componentDataVectors );
break;
default:
break;
}
progress.incrementProgress();

View File

@ -168,7 +168,8 @@ bool RigGeoMechCaseData::readDisplacements( std::string* errorMessag
#ifdef USE_ODB_API
if ( m_readerInterface.notNull() && m_readerInterface->isOpen() )
{
m_readerInterface->readDisplacements( partId, timeStep, 1, displacements );
const auto& frames = m_readerInterface->frameTimes( timeStep );
m_readerInterface->readDisplacements( partId, timeStep, (int)frames.size() - 1, displacements );
return true;
}

View File

@ -250,8 +250,8 @@ std::map<RifOdbReader::RifOdbResultKey, std::vector<std::string>> RifOdbReader::
if ( stepFrames.size() > 1 )
{
// Optimization: Get results metadata for the second frame of the first step only
const odb_Frame& frame = stepFrames.constGet( 1 );
// Optimization: Get results metadata for the last frame of the first step only
const odb_Frame& frame = stepFrames.constGet( stepFrames.size() - 1 );
const odb_FieldOutputRepository& fieldCon = frame.fieldOutputs();
odb_FieldOutputRepositoryIT fieldConIT( fieldCon );