#1052 3D info box: Added Flow Diag results statistics etc.

This commit is contained in:
Jacob Støren
2017-01-03 13:14:07 +01:00
parent 51e8cae11b
commit 5f6468898b
6 changed files with 136 additions and 5 deletions

View File

@@ -45,6 +45,8 @@
#include "RimView.h"
#include "RiuViewer.h"
#include "RigFlowDiagResults.h"
#include "RigFlowDiagVisibleCellsStatCalc.h"
CAF_PDM_SOURCE_INIT(Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig");
//--------------------------------------------------------------------------------------------------
@@ -182,6 +184,31 @@ caf::PdmFieldHandle* Rim3dOverlayInfoConfig::objectToggleField()
return &active;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dOverlayInfoConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* visGroup = uiOrdering.addNewGroup("Visibility");
visGroup->add(&showAnimProgress);
visGroup->add(&showCaseInfo);
visGroup->add(&showResultInfo);
visGroup->add(&showHistogram);
caf::PdmUiGroup* statGroup = uiOrdering.addNewGroup("Statistics Options");
RimEclipseView * eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
if ( !eclipseView || eclipseView->cellResult()->resultType() != RimDefines::FLOW_DIAGNOSTICS ) //
{
statGroup->add(&m_statisticsTimeRange);
}
statGroup->add(&m_statisticsCellRange);
uiOrdering.setForgetRemainingFields(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -260,6 +287,36 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
}
}
}
else if (eclipseView->cellResult()->resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
if ( m_statisticsTimeRange == CURRENT_TIMESTEP || m_statisticsTimeRange == ALL_TIMESTEPS) // All timesteps is ignored
{
int currentTimeStep = eclipseView->currentTimeStep();
if ( m_statisticsCellRange == ALL_CELLS )
{
RigFlowDiagResults* fldResults = eclipseView->cellResult()->flowDiagSolution()->flowDiagResults();
RigFlowDiagResultAddress resAddr = eclipseView->cellResult()->flowDiagResAddress();
fldResults->minMaxScalarValues(resAddr, currentTimeStep, &min, &max);
fldResults->p10p90ScalarValues(resAddr, currentTimeStep, &p10, &p90);
fldResults->meanScalarValue(resAddr, currentTimeStep, &mean);
fldResults->sumScalarValue(resAddr, currentTimeStep, &sum);
histogram = &(fldResults->scalarValuesHistogram(resAddr, currentTimeStep));
}
else if (m_statisticsCellRange == VISIBLE_CELLS )
{
updateVisCellStatsIfNeeded();
m_visibleCellStatistics->meanCellScalarValues(currentTimeStep, mean);
m_visibleCellStatistics->minMaxCellScalarValues(currentTimeStep, min, max);
m_visibleCellStatistics->p10p90CellScalarValues(currentTimeStep, p10, p90);
m_visibleCellStatistics->sumCellScalarValues(currentTimeStep, sum);
histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(currentTimeStep));
}
}
}
}
}
@@ -310,8 +367,15 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
if (isResultsInfoRelevant)
{
QString propName = eclipseView->cellResult()->resultVariable();
QString timeRangeText = m_statisticsTimeRange().uiText();
if ( eclipseView->cellResult()->resultType() == RimDefines::FLOW_DIAGNOSTICS )
{
timeRangeText = caf::AppEnum<StatisticsTimeRangeType>::uiText(CURRENT_TIMESTEP);
propName = QString::fromStdString( eclipseView->cellResult()->flowDiagResAddress().uiText());
}
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName);
infoText += QString("<br><b>Statistics:</b> ") + m_statisticsTimeRange().uiText() + " and " + m_statisticsCellRange().uiText();
infoText += QString("<br><b>Statistics:</b> ") + timeRangeText + " and " + m_statisticsCellRange().uiText();
infoText += QString("<table border=0 cellspacing=5 >"
"<tr> <td>Min</td> <td>P10</td> <td>Mean</td> <td>P90</td> <td>Max</td> <td>Sum</td> </tr>"
"<tr> <td>%1</td> <td> %2</td> <td> %3</td> <td> %4</td> <td> %5</td> <td> %6</td> </tr>"
@@ -550,10 +614,22 @@ void Rim3dOverlayInfoConfig::updateVisCellStatsIfNeeded()
}
else if (eclipseView)
{
size_t scalarIndex = eclipseView->cellResult()->scalarResultIndex();
calc = new RigEclipseNativeVisibleCellsStatCalc(eclipseView->currentGridCellResults()->cellResults(),
scalarIndex,
if ( eclipseView->cellResult()->resultType() == RimDefines::FLOW_DIAGNOSTICS )
{
RigFlowDiagResultAddress resAddr = eclipseView->cellResult()->flowDiagResAddress();
RigFlowDiagResults* fldResults = eclipseView->cellResult()->flowDiagSolution()->flowDiagResults();
calc = new RigFlowDiagVisibleCellsStatCalc(fldResults,
resAddr,
eclipseView->currentTotalCellVisibility().p());
}
else
{
size_t scalarIndex = eclipseView->cellResult()->scalarResultIndex();
calc = new RigEclipseNativeVisibleCellsStatCalc(eclipseView->currentGridCellResults()->cellResults(),
scalarIndex,
eclipseView->currentTotalCellVisibility().p());
}
}
m_visibleCellStatistics = new RigStatisticsDataCache(calc.p());