mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fixed errors in 2b881f2cb8
.
Statistics were not calculated properly for early timesteps when directly accessing a late timestep.
This commit is contained in:
parent
38b40423d8
commit
5b17c27b51
@ -91,7 +91,11 @@ void RigStatisticsDataCache::minMaxCellScalarValues(size_t timeStepIndex, double
|
|||||||
if (timeStepIndex >= m_maxMinValuesPrTs.size())
|
if (timeStepIndex >= m_maxMinValuesPrTs.size())
|
||||||
{
|
{
|
||||||
m_maxMinValuesPrTs.resize(timeStepIndex + 1, std::make_pair(HUGE_VAL, -HUGE_VAL));
|
m_maxMinValuesPrTs.resize(timeStepIndex + 1, std::make_pair(HUGE_VAL, -HUGE_VAL));
|
||||||
|
m_isMaxMinPrTsCalculated.resize(timeStepIndex + 1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_isMaxMinPrTsCalculated[timeStepIndex])
|
||||||
|
{
|
||||||
double tsMin = HUGE_VAL;
|
double tsMin = HUGE_VAL;
|
||||||
double tsMax = -HUGE_VAL;
|
double tsMax = -HUGE_VAL;
|
||||||
|
|
||||||
@ -99,6 +103,8 @@ void RigStatisticsDataCache::minMaxCellScalarValues(size_t timeStepIndex, double
|
|||||||
|
|
||||||
m_maxMinValuesPrTs[timeStepIndex].first = tsMin;
|
m_maxMinValuesPrTs[timeStepIndex].first = tsMin;
|
||||||
m_maxMinValuesPrTs[timeStepIndex].second = tsMax;
|
m_maxMinValuesPrTs[timeStepIndex].second = tsMax;
|
||||||
|
|
||||||
|
m_isMaxMinPrTsCalculated[timeStepIndex] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
min = m_maxMinValuesPrTs[timeStepIndex].first;
|
min = m_maxMinValuesPrTs[timeStepIndex].first;
|
||||||
@ -141,7 +147,12 @@ void RigStatisticsDataCache::posNegClosestToZero(size_t timeStepIndex, double& p
|
|||||||
if (timeStepIndex >= m_posNegClosestToZeroPrTs.size())
|
if (timeStepIndex >= m_posNegClosestToZeroPrTs.size())
|
||||||
{
|
{
|
||||||
m_posNegClosestToZeroPrTs.resize(timeStepIndex + 1, std::make_pair(HUGE_VAL, -HUGE_VAL));
|
m_posNegClosestToZeroPrTs.resize(timeStepIndex + 1, std::make_pair(HUGE_VAL, -HUGE_VAL));
|
||||||
|
m_isClosestToZeroPrTsCalculated.resize(timeStepIndex + 1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_isClosestToZeroPrTsCalculated[timeStepIndex])
|
||||||
|
{
|
||||||
|
|
||||||
double pos = HUGE_VAL;
|
double pos = HUGE_VAL;
|
||||||
double neg = -HUGE_VAL;
|
double neg = -HUGE_VAL;
|
||||||
|
|
||||||
@ -149,6 +160,8 @@ void RigStatisticsDataCache::posNegClosestToZero(size_t timeStepIndex, double& p
|
|||||||
|
|
||||||
m_posNegClosestToZeroPrTs[timeStepIndex].first = pos;
|
m_posNegClosestToZeroPrTs[timeStepIndex].first = pos;
|
||||||
m_posNegClosestToZeroPrTs[timeStepIndex].second = neg;
|
m_posNegClosestToZeroPrTs[timeStepIndex].second = neg;
|
||||||
|
|
||||||
|
m_isClosestToZeroPrTsCalculated[timeStepIndex] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
posNearZero = m_posNegClosestToZeroPrTs[timeStepIndex].first;
|
posNearZero = m_posNegClosestToZeroPrTs[timeStepIndex].first;
|
||||||
|
@ -63,7 +63,9 @@ private:
|
|||||||
std::vector<size_t> m_histogram;
|
std::vector<size_t> m_histogram;
|
||||||
|
|
||||||
std::vector<std::pair<double, double> > m_maxMinValuesPrTs; ///< Max min values for each time step
|
std::vector<std::pair<double, double> > m_maxMinValuesPrTs; ///< Max min values for each time step
|
||||||
|
std::vector<bool> m_isMaxMinPrTsCalculated;
|
||||||
std::vector<std::pair<double, double> > m_posNegClosestToZeroPrTs; ///< PosNeg values for each time step
|
std::vector<std::pair<double, double> > m_posNegClosestToZeroPrTs; ///< PosNeg values for each time step
|
||||||
|
std::vector<bool> m_isClosestToZeroPrTsCalculated;
|
||||||
|
|
||||||
cvf::ref<RigStatisticsCalculator> m_statisticsCalculator;
|
cvf::ref<RigStatisticsCalculator> m_statisticsCalculator;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user