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)
This commit is contained in:
Mark Olesen
2018-12-11 23:50:15 +01:00
parent 6e8cf684d1
commit 1d85fecf4d
342 changed files with 814 additions and 803 deletions

View File

@ -41,7 +41,7 @@ Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcDistribution
if (Pstream::parRun())
{
List<label> facesPresentOnProc(Pstream::nProcs(), 0);
labelList facesPresentOnProc(Pstream::nProcs(), Zero);
if ((srcPatch.size() > 0) || (tgtPatch.size() > 0))
{
facesPresentOnProc[Pstream::myProcNo()] = 1;

View File

@ -257,7 +257,7 @@ void Foam::directAMI<SourcePatch, TargetPatch>::calculate
// list to keep track of whether src face can be mapped
// 1 = mapped, 0 = untested, -1 = cannot map
labelList mapFlag(srcAddr.size(), 0);
labelList mapFlag(srcAddr.size(), Zero);
label nTested = 0;
DynamicList<label> nonOverlapFaces;

View File

@ -49,7 +49,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const
scalarField& result = tresult.ref();
scalarField sumArea(mesh_.nCells(), 0.0);
scalarField sumArea(mesh_.nCells(), Zero);
const vectorField& centres = mesh_.cellCentres();
const vectorField& areas = mesh_.faceAreas();
@ -110,7 +110,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::skewness() const
);
scalarField& result = tresult.ref();
scalarField sumArea(mesh_.nCells(), 0.0);
scalarField sumArea(mesh_.nCells(), Zero);
const vectorField& cellCtrs = mesh_.cellCentres();
const vectorField& faceCtrs = mesh_.faceCentres();

View File

@ -1864,7 +1864,7 @@ bool Foam::extendedEdgeMesh::mergePointsAndSort
}
// Re-classify merged points
labelList nPoints(nNewPoints, 0);
labelList nPoints(nNewPoints, Zero);
forAll(oldToMerged, oldPointI)
{
nPoints[oldToMerged[oldPointI]]++;

View File

@ -80,7 +80,7 @@ void Foam::momentOfInertia::massPropertiesSolid
const scalar r120 = 1.0/120.0;
// order: 1, x, y, z, x^2, y^2, z^2, xy, yz, zx
scalarField integrals(10, 0.0);
scalarField integrals(10, Zero);
forAll(triFaces, i)
{

View File

@ -84,7 +84,7 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
// Find the edges used only once in the cell
labelList edgeUsage(cellEdges.size(), 0);
labelList edgeUsage(cellEdges.size(), Zero);
forAll(curFaces, facei)
{
@ -177,7 +177,7 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
// points marked twice are internal to edge; those marked more than
// twice are corners
labelList pointUsage(cellPoints.size(), 0);
labelList pointUsage(cellPoints.size(), Zero);
forAll(singleEdges, edgeI)
{
@ -737,8 +737,8 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
// (edge, point) addressing.
// Collect the patch sizes
labelList patchSizes(bMesh.size(), 0);
labelList patchStarts(bMesh.size(), 0);
labelList patchSizes(bMesh.size(), Zero);
labelList patchStarts(bMesh.size(), Zero);
forAll(bMesh, patchi)
{

View File

@ -444,7 +444,7 @@ Foam::autoPtr<Foam::mapDistribute> Foam::processorLODs::box::createMap
{
// Per processor refinement info
List<labelList> refineFlags(Pstream::nProcs());
labelList nElems(Pstream::nProcs(), 0);
labelList nElems(Pstream::nProcs(), Zero);
// Assess how many target elements intersect the source bounding boxes
// and use the info to flag how the source boxes should be refined

View File

@ -121,7 +121,7 @@ void Foam::searchableSurfaceCollection::sortHits
) const
{
// Count hits per surface.
labelList nHits(subGeom_.size(), 0);
labelList nHits(subGeom_.size(), Zero);
forAll(info, pointi)
{

View File

@ -76,7 +76,7 @@ void Foam::edgeSurface::calcPointEdges()
{
pointEdges_.setSize(points_.size());
labelList pointNEdges(points_.size(), 0);
labelList pointNEdges(points_.size(), Zero);
forAll(edges_, edgeI)
{

View File

@ -1102,7 +1102,7 @@ Foam::intersectedSurface::intersectedSurface
DynamicList<labelledTri> newTris(eSurf.edges().size()/2);
// Start in newTris for decomposed face.
labelList startTrii(surf.size(), 0);
labelList startTrii(surf.size(), Zero);
forAll(surf, facei)
{

View File

@ -92,7 +92,7 @@ Foam::triSurfaceRegionSearch::treeByRegion() const
regionsAddressing[regionI] = labelList(regionSizes[regionI], -1);
}
labelList nFacesInRegions(nRegions, 0);
labelList nFacesInRegions(nRegions, Zero);
forAll(surface(), fI)
{

View File

@ -160,7 +160,7 @@ Foam::triSurfaceTools::curvatures
symmTensor2D::zero
);
scalarList accumulatedWeights(points.size(), 0.0);
scalarList accumulatedWeights(points.size(), Zero);
forAll(surf, fI)
{