mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2102 Statistics dialog. Support for geo mech data
This commit is contained in:
@@ -62,11 +62,15 @@ RicGridStatisticsDialog::RicGridStatisticsDialog(QWidget* parent)
|
|||||||
|
|
||||||
// Define layout
|
// Define layout
|
||||||
QVBoxLayout* layout = new QVBoxLayout();
|
QVBoxLayout* layout = new QVBoxLayout();
|
||||||
layout->setSpacing(0);
|
|
||||||
layout->addWidget(m_label);
|
layout->addWidget(m_label);
|
||||||
layout->addWidget(m_textEdit);
|
layout->addWidget(m_textEdit);
|
||||||
layout->addWidget(m_historgramPlot);
|
|
||||||
layout->addWidget(m_aggregatedPlot);
|
QVBoxLayout* plotLayout = new QVBoxLayout();
|
||||||
|
plotLayout->setSpacing(0);
|
||||||
|
plotLayout->addWidget(m_historgramPlot);
|
||||||
|
plotLayout->addWidget(m_aggregatedPlot);
|
||||||
|
layout->addLayout(plotLayout);
|
||||||
|
|
||||||
layout->addWidget(m_buttons);
|
layout->addWidget(m_buttons);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
}
|
}
|
||||||
@@ -89,10 +93,10 @@ void RicGridStatisticsDialog::setLabel(const QString& labelText)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicGridStatisticsDialog::setInfoText(RimEclipseView* eclipseView)
|
void RicGridStatisticsDialog::setInfoText(RimView* view)
|
||||||
{
|
{
|
||||||
Rim3dOverlayInfoConfig* overlayInfo = eclipseView->overlayInfoConfig();
|
Rim3dOverlayInfoConfig* overlayInfo = view->overlayInfoConfig();
|
||||||
if (eclipseView && overlayInfo)
|
if (view && overlayInfo)
|
||||||
{
|
{
|
||||||
QString text;
|
QString text;
|
||||||
text = overlayInfo->caseInfoText();
|
text = overlayInfo->caseInfoText();
|
||||||
@@ -104,13 +108,13 @@ void RicGridStatisticsDialog::setInfoText(RimEclipseView* eclipseView)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicGridStatisticsDialog::setHistogramData(RimEclipseView* eclipseView)
|
void RicGridStatisticsDialog::setHistogramData(RimView* view)
|
||||||
{
|
{
|
||||||
deletePlotItems(m_historgramPlot);
|
deletePlotItems(m_historgramPlot);
|
||||||
deletePlotItems(m_aggregatedPlot);
|
deletePlotItems(m_aggregatedPlot);
|
||||||
|
|
||||||
Rim3dOverlayInfoConfig* overlayInfo = eclipseView->overlayInfoConfig();
|
Rim3dOverlayInfoConfig* overlayInfo = view->overlayInfoConfig();
|
||||||
if (eclipseView && overlayInfo)
|
if (view && overlayInfo)
|
||||||
{
|
{
|
||||||
auto hist = new QwtPlotHistogram("Histogram");
|
auto hist = new QwtPlotHistogram("Histogram");
|
||||||
auto aggr = new QwtPlotCurve("Aggregated");
|
auto aggr = new QwtPlotCurve("Aggregated");
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ public:
|
|||||||
~RicGridStatisticsDialog();
|
~RicGridStatisticsDialog();
|
||||||
|
|
||||||
void setLabel(const QString& labelText);
|
void setLabel(const QString& labelText);
|
||||||
void setInfoText(RimEclipseView* eclipseView);
|
void setInfoText(RimView* eclipseView);
|
||||||
void setHistogramData(RimEclipseView* eclipseView);
|
void setHistogramData(RimView* eclipseView);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void deletePlotItems(QwtPlot* plot);
|
void deletePlotItems(QwtPlot* plot);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "Rim3dOverlayInfoConfig.h"
|
#include "Rim3dOverlayInfoConfig.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
|
#include "RimGeoMechView.h"
|
||||||
|
|
||||||
#include "cafSelectionManagerTools.h"
|
#include "cafSelectionManagerTools.h"
|
||||||
|
|
||||||
@@ -47,11 +48,16 @@ bool RicShowGridStatisticsFeature::isCommandEnabled()
|
|||||||
void RicShowGridStatisticsFeature::onActionTriggered(bool isChecked)
|
void RicShowGridStatisticsFeature::onActionTriggered(bool isChecked)
|
||||||
{
|
{
|
||||||
auto eclipseView = caf::firstAncestorOfTypeFromSelectedObject<RimEclipseView*>();
|
auto eclipseView = caf::firstAncestorOfTypeFromSelectedObject<RimEclipseView*>();
|
||||||
|
auto geoMechView = caf::firstAncestorOfTypeFromSelectedObject<RimGeoMechView*>();
|
||||||
|
|
||||||
if (eclipseView && eclipseView->overlayInfoConfig())
|
if (eclipseView && eclipseView->overlayInfoConfig())
|
||||||
{
|
{
|
||||||
eclipseView->overlayInfoConfig()->showStatisticsInfoDialog();
|
eclipseView->overlayInfoConfig()->showStatisticsInfoDialog();
|
||||||
}
|
}
|
||||||
|
else if (geoMechView && geoMechView->overlayInfoConfig())
|
||||||
|
{
|
||||||
|
geoMechView->overlayInfoConfig()->showStatisticsInfoDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -163,11 +163,49 @@ void Rim3dOverlayInfoConfig::setPosition(cvf::Vec2ui position)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData()
|
Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData()
|
||||||
|
{
|
||||||
|
auto eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
|
||||||
|
auto geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
|
||||||
|
|
||||||
|
if (eclipseView) return histogramData(eclipseView);
|
||||||
|
if (geoMechView) return histogramData(geoMechView);
|
||||||
|
return HistogramData();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString Rim3dOverlayInfoConfig::caseInfoText()
|
||||||
|
{
|
||||||
|
auto eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
|
||||||
|
auto geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
|
||||||
|
|
||||||
|
if (eclipseView) return caseInfoText(eclipseView);
|
||||||
|
if (geoMechView) return caseInfoText(geoMechView);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData)
|
||||||
|
{
|
||||||
|
auto eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
|
||||||
|
auto geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
|
||||||
|
|
||||||
|
if (eclipseView) return resultInfoText(histData, eclipseView);
|
||||||
|
if (geoMechView) return resultInfoText(histData, geoMechView);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimEclipseView* eclipseView)
|
||||||
{
|
{
|
||||||
HistogramData histData;
|
HistogramData histData;
|
||||||
|
|
||||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
|
|
||||||
if (eclipseView)
|
if (eclipseView)
|
||||||
{
|
{
|
||||||
bool isResultsInfoRelevant = eclipseView->hasUserRequestedAnimation() && eclipseView->cellResult()->hasResult();
|
bool isResultsInfoRelevant = eclipseView->hasUserRequestedAnimation() && eclipseView->cellResult()->hasResult();
|
||||||
@@ -279,12 +317,79 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString Rim3dOverlayInfoConfig::caseInfoText()
|
Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimGeoMechView* geoMechView)
|
||||||
|
{
|
||||||
|
HistogramData histData;
|
||||||
|
|
||||||
|
if (geoMechView)
|
||||||
|
{
|
||||||
|
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
|
||||||
|
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
|
||||||
|
bool isResultsInfoRelevant = caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
|
||||||
|
|
||||||
|
if (isResultsInfoRelevant)
|
||||||
|
{
|
||||||
|
RigFemResultAddress resAddress = geoMechView->cellResultResultDefinition()->resultAddress();
|
||||||
|
if (m_statisticsCellRange == ALL_CELLS)
|
||||||
|
{
|
||||||
|
if (m_statisticsTimeRange == ALL_TIMESTEPS)
|
||||||
|
{
|
||||||
|
caseData->femPartResults()->meanScalarValue(resAddress, &histData.mean);
|
||||||
|
caseData->femPartResults()->minMaxScalarValues(resAddress, &histData.min, &histData.max);
|
||||||
|
caseData->femPartResults()->p10p90ScalarValues(resAddress, &histData.p10, &histData.p90);
|
||||||
|
caseData->femPartResults()->sumScalarValue(resAddress, &histData.sum);
|
||||||
|
|
||||||
|
histData.histogram = &(caseData->femPartResults()->scalarValuesHistogram(resAddress));
|
||||||
|
}
|
||||||
|
else if (m_statisticsTimeRange == CURRENT_TIMESTEP)
|
||||||
|
{
|
||||||
|
int timeStepIdx = geoMechView->currentTimeStep();
|
||||||
|
caseData->femPartResults()->meanScalarValue(resAddress, timeStepIdx, &histData.mean);
|
||||||
|
caseData->femPartResults()->minMaxScalarValues(resAddress, timeStepIdx, &histData.min, &histData.max);
|
||||||
|
caseData->femPartResults()->p10p90ScalarValues(resAddress, timeStepIdx, &histData.p10, &histData.p90);
|
||||||
|
caseData->femPartResults()->sumScalarValue(resAddress, timeStepIdx, &histData.sum);
|
||||||
|
|
||||||
|
histData.histogram = &(caseData->femPartResults()->scalarValuesHistogram(resAddress, timeStepIdx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m_statisticsCellRange == VISIBLE_CELLS)
|
||||||
|
{
|
||||||
|
this->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 timeStepIdx = geoMechView->currentTimeStep();
|
||||||
|
m_visibleCellStatistics->meanCellScalarValues(timeStepIdx, histData.mean);
|
||||||
|
m_visibleCellStatistics->minMaxCellScalarValues(timeStepIdx, histData.min, histData.max);
|
||||||
|
m_visibleCellStatistics->p10p90CellScalarValues(timeStepIdx, histData.p10, histData.p90);
|
||||||
|
m_visibleCellStatistics->sumCellScalarValues(timeStepIdx, histData.sum);
|
||||||
|
|
||||||
|
histData.histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(timeStepIdx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return histData;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString Rim3dOverlayInfoConfig::caseInfoText(RimEclipseView* eclipseView)
|
||||||
{
|
{
|
||||||
QString infoText;
|
QString infoText;
|
||||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
|
|
||||||
|
|
||||||
if (eclipseView && showCaseInfo())
|
if (eclipseView)
|
||||||
{
|
{
|
||||||
QString caseName;
|
QString caseName;
|
||||||
QString totCellCount;
|
QString totCellCount;
|
||||||
@@ -323,10 +428,36 @@ QString Rim3dOverlayInfoConfig::caseInfoText()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData)
|
QString Rim3dOverlayInfoConfig::caseInfoText(RimGeoMechView* geoMechView)
|
||||||
|
{
|
||||||
|
QString infoText;
|
||||||
|
|
||||||
|
if (geoMechView)
|
||||||
|
{
|
||||||
|
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
|
||||||
|
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
|
||||||
|
RigFemPartCollection* femParts = caseData ? caseData->femParts() : NULL;
|
||||||
|
|
||||||
|
if (femParts)
|
||||||
|
{
|
||||||
|
QString caseName = geoMechCase->caseUserDescription();
|
||||||
|
QString cellCount = QString("%1").arg(femParts->totalElementCount());
|
||||||
|
QString zScale = QString::number(geoMechView->scaleZ());
|
||||||
|
|
||||||
|
infoText = QString(
|
||||||
|
"<p><b><center>-- %1 --</center></b><p>"
|
||||||
|
"<b>Cell count:</b> %2 <b>Z-Scale:</b> %3<br>").arg(caseName, cellCount, zScale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return infoText;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, RimEclipseView* eclipseView)
|
||||||
{
|
{
|
||||||
QString infoText;
|
QString infoText;
|
||||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
|
|
||||||
|
|
||||||
if (eclipseView)
|
if (eclipseView)
|
||||||
{
|
{
|
||||||
@@ -403,18 +534,65 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData)
|
|||||||
return infoText;
|
return infoText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData, RimGeoMechView* geoMechView)
|
||||||
|
{
|
||||||
|
QString infoText;
|
||||||
|
|
||||||
|
if (geoMechView)
|
||||||
|
{
|
||||||
|
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
|
||||||
|
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
|
||||||
|
bool isResultsInfoRelevant = caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
|
||||||
|
|
||||||
|
if (isResultsInfoRelevant)
|
||||||
|
{
|
||||||
|
QString resultPos;
|
||||||
|
QString fieldName = geoMechView->cellResultResultDefinition()->resultFieldUiName();
|
||||||
|
QString compName = geoMechView->cellResultResultDefinition()->resultComponentUiName();
|
||||||
|
|
||||||
|
switch (geoMechView->cellResultResultDefinition()->resultPositionType())
|
||||||
|
{
|
||||||
|
case RIG_NODAL:
|
||||||
|
resultPos = "Nodal";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RIG_ELEMENT_NODAL:
|
||||||
|
resultPos = "Element nodal";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RIG_INTEGRATION_POINT:
|
||||||
|
resultPos = "Integration point";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
infoText += QString("<b>Cell result:</b> %1, %2, %3").arg(resultPos).arg(fieldName).arg(compName);
|
||||||
|
|
||||||
|
infoText += QString("<br><b>Statistics:</b> ") + m_statisticsTimeRange().uiText() + " 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>"
|
||||||
|
"</table>").arg(histData.min).arg(histData.p10).arg(histData.mean).arg(histData.p90).arg(histData.max).arg(histData.sum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return infoText;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void Rim3dOverlayInfoConfig::showStatisticsInfoDialog()
|
void Rim3dOverlayInfoConfig::showStatisticsInfoDialog()
|
||||||
{
|
{
|
||||||
auto eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
|
if (m_viewDef)
|
||||||
|
|
||||||
if (eclipseView)
|
|
||||||
{
|
{
|
||||||
m_gridStatisticsDialog->setLabel("Grid statistics");
|
m_gridStatisticsDialog->setLabel("Grid statistics");
|
||||||
m_gridStatisticsDialog->setInfoText(eclipseView);
|
m_gridStatisticsDialog->setInfoText(m_viewDef);
|
||||||
m_gridStatisticsDialog->setHistogramData(eclipseView);
|
m_gridStatisticsDialog->setHistogramData(m_viewDef);
|
||||||
m_gridStatisticsDialog->resize(600, 800);
|
m_gridStatisticsDialog->resize(600, 800);
|
||||||
m_gridStatisticsDialog->show();
|
m_gridStatisticsDialog->show();
|
||||||
m_gridStatisticsDialog->raise();
|
m_gridStatisticsDialog->raise();
|
||||||
@@ -461,8 +639,16 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
|||||||
m_gridStatisticsDialog->setInfoText(reservoirView);
|
m_gridStatisticsDialog->setInfoText(reservoirView);
|
||||||
m_gridStatisticsDialog->setHistogramData(reservoirView);
|
m_gridStatisticsDialog->setHistogramData(reservoirView);
|
||||||
}
|
}
|
||||||
|
|
||||||
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
|
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
|
||||||
if (geoMechView) updateGeoMech3DInfo(geoMechView);
|
if (geoMechView)
|
||||||
|
{
|
||||||
|
updateGeoMech3DInfo(geoMechView);
|
||||||
|
|
||||||
|
// Update statistics dialog
|
||||||
|
m_gridStatisticsDialog->setInfoText(geoMechView);
|
||||||
|
m_gridStatisticsDialog->setHistogramData(geoMechView);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -513,7 +699,6 @@ void Rim3dOverlayInfoConfig::setReservoirView(RimView* ownerReservoirView)
|
|||||||
void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
|
void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
|
||||||
{
|
{
|
||||||
HistogramData histData;
|
HistogramData histData;
|
||||||
double weightedMean = HUGE_VAL;
|
|
||||||
|
|
||||||
if (showHistogram() || showResultInfo())
|
if (showHistogram() || showResultInfo())
|
||||||
{
|
{
|
||||||
@@ -555,71 +740,11 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
||||||
{
|
{
|
||||||
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
|
HistogramData histData;
|
||||||
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : NULL;
|
|
||||||
bool isResultsInfoRelevant = caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
|
|
||||||
|
|
||||||
// Retreive result stats if needed
|
|
||||||
|
|
||||||
double min = HUGE_VAL, max = HUGE_VAL;
|
|
||||||
double p10 = HUGE_VAL, p90 = HUGE_VAL;
|
|
||||||
double mean = HUGE_VAL;
|
|
||||||
double sum = 0.0;
|
|
||||||
const std::vector<size_t>* histogram = NULL;
|
|
||||||
|
|
||||||
if (showResultInfo() || showHistogram())
|
if (showResultInfo() || showHistogram())
|
||||||
{
|
{
|
||||||
if (isResultsInfoRelevant)
|
histData = histogramData(geoMechView);
|
||||||
{
|
|
||||||
RigFemResultAddress resAddress = geoMechView->cellResultResultDefinition()->resultAddress();
|
|
||||||
if (m_statisticsCellRange == ALL_CELLS)
|
|
||||||
{
|
|
||||||
if (m_statisticsTimeRange == ALL_TIMESTEPS)
|
|
||||||
{
|
|
||||||
caseData->femPartResults()->meanScalarValue(resAddress, &mean);
|
|
||||||
caseData->femPartResults()->minMaxScalarValues(resAddress, &min, &max);
|
|
||||||
caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90);
|
|
||||||
caseData->femPartResults()->sumScalarValue(resAddress, &sum);
|
|
||||||
|
|
||||||
histogram = &(caseData->femPartResults()->scalarValuesHistogram(resAddress));
|
|
||||||
}
|
|
||||||
else if (m_statisticsTimeRange == CURRENT_TIMESTEP)
|
|
||||||
{
|
|
||||||
int timeStepIdx = geoMechView->currentTimeStep();
|
|
||||||
caseData->femPartResults()->meanScalarValue(resAddress, timeStepIdx, &mean);
|
|
||||||
caseData->femPartResults()->minMaxScalarValues(resAddress, timeStepIdx, &min, &max);
|
|
||||||
caseData->femPartResults()->p10p90ScalarValues(resAddress, timeStepIdx, &p10, &p90);
|
|
||||||
caseData->femPartResults()->sumScalarValue(resAddress, timeStepIdx, &sum);
|
|
||||||
|
|
||||||
histogram = &(caseData->femPartResults()->scalarValuesHistogram(resAddress, timeStepIdx));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (m_statisticsCellRange == VISIBLE_CELLS)
|
|
||||||
{
|
|
||||||
this->updateVisCellStatsIfNeeded();
|
|
||||||
|
|
||||||
if (m_statisticsTimeRange == ALL_TIMESTEPS)
|
|
||||||
{
|
|
||||||
// TODO: Only valid if we have no dynamic property filter
|
|
||||||
m_visibleCellStatistics->meanCellScalarValues(mean);
|
|
||||||
m_visibleCellStatistics->minMaxCellScalarValues(min, max);
|
|
||||||
m_visibleCellStatistics->p10p90CellScalarValues(p10, p90);
|
|
||||||
m_visibleCellStatistics->sumCellScalarValues(sum);
|
|
||||||
|
|
||||||
histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram());
|
|
||||||
}
|
|
||||||
else if (m_statisticsTimeRange == CURRENT_TIMESTEP)
|
|
||||||
{
|
|
||||||
int timeStepIdx = geoMechView->currentTimeStep();
|
|
||||||
m_visibleCellStatistics->meanCellScalarValues(timeStepIdx, mean);
|
|
||||||
m_visibleCellStatistics->minMaxCellScalarValues(timeStepIdx, min, max);
|
|
||||||
m_visibleCellStatistics->p10p90CellScalarValues(timeStepIdx, p10, p90);
|
|
||||||
m_visibleCellStatistics->sumCellScalarValues(timeStepIdx, sum);
|
|
||||||
|
|
||||||
histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(timeStepIdx));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compose text
|
// Compose text
|
||||||
@@ -628,60 +753,12 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
|||||||
|
|
||||||
if (showCaseInfo())
|
if (showCaseInfo())
|
||||||
{
|
{
|
||||||
|
infoText = caseInfoText(geoMechView);
|
||||||
RigFemPartCollection* femParts = caseData ? caseData->femParts() : NULL;
|
|
||||||
|
|
||||||
if (femParts)
|
|
||||||
{
|
|
||||||
QString caseName = geoMechCase->caseUserDescription();
|
|
||||||
QString cellCount = QString("%1").arg(femParts->totalElementCount());
|
|
||||||
QString zScale = QString::number(geoMechView->scaleZ());
|
|
||||||
|
|
||||||
infoText = QString(
|
|
||||||
"<p><b><center>-- %1 --</center></b><p>"
|
|
||||||
"<b>Cell count:</b> %2 <b>Z-Scale:</b> %3<br>").arg(caseName, cellCount, zScale);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showResultInfo())
|
if (showResultInfo())
|
||||||
{
|
{
|
||||||
|
infoText += resultInfoText(histData, geoMechView);
|
||||||
if (isResultsInfoRelevant)
|
|
||||||
{
|
|
||||||
{
|
|
||||||
QString resultPos;
|
|
||||||
QString fieldName = geoMechView->cellResultResultDefinition()->resultFieldUiName();
|
|
||||||
QString compName = geoMechView->cellResultResultDefinition()->resultComponentUiName();
|
|
||||||
|
|
||||||
switch (geoMechView->cellResultResultDefinition()->resultPositionType())
|
|
||||||
{
|
|
||||||
case RIG_NODAL:
|
|
||||||
resultPos = "Nodal";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RIG_ELEMENT_NODAL:
|
|
||||||
resultPos = "Element nodal";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RIG_INTEGRATION_POINT:
|
|
||||||
resultPos = "Integration point";
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
infoText += QString("<b>Cell result:</b> %1, %2, %3").arg(resultPos).arg(fieldName).arg(compName);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
infoText += QString("<br><b>Statistics:</b> ") + m_statisticsTimeRange().uiText() + " 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>"
|
|
||||||
"</table>").arg(min).arg(p10).arg(mean).arg(p90).arg(max).arg(sum);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!infoText.isEmpty())
|
if (!infoText.isEmpty())
|
||||||
@@ -693,11 +770,15 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
|||||||
|
|
||||||
if (showHistogram())
|
if (showHistogram())
|
||||||
{
|
{
|
||||||
|
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
|
||||||
|
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : nullptr;
|
||||||
|
bool isResultsInfoRelevant = caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResultResultDefinition()->hasResult();
|
||||||
|
|
||||||
if (isResultsInfoRelevant)
|
if (isResultsInfoRelevant)
|
||||||
{
|
{
|
||||||
geoMechView->viewer()->showHistogram(true);
|
geoMechView->viewer()->showHistogram(true);
|
||||||
geoMechView->viewer()->setHistogram(min, max, *histogram);
|
geoMechView->viewer()->setHistogram(histData.min, histData.max, *histData.histogram);
|
||||||
geoMechView->viewer()->setHistogramPercentiles(p10, p90, mean);
|
geoMechView->viewer()->setHistogramPercentiles(histData.p10, histData.p90, histData.mean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,10 @@ private:
|
|||||||
|
|
||||||
HistogramData histogramData(RimEclipseView* eclipseView);
|
HistogramData histogramData(RimEclipseView* eclipseView);
|
||||||
HistogramData histogramData(RimGeoMechView* geoMechView);
|
HistogramData histogramData(RimGeoMechView* geoMechView);
|
||||||
|
QString caseInfoText(RimEclipseView* eclipseView);
|
||||||
|
QString caseInfoText(RimGeoMechView* geoMechView);
|
||||||
|
QString resultInfoText(const HistogramData& histData, RimEclipseView* eclipseView);
|
||||||
|
QString resultInfoText(const HistogramData& histData, RimGeoMechView* geoMechView);
|
||||||
|
|
||||||
caf::PdmField<bool> active;
|
caf::PdmField<bool> active;
|
||||||
caf::PdmField<bool> showAnimProgress;
|
caf::PdmField<bool> showAnimProgress;
|
||||||
|
|||||||
Reference in New Issue
Block a user