VTK: Add displacement field U with components U1/U2/U3 in RifVtkReader

This commit is contained in:
Magne Sjaastad committed 2026-04-14 14:56:43 +02:00
1 parent 4ae60f1818
commit 1f0c47fb5f
2 files changed
+26 -1

No files matched your search

@@ -576,9 +576,10 @@ std::map<std::string, std::vector<std::string>> RigFemPartResultsCollection::sca
fieldCompNames[RigFemAddressDefines::porBar()];
if ( fieldCompNames.contains( "VOIDR" ) ) fieldCompNames["PORO-PERM"].push_back( "PHI0" );
if ( fieldCompNames.contains( "U" ) ) fieldCompNames["U"].push_back( "U_LENGTH" );
if ( m_readerInterface->populateDerivedResultNames() )
{
if ( fieldCompNames.contains( "U" ) ) fieldCompNames["U"].push_back( "U_LENGTH" );
fieldCompNames[FIELD_NAME_COMPACTION];
}
}
@@ -376,6 +376,8 @@ std::map<std::string, std::vector<std::string>> RifVtkReader::scalarNodeFieldAnd
retVal[entry.first] = {};
}
retVal["U"] = { "U1", "U2", "U3" };
return retVal;
}
@@ -466,6 +468,28 @@ void RifVtkReader::readNodeField( const std::string& fieldName,
int frameIndex,
std::vector<std::vector<float>*>* resultValues )
{
CVF_ASSERT( resultValues );
if ( fieldName == "U" )
{
std::vector<cvf::Vec3f> disp;
readDisplacements( partIndex, stepIndex, frameIndex, &disp );
if ( disp.empty() ) return;
size_t n = disp.size();
for ( int comp = 0; comp < 3 && comp < static_cast<int>( resultValues->size() ); comp++ )
{
if ( ( *resultValues )[comp] == nullptr ) continue;
( *resultValues )[comp]->resize( n );
for ( size_t i = 0; i < n; i++ )
{
( *( *resultValues )[comp] )[i] = disp[i][comp];
}
}
return;
}
readField( RigFemResultPosEnum::RIG_NODAL, fieldName, partIndex, stepIndex, resultValues );
}