From a5fb1e17649dc2806a5e7db4e7174118e539ed95 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 21 Mar 2013 10:31:58 +0100 Subject: [PATCH] One shared active cell info for all statistical cases Invalidate existing statisticsCases when adding/removing source cases Moved computation of active cell union from RigStatistics to RimIdenticalGridCaseGroup Recompute active cell union when opening project file p4#: 21023 --- .../ProjectDataModel/RigStatistics.cpp | 86 --------- .../ProjectDataModel/RigStatistics.h | 1 - .../RimIdenticalGridCaseGroup.cpp | 179 +++++++++++++++++- .../RimIdenticalGridCaseGroup.h | 15 ++ .../RimStatisticalCalculation.cpp | 4 + .../RimStatisticalCollection.cpp | 20 -- .../RimStatisticalCollection.h | 2 - .../ProjectDataModel/RimUiTreeModelPdm.cpp | 7 +- .../ReservoirDataModel/RigActiveCellInfo.cpp | 4 +- .../ReservoirDataModel/RigActiveCellInfo.h | 2 +- .../ReservoirDataModel/RigEclipseCase.cpp | 45 +++-- .../ReservoirDataModel/RigEclipseCase.h | 5 +- .../RigReservoirBuilderMock.cpp | 1 + .../RigReservoirCellResults.cpp | 11 +- 14 files changed, 244 insertions(+), 138 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RigStatistics.cpp b/ApplicationCode/ProjectDataModel/RigStatistics.cpp index 2f609c7938..b3e9a6e549 100644 --- a/ApplicationCode/ProjectDataModel/RigStatistics.cpp +++ b/ApplicationCode/ProjectDataModel/RigStatistics.cpp @@ -52,90 +52,6 @@ void RigStatistics::addNamedResult(RigReservoirCellResults* destinationCellResul } } -//-------------------------------------------------------------------------------------------------- -/// -// See also RifReaderEclipseOutput::readActiveCellInfo() -//-------------------------------------------------------------------------------------------------- -void RigStatistics::computeActiveCellUnion() -{ - if (m_sourceCases.size() == 0) - { - return; - } - - CVF_ASSERT(m_destinationCase); - - RigMainGrid* mainGrid = m_sourceCases[0]->reservoirData()->mainGrid(); - CVF_ASSERT(mainGrid); - - m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->setGlobalCellCount(mainGrid->cells().size()); - m_destinationCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->setGlobalCellCount(mainGrid->cells().size()); - m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->setGridCount(mainGrid->gridCount()); - m_destinationCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->setGridCount(mainGrid->gridCount()); - - size_t globalActiveMatrixIndex = 0; - size_t globalActiveFractureIndex = 0; - - for (size_t gridIdx = 0; gridIdx < mainGrid->gridCount(); gridIdx++) - { - RigGridBase* grid = mainGrid->gridByIndex(gridIdx); - - std::vector activeM(grid->cellCount(), 0); - std::vector activeF(grid->cellCount(), 0); - - for (size_t localGridCellIdx = 0; localGridCellIdx < grid->cellCount(); localGridCellIdx++) - { - for (size_t caseIdx = 0; caseIdx < m_sourceCases.size(); caseIdx++) - { - size_t globalCellIdx = grid->globalGridCellIndex(localGridCellIdx); - - if (activeM[localGridCellIdx] == 0) - { - if (m_sourceCases[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActiveInMatrixModel(globalCellIdx)) - { - activeM[localGridCellIdx] = 1; - } - } - - if (activeF[localGridCellIdx] == 0) - { - if (m_sourceCases[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->isActiveInMatrixModel(globalCellIdx)) - { - activeF[localGridCellIdx] = 1; - } - } - } - } - - size_t activeMatrixIndex = 0; - size_t activeFractureIndex = 0; - - for (size_t localGridCellIdx = 0; localGridCellIdx < grid->cellCount(); localGridCellIdx++) - { - size_t globalCellIdx = grid->globalGridCellIndex(localGridCellIdx); - - if (activeM[localGridCellIdx] != 0) - { - m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->setActiveIndexInMatrixModel(globalCellIdx, globalActiveMatrixIndex++); - activeMatrixIndex++; - } - - if (activeF[localGridCellIdx] != 0) - { - m_destinationCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->setActiveIndexInMatrixModel(globalCellIdx, globalActiveFractureIndex++); - activeFractureIndex++; - } - } - - m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->setGridActiveCellCounts(gridIdx, activeMatrixIndex); - m_destinationCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->setGridActiveCellCounts(gridIdx, activeFractureIndex); - } - - m_destinationCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->computeDerivedData(); - m_destinationCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->computeDerivedData(); - - m_destinationCase->computeCachedData(); -} QString createResultNameMin(const QString& resultName) { return resultName + "_MIN"; } QString createResultNameMax(const QString& resultName) { return resultName + "_MAX"; } @@ -176,8 +92,6 @@ void RigStatistics::evaluateStatistics(const QListactiveCellInfo(RifReaderInterface::MATRIX_RESULTS)->globalMatrixModelActiveCellCount(); RigReservoirCellResults* matrixResults = m_destinationCase->results(RifReaderInterface::MATRIX_RESULTS); diff --git a/ApplicationCode/ProjectDataModel/RigStatistics.h b/ApplicationCode/ProjectDataModel/RigStatistics.h index 5f0e42eb99..3e67e93eb7 100644 --- a/ApplicationCode/ProjectDataModel/RigStatistics.h +++ b/ApplicationCode/ProjectDataModel/RigStatistics.h @@ -140,7 +140,6 @@ public: void debugOutput(RimDefines::ResultCatType resultType, const QString& resultName, size_t timeStepIdx); private: - void computeActiveCellUnion(); void addNamedResult(RigReservoirCellResults* cellResults, RimDefines::ResultCatType resultType, const QString& resultName, size_t activeCellCount); void buildSourceMetaData(RimDefines::ResultCatType resultType, const QString& resultName); diff --git a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp index 5f1d4d170c..9be0877388 100644 --- a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp +++ b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp @@ -23,11 +23,13 @@ #include "RimReservoir.h" #include "RimReservoirView.h" #include "RigEclipseCase.h" +#include "RigReservoirCellResults.h" #include "RimStatisticalCalculation.h" #include "RimStatisticalCollection.h" #include "RimResultReservoir.h" #include "cafProgressInfo.h" +#include "RigActiveCellInfo.h" CAF_PDM_SOURCE_INIT(RimIdenticalGridCaseGroup, "RimIdenticalGridCaseGroup"); @@ -48,6 +50,8 @@ RimIdenticalGridCaseGroup::RimIdenticalGridCaseGroup() statisticalReservoirCollection = new RimStatisticalCollection; m_mainGrid = NULL; + + clearActiveCellUnions(); } //-------------------------------------------------------------------------------------------------- @@ -86,8 +90,12 @@ void RimIdenticalGridCaseGroup::addCase(RimReservoir* reservoir) if (statisticalReservoirCollection->reservoirs().size() == 0) { - statisticalReservoirCollection->createAndAppendStatisticalCalculation(); + createAndAppendStatisticalCalculation(); } + + clearActiveCellUnions(); + clearStatisticsResults(); + updateMainGridAndActiveCellsForStatisticsCases(); } //-------------------------------------------------------------------------------------------------- @@ -101,6 +109,10 @@ void RimIdenticalGridCaseGroup::removeCase(RimReservoir* reservoir) { m_mainGrid = NULL; } + + clearActiveCellUnions(); + clearStatisticsResults(); + updateMainGridAndActiveCellsForStatisticsCases(); } //-------------------------------------------------------------------------------------------------- @@ -161,15 +173,172 @@ void RimIdenticalGridCaseGroup::initAfterRead() } - // Set main grid for statistical calculations + bool foundResultsInCache = false; for (size_t i = 0; i < statisticalReservoirCollection()->reservoirs().size(); i++) { - RimStatisticalCalculation* rimReservoir = dynamic_cast(statisticalReservoirCollection()->reservoirs()[i]); - CVF_ASSERT(rimReservoir); + RimStatisticalCalculation* rimReservoir = statisticalReservoirCollection()->reservoirs()[i]; - rimReservoir->setMainGrid(mainEclipseCase->mainGrid()); + // Check if any results are stored in cache + if (rimReservoir->results(RifReaderInterface::MATRIX_RESULTS)->m_resultCacheMetaData.size() > 0 || + rimReservoir->results(RifReaderInterface::FRACTURE_RESULTS)->m_resultCacheMetaData.size() > 0) + { + foundResultsInCache = true; + break; + } + } + + if (foundResultsInCache) + { + computeUnionOfActiveCells(); } m_mainGrid = mainEclipseCase->mainGrid(); + + updateMainGridAndActiveCellsForStatisticsCases(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimIdenticalGridCaseGroup::computeUnionOfActiveCells() +{ + if (m_unionOfMatrixActiveCells->globalMatrixModelActiveCellCount() > 0) + { + return; + } + + if (caseCollection->reservoirs.size() == 0 || !m_mainGrid) + { + m_unionOfMatrixActiveCells = new RigActiveCellInfo; + m_unionOfFractureActiveCells = new RigActiveCellInfo; + + return; + } + + + m_unionOfMatrixActiveCells->setGlobalCellCount(m_mainGrid->cells().size()); + m_unionOfFractureActiveCells->setGlobalCellCount(m_mainGrid->cells().size()); + m_unionOfMatrixActiveCells->setGridCount(m_mainGrid->gridCount()); + m_unionOfFractureActiveCells->setGridCount(m_mainGrid->gridCount()); + + size_t globalActiveMatrixIndex = 0; + size_t globalActiveFractureIndex = 0; + + for (size_t gridIdx = 0; gridIdx < m_mainGrid->gridCount(); gridIdx++) + { + RigGridBase* grid = m_mainGrid->gridByIndex(gridIdx); + + std::vector activeM(grid->cellCount(), 0); + std::vector activeF(grid->cellCount(), 0); + + for (size_t localGridCellIdx = 0; localGridCellIdx < grid->cellCount(); localGridCellIdx++) + { + for (size_t caseIdx = 0; caseIdx < caseCollection->reservoirs.size(); caseIdx++) + { + size_t globalCellIdx = grid->globalGridCellIndex(localGridCellIdx); + + if (activeM[localGridCellIdx] == 0) + { + if (caseCollection->reservoirs[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActiveInMatrixModel(globalCellIdx)) + { + activeM[localGridCellIdx] = 1; + } + } + + if (activeF[localGridCellIdx] == 0) + { + if (caseCollection->reservoirs[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->isActiveInMatrixModel(globalCellIdx)) + { + activeF[localGridCellIdx] = 1; + } + } + } + } + + size_t activeMatrixIndex = 0; + size_t activeFractureIndex = 0; + + for (size_t localGridCellIdx = 0; localGridCellIdx < grid->cellCount(); localGridCellIdx++) + { + size_t globalCellIdx = grid->globalGridCellIndex(localGridCellIdx); + + if (activeM[localGridCellIdx] != 0) + { + m_unionOfMatrixActiveCells->setActiveIndexInMatrixModel(globalCellIdx, globalActiveMatrixIndex++); + activeMatrixIndex++; + } + + if (activeF[localGridCellIdx] != 0) + { + m_unionOfFractureActiveCells->setActiveIndexInMatrixModel(globalCellIdx, globalActiveFractureIndex++); + activeFractureIndex++; + } + } + + m_unionOfMatrixActiveCells->setGridActiveCellCounts(gridIdx, activeMatrixIndex); + m_unionOfFractureActiveCells->setGridActiveCellCounts(gridIdx, activeFractureIndex); + } + + m_unionOfMatrixActiveCells->computeDerivedData(); + m_unionOfFractureActiveCells->computeDerivedData(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimStatisticalCalculation* RimIdenticalGridCaseGroup::createAndAppendStatisticalCalculation() +{ + RimStatisticalCalculation* newObject = new RimStatisticalCalculation; + + newObject->caseName = QString("Statistics ") + QString::number(statisticalReservoirCollection()->reservoirs.size()+1); + newObject->setMainGrid(this->mainGrid()); + newObject->reservoirData()->setActiveCellInfo(RifReaderInterface::MATRIX_RESULTS, m_unionOfMatrixActiveCells.p()); + newObject->reservoirData()->setActiveCellInfo(RifReaderInterface::FRACTURE_RESULTS, m_unionOfFractureActiveCells.p()); + + statisticalReservoirCollection()->reservoirs.push_back(newObject); + + return newObject; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimIdenticalGridCaseGroup::updateMainGridAndActiveCellsForStatisticsCases() +{ + for (size_t i = 0; i < statisticalReservoirCollection->reservoirs().size(); i++) + { + RimStatisticalCalculation* rimStaticsCase = statisticalReservoirCollection->reservoirs[i]; + + rimStaticsCase->setMainGrid(this->mainGrid()); + rimStaticsCase->reservoirData()->setActiveCellInfo(RifReaderInterface::MATRIX_RESULTS, m_unionOfMatrixActiveCells.p()); + rimStaticsCase->reservoirData()->setActiveCellInfo(RifReaderInterface::FRACTURE_RESULTS, m_unionOfFractureActiveCells.p()); + + if (i == 0) + { + rimStaticsCase->reservoirData()->computeCachedData(); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimIdenticalGridCaseGroup::clearStatisticsResults() +{ + for (size_t i = 0; i < statisticalReservoirCollection->reservoirs().size(); i++) + { + RimStatisticalCalculation* rimStaticsCase = statisticalReservoirCollection->reservoirs[i]; + rimStaticsCase->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->clearAllResults(); + rimStaticsCase->results(RifReaderInterface::FRACTURE_RESULTS)->cellResults()->clearAllResults(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimIdenticalGridCaseGroup::clearActiveCellUnions() +{ + m_unionOfMatrixActiveCells = new RigActiveCellInfo; + m_unionOfFractureActiveCells = new RigActiveCellInfo; } diff --git a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h index 81c7edfed2..a9a368ad75 100644 --- a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h +++ b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h @@ -28,6 +28,7 @@ class RimReservoir; class RigMainGrid; +class RigActiveCellInfo; //================================================================================================== // @@ -47,15 +48,29 @@ public: void addCase(RimReservoir* reservoir); void removeCase(RimReservoir* reservoir); + RimStatisticalCalculation* createAndAppendStatisticalCalculation(); + caf::PdmField caseCollection; caf::PdmField statisticalReservoirCollection; RigMainGrid* mainGrid(); + void computeUnionOfActiveCells(); + protected: virtual caf::PdmFieldHandle* userDescriptionField(); virtual void initAfterRead(); + +private: + void updateMainGridAndActiveCellsForStatisticsCases(); + void clearStatisticsResults(); + void clearActiveCellUnions(); + + private: RigMainGrid* m_mainGrid; + + cvf::ref m_unionOfMatrixActiveCells; + cvf::ref m_unionOfFractureActiveCells; }; diff --git a/ApplicationCode/ProjectDataModel/RimStatisticalCalculation.cpp b/ApplicationCode/ProjectDataModel/RimStatisticalCalculation.cpp index 98a9381a3d..0212edbbdd 100644 --- a/ApplicationCode/ProjectDataModel/RimStatisticalCalculation.cpp +++ b/ApplicationCode/ProjectDataModel/RimStatisticalCalculation.cpp @@ -121,6 +121,10 @@ void RimStatisticalCalculation::computeStatistics() openEclipseGridFile(); } + RimIdenticalGridCaseGroup* gridCaseGroup = caseGroup(); + CVF_ASSERT(gridCaseGroup); + gridCaseGroup->computeUnionOfActiveCells(); + std::vector sourceCases; getSourceCases(sourceCases); diff --git a/ApplicationCode/ProjectDataModel/RimStatisticalCollection.cpp b/ApplicationCode/ProjectDataModel/RimStatisticalCollection.cpp index 79b63b400f..3f61974e36 100644 --- a/ApplicationCode/ProjectDataModel/RimStatisticalCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimStatisticalCollection.cpp @@ -45,26 +45,6 @@ RimStatisticalCollection::~RimStatisticalCollection() reservoirs.deleteAllChildObjects(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimStatisticalCalculation* RimStatisticalCollection::createAndAppendStatisticalCalculation() -{ - RimStatisticalCalculation* newObject = new RimStatisticalCalculation; - RimIdenticalGridCaseGroup* gridCaseGroup = parentCaseGroup(); - - CVF_ASSERT(gridCaseGroup); - CVF_ASSERT(gridCaseGroup->mainGrid()); - - newObject->setMainGrid(gridCaseGroup->mainGrid()); - - newObject->caseName = QString("Statistics ") + QString::number(reservoirs.size()+1); - - reservoirs.push_back(newObject); - - return newObject; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimStatisticalCollection.h b/ApplicationCode/ProjectDataModel/RimStatisticalCollection.h index 85d55996b4..c89522899e 100644 --- a/ApplicationCode/ProjectDataModel/RimStatisticalCollection.h +++ b/ApplicationCode/ProjectDataModel/RimStatisticalCollection.h @@ -42,8 +42,6 @@ public: caf::PdmPointersField reservoirs; - RimStatisticalCalculation* createAndAppendStatisticalCalculation(); - RimIdenticalGridCaseGroup* parentCaseGroup(); private: diff --git a/ApplicationCode/ProjectDataModel/RimUiTreeModelPdm.cpp b/ApplicationCode/ProjectDataModel/RimUiTreeModelPdm.cpp index 6516d59714..8bf365099e 100644 --- a/ApplicationCode/ProjectDataModel/RimUiTreeModelPdm.cpp +++ b/ApplicationCode/ProjectDataModel/RimUiTreeModelPdm.cpp @@ -480,21 +480,22 @@ RimStatisticalCalculation* RimUiTreeModelPdm::addStatisticalCalculation(const QM caf::PdmUiTreeItem* currentItem = getTreeItemFromIndex(itemIndex); QModelIndex collectionIndex; - RimStatisticalCollection* caseGroup = NULL; + RimIdenticalGridCaseGroup* caseGroup = NULL; caf::PdmUiTreeItem* parentCollectionItem = NULL; int position = 0; if (dynamic_cast(currentItem->dataObject().p())) { RimStatisticalCalculation* currentObject = dynamic_cast(currentItem->dataObject().p()); - caseGroup = currentObject->parentStatisticalCollection(); + caseGroup = currentObject->parentStatisticalCollection()->parentCaseGroup(); parentCollectionItem = currentItem->parent(); position = itemIndex.row(); collectionIndex = itemIndex.parent(); } else if (dynamic_cast(currentItem->dataObject().p())) { - caseGroup = dynamic_cast(currentItem->dataObject().p()); + RimStatisticalCollection* statColl = dynamic_cast(currentItem->dataObject().p()); + caseGroup = statColl->parentCaseGroup(); parentCollectionItem = currentItem; position = parentCollectionItem->childCount(); collectionIndex = itemIndex; diff --git a/ApplicationCode/ReservoirDataModel/RigActiveCellInfo.cpp b/ApplicationCode/ReservoirDataModel/RigActiveCellInfo.cpp index bdf3305543..7591d27798 100644 --- a/ApplicationCode/ReservoirDataModel/RigActiveCellInfo.cpp +++ b/ApplicationCode/ReservoirDataModel/RigActiveCellInfo.cpp @@ -45,7 +45,7 @@ bool RigActiveCellInfo::isActiveInMatrixModel(size_t globalCellIndex) const { if (m_activeInMatrixModel.size() == 0) { - return false; + return true; } CVF_TIGHT_ASSERT(globalCellIndex < m_activeInMatrixModel.size()); @@ -60,7 +60,7 @@ size_t RigActiveCellInfo::activeIndexInMatrixModel(size_t globalCellIndex) const { if (m_activeInMatrixModel.size() == 0) { - return cvf::UNDEFINED_SIZE_T; + return globalCellIndex; } CVF_TIGHT_ASSERT(globalCellIndex < m_activeInMatrixModel.size()); diff --git a/ApplicationCode/ReservoirDataModel/RigActiveCellInfo.h b/ApplicationCode/ReservoirDataModel/RigActiveCellInfo.h index a03b138f81..50ae9e1a34 100644 --- a/ApplicationCode/ReservoirDataModel/RigActiveCellInfo.h +++ b/ApplicationCode/ReservoirDataModel/RigActiveCellInfo.h @@ -27,7 +27,7 @@ -class RigActiveCellInfo +class RigActiveCellInfo : public cvf::Object { public: RigActiveCellInfo(); diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseCase.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseCase.cpp index f72efdf255..dbfbdbdde8 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseCase.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseCase.cpp @@ -30,6 +30,9 @@ RigEclipseCase::RigEclipseCase() m_matrixModelResults = new RigReservoirCellResults(m_mainGrid.p()); m_fractureModelResults = new RigReservoirCellResults(m_mainGrid.p()); + + m_activeCellInfo = new RigActiveCellInfo; + m_fractureActiveCellInfo = new RigActiveCellInfo; } //-------------------------------------------------------------------------------------------------- @@ -285,19 +288,19 @@ void RigEclipseCase::computeActiveCellData() size_t i, j, k; m_mainGrid->ijkFromCellIndex(idx, &i, &j, &k); - if (m_activeCellInfo.isActiveInMatrixModel(idx)) + if (m_activeCellInfo->isActiveInMatrixModel(idx)) { matrixModelActiveBB.add(i, j, k); } - if (m_fractureActiveCellInfo.isActiveInMatrixModel(idx)) + if (m_fractureActiveCellInfo->isActiveInMatrixModel(idx)) { fractureModelActiveBB.add(i, j, k); } } - m_activeCellInfo.setMatrixModelActiveCellsBoundingBox(matrixModelActiveBB.m_min, matrixModelActiveBB.m_max); - m_fractureActiveCellInfo.setMatrixModelActiveCellsBoundingBox(fractureModelActiveBB.m_min, fractureModelActiveBB.m_max); + m_activeCellInfo->setMatrixModelActiveCellsBoundingBox(matrixModelActiveBB.m_min, matrixModelActiveBB.m_max); + m_fractureActiveCellInfo->setMatrixModelActiveCellsBoundingBox(fractureModelActiveBB.m_min, fractureModelActiveBB.m_max); } //-------------------------------------------------------------------------------------------------- @@ -316,10 +319,10 @@ RigActiveCellInfo* RigEclipseCase::activeCellInfo(RifReaderInterface::PorosityMo { if (porosityModel == RifReaderInterface::MATRIX_RESULTS) { - return &m_activeCellInfo; + return m_activeCellInfo.p(); } - return &m_fractureActiveCellInfo; + return m_fractureActiveCellInfo.p(); } //-------------------------------------------------------------------------------------------------- @@ -329,12 +332,28 @@ const RigActiveCellInfo* RigEclipseCase::activeCellInfo(RifReaderInterface::Poro { if (porosityModel == RifReaderInterface::MATRIX_RESULTS) { - return &m_activeCellInfo; + return m_activeCellInfo.p(); } - return &m_fractureActiveCellInfo; + return m_fractureActiveCellInfo.p(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseCase::setActiveCellInfo(RifReaderInterface::PorosityModelResultType porosityModel, RigActiveCellInfo* activeCellInfo) +{ + if (porosityModel == RifReaderInterface::MATRIX_RESULTS) + { + m_activeCellInfo = activeCellInfo; + } + else + { + m_fractureActiveCellInfo = activeCellInfo; + } +} + + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -343,14 +362,14 @@ void RigEclipseCase::computeActiveCellsGeometryBoundingBox() if (m_mainGrid.isNull()) { cvf::BoundingBox bb; - m_activeCellInfo.setMatrixActiveCellsGeometryBoundingBox(bb); - m_fractureActiveCellInfo.setMatrixActiveCellsGeometryBoundingBox(bb); + m_activeCellInfo->setMatrixActiveCellsGeometryBoundingBox(bb); + m_fractureActiveCellInfo->setMatrixActiveCellsGeometryBoundingBox(bb); return; } RigActiveCellInfo* activeInfos[2]; - activeInfos[0] = &m_fractureActiveCellInfo; - activeInfos[1] = &m_activeCellInfo; // Last, to make this bb.min become display offset + activeInfos[0] = m_fractureActiveCellInfo.p(); + activeInfos[1] = m_activeCellInfo.p(); // Last, to make this bb.min become display offset cvf::BoundingBox bb; for (int acIdx = 0; acIdx < 2; ++acIdx) @@ -428,6 +447,8 @@ cvf::ref RigEclipseCase::dataAccessObject(const return NULL; } + + /* //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseCase.h b/ApplicationCode/ReservoirDataModel/RigEclipseCase.h index 9deeedf3f0..04d23400ec 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseCase.h +++ b/ApplicationCode/ReservoirDataModel/RigEclipseCase.h @@ -51,6 +51,7 @@ public: RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel); const RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel) const; + void setActiveCellInfo(RifReaderInterface::PorosityModelResultType porosityModel, RigActiveCellInfo* activeCellInfo); cvf::ref dataAccessObject(const RigGridBase* grid, @@ -78,8 +79,8 @@ private: private: cvf::ref m_mainGrid; - RigActiveCellInfo m_activeCellInfo; - RigActiveCellInfo m_fractureActiveCellInfo; + cvf::ref m_activeCellInfo; + cvf::ref m_fractureActiveCellInfo; cvf::ref m_matrixModelResults; cvf::ref m_fractureModelResults; diff --git a/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp b/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp index 6b8145a4aa..ef9831def6 100644 --- a/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp +++ b/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp @@ -18,6 +18,7 @@ #include "RigReservoirBuilderMock.h" #include "RigEclipseCase.h" +#include "RigActiveCellInfo.h" /* rand example: guess the number */ diff --git a/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp b/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp index c7b4cf0012..7f5089a86d 100644 --- a/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp +++ b/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp @@ -505,10 +505,13 @@ void RigReservoirCellResults::removeResult(const QString& resultName) //-------------------------------------------------------------------------------------------------- void RigReservoirCellResults::clearAllResults() { - for (size_t i = 0; i < m_cellScalarResults.size(); i++) - { - m_cellScalarResults[i].clear(); - } + m_cellScalarResults.clear(); + m_maxMinValues.clear(); + m_histograms.clear(); + m_p10p90.clear(); + m_meanValues.clear(); + m_maxMinValuesPrTs.clear(); + m_resultInfos.clear(); } //--------------------------------------------------------------------------------------------------