diff --git a/ApplicationCode/FileInterface/FileInterface_UnitTests/RifReaderEclipseOutput-Test.cpp b/ApplicationCode/FileInterface/FileInterface_UnitTests/RifReaderEclipseOutput-Test.cpp index d61fdb185d..5f84939347 100644 --- a/ApplicationCode/FileInterface/FileInterface_UnitTests/RifReaderEclipseOutput-Test.cpp +++ b/ApplicationCode/FileInterface/FileInterface_UnitTests/RifReaderEclipseOutput-Test.cpp @@ -68,7 +68,7 @@ TEST(RigReservoirTest, FileOutputToolsTest) void buildResultInfoString(RigReservoir* reservoir, RifReaderInterface::PorosityModelResultType porosityModel, RimDefines::ResultCatType resultType) { - RigReservoirCellResults* matrixResults = reservoir->mainGrid()->results(porosityModel); + RigReservoirCellResults* matrixResults = reservoir->results(porosityModel); { QStringList resultNames = matrixResults->resultNames(resultType); diff --git a/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp b/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp index ac83e2e22a..f032efba30 100644 --- a/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp @@ -212,11 +212,11 @@ std::map RifEclipseInputFileTools::readProperties(const QStri ecl_kw_type* eclKeyWordData = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ECL_FLOAT_TYPE); if (eclKeyWordData) { - QString newResultName = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeywords[i].keyword); + QString newResultName = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeywords[i].keyword); - size_t resultIndex = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName); // Should really merge with inputProperty object information because we need to use PropertyName, and not keyword + size_t resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName); // Should really merge with inputProperty object information because we need to use PropertyName, and not keyword - std::vector< std::vector >& newPropertyData = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex); + std::vector< std::vector >& newPropertyData = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex); newPropertyData.push_back(std::vector()); newPropertyData[0].resize(ecl_kw_get_size(eclKeyWordData), HUGE_VAL); ecl_kw_get_data_as_double(eclKeyWordData, newPropertyData[0].data()); @@ -294,13 +294,13 @@ bool RifEclipseInputFileTools::readProperty(const QString& fileName, RigReservoi if (eclKeyWordData) { QString newResultName = resultName; - size_t resultIndex = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(newResultName); + size_t resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(newResultName); if (resultIndex == cvf::UNDEFINED_SIZE_T) { - resultIndex = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName); + resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName); } - std::vector< std::vector >& newPropertyData = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex); + std::vector< std::vector >& newPropertyData = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex); newPropertyData.resize(1); newPropertyData[0].resize(ecl_kw_get_size(eclKeyWordData), HUGE_VAL); ecl_kw_get_data_as_double(eclKeyWordData, newPropertyData[0].data()); @@ -374,7 +374,7 @@ bool RifEclipseInputFileTools::writePropertyToTextFile(const QString& fileName, { CVF_ASSERT(reservoir); - size_t resultIndex = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(resultName); + size_t resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(resultName); if (resultIndex == cvf::UNDEFINED_SIZE_T) { return false; @@ -386,7 +386,7 @@ bool RifEclipseInputFileTools::writePropertyToTextFile(const QString& fileName, return false; } - std::vector< std::vector >& resultData = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex); + std::vector< std::vector >& resultData = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex); if (resultData.size() == 0) { return false; @@ -406,7 +406,7 @@ bool RifEclipseInputFileTools::writeBinaryResultToTextFile(const QString& fileNa { CVF_ASSERT(reservoir); - size_t resultIndex = reservoir->mainGrid()->results(porosityModel)->findScalarResultIndex(resultName); + size_t resultIndex = reservoir->results(porosityModel)->findScalarResultIndex(resultName); if (resultIndex == cvf::UNDEFINED_SIZE_T) { return false; @@ -418,8 +418,7 @@ bool RifEclipseInputFileTools::writeBinaryResultToTextFile(const QString& fileNa return false; } - RigActiveCellInfo* activeCellInfo = reservoir->activeCellInfo(); - cvf::ref dataAccessObject = reservoir->mainGrid()->dataAccessObject(activeCellInfo, porosityModel, timeStep, resultIndex); + cvf::ref dataAccessObject = reservoir->dataAccessObject(reservoir->mainGrid(), porosityModel, timeStep, resultIndex); if (dataAccessObject.isNull()) { return false; @@ -533,13 +532,13 @@ bool RifEclipseInputFileTools::readPropertyAtFilePosition(const QString& fileNam if (eclKeyWordData) { QString newResultName = resultName; - size_t resultIndex = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(newResultName); + size_t resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(newResultName); if (resultIndex == cvf::UNDEFINED_SIZE_T) { - resultIndex = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName); + resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName); } - std::vector< std::vector >& newPropertyData = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex); + std::vector< std::vector >& newPropertyData = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex); newPropertyData.resize(1); newPropertyData[0].resize(ecl_kw_get_size(eclKeyWordData), HUGE_VAL); ecl_kw_get_data_as_double(eclKeyWordData, newPropertyData[0].data()); diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 11930b2838..472243c48b 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -372,8 +372,8 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigReservoir* reservo m_reservoir = reservoir; - reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(this); - reservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(this); + reservoir->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(this); + reservoir->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(this); // Build results meta data if (!buildMetaData(reservoir)) return false; @@ -409,8 +409,8 @@ bool RifReaderEclipseOutput::buildMetaData(RigReservoir* reservoir) progInfo.incrementProgress(); - RigReservoirCellResults* matrixModelResults = m_reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS); - RigReservoirCellResults* fractureModelResults = m_reservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS); + RigReservoirCellResults* matrixModelResults = m_reservoir->results(RifReaderInterface::MATRIX_RESULTS); + RigReservoirCellResults* fractureModelResults = m_reservoir->results(RifReaderInterface::FRACTURE_RESULTS); if (m_dynamicResultsAccess.notNull()) { diff --git a/ApplicationCode/FileInterface/RifReaderMockModel.cpp b/ApplicationCode/FileInterface/RifReaderMockModel.cpp index 0cfb16c02d..6f036e124e 100644 --- a/ApplicationCode/FileInterface/RifReaderMockModel.cpp +++ b/ApplicationCode/FileInterface/RifReaderMockModel.cpp @@ -31,7 +31,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigReservoir* reservoir) m_reservoir = reservoir; - RigReservoirCellResults* cellResults = reservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS); + RigReservoirCellResults* cellResults = reservoir->results(RifReaderInterface::MATRIX_RESULTS); QList dates; diff --git a/ApplicationCode/ModelVisualization/RivCellEdgeEffectGenerator.cpp b/ApplicationCode/ModelVisualization/RivCellEdgeEffectGenerator.cpp index 2e2711e9a8..fac4a1b709 100644 --- a/ApplicationCode/ModelVisualization/RivCellEdgeEffectGenerator.cpp +++ b/ApplicationCode/ModelVisualization/RivCellEdgeEffectGenerator.cpp @@ -96,8 +96,8 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo( const RigGridBase* grid = dynamic_cast(generator->activeGrid()); CVF_ASSERT(grid != NULL); - RigActiveCellInfo* activeCellInfo = cellResultSlot->reservoirView()->eclipseCase()->reservoirData()->activeCellInfo(); - CVF_ASSERT(activeCellInfo != NULL); + RigReservoir* reservoir = cellResultSlot->reservoirView()->eclipseCase()->reservoirData(); + CVF_ASSERT(reservoir != NULL); cvf::ref cellCenterDataAccessObject = NULL; if (cellResultSlot->hasResult()) @@ -109,7 +109,7 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo( } RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel(cellResultSlot->porosityModel()); - cellCenterDataAccessObject = grid->dataAccessObject(activeCellInfo, porosityModel, timeStepIndex, cellResultSlot->gridScalarIndex()); + cellCenterDataAccessObject = reservoir->dataAccessObject(grid, porosityModel, timeStepIndex, cellResultSlot->gridScalarIndex()); } CVF_ASSERT(cellEdgeResultSlot->hasResult()); @@ -128,7 +128,7 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo( { // Assuming static values to be mapped onto cell edge, always using time step zero // TODO: Now hardcoded matrix results, should it be possible to use fracture results? - daObj = grid->dataAccessObject(activeCellInfo, RifReaderInterface::MATRIX_RESULTS, 0, resultIndices[cubeFaceIdx]); + daObj = reservoir->dataAccessObject(grid, RifReaderInterface::MATRIX_RESULTS, 0, resultIndices[cubeFaceIdx]); } cellEdgeDataAccessObjects.push_back(daObj.p()); diff --git a/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp b/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp index 269b4742b3..5f04d3dfc5 100644 --- a/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivGridPartMgr.cpp @@ -223,8 +223,8 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot* RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel(cellResultSlot->porosityModel()); - RigActiveCellInfo* activeCellInfo = cellResultSlot->reservoirView()->eclipseCase()->reservoirData()->activeCellInfo(); - cvf::ref dataAccessObject = m_grid->dataAccessObject(activeCellInfo, porosityModel, resTimeStepIdx, scalarSetIndex); + RigReservoir* reservoir = cellResultSlot->reservoirView()->eclipseCase()->reservoirData(); + cvf::ref dataAccessObject = reservoir->dataAccessObject(m_grid.p(), porosityModel, resTimeStepIdx, scalarSetIndex); if (dataAccessObject.isNull()) return; diff --git a/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp b/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp index 5fe2acbfdf..c7b15fb78a 100644 --- a/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivReservoirViewPartMgr.cpp @@ -605,9 +605,9 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis const RimCellFilter::FilterModeType filterType = (*pfIt)->filterMode(); RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel((*pfIt)->resultDefinition()->porosityModel()); - RigActiveCellInfo* activeCellInfo = propFilterColl->reservoirView()->eclipseCase()->reservoirData()->activeCellInfo(); + RigReservoir* reservoir = propFilterColl->reservoirView()->eclipseCase()->reservoirData(); - cvf::ref dataAccessObject = grid->dataAccessObject(activeCellInfo, porosityModel, timeStepIndex, scalarResultIndex); + cvf::ref dataAccessObject = reservoir->dataAccessObject(grid, porosityModel, timeStepIndex, scalarResultIndex); CVF_ASSERT(dataAccessObject.notNull()); #pragma omp parallel for schedule(dynamic) diff --git a/ApplicationCode/ProjectDataModel/RimInputReservoir.cpp b/ApplicationCode/ProjectDataModel/RimInputReservoir.cpp index 4f13b8d996..21e396d441 100644 --- a/ApplicationCode/ProjectDataModel/RimInputReservoir.cpp +++ b/ApplicationCode/ProjectDataModel/RimInputReservoir.cpp @@ -72,8 +72,8 @@ void RimInputReservoir::openDataFileSet(const QStringList& filenames) if (caseName().contains("Input Mock Debug Model")) { cvf::ref readerInterface = this->createMockModel(this->caseName()); - m_rigReservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p()); - m_rigReservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p()); + m_rigReservoir->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p()); + m_rigReservoir->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p()); m_rigReservoir->activeCellInfo()->computeDerivedData(); @@ -183,8 +183,8 @@ bool RimInputReservoir::openEclipseGridFile() CVF_ASSERT(m_rigReservoir.notNull()); CVF_ASSERT(readerInterface.notNull()); - m_rigReservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p()); - m_rigReservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p()); + m_rigReservoir->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p()); + m_rigReservoir->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p()); m_rigReservoir->computeCachedData(); m_rigReservoir->mainGrid()->computeCachedData(); } @@ -193,8 +193,8 @@ bool RimInputReservoir::openEclipseGridFile() RIApplication* app = RIApplication::instance(); if (app->preferences()->autocomputeDepthRelatedProperties) { - RigReservoirCellResults* matrixResults = m_rigReservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS); - RigReservoirCellResults* fractureResults = m_rigReservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS); + RigReservoirCellResults* matrixResults = m_rigReservoir->results(RifReaderInterface::MATRIX_RESULTS); + RigReservoirCellResults* fractureResults = m_rigReservoir->results(RifReaderInterface::FRACTURE_RESULTS); matrixResults->computeDepthRelatedResults(); fractureResults->computeDepthRelatedResults(); @@ -286,7 +286,7 @@ void RimInputReservoir::loadAndSyncronizeInputProperties() { if (fileKeywordSet.count(knownKeywords[fkIt])) { - QString resultName = this->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(knownKeywords[fkIt]); + QString resultName = this->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(knownKeywords[fkIt]); if (RifEclipseInputFileTools::readProperty(filenames[i], this->reservoirData(), knownKeywords[fkIt], resultName)) { RimInputProperty* inputProperty = new RimInputProperty; @@ -361,7 +361,7 @@ void RimInputReservoir::removeProperty(RimInputProperty* inputProperty) } // Remove the results pointed to by this input property - RigReservoirCellResults* results = m_rigReservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS); + RigReservoirCellResults* results = m_rigReservoir->results(RifReaderInterface::MATRIX_RESULTS); results->removeResult(inputProperty->resultName); this->removeResult(inputProperty->resultName); diff --git a/ApplicationCode/ProjectDataModel/RimReservoir.cpp b/ApplicationCode/ProjectDataModel/RimReservoir.cpp index 79bd2bf00a..4d9f033285 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoir.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoir.cpp @@ -209,13 +209,13 @@ void RimReservoir::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con reservoirView->createDisplayModelAndRedraw(); } - RigReservoirCellResults* matrixModelResults = m_rigReservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS); + RigReservoirCellResults* matrixModelResults = m_rigReservoir->results(RifReaderInterface::MATRIX_RESULTS); if (matrixModelResults) { matrixModelResults->clearAllResults(); } - RigReservoirCellResults* fractureModelResults = m_rigReservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS); + RigReservoirCellResults* fractureModelResults = m_rigReservoir->results(RifReaderInterface::FRACTURE_RESULTS); if (fractureModelResults) { fractureModelResults->clearAllResults(); diff --git a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp index 7bc85b33d8..dfadff16e9 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp @@ -875,7 +875,7 @@ void RimReservoirView::appendCellResultInfo(size_t gridIndex, size_t cellIndex, if (this->cellResult()->hasResult()) { RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel(cellResult()->porosityModel()); - cvf::ref dataAccessObject = grid->dataAccessObject(activeCellInfo, porosityModel, m_currentTimeStep, this->cellResult()->gridScalarIndex()); + cvf::ref dataAccessObject = reservoir->dataAccessObject(grid, porosityModel, m_currentTimeStep, this->cellResult()->gridScalarIndex()); if (dataAccessObject.notNull()) { double scalarValue = dataAccessObject->cellScalar(cellIndex); @@ -896,7 +896,7 @@ void RimReservoirView::appendCellResultInfo(size_t gridIndex, size_t cellIndex, // Cell edge results are static, results are loaded for first time step only RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel(cellResult()->porosityModel()); - cvf::ref dataAccessObject = grid->dataAccessObject(activeCellInfo, porosityModel, 0, resultIndices[idx]); + cvf::ref dataAccessObject = reservoir->dataAccessObject(grid, porosityModel, 0, resultIndices[idx]); if (dataAccessObject.notNull()) { double scalarValue = dataAccessObject->cellScalar(cellIndex); @@ -968,7 +968,7 @@ RigReservoirCellResults* RimReservoirView::gridCellResults() { RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel(cellResult->porosityModel()); - return m_reservoir->reservoirData()->mainGrid()->results(porosityModel); + return m_reservoir->reservoirData()->results(porosityModel); } return NULL; @@ -1038,7 +1038,7 @@ void RimReservoirView::updateLegends() CVF_ASSERT(reservoir); RifReaderInterface::PorosityModelResultType porosityModel = RigReservoirCellResults::convertFromProjectModelPorosityModel(cellResult()->porosityModel()); - RigReservoirCellResults* results = reservoir->mainGrid()->results(porosityModel); + RigReservoirCellResults* results = reservoir->results(porosityModel); CVF_ASSERT(results); if (this->cellResult()->hasResult()) diff --git a/ApplicationCode/ProjectDataModel/RimResultReservoir.cpp b/ApplicationCode/ProjectDataModel/RimResultReservoir.cpp index aa6608c47c..32314a69f4 100644 --- a/ApplicationCode/ProjectDataModel/RimResultReservoir.cpp +++ b/ApplicationCode/ProjectDataModel/RimResultReservoir.cpp @@ -58,8 +58,8 @@ bool RimResultReservoir::openEclipseGridFile() { readerInterface = this->createMockModel(this->caseName()); - m_rigReservoir->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p()); - m_rigReservoir->mainGrid()->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p()); + m_rigReservoir->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p()); + m_rigReservoir->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p()); } else { diff --git a/ApplicationCode/ReservoirDataModel/RigGridBase.cpp b/ApplicationCode/ReservoirDataModel/RigGridBase.cpp index d3423e384b..dd733e6c32 100644 --- a/ApplicationCode/ReservoirDataModel/RigGridBase.cpp +++ b/ApplicationCode/ReservoirDataModel/RigGridBase.cpp @@ -468,21 +468,6 @@ size_t RigGridBase::fractureModelActiveCellCount() const return m_fractureModelActiveCellCount; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -cvf::ref RigGridBase::dataAccessObject(const RigActiveCellInfo* activeCellInfo, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, size_t scalarSetIndex) const -{ - if (timeStepIndex != cvf::UNDEFINED_SIZE_T && - scalarSetIndex != cvf::UNDEFINED_SIZE_T) - { - cvf::ref dataAccess = RigGridScalarDataAccessFactory::createDataAccessObject(this, activeCellInfo, porosityModel, timeStepIndex, scalarSetIndex); - return dataAccess; - } - - return NULL; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigGridBase.h b/ApplicationCode/ReservoirDataModel/RigGridBase.h index b32ce34af2..4a9bf35373 100644 --- a/ApplicationCode/ReservoirDataModel/RigGridBase.h +++ b/ApplicationCode/ReservoirDataModel/RigGridBase.h @@ -99,8 +99,6 @@ public: virtual bool isCellValid( size_t i, size_t j, size_t k ) const; virtual bool cellIJKNeighbor(size_t i, size_t j, size_t k, FaceType face, size_t* neighborCellIndex ) const; - cvf::ref dataAccessObject(const RigActiveCellInfo* activeCellInfo, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, size_t scalarSetIndex) const; - private: std::string m_gridName; cvf::Vec3st m_gridPointDimensions; diff --git a/ApplicationCode/ReservoirDataModel/RigGridScalarDataAccess.cpp b/ApplicationCode/ReservoirDataModel/RigGridScalarDataAccess.cpp index f5fbc92849..909490b89a 100644 --- a/ApplicationCode/ReservoirDataModel/RigGridScalarDataAccess.cpp +++ b/ApplicationCode/ReservoirDataModel/RigGridScalarDataAccess.cpp @@ -28,6 +28,7 @@ #include "RigReservoirCellResults.h" #include "RigActiveCellInfo.h" #include "RigGridBase.h" +#include "RigReservoir.h" @@ -37,7 +38,7 @@ class RigGridAllCellsScalarDataAccess : public cvf::StructGridScalarDataAccess { public: - RigGridAllCellsScalarDataAccess(const RigGridBase* grid, std::vector* resultValues); + RigGridAllCellsScalarDataAccess(const RigGridBase* grid, const std::vector* resultValues); virtual double cellScalar(size_t i, size_t j, size_t k) const; virtual double cellScalar(size_t cellIndex) const; @@ -49,14 +50,14 @@ public: protected: cvf::cref m_grid; - std::vector* m_resultValues; + const std::vector* m_resultValues; }; //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigGridAllCellsScalarDataAccess::RigGridAllCellsScalarDataAccess(const RigGridBase* grid, std::vector* resultValues) : +RigGridAllCellsScalarDataAccess::RigGridAllCellsScalarDataAccess(const RigGridBase* grid, const std::vector* resultValues) : m_grid(grid), m_resultValues(resultValues) { @@ -133,7 +134,7 @@ const cvf::Vec3d* RigGridAllCellsScalarDataAccess::cellVector(size_t i, size_t j class RigGridMatrixActiveCellsScalarDataAccess : public RigGridAllCellsScalarDataAccess { public: - RigGridMatrixActiveCellsScalarDataAccess(const RigGridBase* grid, std::vector* resultValues, const RigActiveCellInfo* activeCellInfo) : + RigGridMatrixActiveCellsScalarDataAccess(const RigGridBase* grid, const std::vector* resultValues, const RigActiveCellInfo* activeCellInfo) : RigGridAllCellsScalarDataAccess(grid, resultValues), m_activeCellInfo(activeCellInfo) { @@ -168,7 +169,7 @@ protected: class RigGridFractureActiveCellsScalarDataAccess : public RigGridAllCellsScalarDataAccess { public: - RigGridFractureActiveCellsScalarDataAccess(const RigGridBase* grid, std::vector* resultValues, const RigActiveCellInfo* activeCellInfo) : + RigGridFractureActiveCellsScalarDataAccess(const RigGridBase* grid, const std::vector* resultValues, const RigActiveCellInfo* activeCellInfo) : RigGridAllCellsScalarDataAccess(grid, resultValues), m_activeCellInfo(activeCellInfo) { @@ -194,45 +195,46 @@ protected: + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- cvf::ref RigGridScalarDataAccessFactory::createDataAccessObject(const RigGridBase* grid, - const RigActiveCellInfo* activeCellInfo, + const RigReservoir* reservoir, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, size_t scalarSetIndex) { CVF_ASSERT(grid); - CVF_ASSERT(grid->mainGrid()); - CVF_ASSERT(grid->mainGrid()->results(porosityModel)); - CVF_ASSERT(activeCellInfo); + CVF_ASSERT(reservoir); + CVF_ASSERT(reservoir->results(porosityModel)); + CVF_ASSERT(reservoir->activeCellInfo()); - if (!grid || !grid->mainGrid() || !grid->mainGrid()->results(porosityModel) || !activeCellInfo) + if (!grid || !reservoir || !reservoir->results(porosityModel) || !reservoir->activeCellInfo()) { return NULL; } - std::vector< std::vector > & scalarSetResults = grid->mainGrid()->results(porosityModel)->cellScalarResults(scalarSetIndex); + const std::vector< std::vector > & scalarSetResults = reservoir->results(porosityModel)->cellScalarResults(scalarSetIndex); if (timeStepIndex >= scalarSetResults.size()) { return NULL; } - std::vector* resultValues = &(scalarSetResults[timeStepIndex]); + const std::vector* resultValues = &(scalarSetResults[timeStepIndex]); - bool useGlobalActiveIndex = grid->mainGrid()->results(porosityModel)->isUsingGlobalActiveIndex(scalarSetIndex); + bool useGlobalActiveIndex = reservoir->results(porosityModel)->isUsingGlobalActiveIndex(scalarSetIndex); if (useGlobalActiveIndex) { if (porosityModel == RifReaderInterface::MATRIX_RESULTS) { - cvf::ref object = new RigGridMatrixActiveCellsScalarDataAccess(grid, resultValues, activeCellInfo); + cvf::ref object = new RigGridMatrixActiveCellsScalarDataAccess(grid, resultValues, reservoir->activeCellInfo()); return object; } else { - cvf::ref object = new RigGridFractureActiveCellsScalarDataAccess(grid, resultValues, activeCellInfo); + cvf::ref object = new RigGridFractureActiveCellsScalarDataAccess(grid, resultValues, reservoir->activeCellInfo()); return object; } } @@ -241,5 +243,6 @@ cvf::ref RigGridScalarDataAccessFactory::create cvf::ref object = new RigGridAllCellsScalarDataAccess(grid, resultValues); return object; } + } diff --git a/ApplicationCode/ReservoirDataModel/RigGridScalarDataAccess.h b/ApplicationCode/ReservoirDataModel/RigGridScalarDataAccess.h index 871a45a82f..708d137617 100644 --- a/ApplicationCode/ReservoirDataModel/RigGridScalarDataAccess.h +++ b/ApplicationCode/ReservoirDataModel/RigGridScalarDataAccess.h @@ -30,11 +30,10 @@ class RigGridScalarDataAccessFactory { public: static cvf::ref createDataAccessObject(const RigGridBase* grid, - const RigActiveCellInfo* activeCellInfo, - RifReaderInterface::PorosityModelResultType porosityModel, - size_t timeStepIndex, - size_t scalarSetIndex); - + const RigReservoir* reservoir, + RifReaderInterface::PorosityModelResultType porosityModel, + size_t timeStepIndex, + size_t scalarSetIndex); }; diff --git a/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp b/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp index da86e676f1..4373527880 100644 --- a/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp +++ b/ApplicationCode/ReservoirDataModel/RigMainGrid.cpp @@ -19,16 +19,12 @@ #include "RIStdInclude.h" #include "RigMainGrid.h" -#include "RigReservoirCellResults.h" #include "cvfAssert.h" RigMainGrid::RigMainGrid(void) : RigGridBase(this) { - m_matrixModelResults = new RigReservoirCellResults(this); - m_fractureModelResults = new RigReservoirCellResults(this); - m_displayModelOffset = cvf::Vec3d::ZERO; m_gridIndex = 0; @@ -122,29 +118,3 @@ const RigGridBase* RigMainGrid::gridByIndex(size_t localGridIndex) const return m_localGrids[localGridIndex-1].p(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RigReservoirCellResults* RigMainGrid::results(RifReaderInterface::PorosityModelResultType porosityModel) -{ - if (porosityModel == RifReaderInterface::MATRIX_RESULTS) - { - return m_matrixModelResults.p(); - } - - return m_fractureModelResults.p(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -const RigReservoirCellResults* RigMainGrid::results(RifReaderInterface::PorosityModelResultType porosityModel) const -{ - if (porosityModel == RifReaderInterface::MATRIX_RESULTS) - { - return m_matrixModelResults.p(); - } - - return m_fractureModelResults.p(); -} - diff --git a/ApplicationCode/ReservoirDataModel/RigMainGrid.h b/ApplicationCode/ReservoirDataModel/RigMainGrid.h index 25744fff35..32ef9258bf 100644 --- a/ApplicationCode/ReservoirDataModel/RigMainGrid.h +++ b/ApplicationCode/ReservoirDataModel/RigMainGrid.h @@ -27,8 +27,6 @@ #include -class RigReservoirCellResults; - class RigMainGrid : public RigGridBase { public: @@ -42,9 +40,6 @@ public: std::vector& cells() {return m_cells;} const std::vector& cells() const {return m_cells;} - RigReservoirCellResults* results(RifReaderInterface::PorosityModelResultType porosityModel); - const RigReservoirCellResults* results(RifReaderInterface::PorosityModelResultType porosityModel) const; - void addLocalGrid(RigLocalGrid* localGrid); size_t gridCount() const { return m_localGrids.size() + 1; } RigGridBase* gridByIndex(size_t localGridIndex); @@ -68,9 +63,6 @@ private: std::vector m_cells; ///< Global array of all cells in the reservoir (including the ones in LGR's) cvf::Collection m_localGrids; ///< List of all the LGR's in this reservoir - cvf::ref m_matrixModelResults; - cvf::ref m_fractureModelResults; - cvf::Vec3d m_displayModelOffset; }; diff --git a/ApplicationCode/ReservoirDataModel/RigReservoir.cpp b/ApplicationCode/ReservoirDataModel/RigReservoir.cpp index 051d0d09bd..10ac75eaa3 100644 --- a/ApplicationCode/ReservoirDataModel/RigReservoir.cpp +++ b/ApplicationCode/ReservoirDataModel/RigReservoir.cpp @@ -19,6 +19,8 @@ #include "RIStdInclude.h" #include "RigReservoir.h" #include "RigMainGrid.h" +#include "RigReservoirCellResults.h" +#include "RigGridScalarDataAccess.h" //-------------------------------------------------------------------------------------------------- /// @@ -26,6 +28,9 @@ RigReservoir::RigReservoir() { m_mainGrid = new RigMainGrid(); + + m_matrixModelResults = new RigReservoirCellResults(m_mainGrid.p()); + m_fractureModelResults = new RigReservoirCellResults(m_mainGrid.p()); } //-------------------------------------------------------------------------------------------------- @@ -349,3 +354,45 @@ void RigReservoir::computeActiveCellsGeometryBoundingBox() m_mainGrid->setDisplayModelOffset(bb.min()); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigReservoirCellResults* RigReservoir::results(RifReaderInterface::PorosityModelResultType porosityModel) +{ + if (porosityModel == RifReaderInterface::MATRIX_RESULTS) + { + return m_matrixModelResults.p(); + } + + return m_fractureModelResults.p(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RigReservoirCellResults* RigReservoir::results(RifReaderInterface::PorosityModelResultType porosityModel) const +{ + if (porosityModel == RifReaderInterface::MATRIX_RESULTS) + { + return m_matrixModelResults.p(); + } + + return m_fractureModelResults.p(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::ref RigReservoir::dataAccessObject(const RigGridBase* grid, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, size_t scalarSetIndex) const +{ + if (timeStepIndex != cvf::UNDEFINED_SIZE_T && + scalarSetIndex != cvf::UNDEFINED_SIZE_T) + { + cvf::ref dataAccess = RigGridScalarDataAccessFactory::createDataAccessObject(grid, this, porosityModel, timeStepIndex, scalarSetIndex); + return dataAccess; + } + + return NULL; + +} diff --git a/ApplicationCode/ReservoirDataModel/RigReservoir.h b/ApplicationCode/ReservoirDataModel/RigReservoir.h index a52665af67..9f25da2ab0 100644 --- a/ApplicationCode/ReservoirDataModel/RigReservoir.h +++ b/ApplicationCode/ReservoirDataModel/RigReservoir.h @@ -27,6 +27,8 @@ #include "RigWellResults.h" #include "RigActiveCellInfo.h" +class RigReservoirCellResults; + class RigReservoir: public cvf::Object { @@ -41,6 +43,13 @@ public: void allGrids(std::vector* grids) const; const RigGridBase* grid(size_t index) const; + + RigReservoirCellResults* results(RifReaderInterface::PorosityModelResultType porosityModel); + const RigReservoirCellResults* results(RifReaderInterface::PorosityModelResultType porosityModel) const; + + cvf::ref dataAccessObject(const RigGridBase* grid, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, size_t scalarSetIndex) const; + + void computeCachedData(); void setWellResults(const cvf::Collection& data); @@ -65,8 +74,13 @@ private: private: RigActiveCellInfo m_activeCellInfo; + cvf::ref m_mainGrid; + cvf::ref m_matrixModelResults; + cvf::ref m_fractureModelResults; + + cvf::Collection m_wellResults; cvf::Collection m_wellCellsInGrid; }; diff --git a/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp b/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp index 954eee3ed6..aaaf6ad27c 100644 --- a/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp +++ b/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp @@ -231,6 +231,16 @@ size_t RigReservoirCellResults::timeStepCount(size_t scalarResultIndex) const return m_cellScalarResults[scalarResultIndex].size(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector< std::vector > & RigReservoirCellResults::cellScalarResults( size_t scalarResultIndex ) const +{ + CVF_TIGHT_ASSERT(scalarResultIndex < resultCount()); + + return m_cellScalarResults[scalarResultIndex]; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.h b/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.h index 577f681039..d4065cfeb2 100644 --- a/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.h +++ b/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.h @@ -71,6 +71,7 @@ public: void computeDepthRelatedResults(); // Access the results data + const std::vector< std::vector > & cellScalarResults(size_t scalarResultIndex) const; std::vector< std::vector > & cellScalarResults(size_t scalarResultIndex); double cellScalarResult(size_t timeStepIndex, size_t scalarResultIndex, size_t resultValueIndex); diff --git a/ApplicationCode/SocketInterface/RiaSocketServer.cpp b/ApplicationCode/SocketInterface/RiaSocketServer.cpp index 4dd668fd82..523a2ddc96 100644 --- a/ApplicationCode/SocketInterface/RiaSocketServer.cpp +++ b/ApplicationCode/SocketInterface/RiaSocketServer.cpp @@ -1,4 +1,3 @@ -///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2011-2012 Statoil ASA, Ceetron AS // @@ -281,18 +280,18 @@ void RiaSocketServer::readCommandFromOctave() size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T; std::vector< std::vector >* scalarResultFrames = NULL; - if (reservoir && reservoir->reservoirData() && reservoir->reservoirData()->mainGrid() && reservoir->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)) + if (reservoir && reservoir->reservoirData() && reservoir->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)) { - scalarResultIndex = reservoir->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(propertyName); + scalarResultIndex = reservoir->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(propertyName); if (scalarResultIndex == cvf::UNDEFINED_SIZE_T && isSetProperty) { - scalarResultIndex = reservoir->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::GENERATED, propertyName); + scalarResultIndex = reservoir->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::GENERATED, propertyName); } if (scalarResultIndex != cvf::UNDEFINED_SIZE_T) { - scalarResultFrames = &(reservoir->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(scalarResultIndex)); + scalarResultFrames = &(reservoir->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(scalarResultIndex)); m_currentScalarIndex = scalarResultIndex; m_currentPropertyName = propertyName; } @@ -523,10 +522,9 @@ void RiaSocketServer::readPropertyDataFromOctave() if( m_currentScalarIndex != cvf::UNDEFINED_SIZE_T && m_currentReservoir->reservoirData() && - m_currentReservoir->reservoirData()->mainGrid() && - m_currentReservoir->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS) ) + m_currentReservoir->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS) ) { - m_currentReservoir->reservoirData()->mainGrid()->results(RifReaderInterface::MATRIX_RESULTS)->recalculateMinMax(m_currentScalarIndex); + m_currentReservoir->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->recalculateMinMax(m_currentScalarIndex); } for (size_t i = 0; i < m_currentReservoir->reservoirViews.size(); ++i)