#3958 Refactoring: Rename modifiable result access to make it easier to track in the code. The existing overloads made things harder to read.

This commit is contained in:
Jacob Støren
2019-01-28 17:04:50 +01:00
parent 79701a6233
commit a3660cd496
11 changed files with 28 additions and 28 deletions

View File

@@ -229,7 +229,7 @@ const std::vector<std::vector<double>>& RigCaseCellResultsData::cellScalarResult
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::vector<double>>& RigCaseCellResultsData::cellScalarResults(const RigEclipseResultAddress& resVarAddr)
std::vector<std::vector<double>>& RigCaseCellResultsData::modifiableCellScalarResultTimesteps(const RigEclipseResultAddress& resVarAddr)
{
size_t scalarResultIndex = findScalarResultIndexFromAddress(resVarAddr);
@@ -241,7 +241,7 @@ std::vector<std::vector<double>>& RigCaseCellResultsData::cellScalarResults(cons
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double>& RigCaseCellResultsData::cellScalarResults(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex)
std::vector<double>& RigCaseCellResultsData::modifiableCellScalarResult(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex)
{
size_t scalarResultIndex = findScalarResultIndexFromAddress(resVarAddr);
@@ -612,7 +612,7 @@ void RigCaseCellResultsData::setTimeStepInfos(const RigEclipseResultAddress& res
m_resultInfos[findScalarResultIndexFromAddress(resVarAddr)].setTimeStepInfos(timeStepInfos);
std::vector<std::vector<double>>& dataValues = this->cellScalarResults(resVarAddr);
std::vector<std::vector<double>>& dataValues = this->modifiableCellScalarResultTimesteps(resVarAddr);
dataValues.resize(timeStepInfos.size());
}
@@ -1490,7 +1490,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T)
{
std::vector<double>& swatForTimeStep = this->cellScalarResults(SWATAddr, timeStepIndex);
const std::vector<double>& swatForTimeStep = this->cellScalarResults(SWATAddr, timeStepIndex);
if (swatForTimeStep.size() > 0)
{
soilResultValueCount = swatForTimeStep.size();
@@ -1500,7 +1500,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T)
{
std::vector<double>& sgasForTimeStep = this->cellScalarResults(SGASAddr, timeStepIndex);
const std::vector<double>& sgasForTimeStep = this->cellScalarResults(SGASAddr, timeStepIndex);
if (sgasForTimeStep.size() > 0)
{
soilResultValueCount = qMax(soilResultValueCount, sgasForTimeStep.size());
@@ -1523,9 +1523,9 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
m_cellScalarResults[soilResultScalarIndex][timeStepIndex].resize(soilResultValueCount);
std::vector<double>* swatForTimeStep = nullptr;
std::vector<double>* sgasForTimeStep = nullptr;
std::vector<double>* ssolForTimeStep = nullptr;
const std::vector<double>* swatForTimeStep = nullptr;
const std::vector<double>* sgasForTimeStep = nullptr;
const std::vector<double>* ssolForTimeStep = nullptr;
if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T)
{
@@ -1554,7 +1554,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
}
}
std::vector<double>& soilForTimeStep = this->cellScalarResults(SOILAddr, timeStepIndex);
std::vector<double>& soilForTimeStep = this->modifiableCellScalarResult(SOILAddr, timeStepIndex);
#pragma omp parallel for
for (int idx = 0; idx < static_cast<int>(soilResultValueCount); idx++)
@@ -2696,8 +2696,8 @@ void RigCaseCellResultsData::setActiveFormationNames(RigFormationNames* activeFo
false,
totalGlobCellCount);
std::vector<double>& fnData = this->cellScalarResults(RigEclipseResultAddress(RiaDefines::FORMATION_NAMES,
RiaDefines::activeFormationNamesResultName()),0);
std::vector<double>& fnData = this->modifiableCellScalarResult(RigEclipseResultAddress(RiaDefines::FORMATION_NAMES,
RiaDefines::activeFormationNamesResultName()), 0);
if (m_activeFormationNamesData.isNull())
{
@@ -2904,7 +2904,7 @@ void RigCaseCellResultsData::copyResultsMetaDataFromMainCase(RigEclipseCaseData*
cellResultsStorage->setTimeStepInfos(RigEclipseResultAddress(resultType, resultName), timeStepInfos);
std::vector< std::vector<double> >& dataValues = cellResultsStorage->cellScalarResults(RigEclipseResultAddress(resultType, resultName));
std::vector< std::vector<double> >& dataValues = cellResultsStorage->modifiableCellScalarResultTimesteps(RigEclipseResultAddress(resultType, resultName));
dataValues.resize(timeStepInfos.size());
}
}

View File

@@ -68,9 +68,9 @@ public:
// Access the results data
const std::vector< std::vector<double> > & cellScalarResults(const RigEclipseResultAddress& resVarAddr) const;
std::vector< std::vector<double> > & cellScalarResults(const RigEclipseResultAddress& resVarAddr);
const std::vector<double>& cellScalarResults(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex) const;
std::vector<double>& cellScalarResults(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex);
std::vector< std::vector<double> > & modifiableCellScalarResultTimesteps(const RigEclipseResultAddress& resVarAddr);
std::vector<double>& modifiableCellScalarResult(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex);
bool isUsingGlobalActiveIndex(const RigEclipseResultAddress& resVarAddr) const;

View File

@@ -55,7 +55,7 @@ private:
return;
}
std::vector<double>& values = m_resultsData->cellScalarResults(m_eclipseResultAddress, timeStepIndex);
const std::vector<double>& values = m_resultsData->cellScalarResults(m_eclipseResultAddress, timeStepIndex);
if (values.empty())
{

View File

@@ -56,7 +56,7 @@ private:
template <typename StatisticsAccumulator>
void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex)
{
std::vector<double>& values = m_caseData->cellScalarResults(m_resultAddress, timeStepIndex);
const std::vector<double>& values = m_caseData->cellScalarResults(m_resultAddress, timeStepIndex);
if (values.empty())
{

View File

@@ -53,7 +53,7 @@ cvf::ref<RigResultModifier> RigResultModifierFactory::createResultModifier(RigEc
return nullptr;
}
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(resVarAddr);
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->modifiableCellScalarResultTimesteps(resVarAddr);
if (timeStepIndex >= scalarSetResults.size())
{