#1054 Added sensible information to the Result Info window when picking Flow Diag results.

Also rolled out the use of resultVariableUiName() to places that should use it.
This commit is contained in:
Jacob Støren
2017-01-04 13:13:06 +01:00
parent 03cf09d90a
commit ebddaa31e6
11 changed files with 48 additions and 25 deletions

View File

@@ -37,6 +37,7 @@
#include <QFileInfo> #include <QFileInfo>
#include <QMessageBox> #include <QMessageBox>
#include "cafUtils.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -84,12 +85,13 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
projectFolder = m_cellColors->reservoirView()->eclipseCase()->locationOnDisc(); projectFolder = m_cellColors->reservoirView()->eclipseCase()->locationOnDisc();
} }
QString outputFileName = projectFolder + "/" + m_cellColors->resultVariable(); QString outputFileName = projectFolder + "/" + caf::Utils::makeValidFileBasename( m_cellColors->resultVariableUiName());
exportSettings.fileName = outputFileName; exportSettings.fileName = outputFileName;
} }
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Binary Eclipse Data to Text File", ""); caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Binary Eclipse Data to Text File", "");
if (propertyDialog.exec() == QDialog::Accepted) if (propertyDialog.exec() == QDialog::Accepted)
{ {
size_t timeStep = m_cellColors->reservoirView()->currentTimeStep(); size_t timeStep = m_cellColors->reservoirView()->currentTimeStep();

View File

@@ -293,7 +293,7 @@ QString RicExportMultipleSnapshotsFeature::resultName(RimView* rimView)
{ {
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(rimView); RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(rimView);
return eclView->cellResult()->resultVariable(); return caf::Utils::makeValidFileBasename(eclView->cellResult()->resultVariableUiName());
} }
else if (dynamic_cast<RimGeoMechView*>(rimView)) else if (dynamic_cast<RimGeoMechView*>(rimView))
{ {

View File

@@ -472,7 +472,13 @@ bool RifEclipseInputFileTools::writePropertyToTextFile(const QString& fileName,
/// Create and write a result vector with values for all cells. /// Create and write a result vector with values for all cells.
/// undefinedValue is used for cells with no result /// undefinedValue is used for cells with no result
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifEclipseInputFileTools::writeBinaryResultToTextFile(const QString& fileName, RigCaseData* eclipseCase, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStep, const QString& resultName, const QString& eclipseKeyWord, const double undefinedValue) bool RifEclipseInputFileTools::writeBinaryResultToTextFile(const QString& fileName,
RigCaseData* eclipseCase,
RifReaderInterface::PorosityModelResultType porosityModel,
size_t timeStep,
const QString& resultName,
const QString& eclipseKeyWord,
const double undefinedValue)
{ {
CVF_ASSERT(eclipseCase); CVF_ASSERT(eclipseCase);

View File

@@ -360,13 +360,13 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
if (eclipseView->cellResult()->isTernarySaturationSelected()) if (eclipseView->cellResult()->isTernarySaturationSelected())
{ {
QString propName = eclipseView->cellResult()->resultVariable(); QString propName = eclipseView->cellResult()->resultVariableUiName();
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName); infoText += QString("<b>Cell Property:</b> %1 ").arg(propName);
} }
if (isResultsInfoRelevant) if (isResultsInfoRelevant)
{ {
QString propName = eclipseView->cellResult()->resultVariable(); QString propName = eclipseView->cellResult()->resultVariableUiName();
QString timeRangeText = m_statisticsTimeRange().uiText(); QString timeRangeText = m_statisticsTimeRange().uiText();
if ( eclipseView->cellResult()->resultType() == RimDefines::FLOW_DIAGNOSTICS ) if ( eclipseView->cellResult()->resultType() == RimDefines::FLOW_DIAGNOSTICS )
{ {
@@ -406,7 +406,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
} }
infoText += QString("<b>Fault results: </b> %1<br>").arg(faultMapping); infoText += QString("<b>Fault results: </b> %1<br>").arg(faultMapping);
infoText += QString("<b>Fault Property:</b> %1 <br>").arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariable()); infoText += QString("<b>Fault Property:</b> %1 <br>").arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariableUiName());
} }
} }

View File

@@ -353,7 +353,7 @@ void RimEclipsePropertyFilter::computeResultValueRange()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilter::updateFilterName() void RimEclipsePropertyFilter::updateFilterName()
{ {
QString newFiltername = resultDefinition->resultVariable(); QString newFiltername = resultDefinition->resultVariableUiName();
if (isCategorySelectionActive()) if (isCategorySelectionActive())
{ {

View File

@@ -515,6 +515,19 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
return RigFlowDiagResultAddress(m_resultVariable().toStdString(), selTracerNames); return RigFlowDiagResultAddress(m_resultVariable().toStdString(), selTracerNames);
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::resultVariableUiName()
{
if (resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
return QString::fromStdString(flowDiagResAddress().uiText());
}
return m_resultVariable();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -59,6 +59,8 @@ public:
RimFlowDiagSolution* flowDiagSolution(); RimFlowDiagSolution* flowDiagSolution();
RigFlowDiagResultAddress flowDiagResAddress() const; RigFlowDiagResultAddress flowDiagResAddress() const;
QString resultVariableUiName();
void loadResult(); void loadResult();
size_t scalarResultIndex() const; size_t scalarResultIndex() const;
bool hasStaticResult() const; bool hasStaticResult() const;

View File

@@ -1000,18 +1000,18 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
{ {
double globalMin, globalMax; double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero; double globalPosClosestToZero, globalNegClosestToZero;
RigFlowDiagResults* cellResultsData = resultColors->flowDiagSolution()->flowDiagResults(); RigFlowDiagResults* flowResultsData = resultColors->flowDiagSolution()->flowDiagResults();
RigFlowDiagResultAddress resAddr = resultColors->flowDiagResAddress(); RigFlowDiagResultAddress resAddr = resultColors->flowDiagResAddress();
cellResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &globalMin, &globalMax); flowResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &globalMin, &globalMax);
cellResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &globalPosClosestToZero, &globalNegClosestToZero); flowResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &globalPosClosestToZero, &globalNegClosestToZero);
double localMin, localMax; double localMin, localMax;
double localPosClosestToZero, localNegClosestToZero; double localPosClosestToZero, localNegClosestToZero;
if ( resultColors->hasDynamicResult() ) if ( resultColors->hasDynamicResult() )
{ {
cellResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &localMin, &localMax); flowResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &localMin, &localMax);
cellResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &localPosClosestToZero, &localNegClosestToZero); flowResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &localPosClosestToZero, &localNegClosestToZero);
} }
else else
{ {
@@ -1033,9 +1033,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
resultColors->legendConfig()->setNamedCategories(resultColors->flowDiagSolution()->tracerNames()); resultColors->legendConfig()->setNamedCategories(resultColors->flowDiagSolution()->tracerNames());
} }
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend()); }
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + QString::fromStdString( resultColors->flowDiagResAddress().uiText())));
}
else else
{ {
double globalMin, globalMax; double globalMin, globalMax;
@@ -1077,10 +1075,10 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
resultColors->legendConfig()->setNamedCategoriesInverse(fnVector); resultColors->legendConfig()->setNamedCategoriesInverse(fnVector);
} }
} }
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariable()));
} }
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariableUiName()));
} }

