C++11: Replaced the C NULL with the safer C++11 nullptr

Requires gcc version 4.7 or higher
This commit is contained in:
Henry Weller
2016-08-05 17:19:38 +01:00
parent 618753c5b4
commit 7656c076c8
363 changed files with 1468 additions and 1416 deletions

View File

@ -216,7 +216,7 @@ void writePatchField
word timeFile = prepend + itoa(timeIndex);
ensightStream* ensightFilePtr = NULL;
ensightStream* ensightFilePtr = nullptr;
if (Pstream::master())
{
if (timeIndex == 0)
@ -330,7 +330,7 @@ void ensightField
const labelList& hexes = meshCellSets.hexes;
const labelList& polys = meshCellSets.polys;
ensightStream* ensightFilePtr = NULL;
ensightStream* ensightFilePtr = nullptr;
if (Pstream::master())
{
// set the filename of the ensight file
@ -548,7 +548,7 @@ void ensightPointField
const wordHashSet& faceZoneNames = eMesh.faceZoneNames();
ensightStream* ensightFilePtr = NULL;
ensightStream* ensightFilePtr = nullptr;
if (Pstream::master())
{
// set the filename of the ensight file

View File

@ -1041,7 +1041,7 @@ void Foam::ensightMesh::write
// set the filename of the ensight file
fileName ensightGeometryFileName = timeFile + "mesh";
ensightStream* ensightGeometryFilePtr = NULL;
ensightStream* ensightGeometryFilePtr = nullptr;
if (Pstream::master())
{
if (binary_)

View File

@ -196,7 +196,7 @@ int main(int argc, char *argv[])
const word prepend = args.globalCaseName() + '.';
OFstream *ensightCaseFilePtr = NULL;
OFstream *ensightCaseFilePtr = nullptr;
if (Pstream::master())
{
fileName caseFileName = prepend + "case";

View File

@ -381,7 +381,7 @@ int main(int argc, char *argv[])
// check that the positions field is present for this time
IOobject* positionPtr = cloudObjs.lookup(word("positions"));
if (positionPtr != NULL)
if (positionPtr != nullptr)
{
ensightParticlePositions
(

View File

@ -111,8 +111,8 @@ Pout<< "zoneName:" << zoneName
INTEGER4 *PassiveVarArray = NULL;
INTEGER4 *VarShareArray = NULL;
INTEGER4 *PassiveVarArray = nullptr;
INTEGER4 *VarShareArray = nullptr;
INTEGER4 ShrConn = 0;
INTEGER4 NumBConns = 0; /* No Boundary Connections */
@ -191,8 +191,8 @@ Pout<< "zoneName:" << zoneName
<< endl;
INTEGER4 *PassiveVarArray = NULL;
INTEGER4 *VarShareArray = NULL;
INTEGER4 *PassiveVarArray = nullptr;
INTEGER4 *VarShareArray = nullptr;
INTEGER4 ShrConn = 0;
INTEGER4 NumBConns = 0; /* No Boundary Connections */
@ -273,8 +273,8 @@ Pout<< "zoneName:" << zoneName
<< endl;
INTEGER4 *PassiveVarArray = NULL;
INTEGER4 *VarShareArray = NULL;
INTEGER4 *PassiveVarArray = nullptr;
INTEGER4 *VarShareArray = nullptr;
INTEGER4 ShrConn = 0;
@ -373,9 +373,9 @@ void Foam::tecplotWriter::writeConnectivity(const fvMesh& mesh) const
FaceNodes.begin(), /* The face nodes array */
FaceLeftElems.begin(), /* The left elements array */
FaceRightElems.begin(), /* The right elements array */
NULL, /* No boundary connection counts */
NULL, /* No boundary connection elements */
NULL /* No boundary connection zones */
nullptr, /* No boundary connection counts */
nullptr, /* No boundary connection elements */
nullptr /* No boundary connection zones */
)
)
{
@ -487,9 +487,9 @@ void Foam::tecplotWriter::writeConnectivity
FaceNodes.begin(), /* The face nodes array */
FaceLeftElems.begin(), /* The left elements array */
FaceRightElems.begin(), /* The right elements array */
NULL, /* No boundary connection counts */
NULL, /* No boundary connection elements */
NULL /* No boundary connection zones */
nullptr, /* No boundary connection counts */
nullptr, /* No boundary connection elements */
nullptr /* No boundary connection zones */
)
)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -206,14 +206,14 @@ int main(int argc, char *argv[])
sFields[i]->correctBoundaryConditions();
sFields[i]->write();
delete sFields[i];
sFields[i] = NULL;
sFields[i] = nullptr;
}
else if (vFields[i])
{
vFields[i]->correctBoundaryConditions();
vFields[i]->write();
delete vFields[i];
vFields[i] = NULL;
vFields[i] = nullptr;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -58,10 +58,10 @@ vtkPV3FoamReader::vtkPV3FoamReader()
SetNumberOfInputPorts(0);
FileName = NULL;
foamData_ = NULL;
FileName = nullptr;
foamData_ = nullptr;
output0_ = NULL;
output0_ = nullptr;
#ifdef VTKPV3FOAM_DUALPORT
// Add second output for the Lagrangian
@ -217,7 +217,7 @@ int vtkPV3FoamReader::RequestInformation
// delete foamData and flag it as fatal error
delete foamData_;
foamData_ = NULL;
foamData_ = nullptr;
return 0;
}

View File

@ -86,7 +86,7 @@ void Foam::vtkPV3Foam::reduceMemory()
if (!reader_->GetCacheMesh())
{
delete meshPtr_;
meshPtr_ = NULL;
meshPtr_ = nullptr;
}
}
@ -226,8 +226,8 @@ Foam::vtkPV3Foam::vtkPV3Foam
)
:
reader_(reader),
dbPtr_(NULL),
meshPtr_(NULL),
dbPtr_(nullptr),
meshPtr_(nullptr),
meshRegion_(polyMesh::defaultRegion),
meshDir_(polyMesh::meshSubDir),
timeIndex_(-1),
@ -347,7 +347,7 @@ void Foam::vtkPV3Foam::updateInfo()
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::updateInfo"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] timeIndex="
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "] timeIndex="
<< timeIndex_ << endl;
}
@ -426,7 +426,7 @@ void Foam::vtkPV3Foam::updateFoamMesh()
if (!reader_->GetCacheMesh())
{
delete meshPtr_;
meshPtr_ = NULL;
meshPtr_ = nullptr;
}
// Check to see if the OpenFOAM mesh has been created
@ -551,7 +551,7 @@ void Foam::vtkPV3Foam::CleanUp()
double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps)
{
int nTimes = 0;
double* tsteps = NULL;
double* tsteps = nullptr;
if (dbPtr_.valid())
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -190,7 +190,7 @@ void Foam::vtkPV3Foam::convertMeshPatches
<< patchName << endl;
}
vtkPolyData* vtkmesh = NULL;
vtkPolyData* vtkmesh = nullptr;
if (patchIds.size() == 1)
{
vtkmesh = patchVTKMesh(patchName, patches[patchIds.begin().key()]);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,7 +45,7 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
const word& cloudName
)
{
vtkPolyData* vtkmesh = NULL;
vtkPolyData* vtkmesh = nullptr;
if (debug)
{

View File

@ -228,7 +228,7 @@ void Foam::vtkPV3Foam::updateInfoPatches
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::updateInfoPatches"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
@ -476,7 +476,7 @@ void Foam::vtkPV3Foam::updateInfoZones
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::updateInfoZones"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
wordList namesLst;

View File

@ -41,7 +41,7 @@ void Foam::vtkPV3Foam::updateInfoFields
{
Info<< "<beg> Foam::vtkPV3Foam::updateInfoFields <"
<< meshType::Mesh::typeName
<< "> [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]"
<< "> [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]"
<< endl;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -56,8 +56,8 @@ vtkPV3blockMeshReader::vtkPV3blockMeshReader()
SetNumberOfInputPorts(0);
FileName = NULL;
foamData_ = NULL;
FileName = nullptr;
foamData_ = nullptr;
ShowPointNumbers = 1;
UpdateGUI = 0;
@ -165,7 +165,7 @@ int vtkPV3blockMeshReader::RequestInformation
//
// // delete foamData and flag it as fatal error
// delete foamData_;
// foamData_ = NULL;
// foamData_ = nullptr;
// return 0;
// }

View File

@ -66,7 +66,7 @@ void Foam::vtkPV3blockMesh::updateInfoBlocks
if (debug)
{
Info<< "<beg> Foam::vtkPV3blockMesh::updateInfoBlocks"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
arrayRangeBlocks_.reset( arraySelection->GetNumberOfArrays() );
@ -109,7 +109,7 @@ void Foam::vtkPV3blockMesh::updateInfoEdges
if (debug)
{
Info<< "<beg> Foam::vtkPV3blockMesh::updateInfoEdges"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() );
@ -150,8 +150,8 @@ Foam::vtkPV3blockMesh::vtkPV3blockMesh
)
:
reader_(reader),
dbPtr_(NULL),
meshPtr_(NULL),
dbPtr_(nullptr),
meshPtr_(nullptr),
meshRegion_(polyMesh::defaultRegion),
meshDir_(polyMesh::meshSubDir),
arrayRangeBlocks_("block"),
@ -269,7 +269,7 @@ void Foam::vtkPV3blockMesh::updateInfo()
if (debug)
{
Info<< "<beg> Foam::vtkPV3blockMesh::updateInfo"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] " << endl;
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "] " << endl;
}
resetCounters();

View File

@ -58,10 +58,10 @@ vtkPVFoamReader::vtkPVFoamReader()
SetNumberOfInputPorts(0);
FileName = NULL;
foamData_ = NULL;
FileName = nullptr;
foamData_ = nullptr;
output0_ = NULL;
output0_ = nullptr;
#ifdef VTKPVFOAM_DUALPORT
// Add second output for the Lagrangian
@ -217,7 +217,7 @@ int vtkPVFoamReader::RequestInformation
// delete foamData and flag it as fatal error
delete foamData_;
foamData_ = NULL;
foamData_ = nullptr;
return 0;
}

View File

@ -86,7 +86,7 @@ void Foam::vtkPVFoam::reduceMemory()
if (!reader_->GetCacheMesh())
{
delete meshPtr_;
meshPtr_ = NULL;
meshPtr_ = nullptr;
}
}
@ -226,8 +226,8 @@ Foam::vtkPVFoam::vtkPVFoam
)
:
reader_(reader),
dbPtr_(NULL),
meshPtr_(NULL),
dbPtr_(nullptr),
meshPtr_(nullptr),
meshRegion_(polyMesh::defaultRegion),
meshDir_(polyMesh::meshSubDir),
timeIndex_(-1),
@ -347,7 +347,7 @@ void Foam::vtkPVFoam::updateInfo()
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::updateInfo"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] timeIndex="
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "] timeIndex="
<< timeIndex_ << endl;
}
@ -426,7 +426,7 @@ void Foam::vtkPVFoam::updateFoamMesh()
if (!reader_->GetCacheMesh())
{
delete meshPtr_;
meshPtr_ = NULL;
meshPtr_ = nullptr;
}
// Check to see if the OpenFOAM mesh has been created
@ -551,7 +551,7 @@ void Foam::vtkPVFoam::CleanUp()
double* Foam::vtkPVFoam::findTimes(int& nTimeSteps)
{
int nTimes = 0;
double* tsteps = NULL;
double* tsteps = nullptr;
if (dbPtr_.valid())
{

View File

@ -188,7 +188,7 @@ void Foam::vtkPVFoam::convertMeshPatches
<< patchName << endl;
}
vtkPolyData* vtkmesh = NULL;
vtkPolyData* vtkmesh = nullptr;
if (patchIds.size() == 1)
{
vtkmesh = patchVTKMesh(patchName, patches[patchIds.begin().key()]);

View File

@ -45,7 +45,7 @@ vtkPolyData* Foam::vtkPVFoam::lagrangianVTKMesh
const word& cloudName
)
{
vtkPolyData* vtkmesh = NULL;
vtkPolyData* vtkmesh = nullptr;
if (debug)
{

View File

@ -228,7 +228,7 @@ void Foam::vtkPVFoam::updateInfoPatches
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::updateInfoPatches"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
@ -476,7 +476,7 @@ void Foam::vtkPVFoam::updateInfoZones
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::updateInfoZones"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
wordList namesLst;

View File

@ -41,7 +41,7 @@ void Foam::vtkPVFoam::updateInfoFields
{
Info<< "<beg> Foam::vtkPVFoam::updateInfoFields <"
<< meshType::Mesh::typeName
<< "> [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]"
<< "> [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]"
<< endl;
}

View File

@ -56,8 +56,8 @@ vtkPVblockMeshReader::vtkPVblockMeshReader()
SetNumberOfInputPorts(0);
FileName = NULL;
foamData_ = NULL;
FileName = nullptr;
foamData_ = nullptr;
ShowPointNumbers = 1;
UpdateGUI = 0;
@ -165,7 +165,7 @@ int vtkPVblockMeshReader::RequestInformation
//
// // delete foamData and flag it as fatal error
// delete foamData_;
// foamData_ = NULL;
// foamData_ = nullptr;
// return 0;
// }

View File

@ -66,7 +66,7 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
if (debug)
{
Info<< "<beg> Foam::vtkPVblockMesh::updateInfoBlocks"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
arrayRangeBlocks_.reset( arraySelection->GetNumberOfArrays() );
@ -109,7 +109,7 @@ void Foam::vtkPVblockMesh::updateInfoEdges
if (debug)
{
Info<< "<beg> Foam::vtkPVblockMesh::updateInfoEdges"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() );
@ -150,8 +150,8 @@ Foam::vtkPVblockMesh::vtkPVblockMesh
)
:
reader_(reader),
dbPtr_(NULL),
meshPtr_(NULL),
dbPtr_(nullptr),
meshPtr_(nullptr),
meshRegion_(polyMesh::defaultRegion),
meshDir_(polyMesh::meshSubDir),
arrayRangeBlocks_("block"),
@ -269,7 +269,7 @@ void Foam::vtkPVblockMesh::updateInfo()
if (debug)
{
Info<< "<beg> Foam::vtkPVblockMesh::updateInfo"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] " << endl;
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "] " << endl;
}
resetCounters();

View File

@ -32,7 +32,7 @@ bool Foam::fieldOk(const IOobjectList& cloudObjs, const word& name)
{
IOobjectList objects(cloudObjs.lookupClass(IOField<Type>::typeName));
return (objects.lookup(name) != NULL);
return (objects.lookup(name) != nullptr);
}
@ -46,7 +46,7 @@ Foam::tmp<Foam::Field<Type>> Foam::readParticleField
IOobjectList objects(cloudObjs.lookupClass(IOField<Type>::typeName));
const IOobject* obj = objects.lookup(name);
if (obj != NULL)
if (obj != nullptr)
{
IOField<Type> newField(*obj);
return tmp<Field<Type>>(new Field<Type>(newField.xfer()));
@ -73,7 +73,7 @@ void Foam::readFields
forAll(fieldNames, j)
{
const IOobject* obj = objects.lookup(fieldNames[j]);
if (obj != NULL)
if (obj != nullptr)
{
Info<< " reading field " << fieldNames[j] << endl;
IOField<Type> newField(*obj);
@ -158,7 +158,7 @@ void Foam::processFields
forAll(userFieldNames, i)
{
IOobject* obj = objects.lookup(userFieldNames[i]);
if (obj != NULL)
if (obj != nullptr)
{
fieldNames.append(obj->name());
}

View File

@ -34,7 +34,7 @@
const scalar xMin = p->minValue();
const scalar xMax = p->maxValue();
autoPtr<OFstream> filePtr(NULL);
autoPtr<OFstream> filePtr(nullptr);
if (writeData)
{
fileName fName = pdfPath/(p->type() + ".data");