mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#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:
parent
79701a6233
commit
a3660cd496
@ -321,7 +321,7 @@ bool RifEclipseInputFileTools::readDataFromKeyword(ecl_kw_type* eclipseKeywordDa
|
||||
RigEclipseResultAddress resAddr( RiaDefines::INPUT_PROPERTY, resultName);
|
||||
caseData->results(RiaDefines::MATRIX_MODEL)->createResultEntry( resAddr, false);
|
||||
|
||||
std::vector< std::vector<double> >& newPropertyData = caseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(resAddr);
|
||||
std::vector< std::vector<double> >& newPropertyData = caseData->results(RiaDefines::MATRIX_MODEL)->modifiableCellScalarResultTimesteps(resAddr);
|
||||
|
||||
newPropertyData.push_back(std::vector<double>());
|
||||
newPropertyData[0].resize(ecl_kw_get_size(eclipseKeywordData), HUGE_VAL);
|
||||
|
@ -84,8 +84,8 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip
|
||||
RigEclipseResultAddress resAddr(RiaDefines::INPUT_PROPERTY, resultName);\
|
||||
cellResults->createResultEntry(resAddr, false); \
|
||||
cellResults->setTimeStepInfos(resAddr, staticResultTimeStepInfos); \
|
||||
cellResults->cellScalarResults(resAddr).resize(1); \
|
||||
std::vector<double>& values = cellResults->cellScalarResults(resAddr)[0]; \
|
||||
cellResults->modifiableCellScalarResultTimesteps(resAddr).resize(1); \
|
||||
std::vector<double>& values = cellResults->modifiableCellScalarResultTimesteps(resAddr)[0]; \
|
||||
this->inputProperty(resultName, &values); \
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ void RimEclipseStatisticsCaseEvaluator::addNamedResult(RigCaseCellResultsData* d
|
||||
destinationCellResults->createResultEntry(resAddr, true);
|
||||
|
||||
destinationCellResults->setTimeStepInfos(resAddr, sourceTimeStepInfos);
|
||||
std::vector< std::vector<double> >& dataValues = destinationCellResults->cellScalarResults(resAddr);
|
||||
std::vector< std::vector<double> >& dataValues = destinationCellResults->modifiableCellScalarResultTimesteps(resAddr);
|
||||
dataValues.resize(sourceTimeStepInfos.size());
|
||||
|
||||
|
||||
|
@ -290,7 +290,7 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell
|
||||
{
|
||||
std::vector<double>* data = nullptr;
|
||||
|
||||
data = &(m_cellResults->cellScalarResults(resAddr, tsIdx));
|
||||
data = &(m_cellResults->modifiableCellScalarResult(resAddr, tsIdx));
|
||||
|
||||
quint64 cellCount = 0;
|
||||
stream >> cellCount;
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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())
|
||||
{
|
||||
|
@ -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())
|
||||
{
|
||||
|
@ -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())
|
||||
{
|
||||
|
@ -434,7 +434,7 @@ private:
|
||||
}
|
||||
|
||||
std::vector< std::vector<double> >* scalarResultFrames = nullptr;
|
||||
scalarResultFrames = &(results->cellScalarResults(resAddr));
|
||||
scalarResultFrames = &(results->modifiableCellScalarResultTimesteps(resAddr));
|
||||
size_t timeStepCount = results->maxTimeStepCount();
|
||||
scalarResultFrames->resize(timeStepCount);
|
||||
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
{
|
||||
if (rimCase->results(porosityModelEnum)->ensureKnownResultLoaded(RigEclipseResultAddress(propertyName)))
|
||||
{
|
||||
scalarResultFrames = &(rimCase->results(porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(propertyName)));
|
||||
scalarResultFrames = &(rimCase->results(porosityModelEnum)->modifiableCellScalarResultTimesteps(RigEclipseResultAddress(propertyName)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ public:
|
||||
rimCase->results(m_porosityModelEnum)->setTimeStepInfos(eclResAddr, timeStepInfos);
|
||||
}
|
||||
|
||||
scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->cellScalarResults(eclResAddr));
|
||||
scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->modifiableCellScalarResultTimesteps(eclResAddr));
|
||||
size_t timeStepCount = rimCase->results(m_porosityModelEnum)->maxTimeStepCount();
|
||||
scalarResultFrames->resize(timeStepCount);
|
||||
|
||||
@ -656,7 +656,7 @@ public:
|
||||
if (m_requestedTimesteps.size() == 1 && m_currentEclResultAddress.isValid())
|
||||
{
|
||||
std::vector< std::vector<double> >* scalarResultFrames = nullptr;
|
||||
scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->cellScalarResults(m_currentEclResultAddress));
|
||||
scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->modifiableCellScalarResultTimesteps(m_currentEclResultAddress));
|
||||
size_t lastIndexWithDataPresent = cvf::UNDEFINED_SIZE_T;
|
||||
for (size_t i = 0; i < scalarResultFrames->size(); i++)
|
||||
{
|
||||
@ -807,7 +807,7 @@ public:
|
||||
}
|
||||
|
||||
m_currentResultAddress = resAddr;
|
||||
scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->cellScalarResults(m_currentResultAddress));
|
||||
scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->modifiableCellScalarResultTimesteps(m_currentResultAddress));
|
||||
size_t timeStepCount = rimCase->results(m_porosityModelEnum)->maxTimeStepCount();
|
||||
scalarResultFrames->resize(timeStepCount);
|
||||
|
||||
@ -1019,7 +1019,7 @@ public:
|
||||
if (m_requestedTimesteps.size() == 1 && m_currentResultAddress.isValid())
|
||||
{
|
||||
std::vector< std::vector<double> >* scalarResultFrames = nullptr;
|
||||
scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(m_currentResultAddress)));
|
||||
scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->modifiableCellScalarResultTimesteps(RigEclipseResultAddress(m_currentResultAddress)));
|
||||
size_t lastIndexWithDataPresent = cvf::UNDEFINED_SIZE_T;
|
||||
for (size_t i = 0; i < scalarResultFrames->size(); i++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user