mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2146 Num Flooded PV: Add volume weighted mean for visible cells and current time step
This commit is contained in:
@@ -87,6 +87,12 @@ void RigStatisticsCalculator::addDataToHistogramCalculator(RigHistogramCalculato
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStatisticsCalculator::mobileVolumeWeightedMean(size_t timeStepIndex, double& mean)
|
||||
{}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfCollection.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -49,5 +49,7 @@ public:
|
||||
|
||||
virtual size_t timeStepCount() = 0;
|
||||
|
||||
static void posNegClosestToZero(const std::vector<double>& values, double& pos, double& neg);
|
||||
virtual void mobileVolumeWeightedMean(size_t timeStepIndex, double& mean);
|
||||
|
||||
static void posNegClosestToZero(const std::vector<double>& values, double& pos, double& neg);
|
||||
};
|
||||
|
||||
@@ -275,6 +275,19 @@ const std::vector<int>& RigStatisticsDataCache::uniqueCellScalarValues(size_t ti
|
||||
return m_statsPrTs[timeStepIndex].m_uniqueValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStatisticsDataCache::mobileVolumeWeightedMean(size_t timeStepIndex, double& mean)
|
||||
{
|
||||
if (!m_statsPrTs[timeStepIndex].m_isVolumeWeightedMeanCalculated)
|
||||
{
|
||||
m_statisticsCalculator->mobileVolumeWeightedMean(timeStepIndex, m_statsPrTs[timeStepIndex].m_volumeWeightedMean);
|
||||
}
|
||||
|
||||
mean = m_statsPrTs[timeStepIndex].m_volumeWeightedMean;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -57,6 +57,8 @@ public:
|
||||
|
||||
const std::vector<int>& uniqueCellScalarValues();
|
||||
const std::vector<int>& uniqueCellScalarValues(size_t timeStepIndex);
|
||||
|
||||
void mobileVolumeWeightedMean(size_t timeStepIndex, double& mean);
|
||||
|
||||
private:
|
||||
void computeHistogramStatisticsIfNeeded();
|
||||
@@ -70,18 +72,20 @@ private:
|
||||
{
|
||||
StatisticsValues()
|
||||
{
|
||||
m_minValue = HUGE_VAL;
|
||||
m_maxValue = -HUGE_VAL;
|
||||
m_isMaxMinCalculated = false;
|
||||
m_meanValue = HUGE_VAL;
|
||||
m_isMeanCalculated = false;
|
||||
m_posClosestToZero = HUGE_VAL;
|
||||
m_negClosestToZero = -HUGE_VAL;
|
||||
m_isClosestToZeroCalculated = false;
|
||||
m_p10 = HUGE_VAL;
|
||||
m_p90 = HUGE_VAL;
|
||||
m_valueSum = 0.0;
|
||||
m_isValueSumCalculated = false;
|
||||
m_minValue = HUGE_VAL;
|
||||
m_maxValue = -HUGE_VAL;
|
||||
m_isMaxMinCalculated = false;
|
||||
m_meanValue = HUGE_VAL;
|
||||
m_isMeanCalculated = false;
|
||||
m_posClosestToZero = HUGE_VAL;
|
||||
m_negClosestToZero = -HUGE_VAL;
|
||||
m_isClosestToZeroCalculated = false;
|
||||
m_p10 = HUGE_VAL;
|
||||
m_p90 = HUGE_VAL;
|
||||
m_valueSum = 0.0;
|
||||
m_isValueSumCalculated = false;
|
||||
m_volumeWeightedMean = HUGE_VAL;
|
||||
m_isVolumeWeightedMeanCalculated = false;
|
||||
}
|
||||
|
||||
double m_minValue;
|
||||
@@ -101,6 +105,9 @@ private:
|
||||
double m_valueSum;
|
||||
bool m_isValueSumCalculated;
|
||||
|
||||
double m_volumeWeightedMean;
|
||||
bool m_isVolumeWeightedMeanCalculated;
|
||||
|
||||
std::vector<size_t> m_histogram;
|
||||
std::vector<int> m_uniqueValues;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user