#3958 Starting refactoring of eclipse results addressing

Preparations for time diff results
This commit is contained in:
Jacob Støren 2019-01-22 08:54:00 +01:00
parent b329f3acc7
commit ccfee8f34a
38 changed files with 369 additions and 310 deletions

View File

@ -262,7 +262,7 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
const std::vector<double>* currentMatrixPressures = nullptr; const std::vector<double>* currentMatrixPressures = nullptr;
if (performPressureDepletionScaling) if (performPressureDepletionScaling)
{ {
pressureResultVector = &results->cellScalarResults(pressureResultIndex); pressureResultVector = &results->cellScalarResults(RigEclipseResultAddress(pressureResultIndex));
CVF_ASSERT(!pressureResultVector->empty()); CVF_ASSERT(!pressureResultVector->empty());
if (pdParams.pressureScalingTimeStep < static_cast<int>(pressureResultVector->size())) if (pdParams.pressureScalingTimeStep < static_cast<int>(pressureResultVector->size()))

View File

@ -321,7 +321,7 @@ bool RifEclipseInputFileTools::readDataFromKeyword(ecl_kw_type* eclipseKeywordDa
size_t resultIndex = RifEclipseInputFileTools::findOrCreateResult(resultName, caseData); size_t resultIndex = RifEclipseInputFileTools::findOrCreateResult(resultName, caseData);
if (resultIndex == cvf::UNDEFINED_SIZE_T) return false; if (resultIndex == cvf::UNDEFINED_SIZE_T) return false;
std::vector< std::vector<double> >& newPropertyData = caseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(resultIndex); std::vector< std::vector<double> >& newPropertyData = caseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(resultIndex));
newPropertyData.push_back(std::vector<double>()); newPropertyData.push_back(std::vector<double>());
newPropertyData[0].resize(ecl_kw_get_size(eclipseKeywordData), HUGE_VAL); newPropertyData[0].resize(ecl_kw_get_size(eclipseKeywordData), HUGE_VAL);
ecl_kw_get_data_as_double(eclipseKeywordData, newPropertyData[0].data()); ecl_kw_get_data_as_double(eclipseKeywordData, newPropertyData[0].data());

View File

@ -576,7 +576,7 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName)
for (int i = 0; i < resultNames.size(); ++i) for (int i = 0; i < resultNames.size(); ++i)
{ {
size_t resIndex = matrixModelResults->findOrCreateScalarResultIndex(RiaDefines::SOURSIMRL, resultNames[i], false); size_t resIndex = matrixModelResults->findOrCreateScalarResultIndex(RiaDefines::SOURSIMRL, resultNames[i], false);
matrixModelResults->setTimeStepInfos(resIndex, timeStepInfos); matrixModelResults->setTimeStepInfos(RigEclipseResultAddress(resIndex), timeStepInfos);
} }
m_hdfReaderInterface = std::move(hdf5ReaderInterface); m_hdfReaderInterface = std::move(hdf5ReaderInterface);
@ -856,7 +856,7 @@ void RifReaderEclipseOutput::buildMetaData(ecl_grid_type* grid)
for (int i = 0; i < matrixResultNames.size(); ++i) for (int i = 0; i < matrixResultNames.size(); ++i)
{ {
size_t resIndex = matrixModelResults->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, matrixResultNames[i], false); size_t resIndex = matrixModelResults->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, matrixResultNames[i], false);
matrixModelResults->setTimeStepInfos(resIndex, timeStepInfos); matrixModelResults->setTimeStepInfos(RigEclipseResultAddress(resIndex), timeStepInfos);
} }
} }
@ -869,7 +869,7 @@ void RifReaderEclipseOutput::buildMetaData(ecl_grid_type* grid)
for (int i = 0; i < fractureResultNames.size(); ++i) for (int i = 0; i < fractureResultNames.size(); ++i)
{ {
size_t resIndex = fractureModelResults->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, fractureResultNames[i], false); size_t resIndex = fractureModelResults->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, fractureResultNames[i], false);
fractureModelResults->setTimeStepInfos(resIndex, timeStepInfos); fractureModelResults->setTimeStepInfos(RigEclipseResultAddress(resIndex), timeStepInfos);
} }
} }
} }
@ -940,7 +940,7 @@ void RifReaderEclipseOutput::buildMetaData(ecl_grid_type* grid)
for (int i = 0; i < matrixResultNames.size(); ++i) for (int i = 0; i < matrixResultNames.size(); ++i)
{ {
size_t resIndex = matrixModelResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, matrixResultNames[i], false); size_t resIndex = matrixModelResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, matrixResultNames[i], false);
matrixModelResults->setTimeStepInfos(resIndex, staticTimeStepInfo); matrixModelResults->setTimeStepInfos(RigEclipseResultAddress(resIndex), staticTimeStepInfo);
} }
} }
@ -955,7 +955,7 @@ void RifReaderEclipseOutput::buildMetaData(ecl_grid_type* grid)
for (int i = 0; i < fractureResultNames.size(); ++i) for (int i = 0; i < fractureResultNames.size(); ++i)
{ {
size_t resIndex = fractureModelResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, fractureResultNames[i], false); size_t resIndex = fractureModelResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, fractureResultNames[i], false);
fractureModelResults->setTimeStepInfos(resIndex, staticTimeStepInfo); fractureModelResults->setTimeStepInfos(RigEclipseResultAddress(resIndex), staticTimeStepInfo);
} }
} }
} }

View File

@ -54,7 +54,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip
for (size_t i = 0; i < m_reservoirBuilder.resultCount(); i++) for (size_t i = 0; i < m_reservoirBuilder.resultCount(); i++)
{ {
size_t resIdx = cellResults->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, QString("Dynamic_Result_%1").arg(i), false); size_t resIdx = cellResults->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, QString("Dynamic_Result_%1").arg(i), false);
cellResults->setTimeStepInfos(resIdx, timeStepInfos); cellResults->setTimeStepInfos(RigEclipseResultAddress(resIdx), timeStepInfos);
} }
if (m_reservoirBuilder.timeStepCount() == 0) return true; if (m_reservoirBuilder.timeStepCount() == 0) return true;
@ -71,7 +71,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip
if (i > 1) resIndex = i; if (i > 1) resIndex = i;
size_t resIdx = cellResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, QString("Static_Result_%1%2").arg(resIndex).arg(varEnd), false); size_t resIdx = cellResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, QString("Static_Result_%1%2").arg(resIndex).arg(varEnd), false);
cellResults->setTimeStepInfos(resIdx, staticResultTimeStepInfos); cellResults->setTimeStepInfos(RigEclipseResultAddress(resIdx), staticResultTimeStepInfos);
} }
@ -80,9 +80,9 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip
size_t resIdx; \ size_t resIdx; \
QString resultName(Name); \ QString resultName(Name); \
resIdx = cellResults->findOrCreateScalarResultIndex(RiaDefines::INPUT_PROPERTY, resultName, false); \ resIdx = cellResults->findOrCreateScalarResultIndex(RiaDefines::INPUT_PROPERTY, resultName, false); \
cellResults->setTimeStepInfos(resIdx, staticResultTimeStepInfos); \ cellResults->setTimeStepInfos(RigEclipseResultAddress(resIdx), staticResultTimeStepInfos); \
cellResults->cellScalarResults(resIdx).resize(1); \ cellResults->cellScalarResults(RigEclipseResultAddress(resIdx)).resize(1); \
std::vector<double>& values = cellResults->cellScalarResults(resIdx)[0]; \ std::vector<double>& values = cellResults->cellScalarResults(RigEclipseResultAddress(resIdx))[0]; \
this->inputProperty(resultName, &values); \ this->inputProperty(resultName, &values); \
} }

View File

@ -50,7 +50,9 @@ class RigFemPartResultsCollection: public cvf::Object
public: public:
static const std::string FIELD_NAME_COMPACTION; static const std::string FIELD_NAME_COMPACTION;
RigFemPartResultsCollection(RifGeoMechReaderInterface* readerInterface, RifElementPropertyReader* elementPropertyReader, const RigFemPartCollection * femPartCollection); RigFemPartResultsCollection(RifGeoMechReaderInterface* readerInterface,
RifElementPropertyReader* elementPropertyReader,
const RigFemPartCollection * femPartCollection);
~RigFemPartResultsCollection() override; ~RigFemPartResultsCollection() override;
void setActiveFormationNames(RigFormationNames* activeFormationNames); void setActiveFormationNames(RigFormationNames* activeFormationNames);

View File

