#3061 Implement Memory Cleanup for eclipse data.

This commit is contained in:
Gaute Lindkvist
2018-06-19 15:28:35 +02:00
parent e3e4e79340
commit 5fc795a24a
6 changed files with 133 additions and 9 deletions

View File

@@ -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

View File

@@ -110,6 +110,8 @@ public:
void clearScalarResult(const RigEclipseResultInfo& resultInfo);
void clearAllResults();
void freeAllocatedResultsData();
bool isResultLoaded(const RigEclipseResultInfo& resultInfo) const;
// Access the results data

View File

@@ -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;
}

View File

@@ -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;