From ccfee8f34a5e2fc02459598aa447a857e0e7ac71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Tue, 22 Jan 2019 08:54:00 +0100 Subject: [PATCH] #3958 Starting refactoring of eclipse results addressing Preparations for time diff results --- .../RicExportFractureCompletionsImpl.cpp | 2 +- .../RifEclipseInputFileTools.cpp | 2 +- .../FileInterface/RifReaderEclipseOutput.cpp | 10 +- .../FileInterface/RifReaderMockModel.cpp | 10 +- .../RigFemPartResultsCollection.h | 4 +- .../RivCellEdgeGeometryUtils.cpp | 2 +- .../ModelVisualization/RivFaultPartMgr.cpp | 8 +- .../RivReservoirFaultsPartMgr.cpp | 4 +- .../Flow/RimWellPlotTools.cpp | 2 +- .../Rim3dOverlayInfoConfig.cpp | 34 +- .../ProjectDataModel/RimCellEdgeColors.cpp | 22 +- .../ProjectDataModel/RimCellEdgeColors.h | 8 +- .../ProjectDataModel/RimEclipseCellColors.cpp | 13 +- .../RimEclipseContourMapProjection.cpp | 6 +- .../RimEclipsePropertyFilter.cpp | 4 +- .../RimEclipseResultDefinition.cpp | 10 +- .../RimEclipseResultDefinition.h | 4 +- .../RimEclipseStatisticsCaseEvaluator.cpp | 6 +- .../RimIdenticalGridCaseGroup.cpp | 6 +- .../RimReservoirCellResultsStorage.cpp | 8 +- .../RigCaseCellResultsData.cpp | 304 ++++++++++-------- .../RigCaseCellResultsData.h | 87 +++-- .../ReservoirDataModel/RigEclipseCaseData.cpp | 4 +- .../RigEclipseNativeStatCalc.cpp | 8 +- .../RigEclipseNativeStatCalc.h | 6 +- .../RigEclipseNativeVisibleCellsStatCalc.cpp | 12 +- .../RigEclipseNativeVisibleCellsStatCalc.h | 8 +- .../RigFlowDiagSolverInterface.cpp | 2 +- .../RigFlowDiagStatCalc.cpp | 2 +- .../RigFlowDiagVisibleCellsStatCalc.cpp | 2 +- ...igNumberOfFloodedPoreVolumesCalculator.cpp | 8 +- .../RigResultAccessorFactory.cpp | 12 +- .../RigResultAccessorFactory.h | 3 +- .../RigResultModifierFactory.cpp | 4 +- .../SocketInterface/RiaCaseInfoCommands.cpp | 4 +- .../SocketInterface/RiaNNCCommands.cpp | 4 +- .../RiaPropertyDataCommands.cpp | 22 +- .../UserInterface/RiuResultTextBuilder.cpp | 22 +- 38 files changed, 369 insertions(+), 310 deletions(-) diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp index 04c91e4103..44216d14ad 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp @@ -262,7 +262,7 @@ std::vector RicExportFractureCompletionsImpl::generateCompdat const std::vector* currentMatrixPressures = nullptr; if (performPressureDepletionScaling) { - pressureResultVector = &results->cellScalarResults(pressureResultIndex); + pressureResultVector = &results->cellScalarResults(RigEclipseResultAddress(pressureResultIndex)); CVF_ASSERT(!pressureResultVector->empty()); if (pdParams.pressureScalingTimeStep < static_cast(pressureResultVector->size())) diff --git a/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp b/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp index 1264ece4b6..be138506e5 100644 --- a/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp @@ -321,7 +321,7 @@ bool RifEclipseInputFileTools::readDataFromKeyword(ecl_kw_type* eclipseKeywordDa size_t resultIndex = RifEclipseInputFileTools::findOrCreateResult(resultName, caseData); if (resultIndex == cvf::UNDEFINED_SIZE_T) return false; - std::vector< std::vector >& newPropertyData = caseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(resultIndex); + std::vector< std::vector >& newPropertyData = caseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(resultIndex)); newPropertyData.push_back(std::vector()); newPropertyData[0].resize(ecl_kw_get_size(eclipseKeywordData), HUGE_VAL); ecl_kw_get_data_as_double(eclipseKeywordData, newPropertyData[0].data()); diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 271e7f89bb..d6c2371f34 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -576,7 +576,7 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName) for (int i = 0; i < resultNames.size(); ++i) { size_t resIndex = matrixModelResults->findOrCreateScalarResultIndex(RiaDefines::SOURSIMRL, resultNames[i], false); - matrixModelResults->setTimeStepInfos(resIndex, timeStepInfos); + matrixModelResults->setTimeStepInfos(RigEclipseResultAddress(resIndex), timeStepInfos); } m_hdfReaderInterface = std::move(hdf5ReaderInterface); @@ -856,7 +856,7 @@ void RifReaderEclipseOutput::buildMetaData(ecl_grid_type* grid) for (int i = 0; i < matrixResultNames.size(); ++i) { 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) { 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) { 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) { size_t resIndex = fractureModelResults->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, fractureResultNames[i], false); - fractureModelResults->setTimeStepInfos(resIndex, staticTimeStepInfo); + fractureModelResults->setTimeStepInfos(RigEclipseResultAddress(resIndex), staticTimeStepInfo); } } } diff --git a/ApplicationCode/FileInterface/RifReaderMockModel.cpp b/ApplicationCode/FileInterface/RifReaderMockModel.cpp index c46c629a51..f5505e6a09 100644 --- a/ApplicationCode/FileInterface/RifReaderMockModel.cpp +++ b/ApplicationCode/FileInterface/RifReaderMockModel.cpp @@ -54,7 +54,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip 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); - cellResults->setTimeStepInfos(resIdx, timeStepInfos); + cellResults->setTimeStepInfos(RigEclipseResultAddress(resIdx), timeStepInfos); } if (m_reservoirBuilder.timeStepCount() == 0) return true; @@ -71,7 +71,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip if (i > 1) resIndex = i; 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; \ QString resultName(Name); \ resIdx = cellResults->findOrCreateScalarResultIndex(RiaDefines::INPUT_PROPERTY, resultName, false); \ - cellResults->setTimeStepInfos(resIdx, staticResultTimeStepInfos); \ - cellResults->cellScalarResults(resIdx).resize(1); \ - std::vector& values = cellResults->cellScalarResults(resIdx)[0]; \ + cellResults->setTimeStepInfos(RigEclipseResultAddress(resIdx), staticResultTimeStepInfos); \ + cellResults->cellScalarResults(RigEclipseResultAddress(resIdx)).resize(1); \ + std::vector& values = cellResults->cellScalarResults(RigEclipseResultAddress(resIdx))[0]; \ this->inputProperty(resultName, &values); \ } diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h index afedc9b519..fdb7363b2b 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h @@ -50,7 +50,9 @@ class RigFemPartResultsCollection: public cvf::Object public: 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; void setActiveFormationNames(RigFormationNames* activeFormationNames); diff --git a/ApplicationCode/ModelVisualization/RivCellEdgeGeometryUtils.cpp b/ApplicationCode/ModelVisualization/RivCellEdgeGeometryUtils.cpp index 0b6cf69ba0..6527a5069e 100644 --- a/ApplicationCode/ModelVisualization/RivCellEdgeGeometryUtils.cpp +++ b/ApplicationCode/ModelVisualization/RivCellEdgeGeometryUtils.cpp @@ -310,7 +310,7 @@ cvf::ref RivCellEdgeGeometryUtils::createCellEdgeResultAccess } else { - size_t resultIndices[6]; + RigEclipseResultAddress resultIndices[6]; cellEdgeResultColors->gridScalarIndices(resultIndices); std::vector metaData; diff --git a/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp b/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp index 6111aa1fbb..2e0fecc935 100644 --- a/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp @@ -691,9 +691,9 @@ void RivFaultPartMgr::updateNNCColors(size_t timeStepIndex, RimEclipseCellColors 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; } @@ -702,7 +702,7 @@ void RivFaultPartMgr::updateNNCColors(size_t timeStepIndex, RimEclipseCellColors if (showNncsWithScalarMappedColor) { - size_t scalarSetIndex = cellResultColors->scalarResultIndex(); + RigEclipseResultAddress scalarSetIndex = cellResultColors->scalarResultIndex(); RiaDefines::ResultCatType resultType = cellResultColors->resultType(); const cvf::ScalarMapper* mapper = cellResultColors->legendConfig()->scalarMapper(); @@ -714,7 +714,7 @@ void RivFaultPartMgr::updateNNCColors(size_t timeStepIndex, RimEclipseCellColors { size_t nativeTimeStepIndex = eclipseCase->uiToNativeTimeStepIndex(timeStepIndex); m_NNCGenerator->textureCoordinates( - m_NNCTextureCoords.p(), mapper, resultType, scalarSetIndex, nativeTimeStepIndex); + m_NNCTextureCoords.p(), mapper, resultType, scalarSetIndex.scalarResultIndex, nativeTimeStepIndex); } } diff --git a/ApplicationCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp b/ApplicationCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp index a030ad9664..4f9f226850 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp @@ -159,7 +159,7 @@ void RivReservoirFaultsPartMgr::appendPartsToModel(cvf::ModelBasicList* model) bool showNncs = true; if (faultCollection->hideNncsWhenNoResultIsAvailable()) { - size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T; + RigEclipseResultAddress scalarResultIndex; if (faultResultColors->showCustomFaultResult()) { scalarResultIndex = faultResultColors->customFaultResult()->scalarResultIndex(); @@ -170,7 +170,7 @@ void RivReservoirFaultsPartMgr::appendPartsToModel(cvf::ModelBasicList* model) } RigMainGrid* mainGrid = m_reservoirView->mainGrid(); - if (!(mainGrid && mainGrid->nncData()->hasScalarValues(scalarResultIndex))) + if (!(mainGrid && mainGrid->nncData()->hasScalarValues(scalarResultIndex.scalarResultIndex))) { showNncs = false; } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellPlotTools.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellPlotTools.cpp index 8a63a28a6f..ceb678001e 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellPlotTools.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellPlotTools.cpp @@ -418,7 +418,7 @@ std::map> RimWellPlotTools::timeStep std::map> timeStepsMap; 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) { diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index 36415b22d4..9806d720b1 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -337,20 +337,20 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimE 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_statisticsTimeRange == ALL_TIMESTEPS) { - eclipseView->currentGridCellResults()->minMaxCellScalarValues(scalarIndex, histData.min, histData.max); - eclipseView->currentGridCellResults()->p10p90CellScalarValues(scalarIndex, histData.p10, histData.p90); - eclipseView->currentGridCellResults()->meanCellScalarValues(scalarIndex, histData.mean); - eclipseView->currentGridCellResults()->sumCellScalarValues(scalarIndex, histData.sum); - eclipseView->currentGridCellResults()->mobileVolumeWeightedMean(scalarIndex, histData.weightedMean); - histData.histogram = &(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(scalarIndex)); + eclipseView->currentGridCellResults()->minMaxCellScalarValues(eclResAddr, histData.min, histData.max); + eclipseView->currentGridCellResults()->p10p90CellScalarValues(eclResAddr, histData.p10, histData.p90); + eclipseView->currentGridCellResults()->meanCellScalarValues(eclResAddr, histData.mean); + eclipseView->currentGridCellResults()->sumCellScalarValues(eclResAddr, histData.sum); + eclipseView->currentGridCellResults()->mobileVolumeWeightedMean(eclResAddr, histData.weightedMean); + histData.histogram = &(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(eclResAddr)); } else if (m_statisticsTimeRange == CURRENT_TIMESTEP) { @@ -360,13 +360,13 @@ Rim3dOverlayInfoConfig::HistogramData Rim3dOverlayInfoConfig::histogramData(RimE currentTimeStep = 0; } - eclipseView->currentGridCellResults()->minMaxCellScalarValues(scalarIndex, currentTimeStep, histData.min, histData.max); - eclipseView->currentGridCellResults()->p10p90CellScalarValues(scalarIndex, currentTimeStep, histData.p10, histData.p90); - eclipseView->currentGridCellResults()->meanCellScalarValues(scalarIndex, currentTimeStep, histData.mean); - eclipseView->currentGridCellResults()->sumCellScalarValues(scalarIndex, currentTimeStep, histData.sum); - eclipseView->currentGridCellResults()->mobileVolumeWeightedMean(scalarIndex, currentTimeStep, histData.weightedMean); + eclipseView->currentGridCellResults()->minMaxCellScalarValues(eclResAddr, currentTimeStep, histData.min, histData.max); + eclipseView->currentGridCellResults()->p10p90CellScalarValues(eclResAddr, currentTimeStep, histData.p10, histData.p90); + eclipseView->currentGridCellResults()->meanCellScalarValues(eclResAddr, currentTimeStep, histData.mean); + eclipseView->currentGridCellResults()->sumCellScalarValues(eclResAddr, currentTimeStep, histData.sum); + eclipseView->currentGridCellResults()->mobileVolumeWeightedMean(eclResAddr, currentTimeStep, histData.weightedMean); - histData.histogram = &(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(scalarIndex, currentTimeStep)); + histData.histogram = &(eclipseView->currentGridCellResults()->cellScalarValuesHistogram(eclResAddr, currentTimeStep)); } else { @@ -1095,10 +1095,10 @@ void Rim3dOverlayInfoConfig::updateVisCellStatsIfNeeded() } else { - size_t scalarIndex = eclipseView->cellResult()->scalarResultIndex(); + RigEclipseResultAddress scalarIndex = eclipseView->cellResult()->scalarResultIndex(); calc = new RigEclipseNativeVisibleCellsStatCalc(eclipseView->currentGridCellResults(), - scalarIndex, - eclipseView->currentTotalCellVisibility().p()); + scalarIndex, + eclipseView->currentTotalCellVisibility().p()); } } diff --git a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp index 5a5de5301e..6aa88c1c32 100644 --- a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp @@ -105,7 +105,7 @@ void RimCellEdgeColors::loadResult() { m_singleVarEdgeResultColors->loadResult();; - size_t resultindex = m_singleVarEdgeResultColors->scalarResultIndex(); + RigEclipseResultAddress resultindex = m_singleVarEdgeResultColors->scalarResultIndex(); for (int cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx) { m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(m_singleVarEdgeResultColors->resultVariable(), resultindex); @@ -132,7 +132,7 @@ void RimCellEdgeColors::loadResult() 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; 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* metaD { CVF_ASSERT(metaDataVector); - size_t resultIndices[6]; + RigEclipseResultAddress resultIndices[6]; this->gridScalarIndices(resultIndices); std::vector resultNames; @@ -387,7 +387,7 @@ void RimCellEdgeColors::resetResultIndices() int 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; for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex) { - hasResult |= ((m_resultNameToIndexPairs[cubeFaceIndex].second) != cvf::UNDEFINED_SIZE_T); + hasResult |= m_resultNameToIndexPairs[cubeFaceIndex].second.isValid(); } return hasResult; @@ -450,13 +450,13 @@ void RimCellEdgeColors::minMaxCellEdgeValues(double& min, double& max) } else { - size_t resultIndices[6]; + RigEclipseResultAddress resultIndices[6]; this->gridScalarIndices(resultIndices); size_t idx; for (idx = 0; idx < 6; idx++) { - if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue; + if (!resultIndices[idx].isValid()) continue; { double cMin, cMax; @@ -481,13 +481,13 @@ void RimCellEdgeColors::posNegClosestToZero(double& pos, double& neg) pos = HUGE_VAL; neg = -HUGE_VAL; - size_t resultIndices[6]; + RigEclipseResultAddress resultIndices[6]; this->gridScalarIndices(resultIndices); size_t idx; for (idx = 0; idx < 6; idx++) { - if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue; + if (!resultIndices[idx].isValid()) continue; { double localPos, localNeg; diff --git a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.h b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.h index 49a63fc9f7..cdf9fbe3e8 100644 --- a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.h +++ b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.h @@ -27,6 +27,8 @@ #include +#include "RigCaseCellResultsData.h" + class RigCaseCellResultsData; class RimEclipseCase; class RimEclipseCellColors; @@ -36,7 +38,7 @@ class RimRegularLegendConfig; class RimCellEdgeMetaData { public: - size_t m_resultIndex; + RigEclipseResultAddress m_resultIndex; QString m_resultVariable; bool m_isStatic; }; @@ -78,7 +80,7 @@ public: void setActive(bool active); double ignoredScalarValue() { return m_ignoredResultScalar; } - void gridScalarIndices(size_t resultIndices[6]); + void gridScalarIndices(RigEclipseResultAddress resultIndices[6]); void cellEdgeMetaData(std::vector* metaData); void loadResult(); @@ -118,7 +120,7 @@ private: caf::PdmField useYVariable; caf::PdmField useZVariable; - std::array, 6> m_resultNameToIndexPairs; + std::array, 6> m_resultNameToIndexPairs; caf::PdmPointer m_reservoirView; double m_ignoredResultScalar; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp index b1c08d4afd..296a4b97c6 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -360,6 +360,7 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep, double globalMin, globalMax; double globalPosClosestToZero, globalNegClosestToZero; + cellResultsData->minMaxCellScalarValues(this->scalarResultIndex(), globalMin, globalMax); cellResultsData->posNegClosestToZero(this->scalarResultIndex(), globalPosClosestToZero, globalNegClosestToZero); @@ -448,8 +449,8 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep, double localMin = 0.0; double localMax = 1.0; - cellResultsData->minMaxCellScalarValues(scalarSetIndex, globalMin, globalMax); - cellResultsData->minMaxCellScalarValues(scalarSetIndex, currentTimeStep, localMin, localMax); + cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), globalMin, globalMax); + cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), currentTimeStep, 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 localMax = 1.0; - cellResultsData->minMaxCellScalarValues(scalarSetIndex, globalMin, globalMax); - cellResultsData->minMaxCellScalarValues(scalarSetIndex, currentTimeStep, localMin, localMax); + cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), globalMin, globalMax); + cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), currentTimeStep, 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 localMax = 1.0; - cellResultsData->minMaxCellScalarValues(scalarSetIndex, globalMin, globalMax); - cellResultsData->minMaxCellScalarValues(scalarSetIndex, currentTimeStep, localMin, localMax); + cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), globalMin, globalMax); + cellResultsData->minMaxCellScalarValues(RigEclipseResultAddress(scalarSetIndex), currentTimeStep, localMin, localMax); ternaryLegendConfig->setAutomaticRanges(RimTernaryLegendConfig::TERNARY_SWAT_IDX, globalMin, globalMax, localMin, localMax); } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseContourMapProjection.cpp b/ApplicationCode/ProjectDataModel/RimEclipseContourMapProjection.cpp index f753c9236d..00492def93 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseContourMapProjection.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseContourMapProjection.cpp @@ -324,8 +324,8 @@ std::vector RimEclipseContourMapProjection::retrieveParameterWeights() std::vector weights; if (m_weightByParameter()) { - size_t gridScalarResultIdx = m_weightingResult->scalarResultIndex(); - if (gridScalarResultIdx != cvf::UNDEFINED_SIZE_T) + RigEclipseResultAddress gridScalarResultIdx = m_weightingResult->scalarResultIndex(); + if (gridScalarResultIdx.isValid()) { m_weightingResult->loadResult(); int timeStep = 0; @@ -333,7 +333,7 @@ std::vector RimEclipseContourMapProjection::retrieveParameterWeights() { timeStep = view()->currentTimeStep(); } - weights = m_weightingResult->currentGridCellResults()->cellScalarResults(gridScalarResultIdx)[timeStep]; + weights = m_weightingResult->currentGridCellResults()->cellScalarResults(gridScalarResultIdx, timeStep); } } return weights; diff --git a/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilter.cpp b/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilter.cpp index 3397e46477..42b9c9a57f 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilter.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilter.cpp @@ -372,8 +372,8 @@ void RimEclipsePropertyFilter::computeResultValueRange() } else { - size_t scalarIndex = resultDefinition->scalarResultIndex(); - if ( scalarIndex != cvf::UNDEFINED_SIZE_T ) + RigEclipseResultAddress scalarIndex = resultDefinition->scalarResultIndex(); + if ( scalarIndex.isValid() ) { RigCaseCellResultsData* results = resultDefinition->currentGridCellResults(); if ( results ) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 08f9cdb0e7..b22d3eb76b 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -625,11 +625,11 @@ QList RimEclipseResultDefinition::calculateValueOptions( //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RimEclipseResultDefinition::scalarResultIndex() const +RigEclipseResultAddress RimEclipseResultDefinition::scalarResultIndex() const { size_t gridScalarResultIndex = cvf::UNDEFINED_SIZE_T; - if (isFlowDiagOrInjectionFlooding()) return cvf::UNDEFINED_SIZE_T; + if (isFlowDiagOrInjectionFlooding()) return RigEclipseResultAddress(); const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); if (gridCellResults ) @@ -637,7 +637,7 @@ size_t RimEclipseResultDefinition::scalarResultIndex() const gridScalarResultIndex = gridCellResults->findScalarResultIndex(m_resultType(), m_resultVariable()); } - return gridScalarResultIndex; + return RigEclipseResultAddress(gridScalarResultIndex); } //-------------------------------------------------------------------------------------------------- @@ -786,7 +786,7 @@ bool RimEclipseResultDefinition::hasStaticResult() const if (isFlowDiagOrInjectionFlooding()) return false; const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); - size_t gridScalarResultIndex = this->scalarResultIndex(); + RigEclipseResultAddress gridScalarResultIndex = this->scalarResultIndex(); if (hasResult() && gridCellResults->timeStepCount(gridScalarResultIndex) == 1 ) { @@ -845,7 +845,7 @@ bool RimEclipseResultDefinition::hasDynamicResult() const if (this->currentGridCellResults()) { const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); - size_t gridScalarResultIndex = this->scalarResultIndex(); + RigEclipseResultAddress gridScalarResultIndex = this->scalarResultIndex(); if (gridCellResults->timeStepCount(gridScalarResultIndex) > 1 ) { return true; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h index b84c8c371d..7c6a578885 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h @@ -35,6 +35,8 @@ #include +#include "RigCaseCellResultsData.h" + class RigCaseCellResultsData; class RimEclipseCase; class RimEclipseView; @@ -92,7 +94,7 @@ public: QString resultVariableUiShortName() const; void loadResult(); - size_t scalarResultIndex() const; + RigEclipseResultAddress scalarResultIndex() const; bool hasStaticResult() const; bool hasDynamicResult() const; bool hasResult() const; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp index 434fc62491..3de1ae61ae 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp @@ -44,13 +44,13 @@ void RimEclipseStatisticsCaseEvaluator::addNamedResult(RigCaseCellResultsData* d // Use time step dates from first result in first source case CVF_ASSERT(m_sourceCases.size() > 0); - std::vector sourceTimeStepInfos = m_sourceCases[0]->results(RiaDefines::MATRIX_MODEL)->timeStepInfos(0); + std::vector sourceTimeStepInfos = m_sourceCases[0]->results(RiaDefines::MATRIX_MODEL)->timeStepInfos(RigEclipseResultAddress(0)); size_t destinationScalarResultIndex = destinationCellResults->findOrCreateScalarResultIndex(resultType, resultName, true); CVF_ASSERT(destinationScalarResultIndex != cvf::UNDEFINED_SIZE_T); - destinationCellResults->setTimeStepInfos(destinationScalarResultIndex, sourceTimeStepInfos); - std::vector< std::vector >& dataValues = destinationCellResults->cellScalarResults(destinationScalarResultIndex); + destinationCellResults->setTimeStepInfos(RigEclipseResultAddress(destinationScalarResultIndex), sourceTimeStepInfos); + std::vector< std::vector >& dataValues = destinationCellResults->cellScalarResults(RigEclipseResultAddress(destinationScalarResultIndex)); dataValues.resize(sourceTimeStepInfos.size()); diff --git a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp index df58cd91ac..d46b2b5333 100644 --- a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp +++ b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp @@ -236,7 +236,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo() // for all cases { - std::vector timeStepInfos = rigCaseData->results(poroModel)->timeStepInfos(0); + std::vector timeStepInfos = rigCaseData->results(poroModel)->timeStepInfos(RigEclipseResultAddress(0)); const std::vector resultInfos = rigCaseData->results(poroModel)->infoForEachResultIndex(); @@ -261,9 +261,9 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo() if (mustBeCalculated) cellResultsStorage->setMustBeCalculated(scalarResultIndex); - cellResultsStorage->setTimeStepInfos(scalarResultIndex, timeStepInfos); + cellResultsStorage->setTimeStepInfos(RigEclipseResultAddress(scalarResultIndex), timeStepInfos); - std::vector< std::vector >& dataValues = cellResultsStorage->cellScalarResults(scalarResultIndex); + std::vector< std::vector >& dataValues = cellResultsStorage->cellScalarResults(RigEclipseResultAddress(scalarResultIndex)); dataValues.resize(timeStepInfos.size()); } } diff --git a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp index e4c3229587..dad45cfc5b 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp @@ -128,7 +128,7 @@ void RimReservoirCellResultsStorage::setupBeforeSave() { // If there is no data, we do not store anything for the current result variable // (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()) { @@ -153,7 +153,7 @@ void RimReservoirCellResultsStorage::setupBeforeSave() const std::vector* data = nullptr; if (tsIdx < timestepCount) { - data = &(m_cellResults->cellScalarResults(resInfo[rIdx].gridScalarResultIndex(), tsIdx)); + data = &(m_cellResults->cellScalarResults(RigEclipseResultAddress(resInfo[rIdx].gridScalarResultIndex()), tsIdx)); } if (data && data->size()) @@ -277,7 +277,7 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell reportNumbers.resize(resInfo->m_timeStepDates().size()); std::vector 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); @@ -285,7 +285,7 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell { std::vector* data = nullptr; - data = &(m_cellResults->cellScalarResults(resultIndex, tsIdx)); + data = &(m_cellResults->cellScalarResults(RigEclipseResultAddress(resultIndex), tsIdx)); quint64 cellCount = 0; stream >> cellCount; diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp index a6b41b65c0..9e82af6f95 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -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& RigCaseCellResultsData::cellScalarValuesHistogram(size_t scalarResultIndex) +const std::vector& RigCaseCellResultsData::cellScalarValuesHistogram(const RigEclipseResultAddress& resVarAddr) { - return m_statisticsDataCache[scalarResultIndex]->cellScalarValuesHistogram(); + return statistics(resVarAddr)->cellScalarValuesHistogram(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const std::vector& RigCaseCellResultsData::cellScalarValuesHistogram(size_t scalarResultIndex, size_t timeStepIndex) +const std::vector& 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& RigCaseCellResultsData::uniqueCellScalarValues(size_t scalarResultIndex) +const std::vector& 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()); - return m_cellScalarResults[scalarResultIndex].size(); + return m_cellScalarResults[resVarAddr.scalarResultIndex].size(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const std::vector>& RigCaseCellResultsData::cellScalarResults(size_t scalarResultIndex) const +const std::vector>& RigCaseCellResultsData::cellScalarResults(const RigEclipseResultAddress& resVarAddr) const { CVF_TIGHT_ASSERT(scalarResultIndex < resultCount()); - return m_cellScalarResults[scalarResultIndex]; + return m_cellScalarResults[resVarAddr.scalarResultIndex]; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector>& RigCaseCellResultsData::cellScalarResults(size_t scalarResultIndex) +std::vector>& RigCaseCellResultsData::cellScalarResults(const RigEclipseResultAddress& resVarAddr) { CVF_TIGHT_ASSERT(scalarResultIndex < resultCount()); - return m_cellScalarResults[scalarResultIndex]; + return m_cellScalarResults[resVarAddr.scalarResultIndex]; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector& RigCaseCellResultsData::cellScalarResults(size_t scalarResultIndex, size_t timeStepIndex) +std::vector& RigCaseCellResultsData::cellScalarResults(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex) { CVF_TIGHT_ASSERT(scalarResultIndex < resultCount()); CVF_TIGHT_ASSERT(timeStepIndex < m_cellScalarResults[scalarResultIndex].size()); - return m_cellScalarResults[scalarResultIndex][timeStepIndex]; + return m_cellScalarResults[resVarAddr.scalarResultIndex][timeStepIndex]; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector& 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 //-------------------------------------------------------------------------------------------------- -bool RigCaseCellResultsData::isUsingGlobalActiveIndex(size_t scalarResultIndex) const +bool RigCaseCellResultsData::isUsingGlobalActiveIndex(const RigEclipseResultAddress& resVarAddr) const { 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; return true; @@ -513,11 +524,11 @@ std::vector RigCaseCellResultsData::allTimeStepDatesFromEclipseReader //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigCaseCellResultsData::timeStepDates(size_t scalarResultIndex) const +std::vector 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 return std::vector(); @@ -531,7 +542,7 @@ std::vector RigCaseCellResultsData::timeStepDates() const size_t scalarResWithMostTimeSteps = cvf::UNDEFINED_SIZE_T; maxTimeStepCount(&scalarResWithMostTimeSteps); - return timeStepDates(scalarResWithMostTimeSteps); + return timeStepDates(RigEclipseResultAddress(scalarResWithMostTimeSteps)); } //-------------------------------------------------------------------------------------------------- @@ -542,17 +553,17 @@ std::vector RigCaseCellResultsData::daysSinceSimulationStart() const size_t scalarResWithMostTimeSteps = cvf::UNDEFINED_SIZE_T; maxTimeStepCount(&scalarResWithMostTimeSteps); - return daysSinceSimulationStart(scalarResWithMostTimeSteps); + return daysSinceSimulationStart(RigEclipseResultAddress(scalarResWithMostTimeSteps)); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigCaseCellResultsData::daysSinceSimulationStart(size_t scalarResultIndex) const +std::vector 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 { @@ -563,10 +574,10 @@ std::vector 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) - return m_resultInfos[scalarResultIndex].timeStepInfos()[timeStepIndex].m_reportNumber; + if (resVarAddr.scalarResultIndex < m_resultInfos.size() && m_resultInfos[resVarAddr.scalarResultIndex].timeStepInfos().size() > timeStepIndex) + return m_resultInfos[resVarAddr.scalarResultIndex].timeStepInfos()[timeStepIndex].m_reportNumber; else return -1; } @@ -574,10 +585,10 @@ int RigCaseCellResultsData::reportStepNumber(size_t scalarResultIndex, size_t ti //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigCaseCellResultsData::timeStepInfos(size_t scalarResultIndex) const +std::vector RigCaseCellResultsData::timeStepInfos(const RigEclipseResultAddress& resVarAddr) const { - if (scalarResultIndex < m_resultInfos.size()) - return m_resultInfos[scalarResultIndex].timeStepInfos(); + if (resVarAddr.scalarResultIndex < m_resultInfos.size()) + return m_resultInfos[resVarAddr.scalarResultIndex].timeStepInfos(); else return std::vector(); } @@ -585,13 +596,13 @@ std::vector RigCaseCellResultsData::timeStepInfos(size_t //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigCaseCellResultsData::setTimeStepInfos(size_t scalarResultIndex, const std::vector& timeStepInfos) +void RigCaseCellResultsData::setTimeStepInfos(const RigEclipseResultAddress& resVarAddr, const std::vector& 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>& dataValues = this->cellScalarResults(scalarResultIndex); + std::vector>& dataValues = this->cellScalarResults(resVarAddr); dataValues.resize(timeStepInfos.size()); } @@ -656,7 +667,7 @@ void RigCaseCellResultsData::clearScalarResult(RiaDefines::ResultCatType type, c m_cellScalarResults[scalarResultIndex][tsIdx].swap(empty); } - recalculateStatistics(scalarResultIndex); + recalculateStatistics(RigEclipseResultAddress(scalarResultIndex)); } //-------------------------------------------------------------------------------------------------- @@ -760,9 +771,9 @@ const std::vector* if (scalarResultIndexPorv == cvf::UNDEFINED_SIZE_T) return nullptr; - const std::vector* porvResults = &(gridCellResults->cellScalarResults(scalarResultIndexPorv, 0)); + const std::vector* porvResults = &(gridCellResults->cellScalarResults(RigEclipseResultAddress(scalarResultIndexPorv), 0)); - if (!gridCellResults->isUsingGlobalActiveIndex(scalarResultIndexPorv)) + if (!gridCellResults->isUsingGlobalActiveIndex(RigEclipseResultAddress(scalarResultIndexPorv))) { // 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, "SGAS"); - this->cellScalarResults(scalarResultIndex).resize(this->maxTimeStepCount()); + m_cellScalarResults[scalarResultIndex].resize(this->maxTimeStepCount()); for (size_t timeStepIdx = 0; timeStepIdx < this->maxTimeStepCount(); timeStepIdx++) { - std::vector& values = this->cellScalarResults(scalarResultIndex)[timeStepIdx]; + std::vector& values = m_cellScalarResults[scalarResultIndex][timeStepIdx]; if (values.size() == 0) { computeSOILForTimeStep(timeStepIdx); @@ -1149,7 +1160,7 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType else if (resultName == RiaDefines::completionTypeResultName()) { 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) { computeCompletionTypeForTimeStep(timeStepIdx); @@ -1177,12 +1188,12 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType if (type == RiaDefines::DYNAMIC_NATIVE && timeStepCount > 0) { - this->cellScalarResults(scalarResultIndex).resize(timeStepCount); + m_cellScalarResults[scalarResultIndex].resize(timeStepCount); size_t i; for (i = 0; i < timeStepCount; i++) { - std::vector& values = this->cellScalarResults(scalarResultIndex)[i]; + std::vector& values = m_cellScalarResults[scalarResultIndex][i]; if (!m_readerInterface->dynamicResult(resultName, RiaDefines::MATRIX_MODEL, i, &values)) { resultLoadingSucess = false; @@ -1200,9 +1211,9 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType } else if (type == RiaDefines::STATIC_NATIVE) { - this->cellScalarResults(scalarResultIndex).resize(1); + m_cellScalarResults[scalarResultIndex].resize(1); - std::vector& values = this->cellScalarResults(scalarResultIndex)[0]; + std::vector& values = m_cellScalarResults[scalarResultIndex][0]; if (!m_readerInterface->staticResult(resultName, RiaDefines::MATRIX_MODEL, &values)) { resultLoadingSucess = false; @@ -1221,7 +1232,7 @@ size_t RigCaseCellResultsData::findOrLoadScalarResult(RiaDefines::ResultCatType if (!resultLoadingSucess) { // 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(); - this->cellScalarResults(scalarResultIndex).resize(timeStepCount); + m_cellScalarResults[scalarResultIndex].resize(timeStepCount); size_t i; for (i = 0; i < timeStepCount; i++) { - std::vector& values = this->cellScalarResults(scalarResultIndex)[i]; + std::vector& values = m_cellScalarResults[scalarResultIndex][i]; eclReader->sourSimRlResult(resultName, i, &values); } } @@ -1275,9 +1286,9 @@ size_t RigCaseCellResultsData::findOrLoadScalarResultForTimeStep(RiaDefines::Res if (this->mustBeCalculated(soilScalarResultIndex)) { - this->cellScalarResults(soilScalarResultIndex).resize(this->maxTimeStepCount()); + m_cellScalarResults[soilScalarResultIndex].resize(this->maxTimeStepCount()); - std::vector& values = this->cellScalarResults(soilScalarResultIndex)[timeStepIndex]; + std::vector& values = m_cellScalarResults[soilScalarResultIndex][timeStepIndex]; if (values.size() == 0) { computeSOILForTimeStep(timeStepIndex); @@ -1309,9 +1320,9 @@ size_t RigCaseCellResultsData::findOrLoadScalarResultForTimeStep(RiaDefines::Res if (type == RiaDefines::DYNAMIC_NATIVE && timeStepCount > 0) { - this->cellScalarResults(scalarResultIndex).resize(timeStepCount); + m_cellScalarResults[scalarResultIndex].resize(timeStepCount); - std::vector& values = this->cellScalarResults(scalarResultIndex)[timeStepIndex]; + std::vector& values = m_cellScalarResults[scalarResultIndex][timeStepIndex]; if (values.size() == 0) { 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) { - this->cellScalarResults(scalarResultIndex).resize(1); + m_cellScalarResults[scalarResultIndex].resize(1); - std::vector& values = this->cellScalarResults(scalarResultIndex)[0]; + std::vector& values = m_cellScalarResults[scalarResultIndex][0]; if (!m_readerInterface->staticResult(resultName, RiaDefines::MATRIX_MODEL, &values)) { resultLoadingSucess = false; @@ -1347,9 +1358,9 @@ size_t RigCaseCellResultsData::findOrLoadScalarResultForTimeStep(RiaDefines::Res { size_t timeStepCount = this->infoForEachResultIndex()[scalarResultIndex].timeStepInfos().size(); - this->cellScalarResults(scalarResultIndex).resize(timeStepCount); + m_cellScalarResults[scalarResultIndex].resize(timeStepCount); - std::vector& values = this->cellScalarResults(scalarResultIndex)[timeStepIndex]; + std::vector& values = m_cellScalarResults[scalarResultIndex][timeStepIndex]; if (values.size() == 0) { @@ -1384,7 +1395,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex) if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T) { - std::vector& swatForTimeStep = this->cellScalarResults(scalarIndexSWAT, timeStepIndex); + std::vector& swatForTimeStep = this->cellScalarResults(RigEclipseResultAddress(scalarIndexSWAT), timeStepIndex); if (swatForTimeStep.size() > 0) { soilResultValueCount = swatForTimeStep.size(); @@ -1394,7 +1405,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex) if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T) { - std::vector& sgasForTimeStep = this->cellScalarResults(scalarIndexSGAS, timeStepIndex); + std::vector& sgasForTimeStep = this->cellScalarResults(RigEclipseResultAddress(scalarIndexSGAS), timeStepIndex); if (sgasForTimeStep.size() > 0) { 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 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 return; } - this->cellScalarResults(soilResultScalarIndex, timeStepIndex).resize(soilResultValueCount); + m_cellScalarResults[soilResultScalarIndex][timeStepIndex].resize(soilResultValueCount); std::vector* swatForTimeStep = nullptr; std::vector* sgasForTimeStep = nullptr; @@ -1423,7 +1434,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex) if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T) { - swatForTimeStep = &(this->cellScalarResults(scalarIndexSWAT, timeStepIndex)); + swatForTimeStep = &(this->cellScalarResults(RigEclipseResultAddress(scalarIndexSWAT), timeStepIndex)); if (swatForTimeStep->size() == 0) { swatForTimeStep = nullptr; @@ -1432,7 +1443,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex) if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T) { - sgasForTimeStep = &(this->cellScalarResults(scalarIndexSGAS, timeStepIndex)); + sgasForTimeStep = &(this->cellScalarResults(RigEclipseResultAddress(scalarIndexSGAS), timeStepIndex)); if (sgasForTimeStep->size() == 0) { sgasForTimeStep = nullptr; @@ -1441,14 +1452,14 @@ void RigCaseCellResultsData::computeSOILForTimeStep(size_t timeStepIndex) if (scalarIndexSSOL != cvf::UNDEFINED_SIZE_T) { - ssolForTimeStep = &(this->cellScalarResults(scalarIndexSSOL, timeStepIndex)); + ssolForTimeStep = &(this->cellScalarResults(RigEclipseResultAddress(scalarIndexSSOL), timeStepIndex)); if (ssolForTimeStep->size() == 0) { ssolForTimeStep = nullptr; } } - std::vector& soilForTimeStep = this->cellScalarResults(soilResultScalarIndex, timeStepIndex); + std::vector& soilForTimeStep = this->cellScalarResults(RigEclipseResultAddress(soilResultScalarIndex), timeStepIndex); #pragma omp parallel for for (int idx = 0; idx < static_cast(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 size_t scalarIndexSGAS = this->findOrCreateScalarResultIndex(RiaDefines::DYNAMIC_NATIVE, "SGAS", false); - if (this->cellScalarResults(scalarIndexSGAS).size() > timeStepIndex) + if (m_cellScalarResults[scalarIndexSGAS].size() > timeStepIndex) { - std::vector& values = this->cellScalarResults(scalarIndexSGAS)[timeStepIndex]; + std::vector& values = m_cellScalarResults[scalarIndexSGAS][timeStepIndex]; if (values.size() > 0) return; } @@ -1503,7 +1514,7 @@ void RigCaseCellResultsData::testAndComputeSgasForTimeStep(size_t timeStepIndex) size_t swatTimeStepCount = 0; { - std::vector& swatForTimeStep = this->cellScalarResults(scalarIndexSWAT, timeStepIndex); + std::vector& swatForTimeStep = m_cellScalarResults[scalarIndexSWAT][timeStepIndex]; if (swatForTimeStep.size() > 0) { 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; } - this->cellScalarResults(scalarIndexSGAS, timeStepIndex).resize(swatResultValueCount); + m_cellScalarResults[scalarIndexSGAS][timeStepIndex].resize(swatResultValueCount); std::vector* swatForTimeStep = nullptr; { - swatForTimeStep = &(this->cellScalarResults(scalarIndexSWAT, timeStepIndex)); + swatForTimeStep = &(m_cellScalarResults[scalarIndexSWAT][timeStepIndex]); if (swatForTimeStep->size() == 0) { swatForTimeStep = nullptr; } } - std::vector& sgasForTimeStep = this->cellScalarResults(scalarIndexSGAS, timeStepIndex); + std::vector& sgasForTimeStep = m_cellScalarResults[scalarIndexSGAS][timeStepIndex]; #pragma omp parallel for for (int idx = 0; idx < static_cast(swatResultValueCount); idx++) @@ -1604,12 +1615,12 @@ void RigCaseCellResultsData::computeDepthRelatedResults() computeBottom = true; } - std::vector>& depth = this->cellScalarResults(depthResultIndex); - std::vector>& dx = this->cellScalarResults(dxResultIndex); - std::vector>& dy = this->cellScalarResults(dyResultIndex); - std::vector>& dz = this->cellScalarResults(dzResultIndex); - std::vector>& tops = this->cellScalarResults(topsResultIndex); - std::vector>& bottom = this->cellScalarResults(bottomResultIndex); + std::vector>& depth = m_cellScalarResults[depthResultIndex]; + std::vector>& dx = m_cellScalarResults[dxResultIndex]; + std::vector>& dy = m_cellScalarResults[dyResultIndex]; + std::vector>& dz = m_cellScalarResults[dzResultIndex]; + std::vector>& tops = m_cellScalarResults[topsResultIndex]; + std::vector>& bottom = m_cellScalarResults[bottomResultIndex]; // 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 - size_t permxResultValueCount = this->cellScalarResults(permResultIdx)[0].size(); + size_t permxResultValueCount = m_cellScalarResults[permResultIdx][0].size(); size_t resultValueCount = permxResultValueCount; if (hasNTGResults) { - size_t ntgResultValueCount = this->cellScalarResults(ntgResultIdx)[0].size(); + size_t ntgResultValueCount = m_cellScalarResults[ntgResultIdx][0].size(); resultValueCount = CVF_MIN(permxResultValueCount, ntgResultValueCount); } // Get all the actual result values - std::vector& permResults = this->cellScalarResults(permResultIdx)[0]; - std::vector& riTransResults = this->cellScalarResults(riTransResultIdx)[0]; + std::vector& permResults = m_cellScalarResults[permResultIdx][0]; + std::vector& riTransResults = m_cellScalarResults[riTransResultIdx][0]; std::vector* ntgResults = nullptr; if (hasNTGResults) { - ntgResults = &(this->cellScalarResults(ntgResultIdx)[0]); + ntgResults = &( m_cellScalarResults[ntgResultIdx][0]); } // Set up output container to correct number of results @@ -1864,12 +1875,12 @@ void RigCaseCellResultsData::computeRiTransComponent(const QString& riTransCompo ResultIndexFunction permIdxFunc = nullptr; ResultIndexFunction ntgIdxFunc = nullptr; { - bool isPermUsingResIdx = this->isUsingGlobalActiveIndex(permResultIdx); - bool isTransUsingResIdx = this->isUsingGlobalActiveIndex(riTransResultIdx); + bool isPermUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(permResultIdx)); + bool isTransUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(riTransResultIdx)); bool isNtgUsingResIdx = false; if (hasNTGResults) { - isNtgUsingResIdx = this->isUsingGlobalActiveIndex(ntgResultIdx); + isNtgUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(ntgResultIdx)); } // Set up result index function pointers @@ -1995,9 +2006,9 @@ void RigCaseCellResultsData::computeNncCombRiTrans() // Get all the actual result values - std::vector& permXResults = this->cellScalarResults(permXResultIdx)[0]; - std::vector& permYResults = this->cellScalarResults(permYResultIdx)[0]; - std::vector& permZResults = this->cellScalarResults(permZResultIdx)[0]; + std::vector& permXResults = m_cellScalarResults[permXResultIdx][0]; + std::vector& permYResults = m_cellScalarResults[permYResultIdx][0]; + std::vector& permZResults = m_cellScalarResults[permZResultIdx][0]; std::vector& riCombTransResults = m_ownerMainGrid->nncData()->makeStaticConnectionScalarResult(RigNNCData::propertyNameRiCombTrans()); m_ownerMainGrid->nncData()->setScalarResultIndex(RigNNCData::propertyNameRiCombTrans(), riCombTransScalarResultIndex); @@ -2005,7 +2016,7 @@ void RigCaseCellResultsData::computeNncCombRiTrans() std::vector* ntgResults = nullptr; if (hasNTGResults) { - ntgResults = &(this->cellScalarResults(ntgResultIdx)[0]); + ntgResults = &(m_cellScalarResults[ntgResultIdx][0]); } // Prepare how to index the result values: @@ -2014,13 +2025,13 @@ void RigCaseCellResultsData::computeNncCombRiTrans() ResultIndexFunction permZIdxFunc = nullptr; ResultIndexFunction ntgIdxFunc = nullptr; { - bool isPermXUsingResIdx = this->isUsingGlobalActiveIndex(permXResultIdx); - bool isPermYUsingResIdx = this->isUsingGlobalActiveIndex(permYResultIdx); - bool isPermZUsingResIdx = this->isUsingGlobalActiveIndex(permZResultIdx); + bool isPermXUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(permXResultIdx)); + bool isPermYUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(permYResultIdx)); + bool isPermZUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(permZResultIdx)); bool isNtgUsingResIdx = false; if (hasNTGResults) { - isNtgUsingResIdx = this->isUsingGlobalActiveIndex(ntgResultIdx); + isNtgUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(ntgResultIdx)); } // 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 - 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 - std::vector& riTransResults = this->cellScalarResults(riTransResultIdx)[0]; - std::vector& transResults = this->cellScalarResults(transResultIdx)[0]; - - std::vector& riMultResults = this->cellScalarResults(riMultResultIdx)[0]; + std::vector& riTransResults = m_cellScalarResults[riTransResultIdx][0]; + std::vector& transResults = m_cellScalarResults[transResultIdx][0]; + std::vector& riMultResults = m_cellScalarResults[riMultResultIdx][0]; // 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 - size_t resultValueCount = this->cellScalarResults(tranCompScResIdx)[0].size(); + size_t resultValueCount = m_cellScalarResults[tranCompScResIdx][0].size(); // Get all the actual result values - std::vector& transResults = this->cellScalarResults(tranCompScResIdx)[0]; - std::vector& riTransByAreaResults = this->cellScalarResults(riTranByAreaScResIdx)[0]; + std::vector& transResults = m_cellScalarResults[tranCompScResIdx][0]; + std::vector& riTransByAreaResults = m_cellScalarResults[riTranByAreaScResIdx][0]; // 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: - bool isUsingResIdx = this->isUsingGlobalActiveIndex(tranCompScResIdx); + bool isUsingResIdx = this->isUsingGlobalActiveIndex(RigEclipseResultAddress(tranCompScResIdx)); // Set up result index function pointers @@ -2400,12 +2410,12 @@ void RigCaseCellResultsData::computeCompletionTypeForTimeStep(size_t timeStep) size_t completionTypeResultIndex = 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& completionTypeResult = this->cellScalarResults(completionTypeResultIndex, timeStep); + std::vector& completionTypeResult = m_cellScalarResults[completionTypeResultIndex][timeStep]; 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); - if (this->cellScalarResults(cellVolIdx).empty()) + if (m_cellScalarResults[cellVolIdx].empty()) { - this->cellScalarResults(cellVolIdx).resize(1); + m_cellScalarResults[cellVolIdx].resize(1); } - std::vector& cellVolumeResults = this->cellScalarResults(cellVolIdx)[0]; + std::vector& cellVolumeResults = m_cellScalarResults[cellVolIdx][0]; size_t cellResultCount = m_activeCellInfo->reservoirCellResultCount(); cellVolumeResults.resize(cellResultCount, std::numeric_limits::infinity()); @@ -2472,17 +2482,17 @@ void RigCaseCellResultsData::computeCellVolumes() void RigCaseCellResultsData::computeOilVolumes() { size_t cellVolIdx = this->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::riCellVolumeResultName(), false); - const std::vector& cellVolumeResults = this->cellScalarResults(cellVolIdx)[0]; + const std::vector& cellVolumeResults = m_cellScalarResults[cellVolIdx][0]; size_t soilIdx = this->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SOIL"); 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(); for (size_t timeStepIdx = 0; timeStepIdx < this->maxTimeStepCount(); timeStepIdx++) { - const std::vector& soilResults = this->cellScalarResults(soilIdx)[timeStepIdx]; - std::vector& oilVolumeResults = this->cellScalarResults(oilVolIdx)[timeStepIdx]; + const std::vector& soilResults = m_cellScalarResults[soilIdx][timeStepIdx]; + std::vector& oilVolumeResults = m_cellScalarResults[oilVolIdx][timeStepIdx]; oilVolumeResults.resize(cellResultCount, 0u); #pragma omp parallel for @@ -2525,7 +2535,7 @@ void RigCaseCellResultsData::computeMobilePV() size_t mobPVIdx = this->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName(), false); - std::vector& mobPVResults = this->cellScalarResults(mobPVIdx)[0]; + std::vector& mobPVResults = m_cellScalarResults[mobPVIdx][0]; // Set up output container to correct number of results mobPVResults.resize(porvResults->size()); @@ -2587,7 +2597,7 @@ bool RigCaseCellResultsData::isDataPresent(size_t scalarResultIndex) const return false; } - const std::vector>& data = this->cellScalarResults(scalarResultIndex); + const std::vector>& data = m_cellScalarResults[scalarResultIndex]; 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"); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigStatisticsDataCache* RigCaseCellResultsData::statistics(const RigEclipseResultAddress& resVarAddr) +{ + return m_statisticsDataCache[resVarAddr.scalarResultIndex].p(); +} diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h index 6b7a04516c..191994b99c 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h @@ -37,6 +37,38 @@ class RigStatisticsDataCache; class RigEclipseTimeStepInfo; 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 //================================================================================================== @@ -54,39 +86,39 @@ public: const RigActiveCellInfo* activeCellInfo() const; // Max and min values of the results - void recalculateStatistics(size_t scalarResultIndex); - void minMaxCellScalarValues(size_t scalarResultIndex, double& min, double& max); - void minMaxCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& min, double& max); - void posNegClosestToZero(size_t scalarResultIndex, double& pos, double& neg); - void posNegClosestToZero(size_t scalarResultIndex, size_t timeStepIndex, double& pos, double& neg); - const std::vector& cellScalarValuesHistogram(size_t scalarResultIndex); - const std::vector& cellScalarValuesHistogram(size_t scalarResultIndex, size_t timeStepIndex); - void p10p90CellScalarValues(size_t scalarResultIndex, double& p10, double& p90); - void p10p90CellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& p10, double& p90); - void meanCellScalarValues(size_t scalarResultIndex, double& meanValue); - void meanCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& meanValue); - const std::vector& uniqueCellScalarValues(size_t scalarResultIndex); - void sumCellScalarValues(size_t scalarResultIndex, double& sumValue); - void sumCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& sumValue); - void mobileVolumeWeightedMean(size_t scalarResultIndex, double& meanValue); - void mobileVolumeWeightedMean(size_t scalarResultIndex, size_t timeStepIndex, double& meanValue); + void recalculateStatistics(const RigEclipseResultAddress& resVarAddr); + void minMaxCellScalarValues(const RigEclipseResultAddress& resVarAddr, double& min, double& max); + void minMaxCellScalarValues(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& min, double& max); + void posNegClosestToZero(const RigEclipseResultAddress& resVarAddr, double& pos, double& neg); + void posNegClosestToZero(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& pos, double& neg); + const std::vector& cellScalarValuesHistogram(const RigEclipseResultAddress& resVarAddr); + const std::vector& cellScalarValuesHistogram(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex); + void p10p90CellScalarValues(const RigEclipseResultAddress& resVarAddr, double& p10, double& p90); + void p10p90CellScalarValues(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& p10, double& p90); + void meanCellScalarValues(const RigEclipseResultAddress& resVarAddr, double& meanValue); + void meanCellScalarValues(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& meanValue); + const std::vector& uniqueCellScalarValues(const RigEclipseResultAddress& resVarAddr); + void sumCellScalarValues(const RigEclipseResultAddress& resVarAddr, double& sumValue); + void sumCellScalarValues(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& sumValue); + void mobileVolumeWeightedMean(const RigEclipseResultAddress& resVarAddr, double& meanValue); + void mobileVolumeWeightedMean(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& meanValue); // Access meta-information about the results 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; QStringList resultNames(RiaDefines::ResultCatType type) const; - bool isUsingGlobalActiveIndex(size_t scalarResultIndex) const; + bool isUsingGlobalActiveIndex(const RigEclipseResultAddress& resVarAddr) const; bool hasFlowDiagUsableFluxes() const; std::vector allTimeStepDatesFromEclipseReader() const; std::vector timeStepDates() const; - std::vector timeStepDates(size_t scalarResultIndex) const; + std::vector timeStepDates(const RigEclipseResultAddress& resVarAddr) const; std::vector daysSinceSimulationStart() const; - std::vector daysSinceSimulationStart(size_t scalarResultIndex) const; - int reportStepNumber(size_t scalarResultIndex, size_t timeStepIndex) const; + std::vector daysSinceSimulationStart(const RigEclipseResultAddress& resVarAddr) const; + int reportStepNumber(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex) const; - std::vector timeStepInfos(size_t scalarResultIndex) const; - void setTimeStepInfos(size_t scalarResultIndex, const std::vector& timeStepInfos); + std::vector timeStepInfos(const RigEclipseResultAddress& resVarAddr) const; + void setTimeStepInfos(const RigEclipseResultAddress& resVarAddr, const std::vector& timeStepInfos); size_t findOrLoadScalarResultForTimeStep(RiaDefines::ResultCatType type, const QString& resultName, size_t timeStepIndex); size_t findOrLoadScalarResult(RiaDefines::ResultCatType type, const QString& resultName); @@ -113,9 +145,10 @@ public: // Access the results data - const std::vector< std::vector > & cellScalarResults(size_t scalarResultIndex) const; - std::vector< std::vector > & cellScalarResults(size_t scalarResultIndex); - std::vector& cellScalarResults(size_t scalarResultIndex, size_t timeStepIndex); + const std::vector< std::vector > & cellScalarResults(const RigEclipseResultAddress& resVarAddr) const; + std::vector< std::vector > & cellScalarResults(const RigEclipseResultAddress& resVarAddr); + const std::vector& cellScalarResults(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex) const; + std::vector& cellScalarResults(const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex); bool updateResultName(RiaDefines::ResultCatType resultType, QString& oldName, const QString& newName); @@ -167,7 +200,7 @@ private: // from RimReservoirCellResultsStorage private: std::vector< std::vector< std::vector > > m_cellScalarResults; ///< Scalar results on the complete reservoir for each Result index (ResultVariable) and timestep cvf::Collection m_statisticsDataCache; - + RigStatisticsDataCache* statistics(const RigEclipseResultAddress& resVarAddr); private: std::vector m_resultInfos; diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp index c61253611d..e8af0651b1 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp @@ -683,7 +683,7 @@ void RigEclipseCaseData::setActiveFormationNames(RigFormationNames* activeFormat false, totalGlobCellCount); - std::vector& fnData = m_matrixModelResults->cellScalarResults(resIndex,0); + std::vector& fnData = m_matrixModelResults->cellScalarResults(RigEclipseResultAddress(resIndex),0); if (m_activeFormationNamesData.isNull()) { @@ -790,7 +790,7 @@ const std::vector* RigEclipseCaseData::resultValues(RiaDefines::Porosity const std::vector* swatResults = nullptr; if (scalarResultIndex != cvf::UNDEFINED_SIZE_T) { - swatResults = &(gridCellResults->cellScalarResults(scalarResultIndex, timeStepIndex)); + swatResults = &(gridCellResults->cellScalarResults(RigEclipseResultAddress(scalarResultIndex), timeStepIndex)); } return swatResults; diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp index 81a07041c6..5234860056 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp @@ -93,7 +93,7 @@ void RigEclipseNativeStatCalc::valueSumAndSampleCount(size_t timeStepIndex, doub //-------------------------------------------------------------------------------------------------- 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; } - const std::vector& weights = m_resultsData->cellScalarResults(mobPVResultIndex, 0); - const std::vector& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex); + const std::vector& weights = m_resultsData->cellScalarResults(RigEclipseResultAddress(mobPVResultIndex), 0); + const std::vector& values = m_resultsData->cellScalarResults(RigEclipseResultAddress(m_scalarResultIndex), timeStepIndex); 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); } diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h b/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h index 84271c83f7..ce45498c24 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h +++ b/ApplicationCode/ReservoirDataModel/RigEclipseNativeStatCalc.h @@ -50,12 +50,12 @@ private: template 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; } - std::vector& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex); + std::vector& values = m_resultsData->cellScalarResults(RigEclipseResultAddress(m_scalarResultIndex), timeStepIndex); if (values.empty()) { @@ -72,7 +72,7 @@ private: if (!actCellInfo->isActive(cIdx)) continue; size_t cellResultIndex = cIdx; - if (m_resultsData->isUsingGlobalActiveIndex(m_scalarResultIndex)) + if (m_resultsData->isUsingGlobalActiveIndex(RigEclipseResultAddress(m_scalarResultIndex))) { cellResultIndex = actCellInfo->cellResultIndex(cIdx); } diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp index 12928e0ffd..fb1100e0d8 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp @@ -31,10 +31,10 @@ /// //-------------------------------------------------------------------------------------------------- RigEclipseNativeVisibleCellsStatCalc::RigEclipseNativeVisibleCellsStatCalc(RigCaseCellResultsData* cellResultsData, - size_t scalarResultIndex, + const RigEclipseResultAddress& scalarResultIndex, const cvf::UByteArray* cellVisibilities) : m_caseData(cellResultsData), - m_scalarResultIndex(scalarResultIndex), + m_resultAddress(scalarResultIndex), m_cellVisibilities(cellVisibilities) { @@ -97,7 +97,7 @@ void RigEclipseNativeVisibleCellsStatCalc::uniqueValues(size_t timeStepIndex, st //-------------------------------------------------------------------------------------------------- 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()); - const std::vector& weights = m_caseData->cellScalarResults(mobPVResultIndex)[0]; - const std::vector& values = m_caseData->cellScalarResults(m_scalarResultIndex, timeStepIndex); + const std::vector& weights = m_caseData->cellScalarResults(RigEclipseResultAddress(mobPVResultIndex), 0); + const std::vector& values = m_caseData->cellScalarResults(m_resultAddress, timeStepIndex); 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); } diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h b/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h index 65b921cfc3..a7aff47b41 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h +++ b/ApplicationCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h @@ -36,7 +36,7 @@ class RigEclipseNativeVisibleCellsStatCalc : public RigStatisticsCalculator { public: RigEclipseNativeVisibleCellsStatCalc(RigCaseCellResultsData* cellResultsData, - size_t scalarResultIndex, + const RigEclipseResultAddress& scalarResultIndex, const cvf::UByteArray* cellVisibilities); void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max) override; @@ -50,13 +50,13 @@ public: private: RigCaseCellResultsData* m_caseData; - size_t m_scalarResultIndex; + RigEclipseResultAddress m_resultAddress; cvf::cref m_cellVisibilities; template void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex) { - std::vector& values = m_caseData->cellScalarResults(m_scalarResultIndex, timeStepIndex); + std::vector& values = m_caseData->cellScalarResults(m_resultAddress, timeStepIndex); if (values.empty()) { @@ -74,7 +74,7 @@ private: if (!(*m_cellVisibilities)[cIdx]) continue; size_t cellResultIndex = cIdx; - if (m_caseData->isUsingGlobalActiveIndex(m_scalarResultIndex)) + if (m_caseData->isUsingGlobalActiveIndex(m_resultAddress)) { cellResultIndex = actCellInfo->cellResultIndex(cIdx); } diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp index 50d3d9bad8..3a6e9df42a 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp @@ -324,7 +324,7 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI size_t resultIndexWithMaxTimeSteps = cvf::UNDEFINED_SIZE_T; 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) ) { diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagStatCalc.cpp b/ApplicationCode/ReservoirDataModel/RigFlowDiagStatCalc.cpp index 51b6b2e5f0..ae810aece2 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagStatCalc.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagStatCalc.cpp @@ -122,7 +122,7 @@ void RigFlowDiagStatCalc::mobileVolumeWeightedMean(size_t timeStepIndex, double& size_t mobPVResultIndex = caseCellResultsData->findOrLoadScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName()); - const std::vector& weights = caseCellResultsData->cellScalarResults(mobPVResultIndex, 0); + const std::vector& weights = caseCellResultsData->cellScalarResults(RigEclipseResultAddress(mobPVResultIndex), 0); const std::vector* values = m_resultsData->resultValues(m_resVarAddr, timeStepIndex); const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo(m_resVarAddr); diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagVisibleCellsStatCalc.cpp b/ApplicationCode/ReservoirDataModel/RigFlowDiagVisibleCellsStatCalc.cpp index f27f8a2844..89aa250367 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagVisibleCellsStatCalc.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagVisibleCellsStatCalc.cpp @@ -111,7 +111,7 @@ void RigFlowDiagVisibleCellsStatCalc::mobileVolumeWeightedMean(size_t timeStepIn size_t mobPVResultIndex = caseCellResultsData->findOrLoadScalarResult(RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName()); - const std::vector& weights = caseCellResultsData->cellScalarResults(mobPVResultIndex, 0); + const std::vector& weights = caseCellResultsData->cellScalarResults(RigEclipseResultAddress(mobPVResultIndex), 0); const std::vector* values = m_resultsData->resultValues(m_resVarAddr, timeStepIndex); const RigActiveCellInfo* actCellInfo = m_resultsData->activeCellInfo(m_resVarAddr); diff --git a/ApplicationCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp b/ApplicationCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp index a59ca86f3a..b8afb48350 100644 --- a/ApplicationCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp +++ b/ApplicationCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp @@ -109,7 +109,7 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator const std::vector* flowrateI = nullptr; if (scalarResultIndexFlowrateI != cvf::UNDEFINED_SIZE_T) { - flowrateI = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(scalarResultIndexFlowrateI, + flowrateI = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(scalarResultIndexFlowrateI), timeStep)); } flowrateIatAllTimeSteps.push_back(flowrateI); @@ -118,7 +118,7 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator const std::vector* flowrateJ = nullptr; if (scalarResultIndexFlowrateJ != cvf::UNDEFINED_SIZE_T) { - flowrateJ = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(scalarResultIndexFlowrateJ, + flowrateJ = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(scalarResultIndexFlowrateJ), timeStep)); } flowrateJatAllTimeSteps.push_back(flowrateJ); @@ -127,7 +127,7 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator const std::vector* flowrateK = nullptr; if (scalarResultIndexFlowrateK != cvf::UNDEFINED_SIZE_T) { - flowrateK = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(scalarResultIndexFlowrateK, + flowrateK = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(scalarResultIndexFlowrateK), timeStep)); } flowrateKatAllTimeSteps.push_back(flowrateK); @@ -144,7 +144,7 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator { if (tracerIndex != cvf::UNDEFINED_SIZE_T) { - const std::vector* tracerResult = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(tracerIndex, timeStep)); + const std::vector* tracerResult = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(RigEclipseResultAddress(tracerIndex), timeStep)); for (size_t i = 0; i < summedTracerValues.size(); i++) { diff --git a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp index 56b4e02c35..166d8db849 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp +++ b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp @@ -91,7 +91,7 @@ cvf::ref RigResultAccessorFactory::createFromNameAndType(cons adjustedTimeStepIndex = 0; } - return createFromResultIdx(eclipseCase, gridIndex, porosityModel, adjustedTimeStepIndex, scalarSetIndex); + return createFromResultIdx(eclipseCase, gridIndex, porosityModel, adjustedTimeStepIndex, RigEclipseResultAddress(scalarSetIndex)); } //-------------------------------------------------------------------------------------------------- @@ -154,7 +154,7 @@ cvf::ref RigResultAccessorFactory::createNativeFromUiResultNa return nullptr; } - return createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, scalarSetIndex); + return createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(scalarSetIndex)); } //-------------------------------------------------------------------------------------------------- @@ -306,9 +306,9 @@ cvf::ref RigResultAccessorFactory::createFromResultIdx(const size_t gridIndex, RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, - size_t resultIndex) + const RigEclipseResultAddress& resultIndex) { - if ( resultIndex == cvf::UNDEFINED_SIZE_T ) + if ( !resultIndex.isValid() ) { return new RigHugeValResultAccessor; } @@ -318,7 +318,7 @@ cvf::ref RigResultAccessorFactory::createFromResultIdx(const const RigGridBase* grid = eclipseCase->grid(gridIndex); if (!grid) return nullptr; - const std::vector< std::vector >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(resultIndex); + const std::vector< std::vector >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(RigEclipseResultAddress(resultIndex)); if (timeStepIndex >= scalarSetResults.size()) { @@ -336,7 +336,7 @@ cvf::ref RigResultAccessorFactory::createFromResultIdx(const return new RigHugeValResultAccessor; } - bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(resultIndex); + bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(RigEclipseResultAddress(resultIndex)); if (useGlobalActiveIndex) { cvf::ref object = new RigActiveCellsResultAccessor(grid, resultValues, eclipseCase->activeCellInfo(porosityModel)); diff --git a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.h b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.h index 19d1b4fd8a..e810072a47 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.h +++ b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.h @@ -28,6 +28,7 @@ class RigActiveCellInfo; class RigGridBase; class RimEclipseResultDefinition; +class RigEclipseResultAddress; class RigResultAccessorFactory { @@ -58,7 +59,7 @@ public: size_t gridIndex, RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, - size_t resultIndex); + const RigEclipseResultAddress& resultIndex); diff --git a/ApplicationCode/ReservoirDataModel/RigResultModifierFactory.cpp b/ApplicationCode/ReservoirDataModel/RigResultModifierFactory.cpp index aab7ebcd87..8d85fdcd9f 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultModifierFactory.cpp +++ b/ApplicationCode/ReservoirDataModel/RigResultModifierFactory.cpp @@ -74,7 +74,7 @@ cvf::ref RigResultModifierFactory::createResultModifier(RigEc return nullptr; } - std::vector< std::vector >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(scalarResultIndex); + std::vector< std::vector >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(RigEclipseResultAddress(scalarResultIndex)); if (timeStepIndex >= scalarSetResults.size()) { @@ -87,7 +87,7 @@ cvf::ref RigResultModifierFactory::createResultModifier(RigEc resultValues = &(scalarSetResults[timeStepIndex]); } - bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(scalarResultIndex); + bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(RigEclipseResultAddress(scalarResultIndex)); if (useGlobalActiveIndex) { cvf::ref object = new RigActiveCellsResultModifier(grid, eclipseCase->activeCellInfo(porosityModel), resultValues); diff --git a/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp b/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp index efecd60ed8..c226a5c75a 100644 --- a/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp @@ -441,7 +441,7 @@ public: return true; } - std::vector timeStepDates = rimCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->timeStepDates(scalarIndexWithMaxTimeStepCount); + std::vector timeStepDates = rimCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->timeStepDates(RigEclipseResultAddress(scalarIndexWithMaxTimeStepCount)); quint64 timeStepCount = timeStepDates.size(); quint64 byteCount = sizeof(quint64) + 6 * timeStepCount * sizeof(qint32); @@ -528,7 +528,7 @@ public: return true; } - std::vector daysSinceSimulationStart = rimCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->daysSinceSimulationStart(scalarIndexWithMaxTimeStepCount); + std::vector daysSinceSimulationStart = rimCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->daysSinceSimulationStart(RigEclipseResultAddress(scalarIndexWithMaxTimeStepCount)); quint64 timeStepCount = daysSinceSimulationStart.size(); quint64 byteCount = sizeof(quint64) + timeStepCount * sizeof(qint32); diff --git a/ApplicationCode/SocketInterface/RiaNNCCommands.cpp b/ApplicationCode/SocketInterface/RiaNNCCommands.cpp index 1948c05051..5afe8fa28d 100644 --- a/ApplicationCode/SocketInterface/RiaNNCCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaNNCCommands.cpp @@ -434,7 +434,7 @@ public: if (scalarResultIndex != cvf::UNDEFINED_SIZE_T) { std::vector< std::vector >* scalarResultFrames = nullptr; - scalarResultFrames = &(results->cellScalarResults(scalarResultIndex)); + scalarResultFrames = &(results->cellScalarResults(RigEclipseResultAddress(scalarResultIndex))); size_t timeStepCount = results->maxTimeStepCount(); scalarResultFrames->resize(timeStepCount); return true; @@ -538,7 +538,7 @@ public: m_currentReservoir->eclipseCaseData() && 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) diff --git a/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp b/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp index 10e2f4961a..7634414434 100644 --- a/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp @@ -82,7 +82,7 @@ public: 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) { // 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); } @@ -421,13 +421,13 @@ public: size_t scalarResWithMostTimeSteps = cvf::UNDEFINED_SIZE_T; rimCase->results(m_porosityModelEnum)->maxTimeStepCount(&scalarResWithMostTimeSteps); - const std::vector timeStepInfos = rimCase->results(m_porosityModelEnum)->timeStepInfos(scalarResWithMostTimeSteps); - rimCase->results(m_porosityModelEnum)->setTimeStepInfos(scalarResultIndex, timeStepInfos); + const std::vector timeStepInfos = rimCase->results(m_porosityModelEnum)->timeStepInfos(RigEclipseResultAddress(scalarResWithMostTimeSteps)); + rimCase->results(m_porosityModelEnum)->setTimeStepInfos(RigEclipseResultAddress(scalarResultIndex), timeStepInfos); } 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(); scalarResultFrames->resize(timeStepCount); @@ -662,7 +662,7 @@ public: if (m_requestedTimesteps.size() == 1 && m_currentScalarIndex != cvf::UNDEFINED_SIZE_T) { std::vector< std::vector >* 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; 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) @@ -816,7 +816,7 @@ public: 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(); scalarResultFrames->resize(timeStepCount); @@ -1026,7 +1026,7 @@ public: if (m_requestedTimesteps.size() == 1 && m_currentScalarIndex != cvf::UNDEFINED_SIZE_T) { std::vector< std::vector >* 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; 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) @@ -1208,7 +1208,7 @@ public: if (args.size() < 5) { // 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); } diff --git a/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp index 2017ed62b2..3085b55ac4 100644 --- a/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp @@ -424,19 +424,19 @@ QString RiuResultTextBuilder::nncResultText() if (m_reservoirView->currentFaultResultColors()) { - size_t scalarResultIdx = m_reservoirView->currentFaultResultColors()->scalarResultIndex(); + RigEclipseResultAddress scalarResultIdx = m_reservoirView->currentFaultResultColors()->scalarResultIndex(); RiaDefines::ResultCatType resultType = m_reservoirView->currentFaultResultColors()->resultType(); const std::vector* nncValues = nullptr; if (resultType == RiaDefines::STATIC_NATIVE) { - nncValues = nncData->staticConnectionScalarResult(scalarResultIdx); + nncValues = nncData->staticConnectionScalarResult(scalarResultIdx.scalarResultIndex); } else if (resultType == RiaDefines::DYNAMIC_NATIVE) { if (m_reservoirView.notNull() && m_reservoirView->eclipseCase()) { 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())) @@ -474,9 +474,9 @@ void RiuResultTextBuilder::appendTextFromResultColors(RigEclipseCaseData* eclips size_t sgasScalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS"); size_t swatScalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT"); - cvf::ref dataAccessObjectX = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, soilScalarSetIndex); - cvf::ref dataAccessObjectY = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, sgasScalarSetIndex); - cvf::ref dataAccessObjectZ = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, swatScalarSetIndex); + cvf::ref dataAccessObjectX = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(soilScalarSetIndex)); + cvf::ref dataAccessObjectY = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(sgasScalarSetIndex)); + cvf::ref dataAccessObjectZ = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress(swatScalarSetIndex)); double scalarValue = 0.0; @@ -616,7 +616,7 @@ QString RiuResultTextBuilder::cellEdgeResultDetails() 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 (uniqueResultIndices.find(resultIndex) != uniqueResultIndices.end()) continue; @@ -628,7 +628,7 @@ QString RiuResultTextBuilder::cellEdgeResultDetails() } RiaDefines::PorosityModelType porosityModel = m_reservoirView->cellResult()->porosityModel(); - cvf::ref resultAccessor = RigResultAccessorFactory::createFromResultIdx(m_reservoirView->eclipseCase()->eclipseCaseData(), m_gridIndex, porosityModel, adjustedTimeStep, resultIndex); + cvf::ref resultAccessor = RigResultAccessorFactory::createFromResultIdx(m_reservoirView->eclipseCase()->eclipseCaseData(), m_gridIndex, porosityModel, adjustedTimeStep, RigEclipseResultAddress(resultIndex)); if (resultAccessor.notNull()) { double scalarValue = resultAccessor->cellScalar(m_cellIndex); @@ -755,9 +755,9 @@ QString RiuResultTextBuilder::cellResultText(RimEclipseCellColors* resultColors) RiaDefines::PorosityModelType porosityModel = resultColors->porosityModel(); - cvf::ref dataAccessObjectX = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, soilScalarSetIndex); - cvf::ref dataAccessObjectY = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, sgasScalarSetIndex); - cvf::ref dataAccessObjectZ = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, swatScalarSetIndex); + cvf::ref dataAccessObjectX = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress(soilScalarSetIndex)); + cvf::ref dataAccessObjectY = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress(sgasScalarSetIndex)); + cvf::ref dataAccessObjectZ = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress(swatScalarSetIndex)); double scalarValue = 0.0;