@ -310,7 +310,7 @@ cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellEdgeResultAccess
} }
else else
{ {
size_t resultIndices[6]; RigEclipseResultAddress resultIndices[6];
cellEdgeResultColors->gridScalarIndices(resultIndices); cellEdgeResultColors->gridScalarIndices(resultIndices);
std::vector<RimCellEdgeMetaData> metaData; std::vector<RimCellEdgeMetaData> metaData;

View File

@ -691,9 +691,9 @@ void RivFaultPartMgr::updateNNCColors(size_t timeStepIndex, RimEclipseCellColors
if (cellResultColors) if (cellResultColors)
{ {
size_t scalarSetIndex = cellResultColors->scalarResultIndex(); RigEclipseResultAddress scalarSetIndex = cellResultColors->scalarResultIndex();
if (m_grid->mainGrid()->nncData()->hasScalarValues(scalarSetIndex)) if (m_grid->mainGrid()->nncData()->hasScalarValues(scalarSetIndex.scalarResultIndex))
{ {
showNncsWithScalarMappedColor = true; showNncsWithScalarMappedColor = true;
} }
@ -702,7 +702,7 @@ void RivFaultPartMgr::updateNNCColors(size_t timeStepIndex, RimEclipseCellColors
if (showNncsWithScalarMappedColor) if (showNncsWithScalarMappedColor)
{ {
size_t scalarSetIndex = cellResultColors->scalarResultIndex(); RigEclipseResultAddress scalarSetIndex = cellResultColors->scalarResultIndex();
RiaDefines::ResultCatType resultType = cellResultColors->resultType(); RiaDefines::ResultCatType resultType = cellResultColors->resultType();
const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper(); const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper();
@ -714,7 +714,7 @@ void RivFaultPartMgr::updateNNCColors(size_t timeStepIndex, RimEclipseCellColors
{ {
size_t nativeTimeStepIndex = eclipseCase->uiToNativeTimeStepIndex(timeStepIndex); size_t nativeTimeStepIndex = eclipseCase->uiToNativeTimeStepIndex(timeStepIndex);
m_NNCGenerator->textureCoordinates( m_NNCGenerator->textureCoordinates(
m_NNCTextureCoords.p(), mapper, resultType, scalarSetIndex, nativeTimeStepIndex); m_NNCTextureCoords.p(), mapper, resultType, scalarSetIndex.scalarResultIndex, nativeTimeStepIndex);
} }
} }

View File

@ -159,7 +159,7 @@ void RivReservoirFaultsPartMgr::appendPartsToModel(cvf::ModelBasicList* model)
bool showNncs = true; bool showNncs = true;
if (faultCollection->hideNncsWhenNoResultIsAvailable()) if (faultCollection->hideNncsWhenNoResultIsAvailable())
{ {
size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T; RigEclipseResultAddress scalarResultIndex;
if (faultResultColors->showCustomFaultResult()) if (faultResultColors->showCustomFaultResult())
{ {
scalarResultIndex = faultResultColors->customFaultResult()->scalarResultIndex(); scalarResultIndex = faultResultColors->customFaultResult()->scalarResultIndex();
@ -170,7 +170,7 @@ void RivReservoirFaultsPartMgr::appendPartsToModel(cvf::ModelBasicList* model)
} }
RigMainGrid* mainGrid = m_reservoirView->mainGrid(); RigMainGrid* mainGrid = m_reservoirView->mainGrid();
if (!(mainGrid && mainGrid->nncData()->hasScalarValues(scalarResultIndex))) if (!(mainGrid && mainGrid->nncData()->hasScalarValues(scalarResultIndex.scalarResultIndex)))
{ {
showNncs = false; showNncs = false;
} }

View File

@ -418,7 +418,7 @@ std::map<QDateTime, std::set<RifDataSourceForRftPlt>> RimWellPlotTools::timeStep
std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timeStepsMap; std::map<QDateTime, std::set<RifDataSourceForRftPlt>> timeStepsMap;
if (resultDataInfo.first != cvf::UNDEFINED_SIZE_T) if (resultDataInfo.first != cvf::UNDEFINED_SIZE_T)
{ {
for (const QDateTime& timeStep : eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->timeStepDates(resultDataInfo.first)) for (const QDateTime& timeStep : eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->timeStepDates(RigEclipseResultAddress(resultDataInfo.first)))
{ {
if (timeStepsMap.count(timeStep) == 0) if (timeStepsMap.count(timeStep) == 0)
{ {

View File

@ -337,20 +337,20 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimE
if (isResultsInfoRelevant) if (isResultsInfoRelevant)
{ {
size_t scalarIndex = eclipseView->cellResult()->scalarResultIndex(); RigEclipseResultAddress eclResAddr = eclipseView->cellResult()->scalarResultIndex();
if (scalarIndex != cvf::UNDEFINED_SIZE_T) if (eclResAddr.isValid())
{ {
if (m_statisticsCellRange == ALL_CELLS) if (m_statisticsCellRange == ALL_CELLS)
{ {
if (m_statisticsTimeRange == ALL_TIMESTEPS) if (m_statisticsTimeRange == ALL_TIMESTEPS)
{ {
eclipseView->currentGridCellResults()->minMaxCellScalarValues(scalarIndex, histData.min, histData.max); eclipseView->currentGridCellResults()->minMaxCellScalarValues(eclResAddr, histData.min, histData.max);
eclipseView->currentGridCellResults()->p10p90CellScalarValues(scalarIndex, histData.p10, histData.p90); eclipseView->currentGridCellResults()->p10p90CellScalarValues(eclResAddr, histData.p10, histData.p90);
eclipseView->currentGridCellResults()->meanCellScalarValues(scalarIndex, histData.mean); eclipseView->currentGridCellResults()->meanCellScalarValues(eclResAddr, histData.mean);
eclipseView->currentGridCellResults()->sumCellScalarValues(scalarIndex, histData.sum); eclipseView->currentGridCellResults()->sumCellScalarValues(eclResAddr, histData.sum);
eclipseView->currentGridCellResults()->mobileVolumeWeightedMean(scalarIndex, histData.weightedMean); eclipseView->currentGridCellResults()->mobileVolumeWeightedMean(eclResAddr, histData.weightedMean);
histData.histogram = &(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(scalarIndex)); histData.histogram = &(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(eclResAddr));
} }
else if (m_statisticsTimeRange == CURRENT_TIMESTEP) else if (m_statisticsTimeRange == CURRENT_TIMESTEP)
{ {
@ -360,13 +360,13 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimE
currentTimeStep = 0; currentTimeStep = 0;
} }
eclipseView->currentGridCellResults()->minMaxCellScalarValues(scalarIndex, currentTimeStep, histData.min, histData.max); eclipseView->currentGridCellResults()->minMaxCellScalarValues(eclResAddr, currentTimeStep, histData.min, histData.max);
eclipseView->currentGridCellResults()->p10p90CellScalarValues(scalarIndex, currentTimeStep, histData.p10, histData.p90); eclipseView->currentGridCellResults()->p10p90CellScalarValues(eclResAddr, currentTimeStep, histData.p10, histData.p90);
eclipseView->currentGridCellResults()->meanCellScalarValues(scalarIndex, currentTimeStep, histData.mean); eclipseView->currentGridCellResults()->meanCellScalarValues(eclResAddr, currentTimeStep, histData.mean);
eclipseView->currentGridCellResults()->sumCellScalarValues(scalarIndex, currentTimeStep, histData.sum); eclipseView->currentGridCellResults()->sumCellScalarValues(eclResAddr, currentTimeStep, histData.sum);
eclipseView->currentGridCellResults()->mobileVolumeWeightedMean(scalarIndex, currentTimeStep, histData.weightedMean); eclipseView->currentGridCellResults()->mobileVolumeWeightedMean(eclResAddr, currentTimeStep, histData.weightedMean);
histData.histogram = &(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(scalarIndex, currentTimeStep)); histData.histogram = &(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(eclResAddr, currentTimeStep));
} }
else else
{ {
@ -1095,10 +1095,10 @@ void Rim3dOverlayInfoConfig::updateVisCellStatsIfNeeded()
} }
else else
{ {
size_t scalarIndex = eclipseView->cellResult()->scalarResultIndex(); RigEclipseResultAddress scalarIndex = eclipseView->cellResult()->scalarResultIndex();
calc = new RigEclipseNativeVisibleCellsStatCalc(eclipseView->currentGridCellResults(), calc = new RigEclipseNativeVisibleCellsStatCalc(eclipseView->currentGridCellResults(),
scalarIndex, scalarIndex,
eclipseView->currentTotalCellVisibility().p()); eclipseView->currentTotalCellVisibility().p());
} }
} }

View File

@ -105,7 +105,7 @@ void RimCellEdgeColors::loadResult()
{ {
m_singleVarEdgeResultColors->loadResult();; m_singleVarEdgeResultColors->loadResult();;
size_t resultindex = m_singleVarEdgeResultColors->scalarResultIndex(); RigEclipseResultAddress resultindex = m_singleVarEdgeResultColors->scalarResultIndex();
for (int cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx) for (int cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
{ {
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(m_singleVarEdgeResultColors->resultVariable(), resultindex); m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(m_singleVarEdgeResultColors->resultVariable(), resultindex);
@ -132,7 +132,7 @@ void RimCellEdgeColors::loadResult()
if (vars[i].endsWith(varEnd)) if (vars[i].endsWith(varEnd))
{ {
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(vars[i], resultindex); m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(vars[i], RigEclipseResultAddress(resultindex));
} }
} }
} }
@ -317,12 +317,12 @@ QStringList RimCellEdgeColors::findResultVariableNames()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimCellEdgeColors::gridScalarIndices(size_t resultIndices[6]) void RimCellEdgeColors::gridScalarIndices(RigEclipseResultAddress resultIndices[6])
{ {
int cubeFaceIndex; int cubeFaceIndex;
for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex) for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex)
{ {
resultIndices[cubeFaceIndex] = m_resultNameToIndexPairs[cubeFaceIndex].second; resultIndices[cubeFaceIndex] = RigEclipseResultAddress(m_resultNameToIndexPairs[cubeFaceIndex].second);
} }
} }
@ -356,7 +356,7 @@ void RimCellEdgeColors::cellEdgeMetaData(std::vector<RimCellEdgeMetaData>* metaD
{ {
CVF_ASSERT(metaDataVector); CVF_ASSERT(metaDataVector);
size_t resultIndices[6]; RigEclipseResultAddress resultIndices[6];
this->gridScalarIndices(resultIndices); this->gridScalarIndices(resultIndices);
std::vector<QString> resultNames; std::vector<QString> resultNames;
@ -387,7 +387,7 @@ void RimCellEdgeColors::resetResultIndices()
int cubeFaceIndex; int cubeFaceIndex;
for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex) for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex)
{ {
m_resultNameToIndexPairs[cubeFaceIndex].second = cvf::UNDEFINED_SIZE_T; m_resultNameToIndexPairs[cubeFaceIndex].second = RigEclipseResultAddress(cvf::UNDEFINED_SIZE_T);
} }
} }
@ -407,7 +407,7 @@ bool RimCellEdgeColors::hasResult() const
int cubeFaceIndex; int cubeFaceIndex;
for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex) for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex)
{ {
hasResult |= ((m_resultNameToIndexPairs[cubeFaceIndex].second) != cvf::UNDEFINED_SIZE_T); hasResult |= m_resultNameToIndexPairs[cubeFaceIndex].second.isValid();
} }
return hasResult; return hasResult;
@ -450,13 +450,13 @@ void RimCellEdgeColors::minMaxCellEdgeValues(double& min, double& max)
} }
else else
{ {
size_t resultIndices[6]; RigEclipseResultAddress resultIndices[6];
this->gridScalarIndices(resultIndices); this->gridScalarIndices(resultIndices);
size_t idx; size_t idx;
for (idx = 0; idx < 6; idx++) for (idx = 0; idx < 6; idx++)
{ {
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue; if (!resultIndices[idx].isValid()) continue;
{ {
double cMin, cMax; double cMin, cMax;
@ -481,13 +481,13 @@ void RimCellEdgeColors::posNegClosestToZero(double& pos, double& neg)
pos = HUGE_VAL; pos = HUGE_VAL;
neg = -HUGE_VAL; neg = -HUGE_VAL;
size_t resultIndices[6]; RigEclipseResultAddress resultIndices[6];
this->gridScalarIndices(resultIndices); this->gridScalarIndices(resultIndices);
size_t idx; size_t idx;
for (idx = 0; idx < 6; idx++) for (idx = 0; idx < 6; idx++)
{ {
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue; if (!resultIndices[idx].isValid()) continue;
{ {
double localPos, localNeg; double localPos, localNeg;

View File

@ -27,6 +27,8 @@
#include <array> #include <array>
#include "RigCaseCellResultsData.h"
class RigCaseCellResultsData; class RigCaseCellResultsData;
class RimEclipseCase; class RimEclipseCase;
class RimEclipseCellColors; class RimEclipseCellColors;
@ -36,7 +38,7 @@ class RimRegularLegendConfig;
class RimCellEdgeMetaData class RimCellEdgeMetaData
{ {
public: public:
size_t m_resultIndex; RigEclipseResultAddress m_resultIndex;
QString m_resultVariable; QString m_resultVariable;
bool m_isStatic; bool m_isStatic;
}; };
@ -78,7 +80,7 @@ public:
void setActive(bool active); void setActive(bool active);
double ignoredScalarValue() { return m_ignoredResultScalar; } double ignoredScalarValue() { return m_ignoredResultScalar; }
void gridScalarIndices(size_t resultIndices[6]); void gridScalarIndices(RigEclipseResultAddress resultIndices[6]);
void cellEdgeMetaData(std::vector<RimCellEdgeMetaData>* metaData); void cellEdgeMetaData(std::vector<RimCellEdgeMetaData>* metaData);
void loadResult(); void loadResult();
@ -118,7 +120,7 @@ private:
caf::PdmField<bool> useYVariable; caf::PdmField<bool> useYVariable;
caf::PdmField<bool> useZVariable; caf::PdmField<bool> useZVariable;
std::array<std::pair<QString, size_t>, 6> m_resultNameToIndexPairs; std::array<std::pair<QString, RigEclipseResultAddress>, 6> m_resultNameToIndexPairs;
caf::PdmPointer<RimEclipseView> m_reservoirView; caf::PdmPointer<RimEclipseView> m_reservoirView;
double m_ignoredResultScalar; double m_ignoredResultScalar;

View File

@ -360,6 +360,7 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep,
double globalMin, globalMax; double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero; double globalPosClosestToZero, globalNegClosestToZero;
cellResultsData->minMaxCellScalarValues(this->scalarResultIndex(), globalMin, globalMax); cellResultsData->minMaxCellScalarValues(this->scalarResultIndex(), globalMin, globalMax);
cellResultsData->posNegClosestToZero(this->scalarResultIndex(), globalPosClosestToZero, globalNegClosestToZero); cellResultsData->posNegClosestToZero(this->scalarResultIndex(), globalPosClosestToZero, globalNegClosestToZero);
@ -448,8 +449,8 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep,
double localMin = 0.0; double localMin = 0.0;
double localMax = 1.0; double localMax = 1.0;
cellResultsData->minMaxCellScalarValues(scalarSetIndex, globalMin, globalMax); cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), globalMin, globalMax);
cellResultsData->minMaxCellScalarValues(scalarSetIndex, currentTimeStep, localMin, localMax); cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), currentTimeStep, localMin, localMax);
ternaryLegendConfig->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SOIL_IDX, globalMin, globalMax, localMin, localMax); ternaryLegendConfig->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SOIL_IDX, globalMin, globalMax, localMin, localMax);
} }
@ -464,8 +465,8 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep,
double localMin = 0.0; double localMin = 0.0;
double localMax = 1.0; double localMax = 1.0;
cellResultsData->minMaxCellScalarValues(scalarSetIndex, globalMin, globalMax); cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), globalMin, globalMax);
cellResultsData->minMaxCellScalarValues(scalarSetIndex, currentTimeStep, localMin, localMax); cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), currentTimeStep, localMin, localMax);
ternaryLegendConfig->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SGAS_IDX, globalMin, globalMax, localMin, localMax); ternaryLegendConfig->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SGAS_IDX, globalMin, globalMax, localMin, localMax);
} }
@ -480,8 +481,8 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep,
double localMin = 0.0; double localMin = 0.0;
double localMax = 1.0; double localMax = 1.0;
cellResultsData->minMaxCellScalarValues(scalarSetIndex, globalMin, globalMax); cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), globalMin, globalMax);
cellResultsData->minMaxCellScalarValues(scalarSetIndex, currentTimeStep, localMin, localMax); cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), currentTimeStep, localMin, localMax);
ternaryLegendConfig->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SWAT_IDX, globalMin, globalMax, localMin, localMax); ternaryLegendConfig->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SWAT_IDX, globalMin, globalMax, localMin, localMax);
} }

View File

@ -324,8 +324,8 @@ std::vector<double> RimEclipseContourMapProjection::retrieveParameterWeights()
std::vector<double> weights; std::vector<double> weights;
if (m_weightByParameter()) if (m_weightByParameter())
{ {
size_t gridScalarResultIdx = m_weightingResult->scalarResultIndex(); RigEclipseResultAddress gridScalarResultIdx = m_weightingResult->scalarResultIndex();
if (gridScalarResultIdx != cvf::UNDEFINED_SIZE_T) if (gridScalarResultIdx.isValid())
{ {
m_weightingResult->loadResult(); m_weightingResult->loadResult();
int timeStep = 0; int timeStep = 0;
@ -333,7 +333,7 @@ std::vector<double> RimEclipseContourMapProjection::retrieveParameterWeights()
{ {
timeStep = view()->currentTimeStep(); timeStep = view()->currentTimeStep();
} }
weights = m_weightingResult->currentGridCellResults()->cellScalarResults(gridScalarResultIdx)[timeStep]; weights = m_weightingResult->currentGridCellResults()->cellScalarResults(gridScalarResultIdx, timeStep);
} }
} }
return weights; return weights;

View File

