From f88343a12232802d0d0ef33b352a3fcc8484c968 Mon Sep 17 00:00:00 2001 From: Stein Dale Date: Mon, 1 Jun 2015 16:37:22 +0200 Subject: [PATCH] Geomech case info (#291) Displaying result info and the number of cells in the 3D view's info box for geomech cases. --- .../GeoMechDataModel/RigFemPartCollection.cpp | 12 ++++ .../GeoMechDataModel/RigFemPartCollection.h | 3 + .../Rim3dOverlayInfoConfig.cpp | 56 ++++++++++++++++++- 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.cpp index 36ffd1a1d1..242d505d68 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.cpp @@ -69,5 +69,17 @@ int RigFemPartCollection::partCount() const return static_cast(m_femParts.size()); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RigFemPartCollection::totalElementCount() const +{ + size_t elementCount = 0; + for (size_t i = 0; i < partCount(); i++) + { + elementCount += part(i)->elementCount(); + } + return elementCount; +} diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.h index c04abf5da9..841b909bd9 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartCollection.h @@ -35,6 +35,9 @@ public: int partCount() const; + size_t totalElementCount() const; + + private: cvf::Collection m_femParts; diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index 0b325f1399..d4e5694804 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -34,6 +34,11 @@ #include "RiuViewer.h" #include "RimGeoMechView.h" #include "RimView.h" +#include "RimGeoMechCase.h" +#include "RigGeoMechCaseData.h" +#include "RigFemPartCollection.h" +#include "RimGeoMechResultSlot.h" +#include "RigStatisticsDataCache.h" CAF_PDM_SOURCE_INIT(Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig"); @@ -274,12 +279,59 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView) { if (showInfoText()) { - QString infoText = QString( - "

-- %1 --

").arg("ToDo: Describe Geo Mech Case"); + QString infoText; + + const RimGeoMechCase* geoMechCase = geoMechView->geoMechCase(); + const RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : NULL; + const RigFemPartCollection* femParts = caseData ? caseData->femParts() : NULL; + + if (femParts) + { + QString caseName = geoMechCase->caseUserDescription(); + QString cellCount = QString("%1").arg(femParts->totalElementCount()); + + infoText = QString( + "

-- %1 --

" + "Cell count: %2
").arg(caseName, cellCount); + + if (geoMechView->cellResult().notNull()) + { + QString resultPos; + QString fieldName = geoMechView->cellResult()->resultFieldName(); + QString compName = geoMechView->cellResult()->resultComponentName(); + QString resultName = compName.isEmpty() ? fieldName : compName; + + if (!resultName.isEmpty()) + { + switch (geoMechView->cellResult()->resultPositionType()) + { + case RIG_NODAL: + resultPos = "Nodal"; + break; + + case RIG_ELEMENT_NODAL: + resultPos = "Element nodal"; + break; + + case RIG_INTEGRATION_POINT: + resultPos = "Integration point"; + break; + + default: + break; + } + + infoText += QString( + "Cell result: %1 %2").arg(resultPos, resultName); + } + } + } + geoMechView->viewer()->setInfoText(infoText); } if (showHistogram()) { + // ToDo } }