Commit e23bd3bb authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: use Zero when zero-initializing types

- makes the intent clearer and avoids the need for additional
  constructor casting. Eg,

      labelList(10, Zero)    vs.  labelList(10, 0)
      scalarField(10, Zero)  vs.  scalarField(10, scalar(0))
      vectorField(10, Zero)  vs.  vectorField(10, vector::zero)
parent 2ad36438
......@@ -577,7 +577,7 @@ int main(int argc, char *argv[])
}
// Add faces to faceZones
labelList nFaces(mesh.faceZones().size(), 0);
labelList nFaces(mesh.faceZones().size(), Zero);
forAll(faceToZoneID, facei)
{
label zoneID = faceToZoneID[facei];
......
......@@ -550,7 +550,7 @@ int main(int argc, char *argv[])
// Dump duplicated points (if any)
const labelList& pointMap = map().pointMap();
labelList nDupPerPoint(map().nOldPoints(), 0);
labelList nDupPerPoint(map().nOldPoints(), Zero);
pointSet dupPoints(mesh, "duplicatedPoints", 100);
......
......@@ -271,7 +271,7 @@ Foam::mirrorFvMesh::mirrorFvMesh
}
// Mirror boundary faces patch by patch
labelList newPatchSizes(boundary().size(), 0);
labelList newPatchSizes(boundary().size(), Zero);
labelList newPatchStarts(boundary().size(), -1);
forAll(boundaryMesh(), patchi)
......
......@@ -130,7 +130,7 @@ int main(int argc, char *argv[])
}
{
// Number of (master)faces per edge
labelList nMasterFaces(patch.nEdges(), 0);
labelList nMasterFaces(patch.nEdges(), Zero);
forAll(faceLabels, facei)
{
......
......@@ -130,8 +130,8 @@ void getBand
scalar& sumSqrIntersect // scalar to avoid overflow
)
{
labelList cellBandwidth(nCells, 0);
scalarField nIntersect(nCells, 0.0);
labelList cellBandwidth(nCells, Zero);
scalarField nIntersect(nCells, Zero);
forAll(neighbour, facei)
{
......
......@@ -1149,7 +1149,7 @@ label findCorrespondingRegion
)
{
// Per region the number of cells in zoneI
labelList cellsInZone(nCellRegions, 0);
labelList cellsInZone(nCellRegions, Zero);
forAll(cellRegion, celli)
{
......@@ -1267,7 +1267,7 @@ void matchRegions
getZoneID(mesh, cellZones, zoneID, neiZoneID);
// Sizes per cellzone
labelList zoneSizes(cellZones.size(), 0);
labelList zoneSizes(cellZones.size(), Zero);
{
List<wordList> zoneNames(Pstream::nProcs());
zoneNames[Pstream::myProcNo()] = cellZones.names();
......@@ -1753,7 +1753,7 @@ int main(int argc, char *argv[])
// Sizes per region
// ~~~~~~~~~~~~~~~~
labelList regionSizes(nCellRegions, 0);
labelList regionSizes(nCellRegions, Zero);
forAll(cellRegion, celli)
{
......
......@@ -244,7 +244,7 @@ void Foam::domainDecomposition::decomposeMesh()
label nInterfaces = interPatchFaces[proci].size();
subPatchIDs[proci].setSize(nInterfaces, labelList(1, label(-1)));
subPatchStarts[proci].setSize(nInterfaces, labelList(1, label(0)));
subPatchStarts[proci].setSize(nInterfaces, labelList(1, Zero));
}
......
......@@ -115,7 +115,7 @@ void Foam::domainDecomposition::processInterCyclics
{
label nIntfcs = interPatchFaces[proci].size();
subPatchIDs[proci].setSize(nIntfcs, labelList(1, patchi));
subPatchStarts[proci].setSize(nIntfcs, labelList(1, label(0)));
subPatchStarts[proci].setSize(nIntfcs, labelList(1, Zero));
}
}
}
......
......@@ -180,7 +180,7 @@ Foam::faMeshDecomposition::faMeshDecomposition
faceToProc_(nFaces()),
procFaceLabels_(nProcs_),
procMeshEdgesMap_(nProcs_),
procNInternalEdges_(nProcs_, 0),
procNInternalEdges_(nProcs_, Zero),
procPatchEdgeLabels_(nProcs_),
procPatchPointAddressing_(nProcs_),
procPatchEdgeAddressing_(nProcs_),
......@@ -991,7 +991,7 @@ void Foam::faMeshDecomposition::decomposeMesh()
// Memory management
{
labelList pointsUsage(nPoints(), 0);
labelList pointsUsage(nPoints(), Zero);
// Globally shared points are the ones used by more than 2 processors
// Size the list approximately and gather the points
......
......@@ -2671,7 +2671,7 @@ int main(int argc, char *argv[])
<< endl;
label nDestProcs = 1;
labelList finalDecomp = labelList(mesh.nCells(), 0);
labelList finalDecomp = labelList(mesh.nCells(), Zero);
redistributeAndWrite
(
......
......@@ -819,7 +819,7 @@ void Foam::vtkPVFoam::renderPatchNames
// Find the total number of zones
// Each zone will take the patch name
// Number of zones per patch ... zero zones should be skipped
labelList nZones(pbMesh.size(), 0);
labelList nZones(pbMesh.size(), Zero);
// Per global zone number the average face centre position
List<DynamicList<point>> zoneCentre(pbMesh.size());
......@@ -862,7 +862,7 @@ void Foam::vtkPVFoam::renderPatchNames
nZones[patchi] = pZones.nZones();
labelList zoneNFaces(pZones.nZones(), 0);
labelList zoneNFaces(pZones.nZones(), Zero);
// Create storage for additional zone centres
forAll(zoneNFaces, zonei)
......
......@@ -121,7 +121,7 @@ int main(int argc, char *argv[])
// Calculate starting ids for particles on each processor
List<label> startIds(numIds.size(), 0);
labelList startIds(numIds.size(), Zero);
for (label i = 0; i < numIds.size()-1; i++)
{
startIds[i+1] += startIds[i] + numIds[i];
......
......@@ -204,7 +204,7 @@ int main(int argc, char *argv[])
Info<< "\n Generating " << nTracks << " tracks" << endl;
// Determine length of each track
labelList trackLengths(nTracks, 0);
labelList trackLengths(nTracks, Zero);
forAll(particleToTrack, i)
{
const label trackI = particleToTrack[i];
......@@ -237,7 +237,7 @@ int main(int argc, char *argv[])
const scalarField& age = tage();
List<label> trackSamples(nTracks, 0);
labelList trackSamples(nTracks, Zero);
forAll(particleToTrack, i)
{
......
......@@ -44,4 +44,4 @@
filePtr.reset(new OFstream(fName));
}
scalarField samples(nIntervals, 0);
scalarField samples(nIntervals, Zero);
......@@ -485,7 +485,7 @@ int main(int argc, char *argv[])
#include "shootRays.H"
// Calculate number of visible faces from local index
labelList nVisibleFaceFaces(nCoarseFaces, 0);
labelList nVisibleFaceFaces(nCoarseFaces, Zero);
forAll(rayStartFace, i)
{
......@@ -628,7 +628,7 @@ int main(int argc, char *argv[])
0.0
);
scalarList patchArea(totalPatches, 0.0);
scalarList patchArea(totalPatches, Zero);
if (Pstream::master())
{
......
......@@ -57,7 +57,7 @@ Foam::tabulatedWallFunctions::general::interpolationTypeNames_
void Foam::tabulatedWallFunctions::general::invertTable()
{
scalarList Rey(uPlus_.size(), 0.0);
scalarList Rey(uPlus_.size(), Zero);
// Calculate Reynolds number
forAll(uPlus_, i)
......
......@@ -1242,7 +1242,7 @@ autoPtr<extendedFeatureEdgeMesh> createEdgeMesh
label nFeatEds = inter.cutEdges().size();
DynamicList<vector> normals(2*nFeatEds);
vectorField edgeDirections(nFeatEds, vector::zero);
vectorField edgeDirections(nFeatEds, Zero);
DynamicList<extendedFeatureEdgeMesh::sideVolumeType> normalVolumeTypes
(
2*nFeatEds
......
......@@ -80,7 +80,7 @@ labelList countBins
{
scalar dist = nBins/(max - min);
labelList binCount(nBins, 0);
labelList binCount(nBins, Zero);
forAll(vals, i)
{
......@@ -444,7 +444,7 @@ int main(int argc, char *argv[])
// ~~~~~~~~~~~~
{
labelList regionSize(surf.patches().size(), 0);
labelList regionSize(surf.patches().size(), Zero);
forAll(surf, facei)
{
......@@ -541,7 +541,7 @@ int main(int argc, char *argv[])
faces
),
"illegal",
scalarField(subSurf.size(), 0.0),
scalarField(subSurf.size(), Zero),
false // face based data
);
}
......@@ -580,7 +580,7 @@ int main(int argc, char *argv[])
// ~~~~~~~~~~~~~~~~
{
scalarField triQ(surf.size(), 0);
scalarField triQ(surf.size(), Zero);
forAll(surf, facei)
{
const labelledTri& f = surf[facei];
......
......@@ -141,7 +141,7 @@ tmp<vectorField> calcPointNormals
{
const labelListList& edgeFaces = s.edgeFaces();
labelList nNormals(s.nPoints(), 0);
labelList nNormals(s.nPoints(), Zero);
forAll(edgeStat, edgeI)
{
if (edgeStat[edgeI] != surfaceFeatures::NONE)
......@@ -355,10 +355,10 @@ tmp<scalarField> avg
const scalarField& edgeWeights
)
{
tmp<scalarField> tres(new scalarField(s.nPoints(), 0.0));
tmp<scalarField> tres(new scalarField(s.nPoints(), Zero));
scalarField& res = tres.ref();
scalarField sumWeight(s.nPoints(), 0.0);
scalarField sumWeight(s.nPoints(), Zero);
const edgeList& edges = s.edges();
......@@ -499,7 +499,7 @@ void lloydsSmoothing
const pointField& points = s.points();
vectorField pointSum(s.nPoints(), Zero);
labelList nPointSum(s.nPoints(), 0);
labelList nPointSum(s.nPoints(), Zero);
forAll(edges, edgeI)
{
......
......@@ -49,18 +49,18 @@ namespace Foam
Foam::SIBS::SIBS(const ODESystem& ode, const dictionary& dict)
:
ODESolver(ode, dict),
a_(iMaxX_, 0.0),
alpha_(kMaxX_, 0.0),
d_p_(n_, kMaxX_, 0.0),
x_p_(kMaxX_, 0.0),
err_(kMaxX_, 0.0),
yTemp_(n_, 0.0),
ySeq_(n_, 0.0),
yErr_(n_, 0.0),
a_(iMaxX_, Zero),
alpha_(kMaxX_, Zero),
d_p_(n_, kMaxX_, Zero),
x_p_(kMaxX_, Zero),
err_(kMaxX_, Zero),
yTemp_(n_, Zero),
ySeq_(n_, Zero),
yErr_(n_, Zero),
dydx0_(n_),
dfdx_(n_, 0.0),
dfdy_(n_, 0.0),
dfdx_(n_, Zero),
dfdy_(n_, Zero),
first_(1),
epsOld_(-1.0)
{}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment