diff --git a/ApplicationCode/Commands/RicGridStatisticsDialog.cpp b/ApplicationCode/Commands/RicGridStatisticsDialog.cpp index a171ad1d6b..84aee97ecf 100644 --- a/ApplicationCode/Commands/RicGridStatisticsDialog.cpp +++ b/ApplicationCode/Commands/RicGridStatisticsDialog.cpp @@ -62,6 +62,7 @@ RicGridStatisticsDialog::RicGridStatisticsDialog(QWidget* parent) // Define layout QVBoxLayout* layout = new QVBoxLayout(); + layout->setSpacing(0); layout->addWidget(m_label); layout->addWidget(m_textEdit); layout->addWidget(m_historgramPlot); @@ -94,8 +95,8 @@ void RicGridStatisticsDialog::setInfoText(RimEclipseView* eclipseView) if (eclipseView && overlayInfo) { QString text; - text = overlayInfo->caseInfoText(eclipseView); - text += overlayInfo->resultInfoText(overlayInfo->histogramData(eclipseView), eclipseView); + text = overlayInfo->caseInfoText(); + text += overlayInfo->resultInfoText(overlayInfo->histogramData()); m_textEdit->setText(text); } } @@ -119,7 +120,7 @@ void RicGridStatisticsDialog::setHistogramData(RimEclipseView* eclipseView) aggr->setStyle(QwtPlotCurve::Steps); aggr->setCurveAttribute(QwtPlotCurve::Inverted); - Rim3dOverlayInfoConfig::HistogramData histogramData = overlayInfo->histogramData(eclipseView); + Rim3dOverlayInfoConfig::HistogramData histogramData = overlayInfo->histogramData(); QVector histSamples; QVector aggrSamples; diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index 3a94434059..57ddde65a5 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -163,108 +163,112 @@ void Rim3dOverlayInfoConfig::setPosition(cvf::Vec2ui position) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimEclipseView* eclipseView) +Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData() { HistogramData histData; - bool isResultsInfoRelevant = eclipseView->hasUserRequestedAnimation() && eclipseView->cellResult()->hasResult(); - - if (isResultsInfoRelevant) + RimEclipseView* eclipseView = dynamic_cast(m_viewDef.p()); + if (eclipseView) { - size_t scalarIndex = eclipseView->cellResult()->scalarResultIndex(); + bool isResultsInfoRelevant = eclipseView->hasUserRequestedAnimation() && eclipseView->cellResult()->hasResult(); - if (scalarIndex != cvf::UNDEFINED_SIZE_T) + if (isResultsInfoRelevant) { + size_t scalarIndex = eclipseView->cellResult()->scalarResultIndex(); - if (m_statisticsCellRange == ALL_CELLS) + if (scalarIndex != cvf::UNDEFINED_SIZE_T) { - if (m_statisticsTimeRange == ALL_TIMESTEPS) - { - eclipseView->currentGridCellResults()->minMaxCellScalarValues(scalarIndex, histData.min, histData.max); - eclipseView->currentGridCellResults()->p10p90CellScalarValues(scalarIndex, histData.p10, histData.p90); - eclipseView->currentGridCellResults()->meanCellScalarValues(scalarIndex, histData.mean); - eclipseView->currentGridCellResults()->sumCellScalarValues(scalarIndex, histData.sum); - histData.histogram = &(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(scalarIndex)); - } - else if (m_statisticsTimeRange == CURRENT_TIMESTEP) - { - int currentTimeStep = eclipseView->currentTimeStep(); - if (eclipseView->cellResult()->hasStaticResult()) - { - currentTimeStep = 0; - } - - eclipseView->currentGridCellResults()->minMaxCellScalarValues(scalarIndex, currentTimeStep, histData.min, histData.max); - eclipseView->currentGridCellResults()->p10p90CellScalarValues(scalarIndex, currentTimeStep, histData.p10, histData.p90); - eclipseView->currentGridCellResults()->meanCellScalarValues(scalarIndex, currentTimeStep, histData.mean); - eclipseView->currentGridCellResults()->sumCellScalarValues(scalarIndex, currentTimeStep, histData.sum); - histData.histogram = &(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(scalarIndex, currentTimeStep)); - } - else - { - CVF_ASSERT(false); - } - } - else if (m_statisticsCellRange == VISIBLE_CELLS) - { - updateVisCellStatsIfNeeded(); - if (m_statisticsTimeRange == ALL_TIMESTEPS) - { - // TODO: Only valid if we have no dynamic property filter - m_visibleCellStatistics->meanCellScalarValues(histData.mean); - m_visibleCellStatistics->minMaxCellScalarValues(histData.min, histData.max); - m_visibleCellStatistics->p10p90CellScalarValues(histData.p10, histData.p90); - m_visibleCellStatistics->sumCellScalarValues(histData.sum); - - histData.histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram()); - } - else if (m_statisticsTimeRange == CURRENT_TIMESTEP) - { - int currentTimeStep = eclipseView->currentTimeStep(); - if (eclipseView->cellResult()->hasStaticResult()) - { - currentTimeStep = 0; - } - - m_visibleCellStatistics->meanCellScalarValues(currentTimeStep, histData.mean); - m_visibleCellStatistics->minMaxCellScalarValues(currentTimeStep, histData.min, histData.max); - m_visibleCellStatistics->p10p90CellScalarValues(currentTimeStep, histData.p10, histData.p90); - m_visibleCellStatistics->sumCellScalarValues(currentTimeStep, histData.sum); - m_visibleCellStatistics->mobileVolumeWeightedMean(currentTimeStep, histData.weightedMean); - - histData.histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(currentTimeStep)); - } - } - } - else if (eclipseView->cellResult()->isFlowDiagOrInjectionFlooding()) - { - 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(); + if (m_statisticsTimeRange == ALL_TIMESTEPS) + { + eclipseView->currentGridCellResults()->minMaxCellScalarValues(scalarIndex, histData.min, histData.max); + eclipseView->currentGridCellResults()->p10p90CellScalarValues(scalarIndex, histData.p10, histData.p90); + eclipseView->currentGridCellResults()->meanCellScalarValues(scalarIndex, histData.mean); + eclipseView->currentGridCellResults()->sumCellScalarValues(scalarIndex, histData.sum); + histData.histogram = &(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(scalarIndex)); + } + else if (m_statisticsTimeRange == CURRENT_TIMESTEP) + { + int currentTimeStep = eclipseView->currentTimeStep(); + if (eclipseView->cellResult()->hasStaticResult()) + { + currentTimeStep = 0; + } - fldResults->minMaxScalarValues(resAddr, currentTimeStep, &histData.min, &histData.max); - fldResults->p10p90ScalarValues(resAddr, currentTimeStep, &histData.p10, &histData.p90); - fldResults->meanScalarValue(resAddr, currentTimeStep, &histData.mean); - fldResults->sumScalarValue(resAddr, currentTimeStep, &histData.sum); - - histData.histogram = &(fldResults->scalarValuesHistogram(resAddr, currentTimeStep)); + eclipseView->currentGridCellResults()->minMaxCellScalarValues(scalarIndex, currentTimeStep, histData.min, histData.max); + eclipseView->currentGridCellResults()->p10p90CellScalarValues(scalarIndex, currentTimeStep, histData.p10, histData.p90); + eclipseView->currentGridCellResults()->meanCellScalarValues(scalarIndex, currentTimeStep, histData.mean); + eclipseView->currentGridCellResults()->sumCellScalarValues(scalarIndex, currentTimeStep, histData.sum); + histData.histogram = &(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(scalarIndex, currentTimeStep)); + } + else + { + CVF_ASSERT(false); + } } else if (m_statisticsCellRange == VISIBLE_CELLS) { updateVisCellStatsIfNeeded(); + if (m_statisticsTimeRange == ALL_TIMESTEPS) + { + // TODO: Only valid if we have no dynamic property filter + m_visibleCellStatistics->meanCellScalarValues(histData.mean); + m_visibleCellStatistics->minMaxCellScalarValues(histData.min, histData.max); + m_visibleCellStatistics->p10p90CellScalarValues(histData.p10, histData.p90); + m_visibleCellStatistics->sumCellScalarValues(histData.sum); - m_visibleCellStatistics->meanCellScalarValues(currentTimeStep, histData.mean); - m_visibleCellStatistics->minMaxCellScalarValues(currentTimeStep, histData.min, histData.max); - m_visibleCellStatistics->p10p90CellScalarValues(currentTimeStep, histData.p10, histData.p90); - m_visibleCellStatistics->sumCellScalarValues(currentTimeStep, histData.sum); - m_visibleCellStatistics->mobileVolumeWeightedMean(currentTimeStep, histData.weightedMean); + histData.histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram()); + } + else if (m_statisticsTimeRange == CURRENT_TIMESTEP) + { + int currentTimeStep = eclipseView->currentTimeStep(); + if (eclipseView->cellResult()->hasStaticResult()) + { + currentTimeStep = 0; + } - histData.histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(currentTimeStep)); + m_visibleCellStatistics->meanCellScalarValues(currentTimeStep, histData.mean); + m_visibleCellStatistics->minMaxCellScalarValues(currentTimeStep, histData.min, histData.max); + m_visibleCellStatistics->p10p90CellScalarValues(currentTimeStep, histData.p10, histData.p90); + m_visibleCellStatistics->sumCellScalarValues(currentTimeStep, histData.sum); + m_visibleCellStatistics->mobileVolumeWeightedMean(currentTimeStep, histData.weightedMean); + + histData.histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(currentTimeStep)); + } + } + } + else if (eclipseView->cellResult()->isFlowDiagOrInjectionFlooding()) + { + 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, &histData.min, &histData.max); + fldResults->p10p90ScalarValues(resAddr, currentTimeStep, &histData.p10, &histData.p90); + fldResults->meanScalarValue(resAddr, currentTimeStep, &histData.mean); + fldResults->sumScalarValue(resAddr, currentTimeStep, &histData.sum); + + histData.histogram = &(fldResults->scalarValuesHistogram(resAddr, currentTimeStep)); + } + else if (m_statisticsCellRange == VISIBLE_CELLS) + { + updateVisCellStatsIfNeeded(); + + m_visibleCellStatistics->meanCellScalarValues(currentTimeStep, histData.mean); + m_visibleCellStatistics->minMaxCellScalarValues(currentTimeStep, histData.min, histData.max); + m_visibleCellStatistics->p10p90CellScalarValues(currentTimeStep, histData.p10, histData.p90); + m_visibleCellStatistics->sumCellScalarValues(currentTimeStep, histData.sum); + m_visibleCellStatistics->mobileVolumeWeightedMean(currentTimeStep, histData.weightedMean); + + histData.histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(currentTimeStep)); + } } } } @@ -275,11 +279,12 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimE //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString Rim3dOverlayInfoConfig::caseInfoText(RimEclipseView* eclipseView) +QString Rim3dOverlayInfoConfig::caseInfoText() { QString infoText; + RimEclipseView* eclipseView = dynamic_cast(m_viewDef.p()); - if (showCaseInfo()) + if (eclipseView && showCaseInfo()) { QString caseName; QString totCellCount; @@ -318,79 +323,83 @@ QString Rim3dOverlayInfoConfig::caseInfoText(RimEclipseView* eclipseView) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, RimEclipseView* eclipseView) +QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData) { QString infoText; - bool isResultsInfoRelevant = eclipseView->hasUserRequestedAnimation() && eclipseView->cellResult()->hasResult(); + RimEclipseView* eclipseView = dynamic_cast(m_viewDef.p()); - if (eclipseView->cellResult()->isTernarySaturationSelected()) + if (eclipseView) { - QString propName = eclipseView->cellResult()->resultVariableUiShortName(); - infoText += QString("Cell Property: %1 ").arg(propName); - } + bool isResultsInfoRelevant = eclipseView->hasUserRequestedAnimation() && eclipseView->cellResult()->hasResult(); - if (isResultsInfoRelevant) - { - QString propName = eclipseView->cellResult()->resultVariableUiShortName(); - QString timeRangeText = m_statisticsTimeRange().uiText(); - if (eclipseView->cellResult()->isFlowDiagOrInjectionFlooding()) + if (eclipseView->cellResult()->isTernarySaturationSelected()) { - timeRangeText = caf::AppEnum::uiText(CURRENT_TIMESTEP); + QString propName = eclipseView->cellResult()->resultVariableUiShortName(); + infoText += QString("Cell Property: %1 ").arg(propName); } - infoText += QString("Cell Property: %1 ").arg(propName); - infoText += QString("
Statistics: ") + timeRangeText + " and " + m_statisticsCellRange().uiText(); - infoText += QString("" - "" - "" - "
Min P10 Mean P90 Max Sum
%1 %2 %3 %4 %5 %6
").arg(histData.min).arg(histData.p10).arg(histData.mean).arg(histData.p90).arg(histData.max).arg(histData.sum); - - if (eclipseView->faultResultSettings()->hasValidCustomResult()) + if (isResultsInfoRelevant) { - QString faultMapping; - bool isShowingGrid = eclipseView->faultCollection()->isGridVisualizationMode(); - if (!isShowingGrid) + QString propName = eclipseView->cellResult()->resultVariableUiShortName(); + QString timeRangeText = m_statisticsTimeRange().uiText(); + if (eclipseView->cellResult()->isFlowDiagOrInjectionFlooding()) { - if (eclipseView->faultCollection()->faultResult() == RimFaultInViewCollection::FAULT_BACK_FACE_CULLING) + timeRangeText = caf::AppEnum::uiText(CURRENT_TIMESTEP); + } + + infoText += QString("Cell Property: %1 ").arg(propName); + infoText += QString("
Statistics: ") + timeRangeText + " and " + m_statisticsCellRange().uiText(); + infoText += QString("" + "" + "" + "
Min P10 Mean P90 Max Sum
%1 %2 %3 %4 %5 %6
").arg(histData.min).arg(histData.p10).arg(histData.mean).arg(histData.p90).arg(histData.max).arg(histData.sum); + + if (eclipseView->faultResultSettings()->hasValidCustomResult()) + { + QString faultMapping; + bool isShowingGrid = eclipseView->faultCollection()->isGridVisualizationMode(); + if (!isShowingGrid) { - faultMapping = "Cells behind fault"; - } - else if (eclipseView->faultCollection()->faultResult() == RimFaultInViewCollection::FAULT_FRONT_FACE_CULLING) - { - faultMapping = "Cells in front of fault"; + if (eclipseView->faultCollection()->faultResult() == RimFaultInViewCollection::FAULT_BACK_FACE_CULLING) + { + faultMapping = "Cells behind fault"; + } + else if (eclipseView->faultCollection()->faultResult() == RimFaultInViewCollection::FAULT_FRONT_FACE_CULLING) + { + faultMapping = "Cells in front of fault"; + } + else + { + faultMapping = "Cells in front and behind fault"; + } } else { faultMapping = "Cells in front and behind fault"; } - } - else - { - faultMapping = "Cells in front and behind fault"; - } - infoText += QString("Fault results: %1
").arg(faultMapping); - infoText += QString("Fault Property: %1
").arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariableUiShortName()); + infoText += QString("Fault results: %1
").arg(faultMapping); + infoText += QString("Fault Property: %1
").arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariableUiShortName()); + } + } + + if (eclipseView->hasUserRequestedAnimation() && eclipseView->cellEdgeResult()->hasResult()) + { + double min, max; + QString cellEdgeName = eclipseView->cellEdgeResult()->resultVariableUiShortName(); + eclipseView->cellEdgeResult()->minMaxCellEdgeValues(min, max); + infoText += QString("Cell Edge Property: %1 ").arg(cellEdgeName); + infoText += QString("" + "" + "" + "
Min Max
%1 %2
").arg(min).arg(max); + } + + if (showVolumeWeightedMean() && histData.weightedMean != HUGE_VAL) + { + infoText += QString("Mobile Volume Weighted Mean: %1").arg(histData.weightedMean); } } - - if (eclipseView->hasUserRequestedAnimation() && eclipseView->cellEdgeResult()->hasResult()) - { - double min, max; - QString cellEdgeName = eclipseView->cellEdgeResult()->resultVariableUiShortName(); - eclipseView->cellEdgeResult()->minMaxCellEdgeValues(min, max); - infoText += QString("Cell Edge Property: %1 ").arg(cellEdgeName); - infoText += QString("" - "" - "" - "
Min Max
%1 %2
").arg(min).arg(max); - } - - if (showVolumeWeightedMean() && histData.weightedMean != HUGE_VAL) - { - infoText += QString("Mobile Volume Weighted Mean: %1").arg(histData.weightedMean); - } - return infoText; } @@ -508,19 +517,19 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView) if (showHistogram() || showResultInfo()) { - histData = histogramData(eclipseView); + histData = histogramData(); } QString infoText; if (showCaseInfo()) { - infoText = caseInfoText(eclipseView); + infoText = caseInfoText(); } if (showResultInfo()) { - infoText += resultInfoText(histData, eclipseView); + infoText += resultInfoText(histData); } if (!infoText.isEmpty()) diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h index c0fe4e1d9b..8afe798668 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.h @@ -69,9 +69,9 @@ public: void setPosition(cvf::Vec2ui position); - HistogramData histogramData(RimEclipseView* eclipseView); - QString caseInfoText(RimEclipseView* eclipseView); - QString resultInfoText(const HistogramData& histData, RimEclipseView* eclipseView); + HistogramData histogramData(); + QString caseInfoText(); + QString resultInfoText(const HistogramData& histData); void showStatisticsInfoDialog();