mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
#748 Added cell property sum to Info box statistics
This commit is contained in:
parent
c3328003d0
commit
24abb27674
@ -805,6 +805,26 @@ void RigFemPartResultsCollection::p10p90ScalarValues(const RigFemResultAddress&
|
||||
this->statistics(resVarAddr)->p10p90CellScalarValues(frameIndex, *p10, *p90);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::sumScalarValue(const RigFemResultAddress& resVarAddr, double* sum)
|
||||
{
|
||||
CVF_ASSERT(sum);
|
||||
|
||||
this->statistics(resVarAddr)->sumCellScalarValues(*sum);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::sumScalarValue(const RigFemResultAddress& resVarAddr, int frameIndex, double* sum)
|
||||
{
|
||||
CVF_ASSERT(sum);
|
||||
|
||||
this->statistics(resVarAddr)->sumCellScalarValues(frameIndex, *sum);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -55,6 +55,8 @@ public:
|
||||
void meanScalarValue(const RigFemResultAddress& resVarAddr, int frameIndex, double* meanValue);
|
||||
void p10p90ScalarValues(const RigFemResultAddress& resVarAddr, double* p10, double* p90);
|
||||
void p10p90ScalarValues(const RigFemResultAddress& resVarAddr, int frameIndex, double* p10, double* p90);
|
||||
void sumScalarValue(const RigFemResultAddress& resVarAddr, double* sum);
|
||||
void sumScalarValue(const RigFemResultAddress& resVarAddr, int frameIndex, double* sum);
|
||||
const std::vector<size_t>& scalarValuesHistogram(const RigFemResultAddress& resVarAddr);
|
||||
const std::vector<size_t>& scalarValuesHistogram(const RigFemResultAddress& resVarAddr, int frameIndex);
|
||||
|
||||
|
@ -197,6 +197,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
|
||||
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;
|
||||
|
||||
bool isResultsInfoRelevant = eclipseView->hasUserRequestedAnimation() && eclipseView->cellResult()->hasResult();
|
||||
@ -213,6 +214,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
|
||||
eclipseView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, min, max);
|
||||
eclipseView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, p10, p90);
|
||||
eclipseView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, mean);
|
||||
eclipseView->currentGridCellResults()->cellResults()->sumCellScalarValues(scalarIndex, sum);
|
||||
histogram = &(eclipseView->currentGridCellResults()->cellResults()->cellScalarValuesHistogram(scalarIndex));
|
||||
}
|
||||
else if (m_statisticsTimeRange == CURRENT_TIMESTEP )
|
||||
@ -220,7 +222,8 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
|
||||
int timeStepIdx = eclipseView->currentTimeStep();
|
||||
eclipseView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, timeStepIdx, min, max);
|
||||
eclipseView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, timeStepIdx, p10, p90);
|
||||
eclipseView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, timeStepIdx, mean);
|
||||
eclipseView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, timeStepIdx, mean);
|
||||
eclipseView->currentGridCellResults()->cellResults()->sumCellScalarValues(scalarIndex, timeStepIdx, sum);
|
||||
histogram = &(eclipseView->currentGridCellResults()->cellResults()->cellScalarValuesHistogram(scalarIndex, timeStepIdx));
|
||||
}
|
||||
else
|
||||
@ -237,6 +240,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
|
||||
m_visibleCellStatistics->meanCellScalarValues(mean);
|
||||
m_visibleCellStatistics->minMaxCellScalarValues(min, max);
|
||||
m_visibleCellStatistics->p10p90CellScalarValues(p10, p90);
|
||||
m_visibleCellStatistics->sumCellScalarValues(sum);
|
||||
|
||||
histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram());
|
||||
}
|
||||
@ -246,6 +250,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
|
||||
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));
|
||||
}
|
||||
@ -303,9 +308,9 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
|
||||
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName);
|
||||
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> </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);
|
||||
"<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 (eclipseView->faultResultSettings()->hasValidCustomResult())
|
||||
{
|
||||
@ -381,6 +386,7 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
||||
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())
|
||||
@ -395,6 +401,7 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
||||
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));
|
||||
}
|
||||
@ -404,6 +411,7 @@ 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);
|
||||
caseData->femPartResults()->sumScalarValue(resAddress, timeStepIdx, &sum);
|
||||
|
||||
histogram = &(caseData->femPartResults()->scalarValuesHistogram(resAddress, timeStepIdx));
|
||||
}
|
||||
@ -418,6 +426,7 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
||||
m_visibleCellStatistics->meanCellScalarValues(mean);
|
||||
m_visibleCellStatistics->minMaxCellScalarValues(min, max);
|
||||
m_visibleCellStatistics->p10p90CellScalarValues(p10, p90);
|
||||
m_visibleCellStatistics->sumCellScalarValues(sum);
|
||||
|
||||
histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram());
|
||||
}
|
||||
@ -427,6 +436,7 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
||||
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));
|
||||
}
|
||||
@ -488,10 +498,9 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
||||
{
|
||||
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> </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);
|
||||
|
||||
"<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);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -127,6 +127,22 @@ void RigCaseCellResultsData::meanCellScalarValues(size_t scalarResultIndex, size
|
||||
m_statisticsDataCache[scalarResultIndex]->meanCellScalarValues(timeStepIndex, meanValue);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCaseCellResultsData::sumCellScalarValues(size_t scalarResultIndex, double& sumValue)
|
||||
{
|
||||
m_statisticsDataCache[scalarResultIndex]->sumCellScalarValues(sumValue);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCaseCellResultsData::sumCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& sumValue)
|
||||
{
|
||||
m_statisticsDataCache[scalarResultIndex]->sumCellScalarValues(timeStepIndex, sumValue);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -59,6 +59,8 @@ public:
|
||||
void p10p90CellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& p10, double& p90);
|
||||
void meanCellScalarValues(size_t scalarResultIndex, double& meanValue);
|
||||
void meanCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& meanValue);
|
||||
void sumCellScalarValues(size_t scalarResultIndex, double& sumValue);
|
||||
void sumCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& sumValue);
|
||||
|
||||
// Access meta-information about the results
|
||||
size_t resultCount() const;
|
||||
|
@ -190,6 +190,51 @@ void RigStatisticsDataCache::meanCellScalarValues(size_t timeStepIndex, double&
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStatisticsDataCache::sumCellScalarValues(double& sumValue)
|
||||
{
|
||||
if (!m_statsAllTimesteps.m_isValueSumCalculated)
|
||||
{
|
||||
double aggregatedSum = 0.0;
|
||||
for (size_t i = 0; i < m_statisticsCalculator->timeStepCount(); i++)
|
||||
{
|
||||
double valueSum = 0.0;
|
||||
this->sumCellScalarValues(i, valueSum);
|
||||
|
||||
aggregatedSum += valueSum;
|
||||
}
|
||||
|
||||
m_statsAllTimesteps.m_valueSum = aggregatedSum;
|
||||
m_statsAllTimesteps.m_isValueSumCalculated = true;
|
||||
}
|
||||
|
||||
sumValue = m_statsAllTimesteps.m_valueSum;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStatisticsDataCache::sumCellScalarValues(size_t timeStepIndex, double& sumValue)
|
||||
{
|
||||
if (timeStepIndex >= m_statsPrTs.size())
|
||||
{
|
||||
m_statsPrTs.resize(timeStepIndex + 1);
|
||||
}
|
||||
|
||||
if (!m_statsPrTs[timeStepIndex].m_isValueSumCalculated)
|
||||
{
|
||||
double valueSum = 0.0;
|
||||
size_t sampleCount = 0;
|
||||
m_statisticsCalculator->valueSumAndSampleCount(timeStepIndex, valueSum, sampleCount);
|
||||
m_statsPrTs[timeStepIndex].m_valueSum = valueSum;
|
||||
m_statsPrTs[timeStepIndex].m_isValueSumCalculated = true;
|
||||
}
|
||||
|
||||
sumValue = m_statsPrTs[timeStepIndex].m_valueSum;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -49,6 +49,9 @@ public:
|
||||
void meanCellScalarValues(double& meanValue);
|
||||
void meanCellScalarValues(size_t timeStepIndex, double& meanValue);
|
||||
|
||||
void sumCellScalarValues(double& sumValue);
|
||||
void sumCellScalarValues(size_t timeStepIndex, double& sumValue);
|
||||
|
||||
const std::vector<size_t>& cellScalarValuesHistogram();
|
||||
const std::vector<size_t>& cellScalarValuesHistogram(size_t timeStepIndex);
|
||||
|
||||
@ -71,6 +74,8 @@ private:
|
||||
m_isClosestToZeroCalculated = false;
|
||||
m_p10 = HUGE_VAL;
|
||||
m_p90 = HUGE_VAL;
|
||||
m_valueSum = 0.0;
|
||||
m_isValueSumCalculated = false;
|
||||
}
|
||||
|
||||
double m_minValue;
|
||||
@ -87,6 +92,9 @@ private:
|
||||
double m_p10;
|
||||
double m_p90;
|
||||
|
||||
double m_valueSum;
|
||||
bool m_isValueSumCalculated;
|
||||
|
||||
std::vector<size_t> m_histogram;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user