mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactored some in 3D info regarding geomech cases.
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
|
||||
#include "RigStatisticsDataCache.h"
|
||||
#include "RigFemNativeVisibleCellsStatCalc.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -89,7 +90,7 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_statisticsTimeRange, "StatisticsTimeRange", "Statistics Time Range", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_statisticsCellRange, "StatisticsCellRange", "Statistics Cell Range", "", "", "");
|
||||
m_statisticsCellRange.uiCapability()->setUiHidden(true);
|
||||
//m_statisticsCellRange.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -143,6 +144,8 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
m_viewDef->viewer()->showInfoText(showInfoText());
|
||||
m_viewDef->viewer()->showHistogram(false);
|
||||
m_viewDef->viewer()->showAnimationProgress(showAnimProgress());
|
||||
|
||||
m_isVisCellStatUpToDate = false;
|
||||
|
||||
RimEclipseView * reservoirView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
|
||||
if (reservoirView) updateEclipse3DInfo(reservoirView);
|
||||
@@ -217,7 +220,8 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * reservoirView)
|
||||
if (reservoirView->hasUserRequestedAnimation() && reservoirView->cellResult()->hasResult())
|
||||
{
|
||||
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName);
|
||||
// Wait until regression tests confirm new statisticks is ok infoText += QString("<br>Statistics for: ") + m_statisticsTimeRange().uiText() + " and " + m_statisticsCellRange().uiText();
|
||||
// Wait until regression tests confirm new statisticks is ok :
|
||||
//infoText += QString("<br>Statistics for: ") + m_statisticsTimeRange().uiText() + " and " + m_statisticsCellRange().uiText();
|
||||
|
||||
if (m_statisticsCellRange == ALL_CELLS)
|
||||
{
|
||||
@@ -349,116 +353,30 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * reservoirView)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
||||
{
|
||||
if (showInfoText())
|
||||
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
|
||||
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : NULL;
|
||||
bool isResultsInfoRelevant = caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResult()->hasResult();
|
||||
|
||||
// Retreive result stats if needed
|
||||
|
||||
double min = HUGE_VAL, max = HUGE_VAL;
|
||||
double p10 = HUGE_VAL, p90 = HUGE_VAL;
|
||||
double mean = HUGE_VAL;
|
||||
const std::vector<size_t>* histogram = NULL;
|
||||
|
||||
if (showInfoText() || showHistogram())
|
||||
{
|
||||
QString infoText;
|
||||
|
||||
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
|
||||
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : NULL;
|
||||
RigFemPartCollection* femParts = caseData ? caseData->femParts() : NULL;
|
||||
|
||||
if (femParts)
|
||||
if (isResultsInfoRelevant)
|
||||
{
|
||||
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 (geoMechView->hasUserRequestedAnimation() && geoMechView->cellResult()->hasResult())
|
||||
RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress();
|
||||
if (m_statisticsCellRange == ALL_CELLS)
|
||||
{
|
||||
QString resultPos;
|
||||
QString fieldName = geoMechView->cellResult()->resultFieldUiName();
|
||||
QString compName = geoMechView->cellResult()->resultComponentUiName();
|
||||
|
||||
if (!fieldName.isEmpty())
|
||||
{
|
||||
switch (geoMechView->cellResult()->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);
|
||||
|
||||
double min = HUGE_VAL, max = HUGE_VAL;
|
||||
double p10 = HUGE_VAL, p90 = HUGE_VAL;
|
||||
double mean = HUGE_VAL;
|
||||
|
||||
RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress();
|
||||
|
||||
if (m_statisticsTimeRange == ALL_TIMESTEPS)
|
||||
{
|
||||
caseData->femPartResults()->meanScalarValue (resAddress, &mean);
|
||||
caseData->femPartResults()->minMaxScalarValues(resAddress,&min, &max);
|
||||
caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
infoText += QString("<table border=0 cellspacing=5 >"
|
||||
"<tr> <td>Min</td> <td>P10</td> <td>Mean</td> <td>P90</td> <td>Max</td> </tr>"
|
||||
"<tr> <td>%1</td> <td> %2</td> <td> %3</td> <td> %4</td> <td> %5</td> </tr>"
|
||||
"</table>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
|
||||
}
|
||||
else
|
||||
{
|
||||
infoText += QString("<br>");
|
||||
}
|
||||
|
||||
int currentTimeStep = geoMechView->currentTimeStep();
|
||||
QString stepName = QString::fromStdString(caseData->femPartResults()->stepNames()[currentTimeStep]);
|
||||
infoText += QString("<b>Time Step:</b> %1 <b>Time:</b> %2").arg(currentTimeStep).arg(stepName);
|
||||
}
|
||||
}
|
||||
|
||||
geoMechView->viewer()->setInfoText(infoText);
|
||||
}
|
||||
|
||||
if (showHistogram())
|
||||
{
|
||||
if (geoMechView->hasUserRequestedAnimation() && geoMechView->cellResult()->hasResult())
|
||||
{
|
||||
geoMechView->viewer()->showHistogram(true);
|
||||
|
||||
// ToDo: Implement statistics for geomech data
|
||||
|
||||
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
|
||||
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : NULL;
|
||||
|
||||
if (caseData)
|
||||
{
|
||||
double min = HUGE_VAL, max = HUGE_VAL;
|
||||
double p10 = HUGE_VAL, p90 = HUGE_VAL;
|
||||
double mean = HUGE_VAL;
|
||||
const std::vector<size_t>* histogram = NULL;
|
||||
|
||||
RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress();
|
||||
|
||||
if (m_statisticsTimeRange == ALL_TIMESTEPS)
|
||||
{
|
||||
caseData->femPartResults()->meanScalarValue(resAddress, &mean);
|
||||
caseData->femPartResults()->minMaxScalarValues(resAddress, &min, &max);
|
||||
caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90);
|
||||
|
||||
histogram = &(caseData->femPartResults()->scalarValuesHistogram(resAddress));
|
||||
}
|
||||
else if (m_statisticsTimeRange == CURRENT_TIMESTEP)
|
||||
@@ -467,16 +385,144 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
||||
caseData->femPartResults()->meanScalarValue(resAddress, timeStepIdx, &mean);
|
||||
caseData->femPartResults()->minMaxScalarValues(resAddress, timeStepIdx, &min, &max);
|
||||
caseData->femPartResults()->p10p90ScalarValues(resAddress, timeStepIdx, &p10, &p90);
|
||||
|
||||
histogram = &(caseData->femPartResults()->scalarValuesHistogram(resAddress, timeStepIdx));
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(false);
|
||||
}
|
||||
}
|
||||
else if (m_statisticsCellRange == VISIBLE_CELLS)
|
||||
{
|
||||
this->updateVisCellStatsIfNeeded();
|
||||
|
||||
geoMechView->viewer()->setHistogram(min, max, *histogram);
|
||||
geoMechView->viewer()->setHistogramPercentiles(p10, p90, mean);
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(timeStepIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Compose text
|
||||
|
||||
if (showInfoText())
|
||||
{
|
||||
QString infoText;
|
||||
|
||||
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 (isResultsInfoRelevant)
|
||||
{
|
||||
{
|
||||
QString resultPos;
|
||||
QString fieldName = geoMechView->cellResult()->resultFieldUiName();
|
||||
QString compName = geoMechView->cellResult()->resultComponentUiName();
|
||||
|
||||
switch (geoMechView->cellResult()->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("<table border=0 cellspacing=5 >"
|
||||
"<tr> <td>Min</td> <td>P10</td> <td>Mean</td> <td>P90</td> <td>Max</td> </tr>"
|
||||
"<tr> <td>%1</td> <td> %2</td> <td> %3</td> <td> %4</td> <td> %5</td> </tr>"
|
||||
"</table>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
|
||||
|
||||
|
||||
}
|
||||
{
|
||||
int currentTimeStep = geoMechView->currentTimeStep();
|
||||
QString stepName = QString::fromStdString(caseData->femPartResults()->stepNames()[currentTimeStep]);
|
||||
infoText += QString("<b>Time Step:</b> %1 <b>Time:</b> %2").arg(currentTimeStep).arg(stepName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
geoMechView->viewer()->setInfoText(infoText);
|
||||
}
|
||||
|
||||
// Populate histogram
|
||||
|
||||
if (showHistogram())
|
||||
{
|
||||
if (isResultsInfoRelevant)
|
||||
{
|
||||
geoMechView->viewer()->showHistogram(true);
|
||||
geoMechView->viewer()->setHistogram(min, max, *histogram);
|
||||
geoMechView->viewer()->setHistogramPercentiles(p10, p90, mean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dOverlayInfoConfig::updateVisCellStatsIfNeeded()
|
||||
{
|
||||
RimEclipseView * eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
|
||||
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
|
||||
|
||||
if (!m_isVisCellStatUpToDate)
|
||||
{
|
||||
cvf::ref<RigStatisticsCalculator> calc;
|
||||
if (geoMechView)
|
||||
{
|
||||
RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress();
|
||||
calc = new RigFemNativeVisibleCellsStatCalc(geoMechView->geoMechCase()->geoMechData(),
|
||||
resAddress,
|
||||
geoMechView->currentTotalCellVisibility().p());
|
||||
m_visibleCellStatistics = new RigStatisticsDataCache(calc.p());
|
||||
m_isVisCellStatUpToDate = true;
|
||||
}
|
||||
else if (eclipseView)
|
||||
{
|
||||
// RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress();
|
||||
// cvf::ref<RigEclipseNativeVisibleCellsStatCalc> calc = new RigEclipseNativeVisibleCellsStatCalc(geoMechView->geoMechCase()->geoMechData(),
|
||||
// resAddress,
|
||||
// geoMechView->currentTotalCellVisibility().p());
|
||||
}
|
||||
|
||||
m_visibleCellStatistics = new RigStatisticsDataCache(calc.p());
|
||||
m_isVisCellStatUpToDate = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user