mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Minor refactor
This commit is contained in:
@@ -173,20 +173,7 @@ void RigStatisticsDataCache::posNegClosestToZero(size_t timeStepIndex, double& p
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
const std::vector<size_t>& RigStatisticsDataCache::cellScalarValuesHistogram()
|
const std::vector<size_t>& RigStatisticsDataCache::cellScalarValuesHistogram()
|
||||||
{
|
{
|
||||||
if (m_histogram.size() == 0)
|
computeStatisticsIfNeeded();
|
||||||
{
|
|
||||||
double min;
|
|
||||||
double max;
|
|
||||||
size_t nBins = 100;
|
|
||||||
this->minMaxCellScalarValues(min, max);
|
|
||||||
|
|
||||||
RigHistogramCalculator histCalc(min, max, nBins, &m_histogram);
|
|
||||||
|
|
||||||
m_statisticsCalculator->addDataToHistogramCalculator(histCalc);
|
|
||||||
|
|
||||||
m_p10 = histCalc.calculatePercentil(0.1);
|
|
||||||
m_p90 = histCalc.calculatePercentil(0.9);
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_histogram;
|
return m_histogram;
|
||||||
}
|
}
|
||||||
@@ -197,7 +184,7 @@ const std::vector<size_t>& RigStatisticsDataCache::cellScalarValuesHistogram()
|
|||||||
void RigStatisticsDataCache::p10p90CellScalarValues(double& p10, double& p90)
|
void RigStatisticsDataCache::p10p90CellScalarValues(double& p10, double& p90)
|
||||||
{
|
{
|
||||||
// First make sure they are calculated
|
// First make sure they are calculated
|
||||||
const std::vector<size_t>& histogr = this->cellScalarValuesHistogram();
|
computeStatisticsIfNeeded();
|
||||||
|
|
||||||
p10 = m_p10;
|
p10 = m_p10;
|
||||||
p90 = m_p90;
|
p90 = m_p90;
|
||||||
@@ -217,3 +204,24 @@ void RigStatisticsDataCache::meanCellScalarValues(double& meanValue)
|
|||||||
meanValue = m_meanValue;
|
meanValue = m_meanValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigStatisticsDataCache::computeStatisticsIfNeeded()
|
||||||
|
{
|
||||||
|
if (m_histogram.size() == 0)
|
||||||
|
{
|
||||||
|
double min;
|
||||||
|
double max;
|
||||||
|
size_t nBins = 100;
|
||||||
|
this->minMaxCellScalarValues(min, max);
|
||||||
|
|
||||||
|
RigHistogramCalculator histCalc(min, max, nBins, &m_histogram);
|
||||||
|
|
||||||
|
m_statisticsCalculator->addDataToHistogramCalculator(histCalc);
|
||||||
|
|
||||||
|
m_p10 = histCalc.calculatePercentil(0.1);
|
||||||
|
m_p90 = histCalc.calculatePercentil(0.9);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ public:
|
|||||||
void meanCellScalarValues(double& meanValue);
|
void meanCellScalarValues(double& meanValue);
|
||||||
const std::vector<size_t>& cellScalarValuesHistogram();
|
const std::vector<size_t>& cellScalarValuesHistogram();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void computeStatisticsIfNeeded();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_minValue;
|
double m_minValue;
|
||||||
double m_maxValue;
|
double m_maxValue;
|
||||||
|
|||||||
Reference in New Issue
Block a user