View File

@@ -51,6 +51,7 @@
#include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeOrdering.h"
#include <cmath> #include <cmath>
#include "cafUtils.h"
//================================================================================================== //==================================================================================================
/// ///
@@ -570,7 +571,7 @@ QString RimWellLogExtractionCurve::wellLogChannelName() const
QString name; QString name;
if (eclipseCase) if (eclipseCase)
{ {
name = m_eclipseResultDefinition->resultVariable(); name = caf::Utils::makeValidFileBasename( m_eclipseResultDefinition->resultVariableUiName());
} }
else if (geoMechCase) else if (geoMechCase)
{ {

View File

@@ -345,7 +345,7 @@ QString RiuResultTextBuilder::nncResultText()
const std::vector<double>* nncValues = nncData->connectionScalarResult(scalarResultIdx); const std::vector<double>* nncValues = nncData->connectionScalarResult(scalarResultIdx);
if (nncValues) if (nncValues)
{ {
QString resultVar = m_reservoirView->currentFaultResultColors()->resultVariable(); QString resultVar = m_reservoirView->currentFaultResultColors()->resultVariableUiName();
double scalarValue = (*nncValues)[m_nncIndex]; double scalarValue = (*nncValues)[m_nncIndex];
text = QString("%1 : %2").arg(resultVar).arg(scalarValue); text = QString("%1 : %2").arg(resultVar).arg(scalarValue);
@@ -489,14 +489,14 @@ void RiuResultTextBuilder::appendTextFromResultColors(RigCaseData* eclipseCase,
} }
else else
{ {
resultAccessor = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, resultColors->scalarResultIndex()); resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, gridIndex, timeStepIndex, resultColors);
} }
if (resultAccessor.notNull()) if (resultAccessor.notNull())
{ {
double scalarValue = resultAccessor->cellScalar(cellIndex); double scalarValue = resultAccessor->cellScalar(cellIndex);
resultInfoText->append("Cell result : "); resultInfoText->append("Cell result : ");
resultInfoText->append(resultColors->resultVariable()); resultInfoText->append(resultColors->resultVariableUiName());
resultInfoText->append(QString(" : %1\n").arg(scalarValue)); resultInfoText->append(QString(" : %1\n").arg(scalarValue));
} }
} }
@@ -649,7 +649,6 @@ QString RiuResultTextBuilder::cellResultText(RimEclipseCellColors* resultColors)
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultColors->porosityModel()); RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultColors->porosityModel());
QString resultVar = resultColors->resultVariable();
if (resultColors->isTernarySaturationSelected()) if (resultColors->isTernarySaturationSelected())
{ {
@@ -687,10 +686,12 @@ QString RiuResultTextBuilder::cellResultText(RimEclipseCellColors* resultColors)
adjustedTimeStep = 0; adjustedTimeStep = 0;
} }
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, m_gridIndex, porosityModel, adjustedTimeStep, resultVar); cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCaseData, m_gridIndex, adjustedTimeStep, resultColors);
if (resultAccessor.notNull()) if (resultAccessor.notNull())
{ {
double scalarValue = resultAccessor->cellFaceScalar(m_cellIndex, m_face); double scalarValue = resultAccessor->cellFaceScalar(m_cellIndex, m_face);
QString resultVar = resultColors->resultVariableUiName();
text = QString("%1 : %2").arg(resultVar).arg(scalarValue); text = QString("%1 : %2").arg(resultVar).arg(scalarValue);
} }
} }

View File

@@ -123,7 +123,7 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuEclipseSelec
QString curveName = eclipseView->eclipseCase()->caseUserDescription(); QString curveName = eclipseView->eclipseCase()->caseUserDescription();
curveName += ", "; curveName += ", ";
curveName += eclipseView->cellResult()->resultVariable(); curveName += eclipseView->cellResult()->resultVariableUiName();
curveName += ", "; curveName += ", ";
curveName += QString("Grid index %1").arg(eclipseSelectionItem->m_gridIndex); curveName += QString("Grid index %1").arg(eclipseSelectionItem->m_gridIndex);
curveName += ", "; curveName += ", ";