From 055c0d4c8c337a0e25f0a3c62bcc1172785e67cb Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 19 Feb 2024 15:29:43 +0100 Subject: [PATCH] #11198 Fix result info for POR-Bar normalized by hydrostatic pressure. Fixes #11198. Fixes #10565. --- .../UserInterface/RiuFemResultTextBuilder.cpp | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuFemResultTextBuilder.cpp b/ApplicationLibCode/UserInterface/RiuFemResultTextBuilder.cpp index 0f1f0b8281..329b3ba39c 100644 --- a/ApplicationLibCode/UserInterface/RiuFemResultTextBuilder.cpp +++ b/ApplicationLibCode/UserInterface/RiuFemResultTextBuilder.cpp @@ -281,16 +281,16 @@ void RiuFemResultTextBuilder::appendTextFromResultColors( RigGeoMechCaseData* if ( resultDefinition->hasResult() ) { - const std::vector& scalarResults = - geomData->femPartResults()->resultValues( resultDefinition->resultAddress(), gridIndex, timeStepIndex, frameIndex ); + auto address = RigFemAddressDefines::getResultLookupAddress( resultDefinition->resultAddress() ); + const std::vector& scalarResults = geomData->femPartResults()->resultValues( address, gridIndex, timeStepIndex, frameIndex ); if ( !scalarResults.empty() ) { - caf::AppEnum resPosAppEnum = resultDefinition->resultPositionType(); + caf::AppEnum resPosAppEnum = address.resultPosType; resultInfoText->append( resPosAppEnum.uiText() + ", " ); resultInfoText->append( resultDefinition->resultFieldUiName() + ", " ); resultInfoText->append( resultDefinition->resultComponentUiName() + ":\n" ); - if ( resultDefinition->resultPositionType() != RIG_ELEMENT_NODAL_FACE ) + if ( address.resultPosType != RIG_ELEMENT_NODAL_FACE ) { RigFemPart* femPart = geomData->femParts()->part( gridIndex ); RigElementType elmType = femPart->elementType( cellIndex ); @@ -302,8 +302,8 @@ void RiuFemResultTextBuilder::appendTextFromResultColors( RigGeoMechCaseData* { float scalarValue = std::numeric_limits::infinity(); int nodeIdx = elementConn[lNodeIdx]; - if ( resultDefinition->resultPositionType() == RIG_NODAL || - ( resultDefinition->resultPositionType() == RIG_DIFFERENTIALS && + if ( address.resultPosType == RIG_NODAL || + ( address.resultPosType == RIG_DIFFERENTIALS && resultDefinition->resultFieldName() == QString::fromStdString( RigFemAddressDefines::porBar() ) ) ) { scalarValue = scalarResults[nodeIdx]; @@ -407,13 +407,15 @@ QString RiuFemResultTextBuilder::closestNodeResultText( RimGeoMechResultDefiniti RigGeoMechCaseData* geomData = m_geomResDef->geoMechCase()->geoMechData(); + auto address = RigFemAddressDefines::getResultLookupAddress( resultColors->resultAddress() ); + const std::vector& scalarResults = - geomData->femPartResults()->resultValues( resultColors->resultAddress(), m_gridIndex, m_timeStepIndex, m_frameIndex ); + geomData->femPartResults()->resultValues( address, m_gridIndex, m_timeStepIndex, m_frameIndex ); if ( !scalarResults.empty() && m_displayCoordView ) { RigFemPart* femPart = geomData->femParts()->part( m_gridIndex ); - RigFemResultPosEnum activeResultPosition = resultColors->resultPositionType(); + RigFemResultPosEnum activeResultPosition = address.resultPosType; cvf::Vec3d intersectionPointInDomain = m_displayCoordView->displayCoordTransform()->translateToDomainCoord( m_intersectionPointInDisplay ); @@ -443,11 +445,7 @@ QString RiuFemResultTextBuilder::closestNodeResultText( RimGeoMechResultDefiniti } else if ( m_isIntersectionTriangleSet && activeResultPosition == RIG_ELEMENT_NODAL_FACE ) { - RiuGeoMechXfTensorResultAccessor tensAccessor( geomData->femPartResults(), - resultColors->resultAddress(), - m_gridIndex, - m_timeStepIndex, - m_frameIndex ); + RiuGeoMechXfTensorResultAccessor tensAccessor( geomData->femPartResults(), address, m_gridIndex, m_timeStepIndex, m_frameIndex ); float tensValue = tensAccessor.calculateElmNodeValue( m_intersectionTriangle, closestElmNodResIdx ); text.append( QString( "Closest result: N[%1], in Element[%2] transformed onto intersection: %3 \n" )