@ -372,8 +372,8 @@ void RimEclipsePropertyFilter::computeResultValueRange()
} }
else else
{ {
size_t scalarIndex = resultDefinition->scalarResultIndex(); RigEclipseResultAddress scalarIndex = resultDefinition->scalarResultIndex();
if ( scalarIndex != cvf::UNDEFINED_SIZE_T ) if ( scalarIndex.isValid() )
{ {
RigCaseCellResultsData* results = resultDefinition->currentGridCellResults(); RigCaseCellResultsData* results = resultDefinition->currentGridCellResults();
if ( results ) if ( results )

View File

@ -625,11 +625,11 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
size_t RimEclipseResultDefinition::scalarResultIndex() const RigEclipseResultAddress RimEclipseResultDefinition::scalarResultIndex() const
{ {
size_t gridScalarResultIndex = cvf::UNDEFINED_SIZE_T; size_t gridScalarResultIndex = cvf::UNDEFINED_SIZE_T;
if (isFlowDiagOrInjectionFlooding()) return cvf::UNDEFINED_SIZE_T; if (isFlowDiagOrInjectionFlooding()) return RigEclipseResultAddress();
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
if (gridCellResults ) if (gridCellResults )
@ -637,7 +637,7 @@ size_t RimEclipseResultDefinition::scalarResultIndex() const
gridScalarResultIndex = gridCellResults->findScalarResultIndex(m_resultType(), m_resultVariable()); gridScalarResultIndex = gridCellResults->findScalarResultIndex(m_resultType(), m_resultVariable());
} }
return gridScalarResultIndex; return RigEclipseResultAddress(gridScalarResultIndex);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -786,7 +786,7 @@ bool RimEclipseResultDefinition::hasStaticResult() const
if (isFlowDiagOrInjectionFlooding()) return false; if (isFlowDiagOrInjectionFlooding()) return false;
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
size_t gridScalarResultIndex = this->scalarResultIndex(); RigEclipseResultAddress gridScalarResultIndex = this->scalarResultIndex();
if (hasResult() && gridCellResults->timeStepCount(gridScalarResultIndex) == 1 ) if (hasResult() && gridCellResults->timeStepCount(gridScalarResultIndex) == 1 )
{ {
@ -845,7 +845,7 @@ bool RimEclipseResultDefinition::hasDynamicResult() const
if (this->currentGridCellResults()) if (this->currentGridCellResults())
{ {
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
size_t gridScalarResultIndex = this->scalarResultIndex(); RigEclipseResultAddress gridScalarResultIndex = this->scalarResultIndex();
if (gridCellResults->timeStepCount(gridScalarResultIndex) > 1 ) if (gridCellResults->timeStepCount(gridScalarResultIndex) > 1 )
{ {
return true; return true;

View File

@ -35,6 +35,8 @@
#include <limits> #include <limits>
#include "RigCaseCellResultsData.h"
class RigCaseCellResultsData; class RigCaseCellResultsData;
class RimEclipseCase; class RimEclipseCase;
class RimEclipseView; class RimEclipseView;
@ -92,7 +94,7 @@ public:
QString resultVariableUiShortName() const; QString resultVariableUiShortName() const;
void loadResult(); void loadResult();
size_t scalarResultIndex() const; RigEclipseResultAddress scalarResultIndex() const;
bool hasStaticResult() const; bool hasStaticResult() const;
bool hasDynamicResult() const; bool hasDynamicResult() const;
bool hasResult() const; bool hasResult() const;

View File

@ -44,13 +44,13 @@ void RimEclipseStatisticsCaseEvaluator::addNamedResult(RigCaseCellResultsData* d
// Use time step dates from first result in first source case // Use time step dates from first result in first source case
CVF_ASSERT(m_sourceCases.size() > 0); CVF_ASSERT(m_sourceCases.size() > 0);
std::vector<RigEclipseTimeStepInfo> sourceTimeStepInfos = m_sourceCases[0]->results(RiaDefines::MATRIX_MODEL)->timeStepInfos(0); std::vector<RigEclipseTimeStepInfo> sourceTimeStepInfos = m_sourceCases[0]->results(RiaDefines::MATRIX_MODEL)->timeStepInfos(RigEclipseResultAddress(0));
size_t destinationScalarResultIndex = destinationCellResults->findOrCreateScalarResultIndex(resultType, resultName, true); size_t destinationScalarResultIndex = destinationCellResults->findOrCreateScalarResultIndex(resultType, resultName, true);
CVF_ASSERT(destinationScalarResultIndex != cvf::UNDEFINED_SIZE_T); CVF_ASSERT(destinationScalarResultIndex != cvf::UNDEFINED_SIZE_T);
destinationCellResults->setTimeStepInfos(destinationScalarResultIndex, sourceTimeStepInfos); destinationCellResults->setTimeStepInfos(RigEclipseResultAddress(destinationScalarResultIndex), sourceTimeStepInfos);
std::vector< std::vector<double> >& dataValues = destinationCellResults->cellScalarResults(destinationScalarResultIndex); std::vector< std::vector<double> >& dataValues = destinationCellResults->cellScalarResults(RigEclipseResultAddress(destinationScalarResultIndex));
dataValues.resize(sourceTimeStepInfos.size()); dataValues.resize(sourceTimeStepInfos.size());

View File

@ -236,7 +236,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
// for all cases // for all cases
{ {
std::vector<RigEclipseTimeStepInfo> timeStepInfos = rigCaseData->results(poroModel)->timeStepInfos(0); std::vector<RigEclipseTimeStepInfo> timeStepInfos = rigCaseData->results(poroModel)->timeStepInfos(RigEclipseResultAddress(0));
const std::vector<RigEclipseResultInfo> resultInfos = rigCaseData->results(poroModel)->infoForEachResultIndex(); const std::vector<RigEclipseResultInfo> resultInfos = rigCaseData->results(poroModel)->infoForEachResultIndex();
@ -261,9 +261,9 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
if (mustBeCalculated) cellResultsStorage->setMustBeCalculated(scalarResultIndex); if (mustBeCalculated) cellResultsStorage->setMustBeCalculated(scalarResultIndex);
cellResultsStorage->setTimeStepInfos(scalarResultIndex, timeStepInfos); cellResultsStorage->setTimeStepInfos(RigEclipseResultAddress(scalarResultIndex), timeStepInfos);
std::vector< std::vector<double> >& dataValues = cellResultsStorage->cellScalarResults(scalarResultIndex); std::vector< std::vector<double> >& dataValues = cellResultsStorage->cellScalarResults(RigEclipseResultAddress(scalarResultIndex));
dataValues.resize(timeStepInfos.size()); dataValues.resize(timeStepInfos.size());
} }
} }

View File

@ -128,7 +128,7 @@ void RimReservoirCellResultsStorage::setupBeforeSave()
{ {
// If there is no data, we do not store anything for the current result variable // If there is no data, we do not store anything for the current result variable
// (Even not the metadata, of cause) // (Even not the metadata, of cause)
size_t timestepCount = m_cellResults->cellScalarResults(resInfo[rIdx].gridScalarResultIndex()).size(); size_t timestepCount = m_cellResults->cellScalarResults(RigEclipseResultAddress(resInfo[rIdx].gridScalarResultIndex())).size();
if (timestepCount && resInfo[rIdx].needsToBeStored()) if (timestepCount && resInfo[rIdx].needsToBeStored())
{ {
@ -153,7 +153,7 @@ void RimReservoirCellResultsStorage::setupBeforeSave()
const std::vector<double>* data = nullptr; const std::vector<double>* data = nullptr;
if (tsIdx < timestepCount) if (tsIdx < timestepCount)
{ {
data = &(m_cellResults->cellScalarResults(resInfo[rIdx].gridScalarResultIndex(), tsIdx)); data = &(m_cellResults->cellScalarResults(RigEclipseResultAddress(resInfo[rIdx].gridScalarResultIndex()), tsIdx));
} }
if (data && data->size()) if (data && data->size())
@ -277,7 +277,7 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell
reportNumbers.resize(resInfo->m_timeStepDates().size()); reportNumbers.resize(resInfo->m_timeStepDates().size());
std::vector<RigEclipseTimeStepInfo> timeStepInfos = RigEclipseTimeStepInfo::createTimeStepInfos(resInfo->m_timeStepDates(), reportNumbers, resInfo->m_daysSinceSimulationStart()); std::vector<RigEclipseTimeStepInfo> timeStepInfos = RigEclipseTimeStepInfo::createTimeStepInfos(resInfo->m_timeStepDates(), reportNumbers, resInfo->m_daysSinceSimulationStart());
m_cellResults->setTimeStepInfos(resultIndex, timeStepInfos); m_cellResults->setTimeStepInfos(RigEclipseResultAddress(resultIndex), timeStepInfos);
progress.setProgressDescription(resInfo->m_resultName); progress.setProgressDescription(resInfo->m_resultName);
@ -285,7 +285,7 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell
{ {
std::vector<double>* data = nullptr; std::vector<double>* data = nullptr;
data = &(m_cellResults->cellScalarResults(resultIndex, tsIdx)); data = &(m_cellResults->cellScalarResults(RigEclipseResultAddress(resultIndex), tsIdx));
quint64 cellCount = 0; quint64 cellCount = 0;
stream >> cellCount; stream >> cellCount;

View File

@ -77,121 +77,121 @@ void RigCaseCellResultsData::setActiveCellInfo(RigActiveCellInfo* activeCellInfo
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::minMaxCellScalarValues(size_t scalarResultIndex, double& min, double& max) void RigCaseCellResultsData::minMaxCellScalarValues(const RigEclipseResultAddress& resVarAddr, double& min, double& max)
{ {
m_statisticsDataCache[scalarResultIndex]->minMaxCellScalarValues(min, max); statistics(resVarAddr)->minMaxCellScalarValues(min, max);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::minMaxCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& min, double& max) void RigCaseCellResultsData::minMaxCellScalarValues(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& min, double& max)
{ {
m_statisticsDataCache[scalarResultIndex]->minMaxCellScalarValues(timeStepIndex, min, max); statistics(resVarAddr)->minMaxCellScalarValues(timeStepIndex, min, max);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::posNegClosestToZero(size_t scalarResultIndex, double& pos, double& neg) void RigCaseCellResultsData::posNegClosestToZero(const RigEclipseResultAddress& resVarAddr, double& pos, double& neg)
{ {
m_statisticsDataCache[scalarResultIndex]->posNegClosestToZero(pos, neg); statistics(resVarAddr)->posNegClosestToZero(pos, neg);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::posNegClosestToZero(size_t scalarResultIndex, size_t timeStepIndex, double& pos, double& neg) void RigCaseCellResultsData::posNegClosestToZero(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& pos, double& neg)
{ {
m_statisticsDataCache[scalarResultIndex]->posNegClosestToZero(timeStepIndex, pos, neg); statistics(resVarAddr)->posNegClosestToZero(timeStepIndex, pos, neg);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::vector<size_t>& RigCaseCellResultsData::cellScalarValuesHistogram(size_t scalarResultIndex) const std::vector<size_t>& RigCaseCellResultsData::cellScalarValuesHistogram(const RigEclipseResultAddress& resVarAddr)
{ {
return m_statisticsDataCache[scalarResultIndex]->cellScalarValuesHistogram(); return statistics(resVarAddr)->cellScalarValuesHistogram();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::vector<size_t>& RigCaseCellResultsData::cellScalarValuesHistogram(size_t scalarResultIndex, size_t timeStepIndex) const std::vector<size_t>& RigCaseCellResultsData::cellScalarValuesHistogram(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex)
{ {
return m_statisticsDataCache[scalarResultIndex]->cellScalarValuesHistogram(timeStepIndex); return statistics(resVarAddr)->cellScalarValuesHistogram(timeStepIndex);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::p10p90CellScalarValues(size_t scalarResultIndex, double& p10, double& p90) void RigCaseCellResultsData::p10p90CellScalarValues(const RigEclipseResultAddress& resVarAddr, double& p10, double& p90)
{ {
m_statisticsDataCache[scalarResultIndex]->p10p90CellScalarValues(p10, p90); statistics(resVarAddr)->p10p90CellScalarValues(p10, p90);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::p10p90CellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& p10, double& p90) void RigCaseCellResultsData::p10p90CellScalarValues(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& p10, double& p90)
{ {
m_statisticsDataCache[scalarResultIndex]->p10p90CellScalarValues(timeStepIndex, p10, p90); statistics(resVarAddr)->p10p90CellScalarValues(timeStepIndex, p10, p90);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::meanCellScalarValues(size_t scalarResultIndex, double& meanValue) void RigCaseCellResultsData::meanCellScalarValues(const RigEclipseResultAddress& resVarAddr, double& meanValue)
{ {
m_statisticsDataCache[scalarResultIndex]->meanCellScalarValues(meanValue); statistics(resVarAddr)->meanCellScalarValues(meanValue);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::meanCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& meanValue) void RigCaseCellResultsData::meanCellScalarValues(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& meanValue)
{ {
m_statisticsDataCache[scalarResultIndex]->meanCellScalarValues(timeStepIndex, meanValue); statistics(resVarAddr)->meanCellScalarValues(timeStepIndex, meanValue);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::vector<int>& RigCaseCellResultsData::uniqueCellScalarValues(size_t scalarResultIndex) const std::vector<int>& RigCaseCellResultsData::uniqueCellScalarValues(const RigEclipseResultAddress& resVarAddr)
{ {
return m_statisticsDataCache[scalarResultIndex]->uniqueCellScalarValues(); return statistics(resVarAddr)->uniqueCellScalarValues();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::sumCellScalarValues(size_t scalarResultIndex, double& sumValue) void RigCaseCellResultsData::sumCellScalarValues(const RigEclipseResultAddress& resVarAddr, double& sumValue)
{ {
m_statisticsDataCache[scalarResultIndex]->sumCellScalarValues(sumValue); statistics(resVarAddr)->sumCellScalarValues(sumValue);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::sumCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& sumValue) void RigCaseCellResultsData::sumCellScalarValues(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& sumValue)
{ {
m_statisticsDataCache[scalarResultIndex]->sumCellScalarValues(timeStepIndex, sumValue); statistics(resVarAddr)->sumCellScalarValues(timeStepIndex, sumValue);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::mobileVolumeWeightedMean(size_t scalarResultIndex, double& meanValue) void RigCaseCellResultsData::mobileVolumeWeightedMean(const RigEclipseResultAddress& resVarAddr, double& meanValue)
{ {
m_statisticsDataCache[scalarResultIndex]->mobileVolumeWeightedMean(meanValue); statistics(resVarAddr)->mobileVolumeWeightedMean(meanValue);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::mobileVolumeWeightedMean(size_t scalarResultIndex, size_t timeStepIndex, double& meanValue) void RigCaseCellResultsData::mobileVolumeWeightedMean(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& meanValue)
{ {
m_statisticsDataCache[scalarResultIndex]->mobileVolumeWeightedMean(timeStepIndex, meanValue); statistics(resVarAddr)->mobileVolumeWeightedMean(timeStepIndex, meanValue);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -205,42 +205,53 @@ size_t RigCaseCellResultsData::resultCount() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
size_t RigCaseCellResultsData::timeStepCount(size_t scalarResultIndex) const size_t RigCaseCellResultsData::timeStepCount(const RigEclipseResultAddress& resVarAddr) const
{ {
CVF_TIGHT_ASSERT(scalarResultIndex < resultCount()); CVF_TIGHT_ASSERT(scalarResultIndex < resultCount());
return m_cellScalarResults[scalarResultIndex].size(); return m_cellScalarResults[resVarAddr.scalarResultIndex].size();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::vector<std::vector<double>>& RigCaseCellResultsData::cellScalarResults(size_t scalarResultIndex) const const std::vector<std::vector<double>>& RigCaseCellResultsData::cellScalarResults(const RigEclipseResultAddress& resVarAddr) const
{ {
CVF_TIGHT_ASSERT(scalarResultIndex < resultCount()); CVF_TIGHT_ASSERT(scalarResultIndex < resultCount());
return m_cellScalarResults[scalarResultIndex]; return m_cellScalarResults[resVarAddr.scalarResultIndex];
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<std::vector<double>>& RigCaseCellResultsData::cellScalarResults(size_t scalarResultIndex) std::vector<std::vector<double>>& RigCaseCellResultsData::cellScalarResults(const RigEclipseResultAddress& resVarAddr)
{ {
CVF_TIGHT_ASSERT(scalarResultIndex < resultCount()); CVF_TIGHT_ASSERT(scalarResultIndex < resultCount());
return m_cellScalarResults[scalarResultIndex]; return m_cellScalarResults[resVarAddr.scalarResultIndex];
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<double>& RigCaseCellResultsData::cellScalarResults(size_t scalarResultIndex, size_t timeStepIndex) std::vector<double>& RigCaseCellResultsData::cellScalarResults(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex)
{ {
CVF_TIGHT_ASSERT(scalarResultIndex < resultCount()); CVF_TIGHT_ASSERT(scalarResultIndex < resultCount());
CVF_TIGHT_ASSERT(timeStepIndex < m_cellScalarResults[scalarResultIndex].size()); CVF_TIGHT_ASSERT(timeStepIndex < m_cellScalarResults[scalarResultIndex].size());
return m_cellScalarResults[scalarResultIndex][timeStepIndex]; return m_cellScalarResults[resVarAddr.scalarResultIndex][timeStepIndex];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>& RigCaseCellResultsData::cellScalarResults(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex) const
{
CVF_TIGHT_ASSERT(scalarResultIndex < resultCount());
CVF_TIGHT_ASSERT(timeStepIndex < m_cellScalarResults[scalarResultIndex].size());
return m_cellScalarResults[resVarAddr.scalarResultIndex][timeStepIndex];
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -460,21 +471,21 @@ const RigActiveCellInfo* RigCaseCellResultsData::activeCellInfo() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::recalculateStatistics(size_t scalarResultIndex) void RigCaseCellResultsData::recalculateStatistics(const RigEclipseResultAddress& resVarAddr)
{ {
m_statisticsDataCache[scalarResultIndex]->clearAllStatistics(); m_statisticsDataCache[resVarAddr.scalarResultIndex]->clearAllStatistics();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Returns whether the result data in question is addressed by Active Cell Index /// Returns whether the result data in question is addressed by Active Cell Index
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RigCaseCellResultsData::isUsingGlobalActiveIndex(size_t scalarResultIndex) const bool RigCaseCellResultsData::isUsingGlobalActiveIndex(const RigEclipseResultAddress& resVarAddr) const
{ {
CVF_TIGHT_ASSERT(scalarResultIndex < m_cellScalarResults.size()); CVF_TIGHT_ASSERT(scalarResultIndex < m_cellScalarResults.size());
if (!m_cellScalarResults[scalarResultIndex].size()) return true; if (!m_cellScalarResults[resVarAddr.scalarResultIndex].size()) return true;
size_t firstTimeStepResultValueCount = m_cellScalarResults[scalarResultIndex][0].size(); size_t firstTimeStepResultValueCount = m_cellScalarResults[resVarAddr.scalarResultIndex][0].size();
if (firstTimeStepResultValueCount == m_ownerMainGrid->globalCellArray().size()) return false; if (firstTimeStepResultValueCount == m_ownerMainGrid->globalCellArray().size()) return false;
return true; return true;
@ -513,11 +524,11 @@ std::vector<QDateTime> RigCaseCellResultsData::allTimeStepDatesFromEclipseReader
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<QDateTime> RigCaseCellResultsData::timeStepDates(size_t scalarResultIndex) const std::vector<QDateTime> RigCaseCellResultsData::timeStepDates(const RigEclipseResultAddress& resVarAddr) const
{ {
if (scalarResultIndex < m_resultInfos.size()) if (resVarAddr.scalarResultIndex < m_resultInfos.size())
{ {
return m_resultInfos[scalarResultIndex].dates(); return m_resultInfos[resVarAddr.scalarResultIndex].dates();
} }
else else
return std::vector<QDateTime>(); return std::vector<QDateTime>();
@ -531,7 +542,7 @@ std::vector<QDateTime> RigCaseCellResultsData::timeStepDates() const
size_t scalarResWithMostTimeSteps = cvf::UNDEFINED_SIZE_T; size_t scalarResWithMostTimeSteps = cvf::UNDEFINED_SIZE_T;
maxTimeStepCount(&scalarResWithMostTimeSteps); maxTimeStepCount(&scalarResWithMostTimeSteps);
return timeStepDates(scalarResWithMostTimeSteps); return timeStepDates(RigEclipseResultAddress(scalarResWithMostTimeSteps));
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -542,17 +553,17 @@ std::vector<double> RigCaseCellResultsData::daysSinceSimulationStart() const
size_t scalarResWithMostTimeSteps = cvf::UNDEFINED_SIZE_T; size_t scalarResWithMostTimeSteps = cvf::UNDEFINED_SIZE_T;
maxTimeStepCount(&scalarResWithMostTimeSteps); maxTimeStepCount(&scalarResWithMostTimeSteps);
return daysSinceSimulationStart(scalarResWithMostTimeSteps); return daysSinceSimulationStart(RigEclipseResultAddress(scalarResWithMostTimeSteps));
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<double> RigCaseCellResultsData::daysSinceSimulationStart(size_t scalarResultIndex) const std::vector<double> RigCaseCellResultsData::daysSinceSimulationStart(const RigEclipseResultAddress& resVarAddr) const
{ {
if (scalarResultIndex < m_resultInfos.size()) if (resVarAddr.scalarResultIndex < m_resultInfos.size())
{ {
return m_resultInfos[scalarResultIndex].daysSinceSimulationStarts(); return m_resultInfos[resVarAddr.scalarResultIndex].daysSinceSimulationStarts();
} }
else else
{ {
@ -563,10 +574,10 @@ std::vector<double> RigCaseCellResultsData::daysSinceSimulationStart(size_t scal
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
int RigCaseCellResultsData::reportStepNumber(size_t scalarResultIndex, size_t timeStepIndex) const int RigCaseCellResultsData::reportStepNumber(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex) const
{ {
if (scalarResultIndex < m_resultInfos.size() && m_resultInfos[scalarResultIndex].timeStepInfos().size() > timeStepIndex) if (resVarAddr.scalarResultIndex < m_resultInfos.size() && m_resultInfos[resVarAddr.scalarResultIndex].timeStepInfos().size() > timeStepIndex)
return m_resultInfos[scalarResultIndex].timeStepInfos()[timeStepIndex].m_reportNumber; return m_resultInfos[resVarAddr.scalarResultIndex].timeStepInfos()[timeStepIndex].m_reportNumber;
else else
return -1; return -1;
} }
@ -574,10 +585,10 @@ int RigCaseCellResultsData::reportStepNumber(size_t scalarResultIndex, size_t ti
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<RigEclipseTimeStepInfo> RigCaseCellResultsData::timeStepInfos(size_t scalarResultIndex) const std::vector<RigEclipseTimeStepInfo> RigCaseCellResultsData::timeStepInfos(const RigEclipseResultAddress& resVarAddr) const
{ {
if (scalarResultIndex < m_resultInfos.size()) if (resVarAddr.scalarResultIndex < m_resultInfos.size())
return m_resultInfos[scalarResultIndex].timeStepInfos(); return m_resultInfos[resVarAddr.scalarResultIndex].timeStepInfos();
else else
return std::vector<RigEclipseTimeStepInfo>(); return std::vector<RigEclipseTimeStepInfo>();
} }
@ -585,13 +596,13 @@ std::vector<RigEclipseTimeStepInfo> RigCaseCellResultsData::timeStepInfos(size_t
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::setTimeStepInfos(size_t scalarResultIndex, const std::vector<RigEclipseTimeStepInfo>& timeStepInfos) void RigCaseCellResultsData::setTimeStepInfos(const RigEclipseResultAddress& resVarAddr, const std::vector<RigEclipseTimeStepInfo>& timeStepInfos)
{ {
CVF_ASSERT(scalarResultIndex < m_resultInfos.size()); CVF_ASSERT(resVarAddr.scalarResultIndex < m_resultInfos.size());
m_resultInfos[scalarResultIndex].setTimeStepInfos(timeStepInfos); m_resultInfos[resVarAddr.scalarResultIndex].setTimeStepInfos(timeStepInfos);
std::vector<std::vector<double>>& dataValues = this->cellScalarResults(scalarResultIndex); std::vector<std::vector<double>>& dataValues = this->cellScalarResults(resVarAddr);
dataValues.resize(timeStepInfos.size()); dataValues.resize(timeStepInfos.size());
} }
@ -656,7 +667,7 @@ void RigCaseCellResultsData::clearScalarResult(RiaDefines::ResultCatType type, c
m_cellScalarResults[scalarResultIndex][tsIdx].swap(empty); m_cellScalarResults[scalarResultIndex][tsIdx].swap(empty);
} }
recalculateStatistics(scalarResultIndex); recalculateStatistics(RigEclipseResultAddress(scalarResultIndex));
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -760,9 +771,9 @@ const std::vector<double>*
if (scalarResultIndexPorv == cvf::UNDEFINED_SIZE_T) return nullptr; if (scalarResultIndexPorv == cvf::UNDEFINED_SIZE_T) return nullptr;
const std::vector<double>* porvResults = &(gridCellResults->cellScalarResults(scalarResultIndexPorv, 0)); const std::vector<double>* porvResults = &(gridCellResults->cellScalarResults(RigEclipseResultAddress(scalarResultIndexPorv), 0));
if (!gridCellResults->isUsingGlobalActiveIndex(scalarResultIndexPorv)) if (!gridCellResults->isUsingGlobalActiveIndex(RigEclipseResultAddress(scalarResultIndexPorv)))
{ {
// PORV is given for all cells // PORV is given for all cells
@ -1133,10 +1144,10 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT"); findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT");
findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS"); findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS");
this->cellScalarResults(scalarResultIndex).resize(this->maxTimeStepCount()); m_cellScalarResults[scalarResultIndex].resize(this->maxTimeStepCount());
for (size_t timeStepIdx = 0; timeStepIdx < this->maxTimeStepCount(); timeStepIdx++) for (size_t timeStepIdx = 0; timeStepIdx < this->maxTimeStepCount(); timeStepIdx++)
{ {
std::vector<double>& values = this->cellScalarResults(scalarResultIndex)[timeStepIdx]; std::vector<double>& values = m_cellScalarResults[scalarResultIndex][timeStepIdx];
if (values.size() == 0) if (values.size() == 0)
{ {
computeSOILForTimeStep(timeStepIdx); computeSOILForTimeStep(timeStepIdx);
@ -1149,7 +1160,7 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
else if (resultName == RiaDefines::completionTypeResultName()) else if (resultName == RiaDefines::completionTypeResultName())
{ {
caf::ProgressInfo progressInfo(this->maxTimeStepCount(), "Calculate Completion Type Results"); caf::ProgressInfo progressInfo(this->maxTimeStepCount(), "Calculate Completion Type Results");
this->cellScalarResults(scalarResultIndex).resize(this->maxTimeStepCount()); m_cellScalarResults[scalarResultIndex].resize(this->maxTimeStepCount());
for (size_t timeStepIdx = 0; timeStepIdx < this->maxTimeStepCount(); ++timeStepIdx) for (size_t timeStepIdx = 0; timeStepIdx < this->maxTimeStepCount(); ++timeStepIdx)
{ {
computeCompletionTypeForTimeStep(timeStepIdx); computeCompletionTypeForTimeStep(timeStepIdx);
@ -1177,12 +1188,12 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
if (type == RiaDefines::DYNAMIC_NATIVE && timeStepCount > 0) if (type == RiaDefines::DYNAMIC_NATIVE && timeStepCount > 0)
{ {
this->cellScalarResults(scalarResultIndex).resize(timeStepCount); m_cellScalarResults[scalarResultIndex].resize(timeStepCount);
size_t i; size_t i;
for (i = 0; i < timeStepCount; i++) for (i = 0; i < timeStepCount; i++)
{ {
std::vector<double>& values = this->cellScalarResults(scalarResultIndex)[i]; std::vector<double>& values = m_cellScalarResults[scalarResultIndex][i];
if (!m_readerInterface->dynamicResult(resultName, RiaDefines::MATRIX_MODEL, i, &values)) if (!m_readerInterface->dynamicResult(resultName, RiaDefines::MATRIX_MODEL, i, &values))
{ {
resultLoadingSucess = false; resultLoadingSucess = false;
@ -1200,9 +1211,9 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
} }
else if (type == RiaDefines::STATIC_NATIVE) else if (type == RiaDefines::STATIC_NATIVE)
{ {
this->cellScalarResults(scalarResultIndex).resize(1); m_cellScalarResults[scalarResultIndex].resize(1);
std::vector<double>& values = this->cellScalarResults(scalarResultIndex)[0]; std::vector<double>& values = m_cellScalarResults[scalarResultIndex][0];
if (!m_readerInterface->staticResult(resultName, RiaDefines::MATRIX_MODEL, &values)) if (!m_readerInterface->staticResult(resultName, RiaDefines::MATRIX_MODEL, &values))
{ {
resultLoadingSucess = false; resultLoadingSucess = false;
@ -1221,7 +1232,7 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
if (!resultLoadingSucess) if (!resultLoadingSucess)
{ {
// Remove last scalar result because loading of result failed // Remove last scalar result because loading of result failed
this->cellScalarResults(scalarResultIndex).clear(); m_cellScalarResults[scalarResultIndex].clear();
} }
} }
@ -1246,12 +1257,12 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType
{ {
size_t timeStepCount = this->infoForEachResultIndex()[scalarResultIndex].timeStepInfos().size(); size_t timeStepCount = this->infoForEachResultIndex()[scalarResultIndex].timeStepInfos().size();
this->cellScalarResults(scalarResultIndex).resize(timeStepCount); m_cellScalarResults[scalarResultIndex].resize(timeStepCount);
size_t i; size_t i;
for (i = 0; i < timeStepCount; i++) for (i = 0; i < timeStepCount; i++)
{ {
std::vector<double>& values = this->cellScalarResults(scalarResultIndex)[i]; std::vector<double>& values = m_cellScalarResults[scalarResultIndex][i];
eclReader->sourSimRlResult(resultName, i, &values); eclReader->sourSimRlResult(resultName, i, &values);
} }
} }
@ -1275,9 +1286,9 @@ size_t RigCaseCellResultsData::findOrLoadScalarResultForTimeStep(RiaDefines::Res
if (this->mustBeCalculated(soilScalarResultIndex)) if (this->mustBeCalculated(soilScalarResultIndex))
{ {
this->cellScalarResults(soilScalarResultIndex).resize(this->maxTimeStepCount()); m_cellScalarResults[soilScalarResultIndex].resize(this->maxTimeStepCount());
std::vector<double>& values = this->cellScalarResults(soilScalarResultIndex)[timeStepIndex]; std::vector<double>& values = m_cellScalarResults[soilScalarResultIndex][timeStepIndex];
if (values.size() == 0) if (values.size() == 0)
{ {
computeSOILForTimeStep(timeStepIndex); computeSOILForTimeStep(timeStepIndex);
@ -1309,9 +1320,9 @@ size_t RigCaseCellResultsData::findOrLoadScalarResultForTimeStep(RiaDefines::Res
if (type == RiaDefines::DYNAMIC_NATIVE && timeStepCount > 0) if (type == RiaDefines::DYNAMIC_NATIVE && timeStepCount > 0)
{ {
this->cellScalarResults(scalarResultIndex).resize(timeStepCount); m_cellScalarResults[scalarResultIndex].resize(timeStepCount);
std::vector<double>& values = this->cellScalarResults(scalarResultIndex)[timeStepIndex]; std::vector<double>& values = m_cellScalarResults[scalarResultIndex][timeStepIndex];
if (values.size() == 0) if (values.size() == 0)
{ {
if (!m_readerInterface->dynamicResult(resultName, RiaDefines::MATRIX_MODEL, timeStepIndex, &values)) if (!m_readerInterface->dynamicResult(resultName, RiaDefines::MATRIX_MODEL, timeStepIndex, &values))
@ -1322,9 +1333,9 @@ size_t RigCaseCellResultsData::findOrLoadScalarResultForTimeStep(RiaDefines::Res
} }
else if (type == RiaDefines::STATIC_NATIVE) else if (type == RiaDefines::STATIC_NATIVE)
{ {
this->cellScalarResults(scalarResultIndex).resize(1); m_cellScalarResults[scalarResultIndex].resize(1);
std::vector<double>& values = this->cellScalarResults(scalarResultIndex)[0]; std::vector<double>& values = m_cellScalarResults[scalarResultIndex][0];
if (!m_readerInterface->staticResult(resultName, RiaDefines::MATRIX_MODEL, &values)) if (!m_readerInterface->staticResult(resultName, RiaDefines::MATRIX_MODEL, &values))
{ {
resultLoadingSucess = false; resultLoadingSucess = false;
@ -1347,9 +1358,9 @@ size_t RigCaseCellResultsData::findOrLoadScalarResultForTimeStep(RiaDefines::Res
{ {
size_t timeStepCount = this->infoForEachResultIndex()[scalarResultIndex].timeStepInfos().size(); size_t timeStepCount = this->infoForEachResultIndex()[scalarResultIndex].timeStepInfos().size();
this->cellScalarResults(scalarResultIndex).resize(timeStepCount); m_cellScalarResults[scalarResultIndex].resize(timeStepCount);
std::vector<double>& values = this->cellScalarResults(scalarResultIndex)[timeStepIndex]; std::vector<double>& values = m_cellScalarResults[scalarResultIndex][timeStepIndex];
if (values.size() == 0) if (values.size() == 0)
{ {
@ -1384,7 +1395,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T) if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T)
{ {
std::vector<double>& swatForTimeStep = this->cellScalarResults(scalarIndexSWAT, timeStepIndex); std::vector<double>& swatForTimeStep = this->cellScalarResults(RigEclipseResultAddress(scalarIndexSWAT), timeStepIndex);
if (swatForTimeStep.size() > 0) if (swatForTimeStep.size() > 0)
{ {
soilResultValueCount = swatForTimeStep.size(); soilResultValueCount = swatForTimeStep.size();
@ -1394,7 +1405,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T) if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T)
{ {
std::vector<double>& sgasForTimeStep = this->cellScalarResults(scalarIndexSGAS, timeStepIndex); std::vector<double>& sgasForTimeStep = this->cellScalarResults(RigEclipseResultAddress(scalarIndexSGAS), timeStepIndex);
if (sgasForTimeStep.size() > 0) if (sgasForTimeStep.size() > 0)
{ {
soilResultValueCount = qMax(soilResultValueCount, sgasForTimeStep.size()); soilResultValueCount = qMax(soilResultValueCount, sgasForTimeStep.size());
@ -1407,15 +1418,15 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
// Make sure memory is allocated for the new SOIL results // Make sure memory is allocated for the new SOIL results
size_t soilResultScalarIndex = this->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "SOIL"); size_t soilResultScalarIndex = this->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "SOIL");
this->cellScalarResults(soilResultScalarIndex).resize(soilTimeStepCount); m_cellScalarResults[soilResultScalarIndex].resize(soilTimeStepCount);
if (this->cellScalarResults(soilResultScalarIndex, timeStepIndex).size() > 0) if (this->cellScalarResults(RigEclipseResultAddress(soilResultScalarIndex), timeStepIndex).size() > 0)
{ {
// Data is computed and allocated, nothing more to do // Data is computed and allocated, nothing more to do
return; return;
} }
this->cellScalarResults(soilResultScalarIndex, timeStepIndex).resize(soilResultValueCount); m_cellScalarResults[soilResultScalarIndex][timeStepIndex].resize(soilResultValueCount);
std::vector<double>* swatForTimeStep = nullptr; std::vector<double>* swatForTimeStep = nullptr;
std::vector<double>* sgasForTimeStep = nullptr; std::vector<double>* sgasForTimeStep = nullptr;
@ -1423,7 +1434,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T) if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T)
{ {
swatForTimeStep = &(this->cellScalarResults(scalarIndexSWAT, timeStepIndex)); swatForTimeStep = &(this->cellScalarResults(RigEclipseResultAddress(scalarIndexSWAT), timeStepIndex));
if (swatForTimeStep->size() == 0) if (swatForTimeStep->size() == 0)
{ {
swatForTimeStep = nullptr; swatForTimeStep = nullptr;
@ -1432,7 +1443,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T) if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T)
{ {
sgasForTimeStep = &(this->cellScalarResults(scalarIndexSGAS, timeStepIndex)); sgasForTimeStep = &(this->cellScalarResults(RigEclipseResultAddress(scalarIndexSGAS), timeStepIndex));
if (sgasForTimeStep->size() == 0) if (sgasForTimeStep->size() == 0)
{ {
sgasForTimeStep = nullptr; sgasForTimeStep = nullptr;
@ -1441,14 +1452,14 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex)
if (scalarIndexSSOL != cvf::UNDEFINED_SIZE_T) if (scalarIndexSSOL != cvf::UNDEFINED_SIZE_T)
{ {
ssolForTimeStep = &(this->cellScalarResults(scalarIndexSSOL, timeStepIndex)); ssolForTimeStep = &(this->cellScalarResults(RigEclipseResultAddress(scalarIndexSSOL), timeStepIndex));
if (ssolForTimeStep->size() == 0) if (ssolForTimeStep->size() == 0)
{ {
ssolForTimeStep = nullptr; ssolForTimeStep = nullptr;
} }
} }
std::vector<double>& soilForTimeStep = this->cellScalarResults(soilResultScalarIndex, timeStepIndex); std::vector<double>& soilForTimeStep = this->cellScalarResults(RigEclipseResultAddress(soilResultScalarIndex), timeStepIndex);
#pragma omp parallel for #pragma omp parallel for
for (int idx = 0; idx < static_cast<int>(soilResultValueCount); idx++) for (int idx = 0; idx < static_cast<int>(soilResultValueCount); idx++)
@ -1493,9 +1504,9 @@ void RigCaseCellResultsData::testAndComputeSgasForTimeStep(size_t timeStepIndex)
// Simulation type is gas and water. No SGAS is present, compute SGAS based on SWAT // Simulation type is gas and water. No SGAS is present, compute SGAS based on SWAT
size_t scalarIndexSGAS = this->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "SGAS", false); size_t scalarIndexSGAS = this->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "SGAS", false);
if (this->cellScalarResults(scalarIndexSGAS).size() > timeStepIndex) if (m_cellScalarResults[scalarIndexSGAS].size() > timeStepIndex)
{ {
std::vector<double>& values = this->cellScalarResults(scalarIndexSGAS)[timeStepIndex]; std::vector<double>& values = m_cellScalarResults[scalarIndexSGAS][timeStepIndex];
if (values.size() > 0) return; if (values.size() > 0) return;
} }
@ -1503,7 +1514,7 @@ void RigCaseCellResultsData::testAndComputeSgasForTimeStep(size_t timeStepIndex)
size_t swatTimeStepCount = 0; size_t swatTimeStepCount = 0;
{ {
std::vector<double>& swatForTimeStep = this->cellScalarResults(scalarIndexSWAT, timeStepIndex); std::vector<double>& swatForTimeStep = m_cellScalarResults[scalarIndexSWAT][timeStepIndex];
if (swatForTimeStep.size() > 0) if (swatForTimeStep.size() > 0)
{ {
swatResultValueCount = swatForTimeStep.size(); swatResultValueCount = swatForTimeStep.size();
@ -1511,26 +1522,26 @@ void RigCaseCellResultsData::testAndComputeSgasForTimeStep(size_t timeStepIndex)
} }
} }
this->cellScalarResults(scalarIndexSGAS).resize(swatTimeStepCount); m_cellScalarResults[scalarIndexSGAS].resize(swatTimeStepCount);
if (this->cellScalarResults(scalarIndexSGAS, timeStepIndex).size() > 0) if (m_cellScalarResults[scalarIndexSGAS][timeStepIndex].size() > 0)
{ {
return; return;
} }
this->cellScalarResults(scalarIndexSGAS, timeStepIndex).resize(swatResultValueCount); m_cellScalarResults[scalarIndexSGAS][timeStepIndex].resize(swatResultValueCount);
std::vector<double>* swatForTimeStep = nullptr; std::vector<double>* swatForTimeStep = nullptr;
{ {
swatForTimeStep = &(this->cellScalarResults(scalarIndexSWAT, timeStepIndex)); swatForTimeStep = &(m_cellScalarResults[scalarIndexSWAT][timeStepIndex]);
if (swatForTimeStep->size() == 0) if (swatForTimeStep->size() == 0)
{ {
swatForTimeStep = nullptr; swatForTimeStep = nullptr;
} }
} }
std::vector<double>& sgasForTimeStep = this->cellScalarResults(scalarIndexSGAS, timeStepIndex); std::vector<double>& sgasForTimeStep = m_cellScalarResults[scalarIndexSGAS][timeStepIndex];
#pragma omp parallel for #pragma omp parallel for
for (int idx = 0; idx < static_cast<int>(swatResultValueCount); idx++) for (int idx = 0; idx < static_cast<int>(swatResultValueCount); idx++)
@ -1604,12 +1615,12 @@ void RigCaseCellResultsData::computeDepthRelatedResults()
computeBottom = true; computeBottom = true;
} }
std::vector<std::vector<double>>& depth = this->cellScalarResults(depthResultIndex); std::vector<std::vector<double>>& depth = m_cellScalarResults[depthResultIndex];
std::vector<std::vector<double>>& dx = this->cellScalarResults(dxResultIndex); std::vector<std::vector<double>>& dx = m_cellScalarResults[dxResultIndex];
std::vector<std::vector<double>>& dy = this->cellScalarResults(dyResultIndex); std::vector<std::vector<double>>& dy = m_cellScalarResults[dyResultIndex];
std::vector<std::vector<double>>& dz = this->cellScalarResults(dzResultIndex); std::vector<std::vector<double>>& dz = m_cellScalarResults[dzResultIndex];
std::vector<std::vector<double>>& tops = this->cellScalarResults(topsResultIndex); std::vector<std::vector<double>>& tops = m_cellScalarResults[topsResultIndex];
std::vector<std::vector<double>>& bottom = this->cellScalarResults(bottomResultIndex); std::vector<std::vector<double>>& bottom = m_cellScalarResults[bottomResultIndex];
// Make sure the size is at least active cells // Make sure the size is at least active cells
{ {
@ -1837,22 +1848,22 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
// Get the result count, to handle that one of them might be globally defined // Get the result count, to handle that one of them might be globally defined
size_t permxResultValueCount = this->cellScalarResults(permResultIdx)[0].size(); size_t permxResultValueCount = m_cellScalarResults[permResultIdx][0].size();
size_t resultValueCount = permxResultValueCount; size_t resultValueCount = permxResultValueCount;
if (hasNTGResults) if (hasNTGResults)
{ {
size_t ntgResultValueCount = this->cellScalarResults(ntgResultIdx)[0].size(); size_t ntgResultValueCount = m_cellScalarResults[ntgResultIdx][0].size();
resultValueCount = CVF_MIN(permxResultValueCount, ntgResultValueCount); resultValueCount = CVF_MIN(permxResultValueCount, ntgResultValueCount);
} }
// Get all the actual result values // Get all the actual result values
std::vector<double>& permResults = this->cellScalarResults(permResultIdx)[0]; std::vector<double>& permResults = m_cellScalarResults[permResultIdx][0];
std::vector<double>& riTransResults = this->cellScalarResults(riTransResultIdx)[0]; std::vector<double>& riTransResults = m_cellScalarResults[riTransResultIdx][0];
std::vector<double>* ntgResults = nullptr; std::vector<double>* ntgResults = nullptr;
if (hasNTGResults) if (hasNTGResults)
{ {
ntgResults = &(this->cellScalarResults(ntgResultIdx)[0]); ntgResults = &( m_cellScalarResults[ntgResultIdx][0]);
} }
// Set up output container to correct number of results // Set up output container to correct number of results
@ -1864,12 +1875,12 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo
ResultIndexFunction permIdxFunc = nullptr; ResultIndexFunction permIdxFunc = nullptr;
ResultIndexFunction ntgIdxFunc = nullptr; ResultIndexFunction ntgIdxFunc = nullptr;
{ {
bool isPermUsingResIdx = this->isUsingGlobalActiveIndex(permResultIdx); bool isPermUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(permResultIdx));
bool isTransUsingResIdx = this->isUsingGlobalActiveIndex(riTransResultIdx); bool isTransUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(riTransResultIdx));
bool isNtgUsingResIdx = false; bool isNtgUsingResIdx = false;
if (hasNTGResults) if (hasNTGResults)
{ {
isNtgUsingResIdx = this->isUsingGlobalActiveIndex(ntgResultIdx); isNtgUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(ntgResultIdx));
} }
// Set up result index function pointers // Set up result index function pointers
@ -1995,9 +2006,9 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
// Get all the actual result values // Get all the actual result values
std::vector<double>& permXResults = this->cellScalarResults(permXResultIdx)[0]; std::vector<double>& permXResults = m_cellScalarResults[permXResultIdx][0];
std::vector<double>& permYResults = this->cellScalarResults(permYResultIdx)[0]; std::vector<double>& permYResults = m_cellScalarResults[permYResultIdx][0];
std::vector<double>& permZResults = this->cellScalarResults(permZResultIdx)[0]; std::vector<double>& permZResults = m_cellScalarResults[permZResultIdx][0];
std::vector<double>& riCombTransResults = std::vector<double>& riCombTransResults =
m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTrans()); m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTrans());
m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombTrans(), riCombTransScalarResultIndex); m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombTrans(), riCombTransScalarResultIndex);
@ -2005,7 +2016,7 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
std::vector<double>* ntgResults = nullptr; std::vector<double>* ntgResults = nullptr;
if (hasNTGResults) if (hasNTGResults)
{ {
ntgResults = &(this->cellScalarResults(ntgResultIdx)[0]); ntgResults = &(m_cellScalarResults[ntgResultIdx][0]);
} }
// Prepare how to index the result values: // Prepare how to index the result values:
@ -2014,13 +2025,13 @@ void RigCaseCellResultsData::computeNncCombRiTrans()
ResultIndexFunction permZIdxFunc = nullptr; ResultIndexFunction permZIdxFunc = nullptr;
ResultIndexFunction ntgIdxFunc = nullptr; ResultIndexFunction ntgIdxFunc = nullptr;
{ {
bool isPermXUsingResIdx = this->isUsingGlobalActiveIndex(permXResultIdx); bool isPermXUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(permXResultIdx));
bool isPermYUsingResIdx = this->isUsingGlobalActiveIndex(permYResultIdx); bool isPermYUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(permYResultIdx));
bool isPermZUsingResIdx = this->isUsingGlobalActiveIndex(permZResultIdx); bool isPermZUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(permZResultIdx));
bool isNtgUsingResIdx = false; bool isNtgUsingResIdx = false;
if (hasNTGResults) if (hasNTGResults)
{ {
isNtgUsingResIdx = this->isUsingGlobalActiveIndex(ntgResultIdx); isNtgUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(ntgResultIdx));
} }
// Set up result index function pointers // Set up result index function pointers
@ -2205,16 +2216,15 @@ void RigCaseCellResultsData::computeRiMULTComponent(const QString& riMultCompNam
// Get the result count, to handle that one of them might be globally defined // Get the result count, to handle that one of them might be globally defined
CVF_ASSERT(this->cellScalarResults(riTransResultIdx)[0].size() == this->cellScalarResults(transResultIdx)[0].size()); CVF_ASSERT(m_cellScalarResults[riTransResultIdx][0].size() == m_cellScalarResults[transResultIdx][0].size());
size_t resultValueCount = this->cellScalarResults(transResultIdx)[0].size(); size_t resultValueCount = m_cellScalarResults[transResultIdx][0].size();
// Get all the actual result values // Get all the actual result values
std::vector<double>& riTransResults = this->cellScalarResults(riTransResultIdx)[0]; std::vector<double>& riTransResults = m_cellScalarResults[riTransResultIdx][0];
std::vector<double>& transResults = this->cellScalarResults(transResultIdx)[0]; std::vector<double>& transResults = m_cellScalarResults[transResultIdx][0];
std::vector<double>& riMultResults = m_cellScalarResults[riMultResultIdx][0];
std::vector<double>& riMultResults = this->cellScalarResults(riMultResultIdx)[0];
// Set up output container to correct number of results // Set up output container to correct number of results
@ -2295,12 +2305,12 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent(const QString& riTran
// Get the result count, to handle that one of them might be globally defined // Get the result count, to handle that one of them might be globally defined
size_t resultValueCount = this->cellScalarResults(tranCompScResIdx)[0].size(); size_t resultValueCount = m_cellScalarResults[tranCompScResIdx][0].size();
// Get all the actual result values // Get all the actual result values
std::vector<double>& transResults = this->cellScalarResults(tranCompScResIdx)[0]; std::vector<double>& transResults = m_cellScalarResults[tranCompScResIdx][0];
std::vector<double>& riTransByAreaResults = this->cellScalarResults(riTranByAreaScResIdx)[0]; std::vector<double>& riTransByAreaResults = m_cellScalarResults[riTranByAreaScResIdx][0];
// Set up output container to correct number of results // Set up output container to correct number of results
@ -2308,7 +2318,7 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent(const QString& riTran
// Prepare how to index the result values: // Prepare how to index the result values:
bool isUsingResIdx = this->isUsingGlobalActiveIndex(tranCompScResIdx); bool isUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(tranCompScResIdx));
// Set up result index function pointers // Set up result index function pointers
@ -2400,12 +2410,12 @@ void RigCaseCellResultsData::computeCompletionTypeForTimeStep(size_t timeStep)
size_t completionTypeResultIndex = size_t completionTypeResultIndex =
this->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, RiaDefines::completionTypeResultName()); this->findScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, RiaDefines::completionTypeResultName());
if (this->cellScalarResults(completionTypeResultIndex).size() < this->maxTimeStepCount()) if (m_cellScalarResults[completionTypeResultIndex].size() < this->maxTimeStepCount())
{ {
this->cellScalarResults(completionTypeResultIndex).resize(this->maxTimeStepCount()); m_cellScalarResults[completionTypeResultIndex].resize(this->maxTimeStepCount());
} }
std::vector<double>& completionTypeResult = this->cellScalarResults(completionTypeResultIndex, timeStep); std::vector<double>& completionTypeResult = m_cellScalarResults[completionTypeResultIndex][timeStep];
size_t resultValues = m_ownerMainGrid->globalCellArray().size(); size_t resultValues = m_ownerMainGrid->globalCellArray().size();
@ -2439,11 +2449,11 @@ void RigCaseCellResultsData::computeCellVolumes()
{ {
size_t cellVolIdx = this->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riCellVolumeResultName(), false); size_t cellVolIdx = this->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riCellVolumeResultName(), false);
if (this->cellScalarResults(cellVolIdx).empty()) if (m_cellScalarResults[cellVolIdx].empty())
{ {
this->cellScalarResults(cellVolIdx).resize(1); m_cellScalarResults[cellVolIdx].resize(1);
} }
std::vector<double>& cellVolumeResults = this->cellScalarResults(cellVolIdx)[0]; std::vector<double>& cellVolumeResults = m_cellScalarResults[cellVolIdx][0];
size_t cellResultCount = m_activeCellInfo->reservoirCellResultCount(); size_t cellResultCount = m_activeCellInfo->reservoirCellResultCount();
cellVolumeResults.resize(cellResultCount, std::numeric_limits<double>::infinity()); cellVolumeResults.resize(cellResultCount, std::numeric_limits<double>::infinity());
@ -2472,17 +2482,17 @@ void RigCaseCellResultsData::computeCellVolumes()
void RigCaseCellResultsData::computeOilVolumes() void RigCaseCellResultsData::computeOilVolumes()
{ {
size_t cellVolIdx = this->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riCellVolumeResultName(), false); size_t cellVolIdx = this->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riCellVolumeResultName(), false);
const std::vector<double>& cellVolumeResults = this->cellScalarResults(cellVolIdx)[0]; const std::vector<double>& cellVolumeResults = m_cellScalarResults[cellVolIdx][0];
size_t soilIdx = this->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SOIL"); size_t soilIdx = this->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SOIL");
size_t oilVolIdx = this->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, RiaDefines::riOilVolumeResultName(), false); size_t oilVolIdx = this->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, RiaDefines::riOilVolumeResultName(), false);
this->cellScalarResults(oilVolIdx).resize(this->maxTimeStepCount()); m_cellScalarResults[oilVolIdx].resize(this->maxTimeStepCount());
size_t cellResultCount = m_activeCellInfo->reservoirCellResultCount(); size_t cellResultCount = m_activeCellInfo->reservoirCellResultCount();
for (size_t timeStepIdx = 0; timeStepIdx < this->maxTimeStepCount(); timeStepIdx++) for (size_t timeStepIdx = 0; timeStepIdx < this->maxTimeStepCount(); timeStepIdx++)
{ {
const std::vector<double>& soilResults = this->cellScalarResults(soilIdx)[timeStepIdx]; const std::vector<double>& soilResults = m_cellScalarResults[soilIdx][timeStepIdx];
std::vector<double>& oilVolumeResults = this->cellScalarResults(oilVolIdx)[timeStepIdx]; std::vector<double>& oilVolumeResults = m_cellScalarResults[oilVolIdx][timeStepIdx];
oilVolumeResults.resize(cellResultCount, 0u); oilVolumeResults.resize(cellResultCount, 0u);
#pragma omp parallel for #pragma omp parallel for
@ -2525,7 +2535,7 @@ void RigCaseCellResultsData::computeMobilePV()
size_t mobPVIdx = this->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName(), false); size_t mobPVIdx = this->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName(), false);
std::vector<double>& mobPVResults = this->cellScalarResults(mobPVIdx)[0]; std::vector<double>& mobPVResults = m_cellScalarResults[mobPVIdx][0];
// Set up output container to correct number of results // Set up output container to correct number of results
mobPVResults.resize(porvResults->size()); mobPVResults.resize(porvResults->size());
@ -2587,7 +2597,7 @@ bool RigCaseCellResultsData::isDataPresent(size_t scalarResultIndex) const
return false; return false;
} }
const std::vector<std::vector<double>>& data = this->cellScalarResults(scalarResultIndex); const std::vector<std::vector<double>>& data = m_cellScalarResults[scalarResultIndex];
for (size_t tsIdx = 0; tsIdx < data.size(); ++tsIdx) for (size_t tsIdx = 0; tsIdx < data.size(); ++tsIdx)
{ {
@ -2656,3 +2666,11 @@ void RigCaseCellResultsData::assignValuesToTemporaryLgrs(const QString& re
RiaLogging::warning("Detected invalid/undefined cells when assigning result values to temporary LGRs"); RiaLogging::warning("Detected invalid/undefined cells when assigning result values to temporary LGRs");
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigStatisticsDataCache* RigCaseCellResultsData::statistics(const RigEclipseResultAddress& resVarAddr)
{
return m_statisticsDataCache[resVarAddr.scalarResultIndex].p();
}

View File

@ -37,6 +37,38 @@ class RigStatisticsDataCache;
class RigEclipseTimeStepInfo; class RigEclipseTimeStepInfo;
class RigEclipseCaseData; class RigEclipseCaseData;
class RigEclipseResultAddress
{
public:
RigEclipseResultAddress()
: scalarResultIndex(-1)
, m_resultCatType(RiaDefines::UNDEFINED)
{}
explicit RigEclipseResultAddress(size_t ascalarResultIndex)
: scalarResultIndex(ascalarResultIndex)
, m_resultCatType(RiaDefines::UNDEFINED)
{}
explicit RigEclipseResultAddress(RiaDefines::ResultCatType type, const QString& resultName)
: scalarResultIndex(-1)
, m_resultCatType(type)
, m_resultName(resultName)
{}
bool isValid() const
{
return (scalarResultIndex != -1);
// Todo
}
size_t scalarResultIndex;
RiaDefines::ResultCatType m_resultCatType;
QString m_resultName;
};
//================================================================================================== //==================================================================================================
/// Class containing the results for the complete number of active cells. Both main grid and LGR's /// Class containing the results for the complete number of active cells. Both main grid and LGR's
//================================================================================================== //==================================================================================================
@ -54,39 +86,39 @@ public:
const RigActiveCellInfo* activeCellInfo() const; const RigActiveCellInfo* activeCellInfo() const;
// Max and min values of the results // Max and min values of the results
void recalculateStatistics(size_t scalarResultIndex); void recalculateStatistics(const RigEclipseResultAddress& resVarAddr);
void minMaxCellScalarValues(size_t scalarResultIndex, double& min, double& max); void minMaxCellScalarValues(const RigEclipseResultAddress& resVarAddr, double& min, double& max);
void minMaxCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& min, double& max); void minMaxCellScalarValues(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& min, double& max);
void posNegClosestToZero(size_t scalarResultIndex, double& pos, double& neg); void posNegClosestToZero(const RigEclipseResultAddress& resVarAddr, double& pos, double& neg);
void posNegClosestToZero(size_t scalarResultIndex, size_t timeStepIndex, double& pos, double& neg); void posNegClosestToZero(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& pos, double& neg);
const std::vector<size_t>& cellScalarValuesHistogram(size_t scalarResultIndex); const std::vector<size_t>& cellScalarValuesHistogram(const RigEclipseResultAddress& resVarAddr);
const std::vector<size_t>& cellScalarValuesHistogram(size_t scalarResultIndex, size_t timeStepIndex); const std::vector<size_t>& cellScalarValuesHistogram(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex);
void p10p90CellScalarValues(size_t scalarResultIndex, double& p10, double& p90); void p10p90CellScalarValues(const RigEclipseResultAddress& resVarAddr, double& p10, double& p90);
void p10p90CellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& p10, double& p90); void p10p90CellScalarValues(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& p10, double& p90);
void meanCellScalarValues(size_t scalarResultIndex, double& meanValue); void meanCellScalarValues(const RigEclipseResultAddress& resVarAddr, double& meanValue);
void meanCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& meanValue); void meanCellScalarValues(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& meanValue);
const std::vector<int>& uniqueCellScalarValues(size_t scalarResultIndex); const std::vector<int>& uniqueCellScalarValues(const RigEclipseResultAddress& resVarAddr);
void sumCellScalarValues(size_t scalarResultIndex, double& sumValue); void sumCellScalarValues(const RigEclipseResultAddress& resVarAddr, double& sumValue);
void sumCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& sumValue); void sumCellScalarValues(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& sumValue);
void mobileVolumeWeightedMean(size_t scalarResultIndex, double& meanValue); void mobileVolumeWeightedMean(const RigEclipseResultAddress& resVarAddr, double& meanValue);
void mobileVolumeWeightedMean(size_t scalarResultIndex, size_t timeStepIndex, double& meanValue); void mobileVolumeWeightedMean(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& meanValue);
// Access meta-information about the results // Access meta-information about the results
size_t resultCount() const; size_t resultCount() const;
size_t timeStepCount(size_t scalarResultIndex) const; size_t timeStepCount(const RigEclipseResultAddress& resVarAddr) const;
size_t maxTimeStepCount(size_t* scalarResultIndex = nullptr) const; size_t maxTimeStepCount(size_t* scalarResultIndex = nullptr) const;
QStringList resultNames(RiaDefines::ResultCatType type) const; QStringList resultNames(RiaDefines::ResultCatType type) const;
bool isUsingGlobalActiveIndex(size_t scalarResultIndex) const; bool isUsingGlobalActiveIndex(const RigEclipseResultAddress& resVarAddr) const;
bool hasFlowDiagUsableFluxes() const; bool hasFlowDiagUsableFluxes() const;
std::vector<QDateTime> allTimeStepDatesFromEclipseReader() const; std::vector<QDateTime> allTimeStepDatesFromEclipseReader() const;
std::vector<QDateTime> timeStepDates() const; std::vector<QDateTime> timeStepDates() const;
std::vector<QDateTime> timeStepDates(size_t scalarResultIndex) const; std::vector<QDateTime> timeStepDates(const RigEclipseResultAddress& resVarAddr) const;
std::vector<double> daysSinceSimulationStart() const; std::vector<double> daysSinceSimulationStart() const;
std::vector<double> daysSinceSimulationStart(size_t scalarResultIndex) const; std::vector<double> daysSinceSimulationStart(const RigEclipseResultAddress& resVarAddr) const;
int reportStepNumber(size_t scalarResultIndex, size_t timeStepIndex) const; int reportStepNumber(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex) const;
std::vector<RigEclipseTimeStepInfo> timeStepInfos(size_t scalarResultIndex) const; std::vector<RigEclipseTimeStepInfo> timeStepInfos(const RigEclipseResultAddress& resVarAddr) const;
void setTimeStepInfos(size_t scalarResultIndex, const std::vector<RigEclipseTimeStepInfo>& timeStepInfos); void setTimeStepInfos(const RigEclipseResultAddress& resVarAddr, const std::vector<RigEclipseTimeStepInfo>& timeStepInfos);
size_t findOrLoadScalarResultForTimeStep(RiaDefines::ResultCatType type, const QString& resultName, size_t timeStepIndex); size_t findOrLoadScalarResultForTimeStep(RiaDefines::ResultCatType type, const QString& resultName, size_t timeStepIndex);
size_t findOrLoadScalarResult(RiaDefines::ResultCatType type, const QString& resultName); size_t findOrLoadScalarResult(RiaDefines::ResultCatType type, const QString& resultName);
@ -113,9 +145,10 @@ public:
// Access the results data // Access the results data
const std::vector< std::vector<double> > & cellScalarResults(size_t scalarResultIndex) const; const std::vector< std::vector<double> > & cellScalarResults(const RigEclipseResultAddress& resVarAddr) const;
std::vector< std::vector<double> > & cellScalarResults(size_t scalarResultIndex); std::vector< std::vector<double> > & cellScalarResults(const RigEclipseResultAddress& resVarAddr);
std::vector<double>& cellScalarResults(size_t scalarResultIndex, size_t timeStepIndex); const std::vector<double>& cellScalarResults(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex) const;
std::vector<double>& cellScalarResults(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex);
bool updateResultName(RiaDefines::ResultCatType resultType, QString& oldName, const QString& newName); bool updateResultName(RiaDefines::ResultCatType resultType, QString& oldName, const QString& newName);
@ -167,7 +200,7 @@ private: // from RimReservoirCellResultsStorage
private: private:
std::vector< std::vector< std::vector<double> > > m_cellScalarResults; ///< Scalar results on the complete reservoir for each Result index (ResultVariable) and timestep std::vector< std::vector< std::vector<double> > > m_cellScalarResults; ///< Scalar results on the complete reservoir for each Result index (ResultVariable) and timestep
cvf::Collection<RigStatisticsDataCache> m_statisticsDataCache; cvf::Collection<RigStatisticsDataCache> m_statisticsDataCache;
RigStatisticsDataCache* statistics(const RigEclipseResultAddress& resVarAddr);
private: private:
std::vector<RigEclipseResultInfo> m_resultInfos; std::vector<RigEclipseResultInfo> m_resultInfos;

View File

@ -683,7 +683,7 @@ void RigEclipseCaseData::setActiveFormationNames(RigFormationNames* activeFormat
false, false,
totalGlobCellCount); totalGlobCellCount);
std::vector<double>& fnData = m_matrixModelResults->cellScalarResults(resIndex,0); std::vector<double>& fnData = m_matrixModelResults->cellScalarResults(RigEclipseResultAddress(resIndex),0);
if (m_activeFormationNamesData.isNull()) if (m_activeFormationNamesData.isNull())
{ {
@ -790,7 +790,7 @@ const std::vector<double>* RigEclipseCaseData::resultValues(RiaDefines::Porosity
const std::vector<double>* swatResults = nullptr; const std::vector<double>* swatResults = nullptr;
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T) if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{ {
swatResults = &(gridCellResults->cellScalarResults(scalarResultIndex, timeStepIndex)); swatResults = &(gridCellResults->cellScalarResults(RigEclipseResultAddress(scalarResultIndex), timeStepIndex));
} }
return swatResults; return swatResults;

View File

@ -93,7 +93,7 @@ void RigEclipseNativeStatCalc::valueSumAndSampleCount(size_t timeStepIndex, doub
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
size_t RigEclipseNativeStatCalc::timeStepCount() size_t RigEclipseNativeStatCalc::timeStepCount()
{ {
return m_resultsData->timeStepCount(m_scalarResultIndex); return m_resultsData->timeStepCount(RigEclipseResultAddress(m_scalarResultIndex));
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -110,10 +110,10 @@ void RigEclipseNativeStatCalc::mobileVolumeWeightedMean(size_t timeStepIndex, do
return; return;
} }
const std::vector<double>& weights = m_resultsData->cellScalarResults(mobPVResultIndex, 0); const std::vector<double>& weights = m_resultsData->cellScalarResults(RigEclipseResultAddress(mobPVResultIndex), 0);
const std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex); const std::vector<double>& values = m_resultsData->cellScalarResults(RigEclipseResultAddress(m_scalarResultIndex), timeStepIndex);
const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo(); const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo();
RigWeightedMeanCalc::weightedMeanOverCells(&weights, &values, nullptr, false, actCellInfo, m_resultsData->isUsingGlobalActiveIndex(m_scalarResultIndex), &mean); RigWeightedMeanCalc::weightedMeanOverCells(&weights, &values, nullptr, false, actCellInfo, m_resultsData->isUsingGlobalActiveIndex(RigEclipseResultAddress(m_scalarResultIndex)), &mean);
} }

View File

@ -50,12 +50,12 @@ private:
template <typename StatisticsAccumulator> template <typename StatisticsAccumulator>
void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex) void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex)
{ {
if (timeStepIndex >= m_resultsData->cellScalarResults(m_scalarResultIndex).size()) if (timeStepIndex >= m_resultsData->cellScalarResults(RigEclipseResultAddress(m_scalarResultIndex)).size())
{ {
return; return;
} }
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex); std::vector<double>& values = m_resultsData->cellScalarResults(RigEclipseResultAddress(m_scalarResultIndex), timeStepIndex);
if (values.empty()) if (values.empty())
{ {
@ -72,7 +72,7 @@ private:
if (!actCellInfo->isActive(cIdx)) continue; if (!actCellInfo->isActive(cIdx)) continue;
size_t cellResultIndex = cIdx; size_t cellResultIndex = cIdx;
if (m_resultsData->isUsingGlobalActiveIndex(m_scalarResultIndex)) if (m_resultsData->isUsingGlobalActiveIndex(RigEclipseResultAddress(m_scalarResultIndex)))
{ {
cellResultIndex = actCellInfo->cellResultIndex(cIdx); cellResultIndex = actCellInfo->cellResultIndex(cIdx);
} }

View File

@ -31,10 +31,10 @@
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigEclipseNativeVisibleCellsStatCalc::RigEclipseNativeVisibleCellsStatCalc(RigCaseCellResultsData* cellResultsData, RigEclipseNativeVisibleCellsStatCalc::RigEclipseNativeVisibleCellsStatCalc(RigCaseCellResultsData* cellResultsData,
size_t scalarResultIndex, const RigEclipseResultAddress& scalarResultIndex,
const cvf::UByteArray* cellVisibilities) const cvf::UByteArray* cellVisibilities)
: m_caseData(cellResultsData), : m_caseData(cellResultsData),
m_scalarResultIndex(scalarResultIndex), m_resultAddress(scalarResultIndex),
m_cellVisibilities(cellVisibilities) m_cellVisibilities(cellVisibilities)
{ {
@ -97,7 +97,7 @@ void RigEclipseNativeVisibleCellsStatCalc::uniqueValues(size_t timeStepIndex, st
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
size_t RigEclipseNativeVisibleCellsStatCalc::timeStepCount() size_t RigEclipseNativeVisibleCellsStatCalc::timeStepCount()
{ {
return m_caseData->timeStepCount(m_scalarResultIndex); return m_caseData->timeStepCount(m_resultAddress);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -107,11 +107,11 @@ void RigEclipseNativeVisibleCellsStatCalc::mobileVolumeWeightedMean(size_t timeS
{ {
size_t mobPVResultIndex = m_caseData->findOrLoadScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName()); size_t mobPVResultIndex = m_caseData->findOrLoadScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName());
const std::vector<double>& weights = m_caseData->cellScalarResults(mobPVResultIndex)[0]; const std::vector<double>& weights = m_caseData->cellScalarResults(RigEclipseResultAddress(mobPVResultIndex), 0);
const std::vector<double>& values = m_caseData->cellScalarResults(m_scalarResultIndex, timeStepIndex); const std::vector<double>& values = m_caseData->cellScalarResults(m_resultAddress, timeStepIndex);
const RigActiveCellInfo* actCellInfo = m_caseData->activeCellInfo(); const RigActiveCellInfo* actCellInfo = m_caseData->activeCellInfo();
RigWeightedMeanCalc::weightedMeanOverCells(&weights, &values, m_cellVisibilities.p(), true, actCellInfo, m_caseData->isUsingGlobalActiveIndex(m_scalarResultIndex), &result); RigWeightedMeanCalc::weightedMeanOverCells(&weights, &values, m_cellVisibilities.p(), true, actCellInfo, m_caseData->isUsingGlobalActiveIndex(m_resultAddress), &result);
} }

View File

@ -36,7 +36,7 @@ class RigEclipseNativeVisibleCellsStatCalc : public RigStatisticsCalculator
{ {
public: public:
RigEclipseNativeVisibleCellsStatCalc(RigCaseCellResultsData* cellResultsData, RigEclipseNativeVisibleCellsStatCalc(RigCaseCellResultsData* cellResultsData,
size_t scalarResultIndex, const RigEclipseResultAddress& scalarResultIndex,
const cvf::UByteArray* cellVisibilities); const cvf::UByteArray* cellVisibilities);
void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) override; void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) override;
@ -50,13 +50,13 @@ public:
private: private:
RigCaseCellResultsData* m_caseData; RigCaseCellResultsData* m_caseData;
size_t m_scalarResultIndex; RigEclipseResultAddress m_resultAddress;
cvf::cref<cvf::UByteArray> m_cellVisibilities; cvf::cref<cvf::UByteArray> m_cellVisibilities;
template <typename StatisticsAccumulator> template <typename StatisticsAccumulator>
void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex) void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex)
{ {
std::vector<double>& values = m_caseData->cellScalarResults(m_scalarResultIndex, timeStepIndex); std::vector<double>& values = m_caseData->cellScalarResults(m_resultAddress, timeStepIndex);
if (values.empty()) if (values.empty())
{ {
@ -74,7 +74,7 @@ private:
if (!(*m_cellVisibilities)[cIdx]) continue; if (!(*m_cellVisibilities)[cIdx]) continue;
size_t cellResultIndex = cIdx; size_t cellResultIndex = cIdx;
if (m_caseData->isUsingGlobalActiveIndex(m_scalarResultIndex)) if (m_caseData->isUsingGlobalActiveIndex(m_resultAddress))
{ {
cellResultIndex = actCellInfo->cellResultIndex(cIdx); cellResultIndex = actCellInfo->cellResultIndex(cIdx);
} }

View File

@ -324,7 +324,7 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
size_t resultIndexWithMaxTimeSteps = cvf::UNDEFINED_SIZE_T; size_t resultIndexWithMaxTimeSteps = cvf::UNDEFINED_SIZE_T;
m_eclipseCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->maxTimeStepCount(&resultIndexWithMaxTimeSteps); m_eclipseCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->maxTimeStepCount(&resultIndexWithMaxTimeSteps);
int reportStepNumber = m_eclipseCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->reportStepNumber(resultIndexWithMaxTimeSteps, timeStepIndex); int reportStepNumber = m_eclipseCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->reportStepNumber(RigEclipseResultAddress(resultIndexWithMaxTimeSteps), timeStepIndex);
if ( !currentRestartData->selectReportStep(reportStepNumber) ) if ( !currentRestartData->selectReportStep(reportStepNumber) )
{ {

View File

@ -122,7 +122,7 @@ void RigFlowDiagStatCalc::mobileVolumeWeightedMean(size_t timeStepIndex, double&
size_t mobPVResultIndex = caseCellResultsData->findOrLoadScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName()); size_t mobPVResultIndex = caseCellResultsData->findOrLoadScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName());
const std::vector<double>& weights = caseCellResultsData->cellScalarResults(mobPVResultIndex, 0); const std::vector<double>& weights = caseCellResultsData->cellScalarResults(RigEclipseResultAddress(mobPVResultIndex), 0);
const std::vector<double>* values = m_resultsData->resultValues(m_resVarAddr, timeStepIndex); const std::vector<double>* values = m_resultsData->resultValues(m_resVarAddr, timeStepIndex);
const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo(m_resVarAddr); const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo(m_resVarAddr);

View File

@ -111,7 +111,7 @@ void RigFlowDiagVisibleCellsStatCalc::mobileVolumeWeightedMean(size_t timeStepIn
size_t mobPVResultIndex = caseCellResultsData->findOrLoadScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName()); size_t mobPVResultIndex = caseCellResultsData->findOrLoadScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName());
const std::vector<double>& weights = caseCellResultsData->cellScalarResults(mobPVResultIndex, 0); const std::vector<double>& weights = caseCellResultsData->cellScalarResults(RigEclipseResultAddress(mobPVResultIndex), 0);
const std::vector<double>* values = m_resultsData->resultValues(m_resVarAddr, timeStepIndex); const std::vector<double>* values = m_resultsData->resultValues(m_resVarAddr, timeStepIndex);
const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo(m_resVarAddr); const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo(m_resVarAddr);

View File

@ -109,7 +109,7 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator
const std::vector<double>* flowrateI = nullptr; const std::vector<double>* flowrateI = nullptr;
if (scalarResultIndexFlowrateI != cvf::UNDEFINED_SIZE_T) if (scalarResultIndexFlowrateI != cvf::UNDEFINED_SIZE_T)
{ {
flowrateI = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(scalarResultIndexFlowrateI, flowrateI = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(scalarResultIndexFlowrateI),
timeStep)); timeStep));
} }
flowrateIatAllTimeSteps.push_back(flowrateI); flowrateIatAllTimeSteps.push_back(flowrateI);
@ -118,7 +118,7 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator
const std::vector<double>* flowrateJ = nullptr; const std::vector<double>* flowrateJ = nullptr;
if (scalarResultIndexFlowrateJ != cvf::UNDEFINED_SIZE_T) if (scalarResultIndexFlowrateJ != cvf::UNDEFINED_SIZE_T)
{ {
flowrateJ = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(scalarResultIndexFlowrateJ, flowrateJ = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(scalarResultIndexFlowrateJ),
timeStep)); timeStep));
} }
flowrateJatAllTimeSteps.push_back(flowrateJ); flowrateJatAllTimeSteps.push_back(flowrateJ);
@ -127,7 +127,7 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator
const std::vector<double>* flowrateK = nullptr; const std::vector<double>* flowrateK = nullptr;
if (scalarResultIndexFlowrateK != cvf::UNDEFINED_SIZE_T) if (scalarResultIndexFlowrateK != cvf::UNDEFINED_SIZE_T)
{ {
flowrateK = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(scalarResultIndexFlowrateK, flowrateK = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(scalarResultIndexFlowrateK),
timeStep)); timeStep));
} }
flowrateKatAllTimeSteps.push_back(flowrateK); flowrateKatAllTimeSteps.push_back(flowrateK);
@ -144,7 +144,7 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator
{ {
if (tracerIndex != cvf::UNDEFINED_SIZE_T) if (tracerIndex != cvf::UNDEFINED_SIZE_T)
{ {
const std::vector<double>* tracerResult = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(tracerIndex, timeStep)); const std::vector<double>* tracerResult = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(tracerIndex), timeStep));
for (size_t i = 0; i < summedTracerValues.size(); i++) for (size_t i = 0; i < summedTracerValues.size(); i++)
{ {

View File

@ -91,7 +91,7 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromNameAndType(cons
adjustedTimeStepIndex = 0; adjustedTimeStepIndex = 0;
} }
return createFromResultIdx(eclipseCase, gridIndex, porosityModel, adjustedTimeStepIndex, scalarSetIndex); return createFromResultIdx(eclipseCase, gridIndex, porosityModel, adjustedTimeStepIndex, RigEclipseResultAddress(scalarSetIndex));
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -154,7 +154,7 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createNativeFromUiResultNa
return nullptr; return nullptr;
} }
return createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, scalarSetIndex); return createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(scalarSetIndex));
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -306,9 +306,9 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultIdx(const
size_t gridIndex, size_t gridIndex,
RiaDefines::PorosityModelType porosityModel, RiaDefines::PorosityModelType porosityModel,
size_t timeStepIndex, size_t timeStepIndex,
size_t resultIndex) const RigEclipseResultAddress& resultIndex)
{ {
if ( resultIndex == cvf::UNDEFINED_SIZE_T ) if ( !resultIndex.isValid() )
{ {
return new RigHugeValResultAccessor; return new RigHugeValResultAccessor;
} }
@ -318,7 +318,7 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultIdx(const
const RigGridBase* grid = eclipseCase->grid(gridIndex); const RigGridBase* grid = eclipseCase->grid(gridIndex);
if (!grid) return nullptr; if (!grid) return nullptr;
const std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(resultIndex); const std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(RigEclipseResultAddress(resultIndex));
if (timeStepIndex >= scalarSetResults.size()) if (timeStepIndex >= scalarSetResults.size())
{ {
@ -336,7 +336,7 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultIdx(const
return new RigHugeValResultAccessor; return new RigHugeValResultAccessor;
} }
bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(resultIndex); bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(RigEclipseResultAddress(resultIndex));
if (useGlobalActiveIndex) if (useGlobalActiveIndex)
{ {
cvf::ref<RigResultAccessor> object = new RigActiveCellsResultAccessor(grid, resultValues, eclipseCase->activeCellInfo(porosityModel)); cvf::ref<RigResultAccessor> object = new RigActiveCellsResultAccessor(grid, resultValues, eclipseCase->activeCellInfo(porosityModel));

View File

@ -28,6 +28,7 @@ class RigActiveCellInfo;
class RigGridBase; class RigGridBase;
class RimEclipseResultDefinition; class RimEclipseResultDefinition;
class RigEclipseResultAddress;
class RigResultAccessorFactory class RigResultAccessorFactory
{ {
@ -58,7 +59,7 @@ public:
size_t gridIndex, size_t gridIndex,
RiaDefines::PorosityModelType porosityModel, RiaDefines::PorosityModelType porosityModel,
size_t timeStepIndex, size_t timeStepIndex,
size_t resultIndex); const RigEclipseResultAddress& resultIndex);

View File

@ -74,7 +74,7 @@ cvf::ref<RigResultModifier> RigResultModifierFactory::createResultModifier(RigEc
return nullptr; return nullptr;
} }
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(scalarResultIndex); std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(RigEclipseResultAddress(scalarResultIndex));
if (timeStepIndex >= scalarSetResults.size()) if (timeStepIndex >= scalarSetResults.size())
{ {
@ -87,7 +87,7 @@ cvf::ref<RigResultModifier> RigResultModifierFactory::createResultModifier(RigEc
resultValues = &(scalarSetResults[timeStepIndex]); resultValues = &(scalarSetResults[timeStepIndex]);
} }
bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(scalarResultIndex); bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(RigEclipseResultAddress(scalarResultIndex));
if (useGlobalActiveIndex) if (useGlobalActiveIndex)
{ {
cvf::ref<RigResultModifier> object = new RigActiveCellsResultModifier(grid, eclipseCase->activeCellInfo(porosityModel), resultValues); cvf::ref<RigResultModifier> object = new RigActiveCellsResultModifier(grid, eclipseCase->activeCellInfo(porosityModel), resultValues);

View File

@ -441,7 +441,7 @@ public:
return true; return true;
} }
std::vector<QDateTime> timeStepDates = rimCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->timeStepDates(scalarIndexWithMaxTimeStepCount); std::vector<QDateTime> timeStepDates = rimCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->timeStepDates(RigEclipseResultAddress(scalarIndexWithMaxTimeStepCount));
quint64 timeStepCount = timeStepDates.size(); quint64 timeStepCount = timeStepDates.size();
quint64 byteCount = sizeof(quint64) + 6 * timeStepCount * sizeof(qint32); quint64 byteCount = sizeof(quint64) + 6 * timeStepCount * sizeof(qint32);
@ -528,7 +528,7 @@ public:
return true; return true;
} }
std::vector<double> daysSinceSimulationStart = rimCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->daysSinceSimulationStart(scalarIndexWithMaxTimeStepCount); std::vector<double> daysSinceSimulationStart = rimCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->daysSinceSimulationStart(RigEclipseResultAddress(scalarIndexWithMaxTimeStepCount));
quint64 timeStepCount = daysSinceSimulationStart.size(); quint64 timeStepCount = daysSinceSimulationStart.size();
quint64 byteCount = sizeof(quint64) + timeStepCount * sizeof(qint32); quint64 byteCount = sizeof(quint64) + timeStepCount * sizeof(qint32);

View File

@ -434,7 +434,7 @@ public:
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T) if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{ {
std::vector< std::vector<double> >* scalarResultFrames = nullptr; std::vector< std::vector<double> >* scalarResultFrames = nullptr;
scalarResultFrames = &(results->cellScalarResults(scalarResultIndex)); scalarResultFrames = &(results->cellScalarResults(RigEclipseResultAddress(scalarResultIndex)));
size_t timeStepCount = results->maxTimeStepCount(); size_t timeStepCount = results->maxTimeStepCount();
scalarResultFrames->resize(timeStepCount); scalarResultFrames->resize(timeStepCount);
return true; return true;
@ -538,7 +538,7 @@ public:
m_currentReservoir->eclipseCaseData() && m_currentReservoir->eclipseCaseData() &&
m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum) ) m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum) )
{ {
m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum)->recalculateStatistics(m_currentScalarIndex); m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum)->recalculateStatistics(RigEclipseResultAddress(m_currentScalarIndex));
} }
for (size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i) for (size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i)

View File

@ -82,7 +82,7 @@ public:
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T) if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{ {
scalarResultFrames = &(rimCase->results(porosityModelEnum)->cellScalarResults(scalarResultIndex)); scalarResultFrames = &(rimCase->results(porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(scalarResultIndex)));
} }
} }
@ -278,7 +278,7 @@ public:
if (args.size() <= 5) if (args.size() <= 5)
{ {
// Select all // Select all
for (size_t tsIdx = 0; tsIdx < rimCase->results(porosityModelEnum)->timeStepCount(scalarResultIndex); ++tsIdx) for (size_t tsIdx = 0; tsIdx < rimCase->results(porosityModelEnum)->timeStepCount(RigEclipseResultAddress(scalarResultIndex)); ++tsIdx)
{ {
requestedTimesteps.push_back(tsIdx); requestedTimesteps.push_back(tsIdx);
} }
@ -421,13 +421,13 @@ public:
size_t scalarResWithMostTimeSteps = cvf::UNDEFINED_SIZE_T; size_t scalarResWithMostTimeSteps = cvf::UNDEFINED_SIZE_T;
rimCase->results(m_porosityModelEnum)->maxTimeStepCount(&scalarResWithMostTimeSteps); rimCase->results(m_porosityModelEnum)->maxTimeStepCount(&scalarResWithMostTimeSteps);
const std::vector<RigEclipseTimeStepInfo> timeStepInfos = rimCase->results(m_porosityModelEnum)->timeStepInfos(scalarResWithMostTimeSteps); const std::vector<RigEclipseTimeStepInfo> timeStepInfos = rimCase->results(m_porosityModelEnum)->timeStepInfos(RigEclipseResultAddress(scalarResWithMostTimeSteps));
rimCase->results(m_porosityModelEnum)->setTimeStepInfos(scalarResultIndex, timeStepInfos); rimCase->results(m_porosityModelEnum)->setTimeStepInfos(RigEclipseResultAddress(scalarResultIndex), timeStepInfos);
} }
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T) if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{ {
scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->cellScalarResults(scalarResultIndex)); scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(scalarResultIndex)));
size_t timeStepCount = rimCase->results(m_porosityModelEnum)->maxTimeStepCount(); size_t timeStepCount = rimCase->results(m_porosityModelEnum)->maxTimeStepCount();
scalarResultFrames->resize(timeStepCount); scalarResultFrames->resize(timeStepCount);
@ -662,7 +662,7 @@ public:
if (m_requestedTimesteps.size() == 1 && m_currentScalarIndex != cvf::UNDEFINED_SIZE_T) if (m_requestedTimesteps.size() == 1 && m_currentScalarIndex != cvf::UNDEFINED_SIZE_T)
{ {
std::vector< std::vector<double> >* scalarResultFrames = nullptr; std::vector< std::vector<double> >* scalarResultFrames = nullptr;
scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->cellScalarResults(m_currentScalarIndex)); scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(m_currentScalarIndex)));
size_t lastIndexWithDataPresent = cvf::UNDEFINED_SIZE_T; size_t lastIndexWithDataPresent = cvf::UNDEFINED_SIZE_T;
for (size_t i = 0; i < scalarResultFrames->size(); i++) for (size_t i = 0; i < scalarResultFrames->size(); i++)
{ {
@ -678,7 +678,7 @@ public:
} }
} }
m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum)->recalculateStatistics(m_currentScalarIndex); m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum)->recalculateStatistics(RigEclipseResultAddress(m_currentScalarIndex));
} }
for (size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i) for (size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i)
@ -816,7 +816,7 @@ public:
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T) if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{ {
scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->cellScalarResults(scalarResultIndex)); scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(scalarResultIndex)));
size_t timeStepCount = rimCase->results(m_porosityModelEnum)->maxTimeStepCount(); size_t timeStepCount = rimCase->results(m_porosityModelEnum)->maxTimeStepCount();
scalarResultFrames->resize(timeStepCount); scalarResultFrames->resize(timeStepCount);
@ -1026,7 +1026,7 @@ public:
if (m_requestedTimesteps.size() == 1 && m_currentScalarIndex != cvf::UNDEFINED_SIZE_T) if (m_requestedTimesteps.size() == 1 && m_currentScalarIndex != cvf::UNDEFINED_SIZE_T)
{ {
std::vector< std::vector<double> >* scalarResultFrames = nullptr; std::vector< std::vector<double> >* scalarResultFrames = nullptr;
scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->cellScalarResults(m_currentScalarIndex)); scalarResultFrames = &(m_currentReservoir->results(m_porosityModelEnum)->cellScalarResults(RigEclipseResultAddress(m_currentScalarIndex)));
size_t lastIndexWithDataPresent = cvf::UNDEFINED_SIZE_T; size_t lastIndexWithDataPresent = cvf::UNDEFINED_SIZE_T;
for (size_t i = 0; i < scalarResultFrames->size(); i++) for (size_t i = 0; i < scalarResultFrames->size(); i++)
{ {
@ -1042,7 +1042,7 @@ public:
} }
} }
m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum)->recalculateStatistics(m_currentScalarIndex); m_currentReservoir->eclipseCaseData()->results(m_porosityModelEnum)->recalculateStatistics(RigEclipseResultAddress(m_currentScalarIndex));
} }
for (size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i) for (size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i)
@ -1208,7 +1208,7 @@ public:
if (args.size() < 5) if (args.size() < 5)
{ {
// Select all // Select all
for (size_t tsIdx = 0; tsIdx < rimCase->results(porosityModel)->timeStepCount(scalarResultIndex); ++tsIdx) for (size_t tsIdx = 0; tsIdx < rimCase->results(porosityModel)->timeStepCount(RigEclipseResultAddress(scalarResultIndex)); ++tsIdx)
{ {
requestedTimesteps.push_back(tsIdx); requestedTimesteps.push_back(tsIdx);
} }

View File

@ -424,19 +424,19 @@ QString RiuResultTextBuilder::nncResultText()
if (m_reservoirView->currentFaultResultColors()) if (m_reservoirView->currentFaultResultColors())
{ {
size_t scalarResultIdx = m_reservoirView->currentFaultResultColors()->scalarResultIndex(); RigEclipseResultAddress scalarResultIdx = m_reservoirView->currentFaultResultColors()->scalarResultIndex();
RiaDefines::ResultCatType resultType = m_reservoirView->currentFaultResultColors()->resultType(); RiaDefines::ResultCatType resultType = m_reservoirView->currentFaultResultColors()->resultType();
const std::vector<double>* nncValues = nullptr; const std::vector<double>* nncValues = nullptr;
if (resultType == RiaDefines::STATIC_NATIVE) if (resultType == RiaDefines::STATIC_NATIVE)
{ {
nncValues = nncData->staticConnectionScalarResult(scalarResultIdx); nncValues = nncData->staticConnectionScalarResult(scalarResultIdx.scalarResultIndex);
} }
else if (resultType == RiaDefines::DYNAMIC_NATIVE) else if (resultType == RiaDefines::DYNAMIC_NATIVE)
{ {
if (m_reservoirView.notNull() && m_reservoirView->eclipseCase()) if (m_reservoirView.notNull() && m_reservoirView->eclipseCase())
{ {
size_t nativeTimeStep = m_reservoirView->eclipseCase()->uiToNativeTimeStepIndex(m_timeStepIndex); size_t nativeTimeStep = m_reservoirView->eclipseCase()->uiToNativeTimeStepIndex(m_timeStepIndex);
nncValues = nncData->dynamicConnectionScalarResult(scalarResultIdx, nativeTimeStep); nncValues = nncData->dynamicConnectionScalarResult(scalarResultIdx.scalarResultIndex, nativeTimeStep);
} }
} }
if (nncValues && (m_nncIndex < nncValues->size())) if (nncValues && (m_nncIndex < nncValues->size()))
@ -474,9 +474,9 @@ void RiuResultTextBuilder::appendTextFromResultColors(RigEclipseCaseData* eclips
size_t sgasScalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS"); size_t sgasScalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS");
size_t swatScalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT"); size_t swatScalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT");
cvf::ref<RigResultAccessor> dataAccessObjectX = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, soilScalarSetIndex); cvf::ref<RigResultAccessor> dataAccessObjectX = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(soilScalarSetIndex));
cvf::ref<RigResultAccessor> dataAccessObjectY = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, sgasScalarSetIndex); cvf::ref<RigResultAccessor> dataAccessObjectY = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(sgasScalarSetIndex));
cvf::ref<RigResultAccessor> dataAccessObjectZ = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, swatScalarSetIndex); cvf::ref<RigResultAccessor> dataAccessObjectZ = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(swatScalarSetIndex));
double scalarValue = 0.0; double scalarValue = 0.0;
@ -616,7 +616,7 @@ QString RiuResultTextBuilder::cellEdgeResultDetails()
for (int idx = 0; idx < 6; idx++) for (int idx = 0; idx < 6; idx++)
{ {
size_t resultIndex = metaData[idx].m_resultIndex; size_t resultIndex = metaData[idx].m_resultIndex.scalarResultIndex;
if (resultIndex == cvf::UNDEFINED_SIZE_T) continue; if (resultIndex == cvf::UNDEFINED_SIZE_T) continue;
if (uniqueResultIndices.find(resultIndex) != uniqueResultIndices.end()) continue; if (uniqueResultIndices.find(resultIndex) != uniqueResultIndices.end()) continue;
@ -628,7 +628,7 @@ QString RiuResultTextBuilder::cellEdgeResultDetails()
} }
RiaDefines::PorosityModelType porosityModel = m_reservoirView->cellResult()->porosityModel(); RiaDefines::PorosityModelType porosityModel = m_reservoirView->cellResult()->porosityModel();
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultIdx(m_reservoirView->eclipseCase()->eclipseCaseData(), m_gridIndex, porosityModel, adjustedTimeStep, resultIndex); cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultIdx(m_reservoirView->eclipseCase()->eclipseCaseData(), m_gridIndex, porosityModel, adjustedTimeStep, RigEclipseResultAddress(resultIndex));
if (resultAccessor.notNull()) if (resultAccessor.notNull())
{ {
double scalarValue = resultAccessor->cellScalar(m_cellIndex); double scalarValue = resultAccessor->cellScalar(m_cellIndex);
@ -755,9 +755,9 @@ QString RiuResultTextBuilder::cellResultText(RimEclipseCellColors* resultColors)
RiaDefines::PorosityModelType porosityModel = resultColors->porosityModel(); RiaDefines::PorosityModelType porosityModel = resultColors->porosityModel();
cvf::ref<RigResultAccessor> dataAccessObjectX = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, soilScalarSetIndex); cvf::ref<RigResultAccessor> dataAccessObjectX = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress(soilScalarSetIndex));
cvf::ref<RigResultAccessor> dataAccessObjectY = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, sgasScalarSetIndex); cvf::ref<RigResultAccessor> dataAccessObjectY = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress(sgasScalarSetIndex));
cvf::ref<RigResultAccessor> dataAccessObjectZ = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, swatScalarSetIndex); cvf::ref<RigResultAccessor> dataAccessObjectZ = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress(swatScalarSetIndex));
double scalarValue = 0.0; double scalarValue = 0.0;