#4062 #4081 Make time and case diff apply immediately and don't change variable name

* Instead show the change in the Result label, legend and info box.
This commit is contained in:
Gaute Lindkvist
2019-02-15 09:37:17 +01:00
parent 69bbf6921c
commit 833a29c3c2
8 changed files with 286 additions and 254 deletions

View File

@@ -632,9 +632,14 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
if (isResultsInfoRelevant) if (isResultsInfoRelevant)
{ {
QString propName = eclipseView->cellResult()->resultVariableUiShortName(); QString propName = eclipseView->cellResult()->resultVariableUiShortName();
QString diffResString = eclipseView->cellResult()->diffResultUiName();
if (!contourMap->contourMapProjection()->isColumnResult()) if (!contourMap->contourMapProjection()->isColumnResult())
{ {
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName); infoText += QString("<b>Cell Property:</b> %1<br>").arg(propName);
}
if (!diffResString.isEmpty())
{
infoText += QString("%1<br>").arg(diffResString);
} }
infoText += QString("<br><b>Statistics:</b> Current Time Step and Visible Cells"); infoText += QString("<br><b>Statistics:</b> Current Time Step and Visible Cells");
infoText += QString("<table border=0 cellspacing=5 >" infoText += QString("<table border=0 cellspacing=5 >"
@@ -656,13 +661,18 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
if (isResultsInfoRelevant) if (isResultsInfoRelevant)
{ {
QString propName = eclipseView->cellResult()->resultVariableUiShortName(); QString propName = eclipseView->cellResult()->resultVariableUiShortName();
QString diffResString = eclipseView->cellResult()->diffResultUiName();
QString timeRangeText = m_statisticsTimeRange().uiText(); QString timeRangeText = m_statisticsTimeRange().uiText();
if (eclipseView->cellResult()->isFlowDiagOrInjectionFlooding()) if (eclipseView->cellResult()->isFlowDiagOrInjectionFlooding())
{ {
timeRangeText = caf::AppEnum<StatisticsTimeRangeType>::uiText(CURRENT_TIMESTEP); timeRangeText = caf::AppEnum<StatisticsTimeRangeType>::uiText(CURRENT_TIMESTEP);
} }
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName); infoText += QString("<b>Cell Property:</b> %1<br>").arg(propName);
if (!diffResString.isEmpty())
{
infoText += QString("%1<br>").arg(diffResString);
}
infoText += QString("<br><b>Statistics:</b> ") + timeRangeText + " and " + m_statisticsCellRange().uiText(); infoText += QString("<br><b>Statistics:</b> ") + timeRangeText + " and " + m_statisticsCellRange().uiText();
infoText += QString("<table border=0 cellspacing=5 >" infoText += QString("<table border=0 cellspacing=5 >"
"<tr> <td>Min</td> <td>P90</td> <td>Mean</td> <td>P10</td> <td>Max</td> <td>Sum</td> </tr>" "<tr> <td>Min</td> <td>P90</td> <td>Mean</td> <td>P10</td> <td>Max</td> <td>Sum</td> </tr>"
@@ -734,9 +744,9 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
if (isResultsInfoRelevant) if (isResultsInfoRelevant)
{ {
QString resultPos; QString resultPos;
QString fieldName = geoMechView->cellResultResultDefinition()->resultFieldUiName(); QString fieldName = geoMechView->cellResultResultDefinition()->resultFieldUiName();
QString compName = geoMechView->cellResultResultDefinition()->resultComponentUiName(); QString compName = geoMechView->cellResultResultDefinition()->resultComponentUiName();
QString diffResString = geoMechView->cellResultResultDefinition()->diffResultUiName();
switch (geoMechView->cellResultResultDefinition()->resultPositionType()) switch (geoMechView->cellResultResultDefinition()->resultPositionType())
{ {
case RIG_NODAL: case RIG_NODAL:
@@ -759,13 +769,17 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, Ri
} }
if (compName == "") if (compName == "")
{ {
infoText += QString("<b>Cell result:</b> %1, %2").arg(resultPos).arg(fieldName); infoText += QString("<b>Cell result:</b> %1, %2<br>").arg(resultPos).arg(fieldName);
} }
else else
{ {
infoText += QString("<b>Cell result:</b> %1, %2, %3").arg(resultPos).arg(fieldName).arg(compName); infoText += QString("<b>Cell result:</b> %1, %2, %3<br>").arg(resultPos).arg(fieldName).arg(compName);
}
if (!diffResString.isEmpty())
{
infoText += QString("%1<br>").arg(diffResString);
} }
infoText += QString("<br><b>Statistics:</b> ") + m_statisticsTimeRange().uiText() + " and " + m_statisticsCellRange().uiText(); infoText += QString("<br><b>Statistics:</b> ") + m_statisticsTimeRange().uiText() + " and " + m_statisticsCellRange().uiText();
infoText += QString("<table border=0 cellspacing=5 >" infoText += QString("<table border=0 cellspacing=5 >"
"<tr> <td>Min</td> <td>P90</td> <td>Mean</td> <td>P10</td> <td>Max</td> <td>Sum</td> </tr>" "<tr> <td>Min</td> <td>P90</td> <td>Mean</td> <td>P10</td> <td>Max</td> <td>Sum</td> </tr>"

View File

@@ -73,7 +73,7 @@ CAF_PDM_SOURCE_INIT(RimEclipseResultDefinition, "ResultDefinition");
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimEclipseResultDefinition::RimEclipseResultDefinition() RimEclipseResultDefinition::RimEclipseResultDefinition()
: m_showUiForDerivedDifferenceResults(false) : m_diffResultOptionsEnabled(false)
{ {
CAF_PDM_InitObject("Result Definition", "", "", ""); CAF_PDM_InitObject("Result Definition", "", "", "");
@@ -91,10 +91,8 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
CAF_PDM_InitField( CAF_PDM_InitField(
&m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", RigEclipseResultAddress::NO_TIME_LAPSE, "Base Time Step", "", "", ""); &m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", RigEclipseResultAddress::NO_TIME_LAPSE, "Base Time Step", "", "", "");
m_timeLapseBaseTimestep.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_differenceCase, "DifferenceCase", "Difference Case", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_differenceCase, "DifferenceCase", "Difference Case", "", "", "");
m_differenceCase.uiCapability()->setUiHidden(true);
// One single tracer list has been split into injectors and producers. // One single tracer list has been split into injectors and producers.
// The old list is defined as injectors and we'll have to move any producers in old projects. // The old list is defined as injectors and we'll have to move any producers in old projects.
@@ -126,18 +124,6 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
m_resultVariableUiField.xmlCapability()->disableIO(); m_resultVariableUiField.xmlCapability()->disableIO();
m_resultVariableUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName()); m_resultVariableUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
CAF_PDM_InitField(&m_timeLapseBaseTimestepUiField,
"TimeLapseBaseTimeStepUI",
RigEclipseResultAddress::NO_TIME_LAPSE,
"Base Time Step",
"",
"",
"");
m_timeLapseBaseTimestepUiField.xmlCapability()->disableIO();
CAF_PDM_InitFieldNoDefault(&m_differenceCaseUiField, "MDifferenceCase", "Difference Case", "", "", "");
m_differenceCaseUiField.xmlCapability()->disableIO();
CAF_PDM_InitFieldNoDefault(&m_flowSolutionUiField, "MFlowDiagSolution", "Solution", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_flowSolutionUiField, "MFlowDiagSolution", "Solution", "", "", "");
m_flowSolutionUiField.xmlCapability()->disableIO(); m_flowSolutionUiField.xmlCapability()->disableIO();
m_flowSolutionUiField.uiCapability()->setUiHidden(true); // For now since there are only one to choose from m_flowSolutionUiField.uiCapability()->setUiHidden(true); // For now since there are only one to choose from
@@ -252,8 +238,6 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
m_porosityModel = m_porosityModelUiField; m_porosityModel = m_porosityModelUiField;
m_resultType = m_resultTypeUiField; m_resultType = m_resultTypeUiField;
m_resultVariable = m_resultVariableUiField; m_resultVariable = m_resultVariableUiField;
m_timeLapseBaseTimestep = m_timeLapseBaseTimestepUiField;
m_differenceCase = m_differenceCaseUiField();
if (m_resultTypeUiField() == RiaDefines::FLOW_DIAGNOSTICS) if (m_resultTypeUiField() == RiaDefines::FLOW_DIAGNOSTICS)
{ {
@@ -268,9 +252,10 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
loadDataAndUpdate(); loadDataAndUpdate();
} }
if (&m_timeLapseBaseTimestepUiField == changedField || &m_differenceCaseUiField == changedField) if (&m_timeLapseBaseTimestep == changedField ||
&m_differenceCase == changedField)
{ {
m_resultVariableUiField = ""; loadDataAndUpdate();
} }
if (&m_flowTracerSelectionMode == changedField) if (&m_flowTracerSelectionMode == changedField)
@@ -627,7 +612,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
{ {
options = calcOptionsForVariableUiFieldStandard(); options = calcOptionsForVariableUiFieldStandard();
} }
else if (fieldNeedingOptions == &m_timeLapseBaseTimestepUiField) else if (fieldNeedingOptions == &m_timeLapseBaseTimestep)
{ {
std::vector<QDateTime> stepDates; std::vector<QDateTime> stepDates;
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
@@ -641,12 +626,12 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
for (size_t stepIdx = 0; stepIdx < stepDates.size(); ++stepIdx) for (size_t stepIdx = 0; stepIdx < stepDates.size(); ++stepIdx)
{ {
QString displayString = stepDates[stepIdx].toString(RimTools::dateFormatString()); QString displayString = stepDates[stepIdx].toString(RimTools::dateFormatString());
displayString += " (" + QString::number(stepIdx) + ")"; displayString += QString(" (#%1)").arg(stepIdx);
options.push_back(caf::PdmOptionItemInfo(displayString, static_cast<int>(stepIdx))); options.push_back(caf::PdmOptionItemInfo(displayString, static_cast<int>(stepIdx)));
} }
} }
else if (fieldNeedingOptions == &m_differenceCaseUiField) else if (fieldNeedingOptions == &m_differenceCase)
{ {
options.push_back(caf::PdmOptionItemInfo("None", nullptr)); options.push_back(caf::PdmOptionItemInfo("None", nullptr));
@@ -665,7 +650,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
if (otherCase->eclipseCaseData() && otherCase->eclipseCaseData()->mainGrid()) if (otherCase->eclipseCaseData() && otherCase->eclipseCaseData()->mainGrid())
{ {
options.push_back( options.push_back(
caf::PdmOptionItemInfo(otherCase->caseUserDescription(), otherCase, false, otherCase->uiIcon())); caf::PdmOptionItemInfo(QString("%1 (#%2)").arg(otherCase->caseUserDescription()).arg(otherCase->caseId()), otherCase, false, otherCase->uiIcon()));
} }
} }
} }
@@ -695,7 +680,7 @@ RigEclipseResultAddress RimEclipseResultDefinition::eclipseResultAddress() const
timelapseTimeStep = m_timeLapseBaseTimestep(); timelapseTimeStep = m_timeLapseBaseTimestep();
} }
if (isCaseDifferenceResult()) if (isCaseDiffResult())
{ {
diffCaseId = m_differenceCase->caseId(); diffCaseId = m_differenceCase->caseId();
} }
@@ -814,16 +799,6 @@ QString RimEclipseResultDefinition::resultVariableUiName() const
return flowDiagResUiText(false, 32); return flowDiagResUiText(false, 32);
} }
if (isTimeDiffResult() && resultType() == RiaDefines::DYNAMIC_NATIVE)
{
return timeDiffResultName(m_resultVariable(), m_timeLapseBaseTimestep());
}
if (isCaseDifferenceResult())
{
return caseDiffResultName(m_resultVariable(), m_differenceCase()->caseId());
}
return m_resultVariable(); return m_resultVariable();
} }
@@ -837,19 +812,74 @@ QString RimEclipseResultDefinition::resultVariableUiShortName() const
return flowDiagResUiText(true, 24); return flowDiagResUiText(true, 24);
} }
if (isTimeDiffResult() && resultType() == RiaDefines::DYNAMIC_NATIVE)
{
return timeDiffResultName(m_resultVariable(), m_timeLapseBaseTimestep());
}
if (isCaseDifferenceResult())
{
return caseDiffResultName(m_resultVariable(), m_differenceCase()->caseId());
}
return m_resultVariable(); return m_resultVariable();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::diffResultUiName() const
{
QStringList diffResult;
if (isTimeDiffResult())
{
std::vector<QDateTime> stepDates;
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
if (gridCellResults)
{
stepDates = gridCellResults->timeStepDates();
diffResult += QString("<b>Base Time Step</b>: %1").arg(stepDates[m_timeLapseBaseTimestep()].toString(RimTools::dateFormatString()));
}
}
if (isCaseDiffResult())
{
diffResult += QString("<b>Base Case</b>: %1").arg(m_differenceCase()->caseUserDescription());
}
return diffResult.join("<br>\n");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::diffResultUiShortName() const
{
QStringList diffResult;
if (isTimeDiffResult() || isCaseDiffResult())
{
diffResult += QString("Diff. Options:");
}
if (isTimeDiffResult())
{
diffResult += QString("Base Time: #%1").arg(m_timeLapseBaseTimestep());
}
if (isCaseDiffResult())
{
diffResult += QString("Base Case: #%1").arg(m_differenceCase()->caseId());
}
return diffResult.join("\n");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::diffResultUiShortNameHTML() const
{
QStringList diffResult;
if (isTimeDiffResult() || isCaseDiffResult())
{
diffResult += QString("<b>Diff. Options:</b>");
}
if (isTimeDiffResult())
{
diffResult += QString("Base Time: #%1").arg(m_timeLapseBaseTimestep());
}
if (isCaseDiffResult())
{
diffResult += QString("Base Case: #%1").arg(m_differenceCase()->caseId());
}
return diffResult.join("\n<br>");
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -878,7 +908,7 @@ void RimEclipseResultDefinition::loadResult()
RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
if (gridCellResults) if (gridCellResults)
{ {
if (isTimeDiffResult() || isCaseDifferenceResult()) if (isTimeDiffResult() || isCaseDiffResult())
{ {
gridCellResults->createResultEntry(this->eclipseResultAddress(), false); gridCellResults->createResultEntry(this->eclipseResultAddress(), false);
} }
@@ -979,8 +1009,6 @@ void RimEclipseResultDefinition::initAfterRead()
m_porosityModelUiField = m_porosityModel; m_porosityModelUiField = m_porosityModel;
m_resultTypeUiField = m_resultType; m_resultTypeUiField = m_resultType;
m_resultVariableUiField = m_resultVariable; m_resultVariableUiField = m_resultVariable;
m_timeLapseBaseTimestepUiField = m_timeLapseBaseTimestep;
m_differenceCaseUiField = m_differenceCase();
m_flowSolutionUiField = m_flowSolution(); m_flowSolutionUiField = m_flowSolution();
m_selectedInjectorTracersUiField = m_selectedInjectorTracers; m_selectedInjectorTracersUiField = m_selectedInjectorTracers;
@@ -1106,9 +1134,9 @@ void RimEclipseResultDefinition::updateUiFieldsFromActiveResult()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::enableUiForDerivedDifferenceResults() void RimEclipseResultDefinition::setDiffResultOptionsEnabled(bool enabled)
{ {
m_showUiForDerivedDifferenceResults = true; m_diffResultOptionsEnabled = true;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -1217,25 +1245,30 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
uiOrdering.add(&m_resultVariableUiField); uiOrdering.add(&m_resultVariableUiField);
} }
if (m_showUiForDerivedDifferenceResults) if (enableDiffResultOptions())
{ {
// NOTE // NOTE
// //
// It is possible to use the case/time diff results in property filter, fault result, etc // It is possible to enable the use of case/time diff results in property filter, fault result, etc
// but to limit the number of UI items, the time/case diff is only available as part of "Cell Result" // but to limit the number of UI items, the time/case diff is only available as part of "Cell Result"
if (m_resultTypeUiField() == RiaDefines::DYNAMIC_NATIVE || m_resultTypeUiField() == RiaDefines::STATIC_NATIVE || caf::PdmUiGroup* differenceGroup = uiOrdering.addNewGroup("Difference Options");
m_resultTypeUiField() == RiaDefines::GENERATED) differenceGroup->setUiReadOnly(!(isTimeDiffResultAvailable() || isCaseDiffResultAvailable()));
m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly(!isTimeDiffResultAvailable());
m_differenceCase.uiCapability()->setUiReadOnly(!isCaseDiffResultAvailable());
if (isTimeDiffResultAvailable())
differenceGroup->add(&m_timeLapseBaseTimestep);
if (isCaseDiffResultAvailable())
differenceGroup->add(&m_differenceCase);
QString resultPropertyLabel = "Result Property";
if (isTimeDiffResult() || isCaseDiffResult())
{ {
caf::PdmUiGroup* differenceGroup = uiOrdering.addNewGroup("Difference Options"); resultPropertyLabel += QString("<br>\n<br>\n%1").arg(diffResultUiShortNameHTML());
if (m_resultTypeUiField() == RiaDefines::DYNAMIC_NATIVE)
{
differenceGroup->add(&m_timeLapseBaseTimestepUiField);
}
differenceGroup->add(&m_differenceCaseUiField);
} }
m_resultVariableUiField.uiCapability()->setUiName(resultPropertyLabel);
} }
uiOrdering.skipRemainingFields(true); uiOrdering.skipRemainingFields(true);
@@ -1385,41 +1418,6 @@ QString RimEclipseResultDefinition::flowDiagResUiText(bool shortLabel, int maxTr
return uiText; return uiText;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::timeDiffResultName(const QString& resultName, int timeStepIndex)
{
return resultName + "_dt_" + QString::number(timeStepIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::caseDiffResultName(const QString& resultName, int caseId)
{
return resultName + " (diff case - " + QString::number(caseId) + ")";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::convertToTimeOrCaseDiffUiVarName(const QString& resultName)
{
if (m_timeLapseBaseTimestepUiField() >= 0 &&
(m_resultTypeUiField() == RiaDefines::DYNAMIC_NATIVE || m_resultTypeUiField() == RiaDefines::GENERATED))
{
return timeDiffResultName(resultName, m_timeLapseBaseTimestepUiField());
}
if (m_differenceCaseUiField())
{
return caseDiffResultName(resultName, m_differenceCaseUiField()->caseId());
}
return resultName;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -1440,7 +1438,6 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariable
{ {
if (s == RiaDefines::completionTypeResultName()) if (s == RiaDefines::completionTypeResultName())
{ {
if (m_timeLapseBaseTimestepUiField() >= 0) continue;
if (results->timeStepDates().empty()) continue; if (results->timeStepDates().empty()) continue;
} }
@@ -1460,7 +1457,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariable
// Cell Center result names // Cell Center result names
foreach (QString s, cellCenterResultNames) foreach (QString s, cellCenterResultNames)
{ {
optionList.push_back(caf::PdmOptionItemInfo(convertToTimeOrCaseDiffUiVarName(s), s)); optionList.push_back(caf::PdmOptionItemInfo(s, s));
} }
// Ternary Result // Ternary Result
@@ -1472,8 +1469,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariable
else if (cellCenterResultNames.contains("SWAT")) else if (cellCenterResultNames.contains("SWAT"))
hasAtLeastOneTernaryComponent = true; hasAtLeastOneTernaryComponent = true;
if ((m_timeLapseBaseTimestepUiField() < 0) && m_resultTypeUiField == RiaDefines::DYNAMIC_NATIVE && if (m_resultTypeUiField == RiaDefines::DYNAMIC_NATIVE && hasAtLeastOneTernaryComponent)
hasAtLeastOneTernaryComponent)
{ {
optionList.push_front( optionList.push_front(
caf::PdmOptionItemInfo(RiaDefines::ternarySaturationResultName(), RiaDefines::ternarySaturationResultName())); caf::PdmOptionItemInfo(RiaDefines::ternarySaturationResultName(), RiaDefines::ternarySaturationResultName()));
@@ -1492,11 +1488,11 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariable
{ {
if (showDerivedResultsFirstInList) if (showDerivedResultsFirstInList)
{ {
optionList.push_front(caf::PdmOptionItemInfo(convertToTimeOrCaseDiffUiVarName(s), s)); optionList.push_front(caf::PdmOptionItemInfo(s, s));
} }
else else
{ {
optionList.push_back(caf::PdmOptionItemInfo(convertToTimeOrCaseDiffUiVarName(s), s)); optionList.push_back(caf::PdmOptionItemInfo(s, s));
} }
} }
@@ -1911,15 +1907,45 @@ void RimEclipseResultDefinition::syncProducerToInjectorSelection()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isTimeDiffResult() const bool RimEclipseResultDefinition::enableDiffResultOptions() const
{ {
return m_timeLapseBaseTimestep() >= 0; return m_diffResultOptionsEnabled;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isCaseDifferenceResult() const bool RimEclipseResultDefinition::isTimeDiffResultAvailable() const
{ {
return m_differenceCase() != nullptr; return enableDiffResultOptions() &&
m_resultType() == RiaDefines::DYNAMIC_NATIVE &&
!isTernarySaturationSelected();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isTimeDiffResult() const
{
return isTimeDiffResultAvailable() && m_timeLapseBaseTimestep() >= 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isCaseDiffResultAvailable() const
{
return enableDiffResultOptions() && !isTernarySaturationSelected() &&
(m_resultType() == RiaDefines::DYNAMIC_NATIVE ||
m_resultType() == RiaDefines::STATIC_NATIVE ||
m_resultType() == RiaDefines::GENERATED);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isCaseDiffResult() const
{
return isCaseDiffResultAvailable() && m_differenceCase() != nullptr;
} }

View File

@@ -93,6 +93,10 @@ public:
QString resultVariableUiName() const; QString resultVariableUiName() const;
QString resultVariableUiShortName() const; QString resultVariableUiShortName() const;
QString diffResultUiName() const;
QString diffResultUiShortName() const;
QString diffResultUiShortNameHTML() const;
void loadResult(); void loadResult();
RigEclipseResultAddress eclipseResultAddress() const; RigEclipseResultAddress eclipseResultAddress() const;
bool hasStaticResult() const; bool hasStaticResult() const;
@@ -116,7 +120,7 @@ public:
void updateUiFieldsFromActiveResult(); void updateUiFieldsFromActiveResult();
void enableUiForDerivedDifferenceResults(); void setDiffResultOptionsEnabled(bool enabled);
protected: protected:
virtual void updateLegendCategorySettings() {}; virtual void updateLegendCategorySettings() {};
@@ -150,9 +154,6 @@ protected:
caf::PdmField< caf::AppEnum< RiaDefines::ResultCatType > > m_resultTypeUiField; caf::PdmField< caf::AppEnum< RiaDefines::ResultCatType > > m_resultTypeUiField;
caf::PdmField< caf::AppEnum< RiaDefines::PorosityModelType > > m_porosityModelUiField; caf::PdmField< caf::AppEnum< RiaDefines::PorosityModelType > > m_porosityModelUiField;
caf::PdmField<QString> m_resultVariableUiField; caf::PdmField<QString> m_resultVariableUiField;
caf::PdmField<int> m_timeLapseBaseTimestepUiField;
caf::PdmPtrField<RimEclipseCase*> m_differenceCaseUiField;
caf::PdmField< caf::AppEnum< FlowTracerSelectionType > > m_flowTracerSelectionMode; caf::PdmField< caf::AppEnum< FlowTracerSelectionType > > m_flowTracerSelectionMode;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowSolutionUiField; caf::PdmPtrField<RimFlowDiagSolution*> m_flowSolutionUiField;
@@ -182,10 +183,6 @@ private:
QString flowDiagResUiText(bool shortLabel, int maxTracerStringLength = std::numeric_limits<int>::max()) const; QString flowDiagResUiText(bool shortLabel, int maxTracerStringLength = std::numeric_limits<int>::max()) const;
static QString timeDiffResultName(const QString& resultName, int timeStepIndex);
static QString caseDiffResultName(const QString& resultName, int caseId);
QString convertToTimeOrCaseDiffUiVarName(const QString& resultName);
QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard(); QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard();
QList<caf::PdmOptionItemInfo> calcOptionsForSelectedTracerField(bool injector); QList<caf::PdmOptionItemInfo> calcOptionsForSelectedTracerField(bool injector);
@@ -207,9 +204,13 @@ private:
void syncInjectorToProducerSelection(); void syncInjectorToProducerSelection();
void syncProducerToInjectorSelection(); void syncProducerToInjectorSelection();
bool enableDiffResultOptions() const;
bool isTimeDiffResultAvailable() const;
bool isTimeDiffResult() const; bool isTimeDiffResult() const;
bool isCaseDifferenceResult() const; bool isCaseDiffResultAvailable() const;
bool isCaseDiffResult() const;
bool m_showUiForDerivedDifferenceResults; private:
bool m_diffResultOptionsEnabled;
}; };

View File

@@ -121,7 +121,7 @@ RimEclipseView::RimEclipseView()
CAF_PDM_InitFieldNoDefault(&m_cellResult, "GridCellResult", "Cell Result", ":/CellResult.png", "", ""); CAF_PDM_InitFieldNoDefault(&m_cellResult, "GridCellResult", "Cell Result", ":/CellResult.png", "", "");
m_cellResult = new RimEclipseCellColors(); m_cellResult = new RimEclipseCellColors();
m_cellResult.uiCapability()->setUiHidden(true); m_cellResult.uiCapability()->setUiHidden(true);
m_cellResult->enableUiForDerivedDifferenceResults(); m_cellResult->setDiffResultOptionsEnabled(true);
CAF_PDM_InitFieldNoDefault(&m_cellEdgeResult, "GridCellEdgeResult", "Cell Edge Result", ":/EdgeResult_1.png", "", ""); CAF_PDM_InitFieldNoDefault(&m_cellEdgeResult, "GridCellEdgeResult", "Cell Edge Result", ":/EdgeResult_1.png", "", "");
m_cellEdgeResult = new RimCellEdgeColors(); m_cellEdgeResult = new RimCellEdgeColors();
@@ -1204,7 +1204,13 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel,
if (resultColors->hasResult() && resultColors->legendConfig()->showLegend()) if (resultColors->hasResult() && resultColors->legendConfig()->showLegend())
{ {
resultColors->legendConfig()->setTitle(legendLabel + resultColors->resultVariableUiName()); QString title = legendLabel + resultColors->resultVariableUiName();
if (!resultColors->diffResultUiShortName().isEmpty())
{
title += QString("\n%1").arg(resultColors->diffResultUiShortName());
}
resultColors->legendConfig()->setTitle(title);
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->titledOverlayFrame()); m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->titledOverlayFrame());
} }

View File

@@ -177,8 +177,7 @@ void RimGeoMechPropertyFilter::updateReadOnlyStateOfAllFields()
// Include fields declared in RimResultDefinition // Include fields declared in RimResultDefinition
objFields.push_back(&(resultDefinition->m_resultPositionTypeUiField)); objFields.push_back(&(resultDefinition->m_resultPositionTypeUiField));
objFields.push_back(&(resultDefinition->m_resultVariableUiField)); objFields.push_back(&(resultDefinition->m_resultVariableUiField));
objFields.push_back(&(resultDefinition->m_isTimeLapseResultUiField)); objFields.push_back(&(resultDefinition->m_timeLapseBaseTimestep));
objFields.push_back(&(resultDefinition->m_timeLapseBaseTimestepUiField));
for (size_t i = 0; i < objFields.size(); i++) for (size_t i = 0; i < objFields.size(); i++)
{ {

View File

@@ -1,6 +1,7 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2015- Statoil ASA // Copyright (C) 2018- Equinor ASA
// Copyright (C) 2015-2018 Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS // Copyright (C) 2015- Ceetron Solutions AS
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
@@ -76,11 +77,7 @@ RimGeoMechResultDefinition::RimGeoMechResultDefinition(void)
CAF_PDM_InitField(&m_resultComponentName, "ResultComponentName", QString(""), "Component", "", "", ""); CAF_PDM_InitField(&m_resultComponentName, "ResultComponentName", QString(""), "Component", "", "", "");
m_resultComponentName.uiCapability()->setUiHidden(true); m_resultComponentName.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_isTimeLapseResult, "IsTimeLapseResult", false, "TimeLapseResult", "", "", ""); CAF_PDM_InitField(&m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", (int) RigFemResultAddress::NO_TIME_LAPSE, "Base Time Step", "", "", "");
m_isTimeLapseResult.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", 0, "Base Time Step", "", "", "");
m_timeLapseBaseTimestep.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_compactionRefLayer, "CompactionRefLayer", 0, "Compaction Ref Layer", "", "", ""); CAF_PDM_InitField(&m_compactionRefLayer, "CompactionRefLayer", 0, "Compaction Ref Layer", "", "", "");
m_compactionRefLayer.uiCapability()->setUiHidden(true); m_compactionRefLayer.uiCapability()->setUiHidden(true);
@@ -91,18 +88,17 @@ RimGeoMechResultDefinition::RimGeoMechResultDefinition(void)
CAF_PDM_InitField(&m_resultVariableUiField, "ResultVariableUI", QString(""), "Value", "", "", ""); CAF_PDM_InitField(&m_resultVariableUiField, "ResultVariableUI", QString(""), "Value", "", "", "");
m_resultVariableUiField.xmlCapability()->disableIO(); m_resultVariableUiField.xmlCapability()->disableIO();
CAF_PDM_InitField(&m_isTimeLapseResultUiField, "IsTimeLapseResultUI", false, "Enable Relative Result", "", "Use the difference with respect to a specific time step as the result variable to plot", "");
m_isTimeLapseResultUiField.xmlCapability()->disableIO();
CAF_PDM_InitField(&m_timeLapseBaseTimestepUiField, "TimeLapseBaseTimeStepUI", 0, "Base Time Step", "", "", "");
m_timeLapseBaseTimestepUiField.xmlCapability()->disableIO();
m_resultVariableUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName()); m_resultVariableUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
m_resultVariableUiField.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); m_resultVariableUiField.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
CAF_PDM_InitField(&m_compactionRefLayerUiField, "CompactionRefLayerUi", (int)RigFemResultAddress::NO_COMPACTION, "Compaction Ref Layer", "", "The compaction is calculated with reference to this layer. Default layer is the topmost layer with POR", ""); CAF_PDM_InitField(&m_compactionRefLayerUiField, "CompactionRefLayerUi", (int)RigFemResultAddress::NO_COMPACTION, "Compaction Ref Layer", "", "The compaction is calculated with reference to this layer. Default layer is the topmost layer with POR", "");
m_compactionRefLayerUiField.xmlCapability()->disableIO(); m_compactionRefLayerUiField.xmlCapability()->disableIO();
// OBSOLETE FIELDS
CAF_PDM_InitField(&m_isTimeLapseResult_OBSOLETE, "IsTimeLapseResult", true, "TimeLapseResult", "", "", "");
m_isTimeLapseResult_OBSOLETE.xmlCapability()->setIOWritable(false);
m_isTimeLapseResult_OBSOLETE.uiCapability()->setUiHidden(true);
m_isChangedByField = false; m_isChangedByField = false;
m_addWellPathDerivedResults = false; m_addWellPathDerivedResults = false;
} }
@@ -123,12 +119,17 @@ void RimGeoMechResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
uiOrdering.add(&m_resultPositionTypeUiField); uiOrdering.add(&m_resultPositionTypeUiField);
uiOrdering.add(&m_resultVariableUiField); uiOrdering.add(&m_resultVariableUiField);
QString valueLabel = "Value";
if (m_timeLapseBaseTimestep != RigFemResultAddress::NO_TIME_LAPSE)
{
valueLabel += QString(" (%1)").arg(diffResultUiName());
}
m_resultVariableUiField.uiCapability()->setUiName(valueLabel);
if ( m_resultPositionTypeUiField() != RIG_FORMATION_NAMES ) if ( m_resultPositionTypeUiField() != RIG_FORMATION_NAMES )
{ {
caf::PdmUiGroup * timeLapseGr = uiOrdering.addNewGroup("Relative Result Options"); caf::PdmUiGroup * timeLapseGr = uiOrdering.addNewGroup("Difference Options");
timeLapseGr->add(&m_isTimeLapseResultUiField); timeLapseGr->add(&m_timeLapseBaseTimestep);
if ( m_isTimeLapseResultUiField() )
timeLapseGr->add(&m_timeLapseBaseTimestepUiField);
} }
if (m_resultPositionTypeUiField() == RIG_NODAL) if (m_resultPositionTypeUiField() == RIG_NODAL)
@@ -184,21 +185,15 @@ QList<caf::PdmOptionItemInfo> RimGeoMechResultDefinition::calculateValueOptions(
QStringList uiVarNames; QStringList uiVarNames;
QStringList varNames; QStringList varNames;
bool isNeedingTimeLapseStrings = m_isTimeLapseResultUiField() && (m_resultPositionTypeUiField() != RIG_FORMATION_NAMES);
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames, isNeedingTimeLapseStrings, m_timeLapseBaseTimestepUiField); getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames);
for (int oIdx = 0; oIdx < uiVarNames.size(); ++oIdx) for (int oIdx = 0; oIdx < uiVarNames.size(); ++oIdx)
{ {
options.push_back(caf::PdmOptionItemInfo(uiVarNames[oIdx], varNames[oIdx])); options.push_back(caf::PdmOptionItemInfo(uiVarNames[oIdx], varNames[oIdx]));
} }
} }
else if (&m_isTimeLapseResultUiField == fieldNeedingOptions) else if (&m_timeLapseBaseTimestep == fieldNeedingOptions)
{
//options.push_back(caf::PdmOptionItemInfo("Absolute", false));
//options.push_back(caf::PdmOptionItemInfo("Time Lapse", true));
}
else if (&m_timeLapseBaseTimestepUiField == fieldNeedingOptions)
{ {
std::vector<std::string> stepNames; std::vector<std::string> stepNames;
if(m_geomCase->geoMechData()) if(m_geomCase->geoMechData())
@@ -206,9 +201,10 @@ QList<caf::PdmOptionItemInfo> RimGeoMechResultDefinition::calculateValueOptions(
stepNames = m_geomCase->geoMechData()->femPartResults()->filteredStepNames(); stepNames = m_geomCase->geoMechData()->femPartResults()->filteredStepNames();
} }
options.push_back(caf::PdmOptionItemInfo(QString("Disabled"), (int)RigFemResultAddress::NO_TIME_LAPSE));
for (size_t stepIdx = 0; stepIdx < stepNames.size(); ++stepIdx) for (size_t stepIdx = 0; stepIdx < stepNames.size(); ++stepIdx)
{ {
options.push_back(caf::PdmOptionItemInfo(QString::fromStdString(stepNames[stepIdx]), static_cast<int>(stepIdx))); options.push_back(caf::PdmOptionItemInfo(QString("%1 (#%2)").arg(QString::fromStdString(stepNames[stepIdx])).arg(stepIdx), static_cast<int>(stepIdx)));
} }
} }
else if (&m_compactionRefLayerUiField == fieldNeedingOptions) else if (&m_compactionRefLayerUiField == fieldNeedingOptions)
@@ -246,45 +242,27 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
if (&m_resultPositionTypeUiField == changedField) if (&m_resultPositionTypeUiField == changedField)
{ {
if (m_resultPositionTypeUiField() == RIG_WELLPATH_DERIVED) if (m_resultPositionTypeUiField() == RIG_WELLPATH_DERIVED || m_resultPositionType() == RIG_FORMATION_NAMES)
{ {
m_isTimeLapseResultUiField = false; m_timeLapseBaseTimestep = RigFemResultAddress::NO_TIME_LAPSE;
m_isTimeLapseResultUiField.uiCapability()->setUiReadOnly(true); m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly(true);
m_timeLapseBaseTimestepUiField.uiCapability()->setUiReadOnly(true);
} }
else else
{ {
m_isTimeLapseResultUiField.uiCapability()->setUiReadOnly(false); m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly(false);
m_timeLapseBaseTimestepUiField.uiCapability()->setUiReadOnly(false);
}
}
if (&m_isTimeLapseResultUiField == changedField)
{
m_isTimeLapseResult = m_isTimeLapseResultUiField;
if (m_isTimeLapseResult())
{
if (m_timeLapseBaseTimestep() == RigFemResultAddress::NO_TIME_LAPSE)
{
m_timeLapseBaseTimestep = 0;
m_timeLapseBaseTimestepUiField = 0;
}
} }
} }
if( &m_resultPositionTypeUiField == changedField if( &m_resultPositionTypeUiField == changedField
|| &m_isTimeLapseResultUiField == changedField || &m_timeLapseBaseTimestep == changedField)
|| &m_timeLapseBaseTimestepUiField == changedField)
{ {
std::map<std::string, std::vector<std::string> > fieldCompNames = getResultMetaDataForUIFieldSetting(); std::map<std::string, std::vector<std::string> > fieldCompNames = getResultMetaDataForUIFieldSetting();
QStringList uiVarNames; QStringList uiVarNames;
QStringList varNames; QStringList varNames;
bool isNeedingTimeLapseStrings = m_isTimeLapseResultUiField() && (m_resultPositionTypeUiField() != RIG_FORMATION_NAMES);
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames, isNeedingTimeLapseStrings, m_timeLapseBaseTimestepUiField); getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames);
if (m_resultPositionTypeUiField() == m_resultPositionType() if (m_resultPositionTypeUiField() == m_resultPositionType()
&& m_isTimeLapseResultUiField() == m_isTimeLapseResult()
&& m_timeLapseBaseTimestepUiField() == m_timeLapseBaseTimestep()
&& varNames.contains(composeFieldCompString(m_resultFieldName(), m_resultComponentName()))) && varNames.contains(composeFieldCompString(m_resultFieldName(), m_resultComponentName())))
{ {
m_resultVariableUiField = composeFieldCompString(m_resultFieldName(), m_resultComponentName()); m_resultVariableUiField = composeFieldCompString(m_resultFieldName(), m_resultComponentName());
@@ -305,7 +283,7 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
this->firstAncestorOrThisOfType(rim3dWellLogCurve); this->firstAncestorOrThisOfType(rim3dWellLogCurve);
if (&m_resultVariableUiField == changedField || &m_compactionRefLayerUiField == changedField) if (&m_resultVariableUiField == changedField || &m_compactionRefLayerUiField == changedField || &m_timeLapseBaseTimestep == changedField)
{ {
QStringList fieldComponentNames = m_resultVariableUiField().split(QRegExp("\\s+")); QStringList fieldComponentNames = m_resultVariableUiField().split(QRegExp("\\s+"));
if (fieldComponentNames.size() > 0) if (fieldComponentNames.size() > 0)
@@ -316,8 +294,6 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
// Complete string of selected formation is stored in m_resultFieldName // Complete string of selected formation is stored in m_resultFieldName
m_resultFieldName = m_resultVariableUiField(); m_resultFieldName = m_resultVariableUiField();
m_resultComponentName = ""; m_resultComponentName = "";
m_isTimeLapseResult = false;
m_timeLapseBaseTimestep = 0;
} }
else else
{ {
@@ -331,8 +307,6 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
m_resultComponentName = ""; m_resultComponentName = "";
} }
m_isTimeLapseResult = m_isTimeLapseResultUiField();
m_timeLapseBaseTimestep = m_timeLapseBaseTimestepUiField();
m_compactionRefLayer = m_compactionRefLayerUiField(); m_compactionRefLayer = m_compactionRefLayerUiField();
} }
@@ -416,9 +390,7 @@ std::map<std::string, std::vector<std::string> > RimGeoMechResultDefinition::get
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGeoMechResultDefinition::getUiAndResultVariableStringList(QStringList* uiNames, void RimGeoMechResultDefinition::getUiAndResultVariableStringList(QStringList* uiNames,
QStringList* variableNames, QStringList* variableNames,
const std::map<std::string, std::vector<std::string> >& fieldCompNames, const std::map<std::string, std::vector<std::string> >& fieldCompNames)
bool isTimeLapseResultList,
int baseFrameIdx)
{ {
CVF_ASSERT(uiNames && variableNames); CVF_ASSERT(uiNames && variableNames);
@@ -429,7 +401,7 @@ void RimGeoMechResultDefinition::getUiAndResultVariableStringList(QStringList* u
if (resultFieldName == "E" || resultFieldName == "S" || resultFieldName == "POR") continue; // We will not show the native POR, Stress and Strain if (resultFieldName == "E" || resultFieldName == "S" || resultFieldName == "POR") continue; // We will not show the native POR, Stress and Strain
QString resultFieldUiName = convertToUiResultFieldName(resultFieldName, isTimeLapseResultList, baseFrameIdx); QString resultFieldUiName = convertToUiResultFieldName(resultFieldName);
uiNames->push_back(resultFieldUiName); uiNames->push_back(resultFieldUiName);
variableNames->push_back(resultFieldName); variableNames->push_back(resultFieldName);
@@ -438,7 +410,7 @@ void RimGeoMechResultDefinition::getUiAndResultVariableStringList(QStringList* u
for (compIt = fieldIt->second.begin(); compIt != fieldIt->second.end(); ++compIt) for (compIt = fieldIt->second.begin(); compIt != fieldIt->second.end(); ++compIt)
{ {
QString resultCompName = QString::fromStdString(*compIt); QString resultCompName = QString::fromStdString(*compIt);
uiNames->push_back(" " + convertToUIComponentName(resultCompName, isTimeLapseResultList, baseFrameIdx)); uiNames->push_back(resultCompName);
variableNames->push_back(composeFieldCompString(resultFieldName, resultCompName)); variableNames->push_back(composeFieldCompString(resultFieldName, resultCompName));
} }
} }
@@ -461,13 +433,17 @@ QString RimGeoMechResultDefinition::composeFieldCompString(const QString& result
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGeoMechResultDefinition::initAfterRead() void RimGeoMechResultDefinition::initAfterRead()
{ {
if (!m_isTimeLapseResult_OBSOLETE())
{
m_timeLapseBaseTimestep = RigFemResultAddress::NO_TIME_LAPSE;
}
m_resultPositionTypeUiField = m_resultPositionType; m_resultPositionTypeUiField = m_resultPositionType;
m_resultVariableUiField = composeFieldCompString(m_resultFieldName(), m_resultComponentName()); m_resultVariableUiField = composeFieldCompString(m_resultFieldName(), m_resultComponentName());
m_isTimeLapseResultUiField = m_isTimeLapseResult;
m_timeLapseBaseTimestepUiField = m_timeLapseBaseTimestep;
m_isTimeLapseResultUiField.uiCapability()->setUiReadOnly(resultPositionType() == RIG_WELLPATH_DERIVED);
m_timeLapseBaseTimestepUiField.uiCapability()->setUiReadOnly(resultPositionType() == RIG_WELLPATH_DERIVED);
m_compactionRefLayerUiField = m_compactionRefLayer; m_compactionRefLayerUiField = m_compactionRefLayer;
m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly(resultPositionType() == RIG_WELLPATH_DERIVED);
} }
@@ -509,7 +485,7 @@ RigFemResultAddress RimGeoMechResultDefinition::resultAddress() const
return RigFemResultAddress(resultPositionType(), return RigFemResultAddress(resultPositionType(),
resultFieldName().toStdString(), resultFieldName().toStdString(),
resultComponentName().toStdString(), resultComponentName().toStdString(),
m_isTimeLapseResult() ? m_timeLapseBaseTimestep() : RigFemResultAddress::NO_TIME_LAPSE, m_timeLapseBaseTimestep(),
resultFieldName().toStdString() == RigFemPartResultsCollection::FIELD_NAME_COMPACTION ? m_compactionRefLayer() : RigFemResultAddress::NO_COMPACTION); resultFieldName().toStdString() == RigFemPartResultsCollection::FIELD_NAME_COMPACTION ? m_compactionRefLayer() : RigFemResultAddress::NO_COMPACTION);
} }
@@ -545,6 +521,40 @@ QString RimGeoMechResultDefinition::resultComponentName() const
return m_resultComponentName(); return m_resultComponentName();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGeoMechResultDefinition::diffResultUiName() const
{
QString diffResultString;
if (m_timeLapseBaseTimestep != RigFemResultAddress::NO_TIME_LAPSE)
{
if (m_geomCase->geoMechData())
{
std::vector<std::string> stepNames = m_geomCase->geoMechData()->femPartResults()->filteredStepNames();
QString timeStepString = QString::fromStdString(stepNames[m_timeLapseBaseTimestep()]);
diffResultString += QString("<b>Base Time Step</b>: %1").arg(timeStepString);
}
}
return diffResultString;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGeoMechResultDefinition::diffResultUiShortName() const
{
QString diffResultString;
if (m_timeLapseBaseTimestep != RigFemResultAddress::NO_TIME_LAPSE)
{
if (m_geomCase->geoMechData())
{
diffResultString += QString("Base Time: #%1").arg(m_timeLapseBaseTimestep());
}
}
return diffResultString;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -576,7 +586,7 @@ bool RimGeoMechResultDefinition::hasResult()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimGeoMechResultDefinition::resultFieldUiName() QString RimGeoMechResultDefinition::resultFieldUiName()
{ {
return convertToUiResultFieldName(m_resultFieldName(), m_isTimeLapseResult, m_timeLapseBaseTimestep); return convertToUiResultFieldName(m_resultFieldName());
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -584,15 +594,13 @@ QString RimGeoMechResultDefinition::resultFieldUiName()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimGeoMechResultDefinition::resultComponentUiName() QString RimGeoMechResultDefinition::resultComponentUiName()
{ {
return convertToUIComponentName(m_resultComponentName(), m_isTimeLapseResult, m_timeLapseBaseTimestep); return m_resultComponentName();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimGeoMechResultDefinition::convertToUiResultFieldName(QString resultFieldName, QString RimGeoMechResultDefinition::convertToUiResultFieldName(QString resultFieldName)
bool isTimeLapseResultList,
int baseFrameIdx)
{ {
QString newName (resultFieldName); QString newName (resultFieldName);
@@ -603,23 +611,9 @@ QString RimGeoMechResultDefinition::convertToUiResultFieldName(QString resultFie
if (resultFieldName == "MODULUS") newName = "Young's Modulus"; if (resultFieldName == "MODULUS") newName = "Young's Modulus";
if (resultFieldName == "RATIO") newName = "Poisson's Ratio"; if (resultFieldName == "RATIO") newName = "Poisson's Ratio";
if (isTimeLapseResultList) newName += "_D" + QString::number(baseFrameIdx);
return newName; return newName;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGeoMechResultDefinition::convertToUIComponentName(QString resultComponentName,
bool isTimeLapseResultList,
int baseFrameIdx)
{
if(isTimeLapseResultList) resultComponentName += "_D" + QString::number(baseFrameIdx);
return resultComponentName;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -628,18 +622,10 @@ void RimGeoMechResultDefinition::setResultAddress( const RigFemResultAddress& re
m_resultPositionType = resultAddress.resultPosType; m_resultPositionType = resultAddress.resultPosType;
m_resultFieldName = QString::fromStdString(resultAddress.fieldName); m_resultFieldName = QString::fromStdString(resultAddress.fieldName);
m_resultComponentName = QString::fromStdString(resultAddress.componentName); m_resultComponentName = QString::fromStdString(resultAddress.componentName);
m_timeLapseBaseTimestep = resultAddress.timeLapseBaseFrameIdx;
m_compactionRefLayer = resultAddress.refKLayerIndex;
m_resultPositionTypeUiField = m_resultPositionType; m_resultPositionTypeUiField = m_resultPositionType;
m_resultVariableUiField = composeFieldCompString(m_resultFieldName(), m_resultComponentName()); m_resultVariableUiField = composeFieldCompString(m_resultFieldName(), m_resultComponentName());
m_isTimeLapseResult = resultAddress.isTimeLapse();
m_isTimeLapseResultUiField = m_isTimeLapseResult;
if (m_isTimeLapseResult)
{
m_timeLapseBaseTimestep = resultAddress.timeLapseBaseFrameIdx;
}
m_timeLapseBaseTimestepUiField = m_timeLapseBaseTimestep;
m_compactionRefLayer = resultAddress.refKLayerIndex;
m_compactionRefLayerUiField = m_compactionRefLayer; m_compactionRefLayerUiField = m_compactionRefLayer;
} }

View File

@@ -1,6 +1,7 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2015- Statoil ASA // Copyright (C) 2018- Equinor ASA
// Copyright (C) 2015-2018 Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS // Copyright (C) 2015- Ceetron Solutions AS
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
@@ -43,28 +44,30 @@ public:
RimGeoMechResultDefinition(void); RimGeoMechResultDefinition(void);
~RimGeoMechResultDefinition(void) override; ~RimGeoMechResultDefinition(void) override;
void setGeoMechCase(RimGeoMechCase* geomCase); void setGeoMechCase(RimGeoMechCase* geomCase);
RigGeoMechCaseData* ownerCaseData(); RigGeoMechCaseData* ownerCaseData();
bool hasResult(); bool hasResult();
void loadResult(); void loadResult();
void setAddWellPathDerivedResults(bool addWellPathDerivedResults); void setAddWellPathDerivedResults(bool addWellPathDerivedResults);
RigFemResultAddress resultAddress() const; RigFemResultAddress resultAddress() const;
std::vector<RigFemResultAddress> observedResults() const override; std::vector<RigFemResultAddress> observedResults() const override;
RigFemResultPosEnum resultPositionType() const; RigFemResultPosEnum resultPositionType() const;
QString resultFieldName() const; QString resultFieldName() const;
QString resultComponentName() const; QString resultComponentName() const;
void setResultAddress(const RigFemResultAddress& resultAddress); QString diffResultUiName() const;
QString diffResultUiShortName() const;
void setResultAddress(const RigFemResultAddress& resultAddress);
QString resultFieldUiName(); QString resultFieldUiName();
QString resultComponentUiName(); QString resultComponentUiName();
bool hasCategoryResult() { return m_resultPositionType() == RIG_FORMATION_NAMES; } bool hasCategoryResult() { return m_resultPositionType() == RIG_FORMATION_NAMES; }
protected: protected:
virtual void updateLegendCategorySettings() {}; virtual void updateLegendCategorySettings() {};
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private: private:
@@ -83,41 +86,33 @@ private:
std::map<std::string, std::vector<std::string> > getResultMetaDataForUIFieldSetting(); std::map<std::string, std::vector<std::string> > getResultMetaDataForUIFieldSetting();
static void getUiAndResultVariableStringList(QStringList* uiNames, static void getUiAndResultVariableStringList(QStringList* uiNames,
QStringList* variableNames, QStringList* variableNames,
const std::map<std::string, std::vector<std::string> >& fieldCompNames, const std::map<std::string, std::vector<std::string> >& fieldCompNames);
bool isTimeLapseResultList,
int baseFrameIdx);
static QString composeFieldCompString(const QString& resultFieldName, static QString composeFieldCompString(const QString& resultFieldName,
const QString& resultComponentName); const QString& resultComponentName);
static QString convertToUiResultFieldName(QString resultFieldName, static QString convertToUiResultFieldName(QString resultFieldName);
bool isTimeLapseResultList,
int baseFrameIdx);
static QString convertToUIComponentName(QString resultComponentName,
bool isTimeLapseResultList,
int baseFrameIdx);
// Data Fields // Data Fields
caf::PdmField<caf::AppEnum<RigFemResultPosEnum> > m_resultPositionType; caf::PdmField<caf::AppEnum<RigFemResultPosEnum> > m_resultPositionType;
caf::PdmField<QString> m_resultFieldName; caf::PdmField<QString> m_resultFieldName;
caf::PdmField<QString> m_resultComponentName; caf::PdmField<QString> m_resultComponentName;
caf::PdmField<bool> m_isTimeLapseResult;
caf::PdmField<int> m_timeLapseBaseTimestep; caf::PdmField<int> m_timeLapseBaseTimestep;
caf::PdmField<int> m_compactionRefLayer; caf::PdmField<int> m_compactionRefLayer;
// UI Fields only // UI Fields only
friend class RimGeoMechPropertyFilter; // Property filter needs the ui fields friend class RimGeoMechPropertyFilter; // Property filter needs the ui fields
friend class RimWellLogExtractionCurve; // Curve needs the ui fields friend class RimWellLogExtractionCurve; // Curve needs the ui fields
friend class RimGeoMechCellColors; // Needs the ui fields friend class RimGeoMechCellColors; // Needs the ui fields
caf::PdmField<caf::AppEnum<RigFemResultPosEnum> > m_resultPositionTypeUiField; caf::PdmField<caf::AppEnum<RigFemResultPosEnum> > m_resultPositionTypeUiField;
caf::PdmField<QString> m_resultVariableUiField; caf::PdmField<QString> m_resultVariableUiField;
caf::PdmField<bool> m_isTimeLapseResultUiField;
caf::PdmField<int> m_timeLapseBaseTimestepUiField;
caf::PdmField<int> m_compactionRefLayerUiField; caf::PdmField<int> m_compactionRefLayerUiField;
caf::PdmPointer<RimGeoMechCase> m_geomCase; caf::PdmPointer<RimGeoMechCase> m_geomCase;
// Obsolete Data Fields
caf::PdmField<bool> m_isTimeLapseResult_OBSOLETE;
bool m_isChangedByField; bool m_isChangedByField;
bool m_addWellPathDerivedResults; bool m_addWellPathDerivedResults;
}; };

View File

@@ -554,6 +554,11 @@ void RimGeoMechView::updateLegendTextAndRanges(RimRegularLegendConfig* legendCon
legendTitle += " [GPa]"; legendTitle += " [GPa]";
} }
if (!cellResult->diffResultUiShortName().isEmpty())
{
legendTitle += QString("\nTime Diff:\n%1").arg(cellResult->diffResultUiShortName());
}
legendConfig->setTitle(legendTitle); legendConfig->setTitle(legendTitle);
} }