mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3061 Implement Memory Cleanup for eclipse data.
This commit is contained in:
@@ -632,11 +632,13 @@ void RigCaseCellResultsData::clearScalarResult(RiaDefines::ResultCatType type, c
|
||||
size_t scalarResultIndex = this->findScalarResultIndex(type, resultName);
|
||||
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T) return;
|
||||
|
||||
std::vector<std::vector<double>> empty;
|
||||
m_cellScalarResults[scalarResultIndex].swap(empty);
|
||||
for (size_t tsIdx = 0; tsIdx < m_cellScalarResults[scalarResultIndex].size(); ++tsIdx)
|
||||
{
|
||||
std::vector<double> empty;
|
||||
m_cellScalarResults[scalarResultIndex][tsIdx].swap(empty);
|
||||
}
|
||||
|
||||
recalculateStatistics(scalarResultIndex);
|
||||
|
||||
//m_resultInfos[scalarResultIndex].type() = RiaDefines::REMOVED;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -674,6 +676,20 @@ void RigCaseCellResultsData::freeAllocatedResultsData()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigCaseCellResultsData::isResultLoaded(const RigEclipseResultInfo& resultInfo) const
|
||||
{
|
||||
size_t scalarResultIndex = this->findScalarResultIndex(resultInfo.resultType(), resultInfo.resultName());
|
||||
CVF_TIGHT_ASSERT(scalarResultIndex != cvf::UNDEFINED_SIZE_T);
|
||||
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
return isDataPresent(scalarResultIndex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Make sure we have a result with given type and name, and make sure one "timestep" result vector
|
||||
// for the static result values are allocated
|
||||
|
||||
@@ -110,6 +110,8 @@ public:
|
||||
void clearScalarResult(const RigEclipseResultInfo& resultInfo);
|
||||
void clearAllResults();
|
||||
void freeAllocatedResultsData();
|
||||
bool isResultLoaded(const RigEclipseResultInfo& resultInfo) const;
|
||||
|
||||
|
||||
// Access the results data
|
||||
|
||||
|
||||
@@ -204,3 +204,19 @@ std::vector<int> RigEclipseResultInfo::reportNumbers() const
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Ordering operator for set storage. Just the type and name are used to find unique addresses.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigEclipseResultInfo::operator<(const RigEclipseResultInfo& rhs) const
|
||||
{
|
||||
if (m_resultType != rhs.resultType())
|
||||
{
|
||||
return m_resultType < rhs.resultType();
|
||||
}
|
||||
if (m_resultName != rhs.resultName())
|
||||
{
|
||||
return m_resultName < rhs.resultName();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ public:
|
||||
std::vector<double> daysSinceSimulationStarts() const;
|
||||
std::vector<int> reportNumbers() const;
|
||||
|
||||
bool operator<(const RigEclipseResultInfo& rhs) const;
|
||||
private:
|
||||
RiaDefines::ResultCatType m_resultType;
|
||||
bool m_needsToBeStored;
|
||||
|
||||
Reference in New Issue
Block a user