diff --git a/ApplicationCode/ReservoirDataModel/RigGridScalarDataAccess.cpp b/ApplicationCode/ReservoirDataModel/RigGridScalarDataAccess.cpp index b9d6a61d3b..931ef6fc4c 100644 --- a/ApplicationCode/ReservoirDataModel/RigGridScalarDataAccess.cpp +++ b/ApplicationCode/ReservoirDataModel/RigGridScalarDataAccess.cpp @@ -43,7 +43,7 @@ public: virtual void setCellScalar(size_t cellIndex, double value); private: - cvf::cref m_grid; + const RigGridBase* m_grid; std::vector* m_reservoirResultValues; }; @@ -55,6 +55,7 @@ RigGridAllCellsScalarDataAccess::RigGridAllCellsScalarDataAccess(const RigGridBa m_reservoirResultValues(reservoirResultValues) { CVF_ASSERT(reservoirResultValues != NULL); + CVF_ASSERT(grid != NULL); } //-------------------------------------------------------------------------------------------------- @@ -65,7 +66,7 @@ double RigGridAllCellsScalarDataAccess::cellScalar(size_t gridLocalCellIndex) co if (m_reservoirResultValues->size() == 0 ) return HUGE_VAL; size_t globalGridCellIndex = m_grid->globalGridCellIndex(gridLocalCellIndex); - CVF_TIGHT_ASSERT(globalGridCellIndex < m_reservoirResultValues->size() ); + CVF_TIGHT_ASSERT(globalGridCellIndex < m_reservoirResultValues->size()); return m_reservoirResultValues->at(globalGridCellIndex); } @@ -76,7 +77,7 @@ double RigGridAllCellsScalarDataAccess::cellScalar(size_t gridLocalCellIndex) co void RigGridAllCellsScalarDataAccess::setCellScalar(size_t gridLocalCellIndex, double scalarValue) { size_t globalGridCellIndex = m_grid->globalGridCellIndex(gridLocalCellIndex); - CVF_TIGHT_ASSERT(globalGridCellIndex < m_reservoirResultValues->size() ); + CVF_TIGHT_ASSERT(globalGridCellIndex < m_reservoirResultValues->size()); (*m_reservoirResultValues)[globalGridCellIndex] = scalarValue; } @@ -92,7 +93,8 @@ public: m_reservoirResultValues(reservoirResultValues), m_activeCellInfo(activeCellInfo) { - + CVF_ASSERT(reservoirResultValues != NULL); + CVF_ASSERT(grid != NULL); } virtual double cellScalar(size_t gridLocalCellIndex) const @@ -103,7 +105,7 @@ public: size_t resultValueIndex = m_activeCellInfo->activeIndexInMatrixModel(globalGridCellIndex); if (resultValueIndex == cvf::UNDEFINED_SIZE_T) return HUGE_VAL; - CVF_TIGHT_ASSERT (resultValueIndex < m_reservoirResultValues->size()); + CVF_TIGHT_ASSERT(resultValueIndex < m_reservoirResultValues->size()); return m_reservoirResultValues->at(resultValueIndex); } @@ -116,14 +118,14 @@ public: size_t globalGridCellIndex = m_grid->globalGridCellIndex(gridLocalCellIndex); size_t resultValueIndex = m_activeCellInfo->activeIndexInMatrixModel(globalGridCellIndex); - CVF_TIGHT_ASSERT (resultValueIndex < m_reservoirResultValues->size()); + CVF_TIGHT_ASSERT(resultValueIndex < m_reservoirResultValues->size()); (*m_reservoirResultValues)[resultValueIndex] = scalarValue; } private: const RigActiveCellInfo* m_activeCellInfo; - cvf::cref m_grid; + const RigGridBase* m_grid; std::vector* m_reservoirResultValues; }; @@ -137,7 +139,6 @@ cvf::ref RigGridScalarDataAccessFactory::create size_t timeStepIndex, size_t scalarSetIndex) { - CVF_ASSERT(gridIndex < eclipseCase->gridCount()); CVF_ASSERT(eclipseCase); CVF_ASSERT(eclipseCase->results(porosityModel)); @@ -145,12 +146,12 @@ cvf::ref RigGridScalarDataAccessFactory::create RigGridBase *grid = eclipseCase->grid(gridIndex); - if ( !eclipseCase || !eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel)) + if (!eclipseCase || !eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel)) { return NULL; } - std::vector< std::vector > & scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(scalarSetIndex); + std::vector< std::vector >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(scalarSetIndex); if (timeStepIndex >= scalarSetResults.size()) { return NULL; @@ -158,7 +159,6 @@ cvf::ref RigGridScalarDataAccessFactory::create std::vector* resultValues = &(scalarSetResults[timeStepIndex]); - bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(scalarSetIndex); if (useGlobalActiveIndex) { @@ -170,6 +170,5 @@ cvf::ref RigGridScalarDataAccessFactory::create cvf::ref object = new RigGridAllCellsScalarDataAccess(grid, resultValues); return object; } - } diff --git a/ApplicationCode/ReservoirDataModel/RigStatistics.cpp b/ApplicationCode/ReservoirDataModel/RigStatistics.cpp index b9b1f0bbfc..51d29d7ed7 100644 --- a/ApplicationCode/ReservoirDataModel/RigStatistics.cpp +++ b/ApplicationCode/ReservoirDataModel/RigStatistics.cpp @@ -56,6 +56,8 @@ void RigStatistics::computeActiveCellUnion() return; } + CVF_ASSERT(m_destinationCase); + RigMainGrid* mainGrid = m_sourceCases[0]->mainGrid(); CVF_ASSERT(mainGrid); @@ -165,7 +167,7 @@ void RigStatistics::buildSourceMetaData(RimDefines::ResultCatType resultType, co //-------------------------------------------------------------------------------------------------- void RigStatistics::evaluateStatistics(const QList >& resultSpecification) { - CVF_ASSERT(m_destinationCase.notNull()); + CVF_ASSERT(m_destinationCase); computeActiveCellUnion(); @@ -372,9 +374,10 @@ void RigStatistics::evaluateStatistics(const QListresults(RifReaderInterface::MATRIX_RESULTS); size_t scalarResultIndex = m_destinationCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(resultType, resultName); cvf::ref dataAccessObject = m_destinationCase->dataAccessObject(m_destinationCase->mainGrid(), RifReaderInterface::MATRIX_RESULTS, timeStepIdx, scalarResultIndex); @@ -399,5 +402,7 @@ RigStatistics::RigStatistics(cvf::Collection& sourceCases, const { m_globalCellCount = sourceCases[0]->mainGrid()->cells().size(); } + + CVF_ASSERT(m_destinationCase); } diff --git a/ApplicationCode/ReservoirDataModel/RigStatistics.h b/ApplicationCode/ReservoirDataModel/RigStatistics.h index 05d609903c..f0792129f8 100644 --- a/ApplicationCode/ReservoirDataModel/RigStatistics.h +++ b/ApplicationCode/ReservoirDataModel/RigStatistics.h @@ -147,6 +147,6 @@ private: RigStatisticsConfig m_statisticsConfig; - cvf::ref m_destinationCase; + RigEclipseCase* m_destinationCase; };