Use raw pointers instead of ref count

Added more asserts and cleanup
p4#: 20891
This commit is contained in:
Magne Sjaastad 2013-03-13 14:43:27 +01:00
parent d33a27a082
commit 160456106a
3 changed files with 19 additions and 15 deletions

View File

@ -43,7 +43,7 @@ public:
virtual void setCellScalar(size_t cellIndex, double value);
private:
cvf::cref<RigGridBase> m_grid;
const RigGridBase* m_grid;
std::vector<double>* m_reservoirResultValues;
};
@ -55,6 +55,7 @@ RigGridAllCellsScalarDataAccess::RigGridAllCellsScalarDataAccess(const RigGridBa
m_reservoirResultValues(reservoirResultValues)
{
CVF_ASSERT(reservoirResultValues != NULL);
CVF_ASSERT(grid != NULL);
}
//--------------------------------------------------------------------------------------------------
@ -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
@ -123,7 +125,7 @@ public:
private:
const RigActiveCellInfo* m_activeCellInfo;
cvf::cref<RigGridBase> m_grid;
const RigGridBase* m_grid;
std::vector<double>* m_reservoirResultValues;
};
@ -137,7 +139,6 @@ cvf::ref<cvf::StructGridScalarDataAccess> RigGridScalarDataAccessFactory::create
size_t timeStepIndex,
size_t scalarSetIndex)
{
CVF_ASSERT(gridIndex < eclipseCase->gridCount());
CVF_ASSERT(eclipseCase);
CVF_ASSERT(eclipseCase->results(porosityModel));
@ -158,7 +159,6 @@ cvf::ref<cvf::StructGridScalarDataAccess> RigGridScalarDataAccessFactory::create
std::vector<double>* resultValues = &(scalarSetResults[timeStepIndex]);
bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(scalarSetIndex);
if (useGlobalActiveIndex)
{
@ -170,6 +170,5 @@ cvf::ref<cvf::StructGridScalarDataAccess> RigGridScalarDataAccessFactory::create
cvf::ref<cvf::StructGridScalarDataAccess> object = new RigGridAllCellsScalarDataAccess(grid, resultValues);
return object;
}
}

View File

@ -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<QPair<RimDefines::ResultCatType, QString> >& resultSpecification)
{
CVF_ASSERT(m_destinationCase.notNull());
CVF_ASSERT(m_destinationCase);
computeActiveCellUnion();
@ -372,9 +374,10 @@ void RigStatistics::evaluateStatistics(const QList<QPair<RimDefines::ResultCatTy
//--------------------------------------------------------------------------------------------------
void RigStatistics::debugOutput(RimDefines::ResultCatType resultType, const QString& resultName, size_t timeStepIdx)
{
CVF_ASSERT(m_destinationCase);
qDebug() << resultName << "timeIdx : " << timeStepIdx;
RigReservoirCellResults* matrixResults = m_destinationCase->results(RifReaderInterface::MATRIX_RESULTS);
size_t scalarResultIndex = m_destinationCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(resultType, resultName);
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = m_destinationCase->dataAccessObject(m_destinationCase->mainGrid(), RifReaderInterface::MATRIX_RESULTS, timeStepIdx, scalarResultIndex);
@ -399,5 +402,7 @@ RigStatistics::RigStatistics(cvf::Collection<RigEclipseCase>& sourceCases, const
{
m_globalCellCount = sourceCases[0]->mainGrid()->cells().size();
}
CVF_ASSERT(m_destinationCase);
}

View File

@ -147,6 +147,6 @@ private:
RigStatisticsConfig m_statisticsConfig;
cvf::ref<RigEclipseCase> m_destinationCase;
RigEclipseCase* m_destinationCase;
};