From 2ce7e2c3d2c5684f748e98710af1181fcd51ec2a Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Wed, 10 Jan 2018 14:14:36 +0100 Subject: [PATCH] #2360 Elm props: Use element index in closest result intex calc --- .../GeoMechDataModel/RigFemPartResultsCollection.cpp | 8 +++++++- .../GeoMechVisualization/RivFemPartGeometryGenerator.cpp | 7 +++++++ .../GeoMechVisualization/RivFemPartGeometryGenerator.h | 2 ++ .../GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp | 4 ++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp index 4722662922..0bababf189 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp @@ -175,7 +175,9 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult(in std::vector resultsForEachComponent; for (auto elem : elementProperties) { - RigFemScalarResultFrames* currentFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr); + RigFemResultAddress addressForElement(RIG_ELEMENT, elem.first, ""); + RigFemScalarResultFrames* currentFrames = m_femPartResults[partIndex]->createScalarResult(addressForElement); + currentFrames->enableAsSingleFrameResult(); currentFrames->frameData(0).swap(elem.second); } @@ -2175,6 +2177,10 @@ RigFemClosestResultIndexCalculator::RigFemClosestResultIndexCalculator(RigFemPar { m_resultIndexToClosestResult = -1; } + else if (resultPosition == RIG_ELEMENT) + { + m_resultIndexToClosestResult = elementIndex; + } else { m_resultIndexToClosestResult = m_closestElementNodeResIdx; diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp index 63058ce4ae..ef612df8ba 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp @@ -175,6 +175,7 @@ void RivFemPartGeometryGenerator::computeArrays() m_quadVerticesToNodeIdx.clear(); m_quadVerticesToGlobalElmNodeIdx.clear(); m_quadVerticesToGlobalElmFaceNodeIdx.clear(); + m_quadVerticesToGlobalElmIdx.clear(); trianglesToElements.clear(); trianglesToElementFaces.clear(); @@ -183,6 +184,7 @@ void RivFemPartGeometryGenerator::computeArrays() vertices.reserve(estimatedQuadVxCount); m_quadVerticesToNodeIdx.reserve(estimatedQuadVxCount); m_quadVerticesToGlobalElmNodeIdx.reserve(estimatedQuadVxCount); + m_quadVerticesToGlobalElmIdx.reserve(estimatedQuadVxCount); trianglesToElements.reserve(estimatedQuadVxCount/2); trianglesToElementFaces.reserve(estimatedQuadVxCount/2); @@ -258,6 +260,11 @@ void RivFemPartGeometryGenerator::computeArrays() m_quadVerticesToGlobalElmFaceNodeIdx.push_back(elmNodFaceResIdxFaceStart + 2); m_quadVerticesToGlobalElmFaceNodeIdx.push_back(elmNodFaceResIdxFaceStart + 3); + m_quadVerticesToGlobalElmIdx.push_back(elmIdx); + m_quadVerticesToGlobalElmIdx.push_back(elmIdx); + m_quadVerticesToGlobalElmIdx.push_back(elmIdx); + m_quadVerticesToGlobalElmIdx.push_back(elmIdx); + trianglesToElements.push_back(elmIdx); trianglesToElements.push_back(elmIdx); trianglesToElementFaces.push_back(lfIdx); diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.h b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.h index 2d6edab282..c123ad8bbd 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.h +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.h @@ -86,6 +86,7 @@ public: const std::vector& quadVerticesToNodeIdxMapping() const { return m_quadVerticesToNodeIdx;} const std::vector& quadVerticesToGlobalElmNodeIdx() const { return m_quadVerticesToGlobalElmNodeIdx;} const std::vector& quadVerticesToGlobalElmFaceNodeIdx() const { return m_quadVerticesToGlobalElmFaceNodeIdx; } + const std::vector& quadVerticesToGlobalElmIdx() const { return m_quadVerticesToGlobalElmIdx; } RivFemPartTriangleToElmMapper* triangleToElementMapper() { return m_triangleMapper.p();} @@ -107,6 +108,7 @@ private: std::vector m_quadVerticesToNodeIdx; std::vector m_quadVerticesToGlobalElmNodeIdx; std::vector m_quadVerticesToGlobalElmFaceNodeIdx; + std::vector m_quadVerticesToGlobalElmIdx; // Mappings cvf::ref m_triangleMapper; diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp index 3c327985d7..262b7affc5 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp @@ -259,6 +259,10 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechCe { vxToResultMapping = &(m_surfaceGenerator.quadVerticesToGlobalElmFaceNodeIdx()); } + else if (resVarAddress.resultPosType == RIG_ELEMENT) + { + vxToResultMapping = &(m_surfaceGenerator.quadVerticesToGlobalElmIdx()); + } if (!vxToResultMapping) return;