(clang-tidy) : modernize-use-nullptr

This commit is contained in:
Magne Sjaastad
2018-02-18 18:56:43 +01:00
parent 69875eec8f
commit 1ae30ef11a
195 changed files with 552 additions and 552 deletions

View File

@@ -535,8 +535,8 @@ void RivGridBoxGenerator::createLegend(EdgeType edge, cvf::Collection<cvf::Part>
break;
}
std::vector<double>* displayCoordsTickValues = NULL;
std::vector<double>* domainCoordsTickValues = NULL;
std::vector<double>* displayCoordsTickValues = nullptr;
std::vector<double>* domainCoordsTickValues = nullptr;
if (axis == X_AXIS)
{

View File

@@ -67,9 +67,9 @@ bool RivEclipseIntersectionGrid::useCell(size_t cellIndex) const
{
const RigCell& cell = m_mainGrid->globalCellArray()[cellIndex];
if (m_showInactiveCells)
return !(cell.isInvalid() || (cell.subGrid() != NULL));
return !(cell.isInvalid() || (cell.subGrid() != nullptr));
else
return m_activeCellInfo->isActive(cellIndex) && (cell.subGrid() == NULL);
return m_activeCellInfo->isActive(cellIndex) && (cell.subGrid() == nullptr);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -43,7 +43,7 @@
//--------------------------------------------------------------------------------------------------
CellEdgeEffectGenerator::CellEdgeEffectGenerator(const cvf::ScalarMapper* edgeScalarMapper)
{
CVF_ASSERT(edgeScalarMapper != NULL);
CVF_ASSERT(edgeScalarMapper != nullptr);
m_edgeScalarMapper = edgeScalarMapper;

View File

@@ -56,7 +56,7 @@ void RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(
float opacityLevel)
{
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData();
CVF_ASSERT(eclipseCase != NULL);
CVF_ASSERT(eclipseCase != nullptr);
// Create result access objects
@@ -90,7 +90,7 @@ void RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(
double ignoredScalarValue = cellEdgeResultColors->ignoredScalarValue();
const std::vector<cvf::ubyte>* isWellPipeVisible = NULL;
const std::vector<cvf::ubyte>* isWellPipeVisible = nullptr;
cvf::cref<cvf::UIntArray> gridCellToWellindexMap;
if (opacityLevel < 1.0f)
@@ -200,7 +200,7 @@ void RivCellEdgeGeometryUtils::addTernaryCellEdgeResultsToDrawableGeo(size_t tim
cvf::DrawableGeo* geo, size_t gridIndex, float opacityLevel)
{
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData();
CVF_ASSERT(eclipseCase != NULL);
CVF_ASSERT(eclipseCase != nullptr);
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeResultAccessor(cellResultColors, cellEdgeResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
@@ -339,7 +339,7 @@ cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellEdgeResultAccess
//--------------------------------------------------------------------------------------------------
cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellCenterResultAccessor(RimEclipseCellColors* cellResultColors, size_t timeStepIndex, RigEclipseCaseData* eclipseCase, const RigGridBase* grid)
{
cvf::ref<RigResultAccessor> resultAccessor = NULL;
cvf::ref<RigResultAccessor> resultAccessor = nullptr;
if (cellResultColors->hasResult())
{

View File

@@ -60,7 +60,7 @@ cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::generateSurface()
CVF_ASSERT(m_vertices.notNull());
if (m_vertices->size() == 0) return NULL;
if (m_vertices->size() == 0) return nullptr;
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
geo->setFromQuadVertexArray(m_vertices.p());
@@ -75,7 +75,7 @@ cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::generateSurface()
cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::createMeshDrawable()
{
if (!(m_vertices.notNull() && m_vertices->size() != 0)) return NULL;
if (!(m_vertices.notNull() && m_vertices->size() != 0)) return nullptr;
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
geo->setVertexArray(m_vertices.p());
@@ -93,7 +93,7 @@ cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::createMeshDrawable()
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::createOutlineMeshDrawable(double creaseAngle)
{
if (!(m_vertices.notNull() && m_vertices->size() != 0)) return NULL;
if (!(m_vertices.notNull() && m_vertices->size() != 0)) return nullptr;
cvf::OutlineEdgeExtractor ee(creaseAngle, *m_vertices);
@@ -103,7 +103,7 @@ cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::createOutlineMeshDrawable(
cvf::ref<cvf::UIntArray> lineIndices = ee.lineIndices();
if (lineIndices->size() == 0)
{
return NULL;
return nullptr;
}
cvf::ref<cvf::PrimitiveSetIndexedUInt> prim = new cvf::PrimitiveSetIndexedUInt(cvf::PT_LINES);

View File

@@ -374,7 +374,7 @@ void RivFaultPartMgr::updatePartEffect()
m_oppositeFaultFaces->setEffect(geometryOnlyEffect.p());
}
updateNNCColors(0, NULL);
updateNNCColors(0, nullptr);
// Update mesh colors as well, in case of change
RiaPreferences* prefs = RiaApplication::instance()->preferences();
@@ -417,8 +417,8 @@ void RivFaultPartMgr::updatePartEffect()
//--------------------------------------------------------------------------------------------------
void RivFaultPartMgr::createLabelWithAnchorLine(const cvf::Part* part)
{
m_faultLabelPart = NULL;
m_faultLabelLinePart = NULL;
m_faultLabelPart = nullptr;
m_faultLabelLinePart = nullptr;
if (!part) return;

View File

@@ -189,7 +189,7 @@ void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoB
//--------------------------------------------------------------------------------------------------
void RivGridPartMgr::appendPartsToModel(cvf::ModelBasicList* model)
{
CVF_ASSERT(model != NULL);
CVF_ASSERT(model != nullptr);
if(m_surfaceFaces.notNull() ) model->addPart(m_surfaceFaces.p() );
if(m_surfaceGridLines.notNull()) model->addPart(m_surfaceGridLines.p());

View File

@@ -56,7 +56,7 @@ cvf::ref<cvf::DrawableGeo> RivNNCGeometryGenerator::generateSurface()
CVF_ASSERT(m_vertices.notNull());
if (m_vertices->size() == 0) return NULL;
if (m_vertices->size() == 0) return nullptr;
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
geo->setFromTriangleVertexArray(m_vertices.p());
@@ -76,7 +76,7 @@ void RivNNCGeometryGenerator::computeArrays()
long long numConnections = static_cast<long long>(m_nncIndexes.isNull()? m_nncData->connections().size(): m_nncIndexes->size());
bool isVisibilityCalcActive = m_cellVisibility.notNull() && m_grid.notNull();
std::vector<RigCell>* allCells = NULL;
std::vector<RigCell>* allCells = nullptr;
if (isVisibilityCalcActive)
{
allCells = &(m_grid->mainGrid()->globalCellArray());

View File

@@ -108,7 +108,7 @@ cvf::ref<cvf::DrawableGeo> RivPipeGeometryGenerator::createPipeSurface()
{
if (m_radius == 0.0)
{
return NULL;
return nullptr;
}
updateFilteredPipeCenterCoords();
@@ -212,9 +212,9 @@ void RivPipeGeometryGenerator::computeCircle(double radius, size_t tesselationCo
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivPipeGeometryGenerator::generateLine(const cvf::Vec3dArray* coords)
{
CVF_ASSERT(coords != NULL);
CVF_ASSERT(coords != nullptr);
if (coords->size() < 2 ) return NULL;
if (coords->size() < 2 ) return nullptr;
size_t duplicateVertexCount = 2 * (coords->size() - 1);
@@ -259,9 +259,9 @@ cvf::ref<cvf::DrawableGeo> RivPipeGeometryGenerator::generateLine(const cvf::Vec
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivPipeGeometryGenerator::generateExtrudedCylinder(double radius, size_t crossSectionNodeCount, const cvf::Vec3dArray* cylinderCenterCoords)
{
CVF_ASSERT(cylinderCenterCoords != NULL);
CVF_ASSERT(cylinderCenterCoords != nullptr);
if (cylinderCenterCoords->size() < 2) return NULL;
if (cylinderCenterCoords->size() < 2) return nullptr;
std::vector<cvf::Vec3f> crossSectionVertices;
std::vector<cvf::Vec3f> cylinderSegmentNormals;
@@ -300,7 +300,7 @@ cvf::ref<cvf::DrawableGeo> RivPipeGeometryGenerator::generateExtrudedCylinder(do
}
}
if (i >= cylinderCenterCoords->size()-1) return NULL; // The pipe coordinates is all the same point
if (i >= cylinderCenterCoords->size()-1) return nullptr; // The pipe coordinates is all the same point
// Loop along the cylinder center coords and calculate the cross section vertexes in each center vertex
@@ -346,7 +346,7 @@ cvf::ref<cvf::DrawableGeo> RivPipeGeometryGenerator::generateExtrudedCylinder(do
size_t crossSectionCount = crossSectionVertices.size() / crossSectionNodeCount;
if (crossSectionCount < 2) return NULL;
if (crossSectionCount < 2) return nullptr;
CVF_ASSERT(crossSectionVertices.size() - crossSectionNodeCount == cylinderSegmentNormals.size());

View File

@@ -95,7 +95,7 @@ void RivReservoirFaultsPartMgr::setCellVisibility(cvf::UByteArray* cellVisibilit
//--------------------------------------------------------------------------------------------------
void RivReservoirFaultsPartMgr::appendPartsToModel(cvf::ModelBasicList* model)
{
CVF_ASSERT(model != NULL);
CVF_ASSERT(model != nullptr);
RimFaultInViewCollection* faultCollection = m_reservoirView->faultCollection();
if (!faultCollection) return;
@@ -243,7 +243,7 @@ void RivReservoirFaultsPartMgr::updateCellEdgeResultColor(size_t timeStepIndex,
//--------------------------------------------------------------------------------------------------
void RivReservoirFaultsPartMgr::appendLabelPartsToModel(cvf::ModelBasicList* model)
{
CVF_ASSERT(model != NULL);
CVF_ASSERT(model != nullptr);
if (!m_reservoirView) return;
RimFaultInViewCollection* faultCollection = m_reservoirView->faultCollection();

View File

@@ -150,8 +150,8 @@ void RivReservoirViewPartMgr::scheduleGeometryRegen(RivCellSetEnum geometryType)
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType)
{
RigEclipseCaseData* eclipseCase = NULL;
if (m_reservoirView != NULL && m_reservoirView->eclipseCase())
RigEclipseCaseData* eclipseCase = nullptr;
if (m_reservoirView != nullptr && m_reservoirView->eclipseCase())
{
eclipseCase = m_reservoirView->eclipseCase()->eclipseCaseData();
}
@@ -564,10 +564,10 @@ void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisib
bool activeCellsIsVisible,
bool mainGridIsVisible)
{
CVF_ASSERT(cellVisibility != NULL);
CVF_ASSERT(grid != NULL);
CVF_ASSERT(activeCellInfo != NULL);
CVF_ASSERT(cellIsInWellStatuses != NULL);
CVF_ASSERT(cellVisibility != nullptr);
CVF_ASSERT(grid != nullptr);
CVF_ASSERT(activeCellInfo != nullptr);
CVF_ASSERT(cellIsInWellStatuses != nullptr);
CVF_ASSERT(cellIsInWellStatuses->size() >= grid->cellCount());
cellVisibility->resize(grid->cellCount());
@@ -614,8 +614,8 @@ void RivReservoirViewPartMgr::computeOverriddenCellVisibility(cvf::UByteArray* c
std::vector<std::vector<cvf::UByteArray*> > gridsWithCellSetVisibility = masterView->getAllGridsCurrentCellSetsCellVisibility();
#endif
CVF_ASSERT(cellVisibility != NULL);
CVF_ASSERT(grid != NULL);
CVF_ASSERT(cellVisibility != nullptr);
CVF_ASSERT(grid != nullptr);
size_t gridCellCount = grid->cellCount();
cellVisibility->resize(gridCellCount);
@@ -660,8 +660,8 @@ void RivReservoirViewPartMgr::computeOverriddenCellVisibility(cvf::UByteArray* c
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::copyByteArray(cvf::UByteArray* destination, const cvf::UByteArray* source )
{
CVF_ASSERT(destination != NULL);
CVF_ASSERT(source != NULL);
CVF_ASSERT(destination != nullptr);
CVF_ASSERT(source != nullptr);
if (destination->size() != source->size())
{
@@ -685,11 +685,11 @@ void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType
const cvf::UByteArray* nativeVisibility,
const RimCellRangeFilterCollection* rangeFilterColl)
{
CVF_ASSERT(cellVisibility != NULL);
CVF_ASSERT(nativeVisibility != NULL);
CVF_ASSERT(rangeFilterColl != NULL);
CVF_ASSERT(cellVisibility != nullptr);
CVF_ASSERT(nativeVisibility != nullptr);
CVF_ASSERT(rangeFilterColl != nullptr);
CVF_ASSERT(grid != NULL);
CVF_ASSERT(grid != nullptr);
CVF_ASSERT(nativeVisibility->size() == grid->cellCount());
// Initialize range filter with native visibility
@@ -701,7 +701,7 @@ void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType
cvf::CellRangeFilter gridCellRangeFilter;
rangeFilterColl->compoundCellRangeFilter(&gridCellRangeFilter, grid->gridIndex());
const RigLocalGrid* lgr = NULL;
const RigLocalGrid* lgr = nullptr;
cvf::ref<cvf::UByteArray> parentGridVisibilities;
if (!grid->isMainGrid())
@@ -741,7 +741,7 @@ void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType
size_t mainGridJ;
size_t mainGridK;
bool isInSubGridArea = cell.subGrid() != NULL;
bool isInSubGridArea = cell.subGrid() != nullptr;
grid->ijkFromCellIndex(cellIndex, &mainGridI, &mainGridJ, &mainGridK);
bool nativeRangeVisibility = false;
@@ -769,9 +769,9 @@ void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType
void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid, size_t timeStepIndex,
const cvf::UByteArray* rangeFilterVisibility, RimEclipsePropertyFilterCollection* propFilterColl)
{
CVF_ASSERT(cellVisibility != NULL);
CVF_ASSERT(rangeFilterVisibility != NULL);
CVF_ASSERT(propFilterColl != NULL);
CVF_ASSERT(cellVisibility != nullptr);
CVF_ASSERT(rangeFilterVisibility != nullptr);
CVF_ASSERT(propFilterColl != nullptr);
CVF_ASSERT(grid->cellCount() > 0);
CVF_ASSERT(rangeFilterVisibility->size() == grid->cellCount());

View File

@@ -224,10 +224,10 @@ void RivSimWellPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLi
//--------------------------------------------------------------------------------------------------
void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
{
if (m_rimWell == NULL) return;
if (m_rimWell == nullptr) return;
RigSimWellData* simWellData = m_rimWell->simWellData();
if (simWellData == NULL) return;
if (simWellData == nullptr) return;
if (!simWellData->hasWellResult(frameIndex)) return; // Or reset colors or something
@@ -282,14 +282,14 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
for (size_t wcIdx = 0; wcIdx < cellIds.size(); ++wcIdx)
{
// we need a faster lookup, I guess
const RigWellResultPoint* wResCell = NULL;
const RigWellResultPoint* wResCell = nullptr;
if (cellIds[wcIdx].isCell())
{
wResCell = wResFrame.findResultCell(cellIds[wcIdx].m_gridIndex, cellIds[wcIdx].m_gridCellIndex);
}
if (wResCell == NULL)
if (wResCell == nullptr)
{
// We cant find any state. This well cell is closed.
}

View File

@@ -42,7 +42,7 @@ RivSingleCellPartGenerator::RivSingleCellPartGenerator(RigEclipseCaseData* rigCa
: m_rigCaseData(rigCaseData),
m_gridIndex(gridIndex),
m_cellIndex(cellIndex),
m_geoMechCase(NULL)
m_geoMechCase(nullptr)
{
}
@@ -53,7 +53,7 @@ RivSingleCellPartGenerator::RivSingleCellPartGenerator(RimGeoMechCase* rimGeoMec
: m_geoMechCase(rimGeoMechCase),
m_gridIndex(gridIndex),
m_cellIndex(cellIndex),
m_rigCaseData(NULL)
m_rigCaseData(nullptr)
{
}
@@ -101,5 +101,5 @@ cvf::ref<cvf::DrawableGeo> RivSingleCellPartGenerator::createMeshDrawable()
return RivFemPartGeometryGenerator::createMeshDrawableFromSingleElement(femPart, m_cellIndex);
}
return NULL;
return nullptr;
}

View File

@@ -241,9 +241,9 @@ caf::EffectGenerator* RivTernaryScalarMapperEffectGenerator::copy() const
//--------------------------------------------------------------------------------------------------
bool RivTernaryScalarMapperEffectGenerator::isImagesEqual(const cvf::TextureImage* texImg1, const cvf::TextureImage* texImg2)
{
if (texImg1 == NULL && texImg2 == NULL) return true;
if (texImg1 == nullptr && texImg2 == nullptr) return true;
if (texImg1 != NULL && texImg2 != NULL
if (texImg1 != nullptr && texImg2 != nullptr
&& texImg1->height() == texImg2->height()
&& texImg1->width() == texImg2->width()
&& texImg1->width() > 0 && texImg1->height() > 0

View File

@@ -81,7 +81,7 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
RimEclipseCellColors* cellResultColors,
const RivTernaryScalarMapper* ternaryColorMapper,
size_t timeStepIndex)
: m_quadMapper(NULL)
: m_quadMapper(nullptr)
{
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData();
@@ -100,7 +100,7 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
m_resultAccessor->setTernaryResultAccessors(soil.p(), sgas.p(), swat.p());
// Create a texture mapper without detecting transparency using RigPipeInCellEvaluator
m_texMapper = new RivTernaryResultToTextureMapper(ternaryColorMapper, NULL);
m_texMapper = new RivTernaryResultToTextureMapper(ternaryColorMapper, nullptr);
CVF_ASSERT(m_texMapper.notNull());
}