mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#282) Added basic data structures to compute and cache unique integer values
This commit is contained in:
@@ -255,6 +255,26 @@ const std::vector<size_t>& RigStatisticsDataCache::cellScalarValuesHistogram(siz
|
||||
return m_statsPrTs[timeStepIndex].m_histogram;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::set<int>& RigStatisticsDataCache::uniqueCellScalarValues()
|
||||
{
|
||||
computeUniqueValuesIfNeeded();
|
||||
|
||||
return m_statsAllTimesteps.m_uniqueValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::set<int>& RigStatisticsDataCache::uniqueCellScalarValues(size_t timeStepIndex)
|
||||
{
|
||||
computeUniqueValuesIfNeeded(timeStepIndex);
|
||||
|
||||
return m_statsPrTs[timeStepIndex].m_uniqueValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -319,3 +339,35 @@ void RigStatisticsDataCache::computeHistogramStatisticsIfNeeded(size_t timeStepI
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStatisticsDataCache::computeUniqueValuesIfNeeded(size_t timeStepIndex)
|
||||
{
|
||||
if (timeStepIndex >= m_statsPrTs.size())
|
||||
{
|
||||
m_statsPrTs.resize(timeStepIndex + 1);
|
||||
}
|
||||
|
||||
if (m_statsPrTs[timeStepIndex].m_uniqueValues.size() == 0)
|
||||
{
|
||||
m_statisticsCalculator->uniqueValues(timeStepIndex, m_statsPrTs[timeStepIndex].m_uniqueValues);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigStatisticsDataCache::computeUniqueValuesIfNeeded()
|
||||
{
|
||||
if (m_statsAllTimesteps.m_uniqueValues.size() == 0)
|
||||
{
|
||||
for (size_t tIdx = 0; tIdx < m_statisticsCalculator->timeStepCount(); tIdx++)
|
||||
{
|
||||
computeUniqueValuesIfNeeded(tIdx);
|
||||
|
||||
m_statsAllTimesteps.m_uniqueValues.insert(m_statsPrTs[tIdx].m_uniqueValues.begin(), m_statsPrTs[tIdx].m_uniqueValues.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user