diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.cpp index fe3ea741cf..566d09f74c 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.cpp @@ -99,3 +99,28 @@ int RigFemTypes::oppositeFace(RigElementType elmType, int faceIdx) return faceIdx; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- + +const int* RigFemTypes::localElmNodeToIntegrationPointMapping(RigElementType elmType) +{ + static const int HEX8_Mapping[8] ={ 0, 1, 3, 2, 4, 5, 7, 6 }; + + switch (elmType) + { + case HEX8: + case HEX8P: + return HEX8_Mapping; + break; + case CAX4: + return HEX8_Mapping; // First four is identical to HEX8 + break; + default: + assert(false); // Element type not supported + break; + } + + return HEX8_Mapping; +} diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.h index 7cd72a39a0..eb9a70dfcb 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemTypes.h @@ -35,4 +35,5 @@ public: static int elmentFaceCount(RigElementType elmType); static const int* localElmNodeIndicesForFace(RigElementType elmType, int faceIdx, int* faceNodeCount); static int oppositeFace(RigElementType elmType, int faceIdx); + static const int* localElmNodeToIntegrationPointMapping(RigElementType elmType); }; diff --git a/ApplicationCode/GeoMech/OdbReader/RifOdbReader.cpp b/ApplicationCode/GeoMech/OdbReader/RifOdbReader.cpp index aa5219901e..e7ddabb22a 100644 --- a/ApplicationCode/GeoMech/OdbReader/RifOdbReader.cpp +++ b/ApplicationCode/GeoMech/OdbReader/RifOdbReader.cpp @@ -924,7 +924,7 @@ void RifOdbReader::readIntegrationPointField(const std::string& fieldName, int p float* data = bulkDataGetter.data(); RigElementType eType = toRigElementType(bulkData.baseElementType()); - const int* elmNodeToIpResultMapping = localElmNodeToIntegrationPointMapping(eType); + const int* elmNodeToIpResultMapping = localElmNodeToIntegrationPointMapping(eType); // Todo: Use the one in RigFemTypes.h, but we need to guard against unknown element types first. if (!elmNodeToIpResultMapping) continue; for (int elem = 0; elem < elemCount; elem++) diff --git a/ApplicationCode/UserInterface/RiuFemResultTextBuilder.cpp b/ApplicationCode/UserInterface/RiuFemResultTextBuilder.cpp index d35ebe99b5..1c14e89877 100644 --- a/ApplicationCode/UserInterface/RiuFemResultTextBuilder.cpp +++ b/ApplicationCode/UserInterface/RiuFemResultTextBuilder.cpp @@ -178,6 +178,8 @@ void RiuFemResultTextBuilder::appendTextFromResultColors(RigGeoMechCaseData* geo RigElementType elmType = femPart->elementType(cellIndex); const int* elmentConn = femPart->connectivities(cellIndex); int elmNodeCount = RigFemTypes::elmentNodeCount(elmType); + const int* lElmNodeToIpMap = RigFemTypes::localElmNodeToIntegrationPointMapping(elmType); + for (int lNodeIdx = 0; lNodeIdx < elmNodeCount; ++lNodeIdx) { @@ -194,7 +196,18 @@ void RiuFemResultTextBuilder::appendTextFromResultColors(RigGeoMechCaseData* geo scalarValue = scalarResults[resIdx]; } - resultInfoText->append(QString("\tN:%1 \t: %2\n").arg(femPart->nodes().nodeIds[nodeIdx]).arg(scalarValue)); + + if (resultColors->resultPositionType() == RIG_INTEGRATION_POINT) + { + resultInfoText->append(QString("\tIP:%1 \t: %2 \tAss. Node: \t%3").arg(lElmNodeToIpMap[lNodeIdx] + 1 ).arg(scalarValue).arg(femPart->nodes().nodeIds[nodeIdx])); + } + else + { + resultInfoText->append(QString("\tN:%1 \t: %2").arg(femPart->nodes().nodeIds[nodeIdx]).arg(scalarValue)); + } + + cvf::Vec3f nodeCoord = femPart->nodes().coordinates[nodeIdx]; + resultInfoText->append(QString("\t( %3, %4, %5)\n").arg(nodeCoord[0]).arg(nodeCoord[1]).arg(nodeCoord[2])); } } }