diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp index 2fd5433f51..d5d43459c6 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp @@ -231,11 +231,8 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechRe RigGeoMechCaseData* caseData = cellResultSlot->ownerCaseData(); if (!caseData) return; - caf::AppEnum resPosType = cellResultSlot->resultPositionType(); - QString fieldName = cellResultSlot->resultFieldName(); - QString compName = cellResultSlot->resultComponentName(); - RigFemResultAddress resVarAddress(resPosType, fieldName.toStdString(), compName.toStdString()); + RigFemResultAddress resVarAddress = cellResultSlot->resultAddress(); const std::vector& resultValues = caseData->femPartResults()->resultValues(resVarAddress, m_gridIdx, (int)timeStepIndex); diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index 0eba37a3c2..16c47c8601 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -299,11 +299,10 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView) if (geoMechView->hasUserRequestedAnimation() && geoMechView->cellResult()->hasResult()) { QString resultPos; - QString fieldName = geoMechView->cellResult()->resultFieldName(); - QString compName = geoMechView->cellResult()->resultComponentName(); - QString resultName = compName.isEmpty() ? fieldName : compName; + QString fieldName = geoMechView->cellResult()->resultFieldUiName(); + QString compName = geoMechView->cellResult()->resultComponentUiName(); - if (!resultName.isEmpty()) + if (!fieldName.isEmpty()) { switch (geoMechView->cellResult()->resultPositionType()) { @@ -324,7 +323,7 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView) } infoText += QString( - "Cell result: %1, %2, %3").arg(resultPos).arg(fieldName).arg(resultName); + "Cell result: %1, %2, %3").arg(resultPos).arg(fieldName).arg(compName); double min = 0, max = 0; double p10 = 0, p90 = 0; @@ -357,34 +356,27 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView) if (showHistogram()) { - if (geoMechView->hasUserRequestedAnimation() && geoMechView->cellResult()->hasResult()) - { - QString fieldName = geoMechView->cellResult()->resultFieldName(); - QString compName = geoMechView->cellResult()->resultComponentName(); - QString resultName = compName.isEmpty() ? fieldName : compName; + if (geoMechView->hasUserRequestedAnimation() && geoMechView->cellResult()->hasResult()) + { + geoMechView->viewer()->showHistogram(true); - if (!resultName.isEmpty()) + // ToDo: Implement statistics for geomech data + + RimGeoMechCase* geoMechCase = geoMechView->geoMechCase(); + RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : NULL; + + if (caseData) { - geoMechView->viewer()->showHistogram(true); + double min = 0, max = 0; + double p10 = 0, p90 = 0; + double mean = 0; - // ToDo: Implement statistics for geomech data - - RimGeoMechCase* geoMechCase = geoMechView->geoMechCase(); - RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : NULL; - - if (caseData) - { - double min = 0, max = 0; - double p10 = 0, p90 = 0; - double mean = 0; - - RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress(); - caseData->femPartResults()->meanScalarValue(resAddress, &mean); - caseData->femPartResults()->minMaxScalarValues(resAddress,&min, &max); - caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90); - geoMechView->viewer()->setHistogram(min, max, caseData->femPartResults()->scalarValuesHistogram(resAddress)); - geoMechView->viewer()->setHistogramPercentiles(p10, p90, mean); - } + RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress(); + caseData->femPartResults()->meanScalarValue(resAddress, &mean); + caseData->femPartResults()->minMaxScalarValues(resAddress, &min, &max); + caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90); + geoMechView->viewer()->setHistogram(min, max, caseData->femPartResults()->scalarValuesHistogram(resAddress)); + geoMechView->viewer()->setHistogramPercentiles(p10, p90, mean); } } } diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp index c7cc1c4134..039293c198 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp @@ -107,18 +107,6 @@ QList RimGeoMechResultSlot::calculateValueOptions(const options.push_back(caf::PdmOptionItemInfo(uiVarNames[oIdx], varNames[oIdx])); } -#if 0 - - for (auto fieldIt = fieldCompNames.begin(); fieldIt != fieldCompNames.end(); ++fieldIt) - { - options.push_back(caf::PdmOptionItemInfo(QString::fromStdString(fieldIt->first), QString::fromStdString(fieldIt->first))); - - for (auto compIt = fieldIt->second.begin(); compIt != fieldIt->second.end(); ++compIt) - { - options.push_back(caf::PdmOptionItemInfo(QString::fromStdString(" " + *compIt), QString::fromStdString(fieldIt->first + " " + *compIt))); - } - } -#endif } } @@ -218,14 +206,21 @@ void RimGeoMechResultSlot::getUiAndResultVariableStringList(QStringList* uiNames std::map >::const_iterator fieldIt; for (fieldIt = fieldCompNames.begin(); fieldIt != fieldCompNames.end(); ++fieldIt) { - uiNames->push_back(QString::fromStdString(fieldIt->first)); - variableNames->push_back(QString::fromStdString(fieldIt->first)); + QString resultFieldName = QString::fromStdString(fieldIt->first); + + if (resultFieldName == "E" || resultFieldName == "S") continue; // We will not show the native Stress and Strain + + QString resultFieldUiName = convertToUiResultFieldName(resultFieldName); + + uiNames->push_back(resultFieldUiName); + variableNames->push_back(resultFieldName); std::vector::const_iterator compIt; for (compIt = fieldIt->second.begin(); compIt != fieldIt->second.end(); ++compIt) { - uiNames->push_back(QString::fromStdString(" " + *compIt)); - variableNames->push_back(composeUiVarString(QString::fromStdString(fieldIt->first), QString::fromStdString(*compIt))); + QString resultCompName = QString::fromStdString(*compIt); + uiNames->push_back(" " + resultCompName); + variableNames->push_back(composeUiVarString(resultFieldName, resultCompName)); } } } @@ -269,3 +264,32 @@ bool RimGeoMechResultSlot::hasResult() { return ownerCaseData()->femPartResults()->assertResultsLoaded(this->resultAddress()); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimGeoMechResultSlot::resultFieldUiName() +{ + return convertToUiResultFieldName(m_resultFieldName()); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimGeoMechResultSlot::resultComponentUiName() +{ + return m_resultComponentName(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimGeoMechResultSlot::convertToUiResultFieldName(QString resultFieldName) +{ + if (resultFieldName == "E") return "NativeAbaqus Strain"; + if (resultFieldName == "S") return "NativeAbaqus Stess"; + if (resultFieldName == "NE") return "E"; // Make NE and NS appear as E and S + if (resultFieldName == "NS") return "S"; + + return resultFieldName; +} diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.h b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.h index a9cfce0501..1efebbaaa1 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.h @@ -54,6 +54,9 @@ public: QString resultFieldName() { return m_resultFieldName();} QString resultComponentName() { return m_resultComponentName();} + QString resultFieldUiName(); + QString resultComponentUiName(); + caf::PdmField legendConfig; @@ -78,4 +81,7 @@ private: caf::PdmField m_resultVariableUiField; caf::PdmPointer m_reservoirView; + + static QString convertToUiResultFieldName(QString resultFieldName); + }; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp index f1415e94dc..a24944de5e 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -412,7 +412,7 @@ void RimGeoMechView::updateLegends() cellResult()->legendConfig->legend()->setTitle(cvfqt::Utils::toString( caf::AppEnum(cellResult->resultPositionType()).uiText() + "\n" - + cellResult->resultFieldName() + " " + cellResult->resultComponentName())); + + cellResult->resultFieldUiName() + ", " + cellResult->resultComponentUiName())); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuFemResultTextBuilder.cpp b/ApplicationCode/UserInterface/RiuFemResultTextBuilder.cpp index 43d62cca8e..949a53978d 100644 --- a/ApplicationCode/UserInterface/RiuFemResultTextBuilder.cpp +++ b/ApplicationCode/UserInterface/RiuFemResultTextBuilder.cpp @@ -170,8 +170,8 @@ void RiuFemResultTextBuilder::appendTextFromResultSlot(RigGeoMechCaseData* geomD { caf::AppEnum resPosAppEnum = resultSlot->resultPositionType(); resultInfoText->append(resPosAppEnum.uiText() + ", "); - resultInfoText->append(resultSlot->resultFieldName()+ ", ") ; - resultInfoText->append(resultSlot->resultComponentName() + ":\n"); + resultInfoText->append(resultSlot->resultFieldUiName()+ ", ") ; + resultInfoText->append(resultSlot->resultComponentUiName() + ":\n"); RigFemPart* femPart = geomData->femParts()->part(gridIndex);