Add support for grid calculations as data source for statistics

- add data source selection, either Case Property or Grid Calculation
- add Time Step Selection, can be used for both dynamic case properties and Grid Calculations
- optionally release grid calculation data when statistics is computed
- recursive grid calculations is supported
This commit is contained in:
Magne Sjaastad
2023-11-07 19:23:12 +01:00
parent 92d1bd9386
commit 39fc9d5c36
12 changed files with 565 additions and 282 deletions

View File

@@ -699,23 +699,34 @@ void RigCaseCellResultsData::clearAllResults()
/// Removes all the actual numbers put into this object, and frees up the memory.
/// Does not touch the metadata in any way
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::freeAllocatedResultsData()
void RigCaseCellResultsData::freeAllocatedResultsData( std::vector<RiaDefines::ResultCatType> categoriesToExclude,
std::optional<size_t> timeStepIndexToRelease )
{
for ( size_t resultIdx = 0; resultIdx < m_cellScalarResults.size(); ++resultIdx )
{
if ( resultIdx < m_resultInfos.size() &&
m_resultInfos[resultIdx].eclipseResultAddress().resultCatType() == RiaDefines::ResultCatType::GENERATED )
if ( resultIdx < m_resultInfos.size() )
{
// Not possible to recreate generated results, keep them
continue;
auto resultCategory = m_resultInfos[resultIdx].eclipseResultAddress().resultCatType();
if ( std::find( categoriesToExclude.begin(), categoriesToExclude.end(), resultCategory ) != categoriesToExclude.end() )
{
// Keep generated results for these categories
continue;
}
}
for ( auto& tsIdx : m_cellScalarResults[resultIdx] )
for ( size_t index = 0; index < m_cellScalarResults[resultIdx].size(); index++ )
{
if ( timeStepIndexToRelease && index != *timeStepIndexToRelease )
{
// Keep generated results for these time steps
continue;
}
auto& dataForTimeStep = m_cellScalarResults[resultIdx][index];
// Using swap with an empty vector as that is the safest way to really get rid of the allocated data in a
// vector
std::vector<double> empty;
tsIdx.swap( empty );
dataForTimeStep.swap( empty );
}
}
}

View File

@@ -29,6 +29,7 @@
#include <cmath>
#include <map>
#include <optional>
#include <vector>
class RifReaderInterface;
@@ -116,7 +117,7 @@ public:
void clearScalarResult( RiaDefines::ResultCatType type, const QString& resultName );
void clearScalarResult( const RigEclipseResultAddress& resultAddress );
void clearAllResults();
void freeAllocatedResultsData();
void freeAllocatedResultsData( std::vector<RiaDefines::ResultCatType> categoriesToExclude, std::optional<size_t> timeStepIndexToRelease );
void eraseAllSourSimData();
void setRemovedTagOnGeneratedResult( const RigEclipseResultAddress& resultAddress );