From 132fd41bf474518cbf273293a4d97d11781b54dd Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 27 Jan 2023 17:42:27 +0100 Subject: [PATCH] Show element ID, not element Index in mohrs plot legend --- .../UserInterface/RiuMohrsCirclePlot.cpp | 20 ++++++++++++++++--- .../UserInterface/RiuMohrsCirclePlot.h | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp b/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp index 7a6d6e566b..cf36d228e7 100644 --- a/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp @@ -110,8 +110,11 @@ void RiuMohrsCirclePlot::appendSelection( const RiuSelectionItem* selectionItem if ( geoMechSelectionItem ) { - const size_t gridIndex = geoMechSelectionItem->m_gridIndex; + const size_t gridIndex = geoMechSelectionItem->m_gridIndex; + RigFemPart* femPart = geoMechSelectionItem->m_resultDefinition->ownerCaseData()->femParts()->part( gridIndex ); + const size_t cellIndex = geoMechSelectionItem->m_cellIndex; + const int elmId = femPart->elmId( cellIndex ); const cvf::Color3f color = geoMechSelectionItem->m_color; addOrUpdateCurves( geoMechSelectionItem->m_resultDefinition, @@ -119,6 +122,7 @@ void RiuMohrsCirclePlot::appendSelection( const RiuSelectionItem* selectionItem geoMechSelectionItem->m_frameIdx, gridIndex, cellIndex, + elmId, cvf::Color3ub( color ) ); updatePlot(); @@ -173,7 +177,13 @@ void RiuMohrsCirclePlot::updateOnTimeStepChanged( Rim3dView* changedView ) for ( const MohrsCirclesInfo& mohrInfo : mohrsCiclesInfosCopy ) { - addOrUpdateCurves( mohrInfo.geomResDef, stepIdx, frameIdx, mohrInfo.gridIndex, mohrInfo.elmIndex, mohrInfo.color ); + addOrUpdateCurves( mohrInfo.geomResDef, + stepIdx, + frameIdx, + mohrInfo.gridIndex, + mohrInfo.elmIndex, + mohrInfo.elmId, + mohrInfo.color ); } updatePlot(); @@ -232,7 +242,7 @@ void RiuMohrsCirclePlot::addOrUpdateMohrCircleCurves( const MohrsCirclesInfo& mo QString( "FOS: %1, " ).arg( QString::number( mohrsCirclesInfo.factorOfSafety, 'f', 2 ) ) ); textBuilder.append( QString( "Element Id: %1, ijk[%2, %3, %4]," ) - .arg( mohrsCirclesInfo.elmIndex ) + .arg( mohrsCirclesInfo.elmId ) .arg( mohrsCirclesInfo.i ) .arg( mohrsCirclesInfo.j ) .arg( mohrsCirclesInfo.k ) ); @@ -363,6 +373,7 @@ bool RiuMohrsCirclePlot::addOrUpdateCurves( const RimGeoMechResultDefinition* ge int frameIndex, size_t gridIndex, size_t elmIndex, + int elmId, const cvf::Color3ub& color ) { RigFemPart* femPart = geomResDef->ownerCaseData()->femParts()->part( gridIndex ); @@ -405,9 +416,12 @@ bool RiuMohrsCirclePlot::addOrUpdateCurves( const RimGeoMechResultDefinition* ge CVF_ASSERT( validIndex ); if ( validIndex ) { + int elmId = femPart->elmId( elmIndex ); + MohrsCirclesInfo mohrsCircle( principals, gridIndex, elmIndex, + elmId, i, j, k, diff --git a/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.h b/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.h index 8bb6aa64b7..d4383dcada 100644 --- a/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.h +++ b/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.h @@ -59,6 +59,7 @@ private: MohrsCirclesInfo( cvf::Vec3f principals, size_t gridIndex, size_t elmIndex, + int elmId, size_t i, size_t j, size_t k, @@ -68,6 +69,7 @@ private: : principals( principals ) , gridIndex( gridIndex ) , elmIndex( elmIndex ) + , elmId( elmId ) , i( i ) , j( j ) , k( k ) @@ -80,6 +82,7 @@ private: cvf::Vec3f principals; size_t gridIndex; size_t elmIndex; + int elmId; size_t i, j, k; const RimGeoMechResultDefinition* geomResDef; double factorOfSafety; @@ -104,6 +107,7 @@ private: int frameIndex, size_t gridIndex, size_t elmIndex, + int elmId, const cvf::Color3ub& color ); void updatePlot();