#323, #318 Geomechanical sign on Stress/Strain

Now they are presented as S and E, and the native Abaqus values are hidden.
This commit is contained in:
Jacob Støren 2015-06-19 14:38:31 +02:00
parent e740bdc618
commit 0377461da0
6 changed files with 72 additions and 53 deletions

View File

@ -231,11 +231,8 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechRe
RigGeoMechCaseData* caseData = cellResultSlot->ownerCaseData();
if (!caseData) return;
caf::AppEnum<RigFemResultPosEnum> 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<float>& resultValues = caseData->femPartResults()->resultValues(resVarAddress, m_gridIdx, (int)timeStepIndex);

View File

@ -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(
"<b>Cell result:</b> %1, %2, %3").arg(resultPos).arg(fieldName).arg(resultName);
"<b>Cell result:</b> %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);
}
}
}

View File

@ -107,18 +107,6 @@ QList<caf::PdmOptionItemInfo> 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<std::string, std::vector<std::string> >::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<std::string>::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;
}

View File

@ -54,6 +54,9 @@ public:
QString resultFieldName() { return m_resultFieldName();}
QString resultComponentName() { return m_resultComponentName();}
QString resultFieldUiName();
QString resultComponentUiName();
caf::PdmField<RimLegendConfig*> legendConfig;
@ -78,4 +81,7 @@ private:
caf::PdmField<QString> m_resultVariableUiField;
caf::PdmPointer<RimGeoMechView> m_reservoirView;
static QString convertToUiResultFieldName(QString resultFieldName);
};

View File

@ -412,7 +412,7 @@ void RimGeoMechView::updateLegends()
cellResult()->legendConfig->legend()->setTitle(cvfqt::Utils::toString(
caf::AppEnum<RigFemResultPosEnum>(cellResult->resultPositionType()).uiText() + "\n"
+ cellResult->resultFieldName() + " " + cellResult->resultComponentName()));
+ cellResult->resultFieldUiName() + ", " + cellResult->resultComponentUiName()));
}
//--------------------------------------------------------------------------------------------------

View File

@ -170,8 +170,8 @@ void RiuFemResultTextBuilder::appendTextFromResultSlot(RigGeoMechCaseData* geomD
{
caf::AppEnum<RigFemResultPosEnum> 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);