Commit e23bd3bb authored by Mark Olesen's avatar Mark Olesen

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
......@@ -29,8 +29,8 @@
);
}
scalarList Y0(nSpecie, 0.0);
scalarList X0(nSpecie, 0.0);
scalarList Y0(nSpecie, Zero);
scalarList X0(nSpecie, Zero);
dictionary fractions(initialConditions.subDict("fractions"));
if (fractionBasis == "mole")
......
......@@ -44,7 +44,7 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
psiName_("thermo:psi"),
muName_("thermo:mu"),
accommodationCoeff_(1.0),
Twall_(p.size(), 0.0),
Twall_(p.size(), Zero),
gamma_(1.4)
{
refValue() = 0.0;
......
......@@ -45,7 +45,7 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
muName_("thermo:mu"),
tauMCName_("tauMC"),
accommodationCoeff_(1.0),
Uwall_(p.size(), vector(0.0, 0.0, 0.0)),
Uwall_(p.size(), Zero),
thermalCreep_(true),
curvature_(true)
{}
......
......@@ -12,7 +12,7 @@ PtrList<radiation::radiationModel> radiation(fluidRegions.size());
List<scalar> initialMassFluid(fluidRegions.size());
List<label> pRefCellFluid(fluidRegions.size(), -1);
List<scalar> pRefValueFluid(fluidRegions.size(), 0.0);
List<scalar> pRefValueFluid(fluidRegions.size(), Zero);
List<bool> frozenFlowFluid(fluidRegions.size(), false);
PtrList<dimensionedScalar> rhoMax(fluidRegions.size());
......
......@@ -248,7 +248,7 @@ forAll(fluidRegions, i)
IOobject::AUTO_WRITE
),
fluidRegions[i],
dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0)
dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero)
)
);
......
List<scalar> cumulativeContErr(fluidRegions.size(), 0.0);
List<scalar> cumulativeContErr(fluidRegions.size(), Zero);
......@@ -11,7 +11,7 @@ labelListList donorCell(mesh.nInternalFaces());
scalarListList weightCellCells(mesh.nInternalFaces());
// Interpolated HbyA faces
vectorField UIntFaces(mesh.nInternalFaces(), vector::zero);
vectorField UIntFaces(mesh.nInternalFaces(), Zero);
// Determine receptor neighbour cells
labelList receptorNeigCell(mesh.nInternalFaces(), -1);
......@@ -23,7 +23,7 @@ labelList receptorNeigCell(mesh.nInternalFaces(), -1);
label nZones = gMax(zoneID)+1;
PtrList<fvMeshSubset> meshParts(nZones);
labelList nCellsPerZone(nZones, 0);
labelList nCellsPerZone(nZones, Zero);
// A mesh subset for each zone
forAll(meshParts, zonei)
......@@ -173,7 +173,7 @@ labelList receptorNeigCell(mesh.nInternalFaces(), -1);
}
// contravariant U
vectorField U1Contrav(mesh.nInternalFaces(), vector::zero);
vectorField U1Contrav(mesh.nInternalFaces(), Zero);
surfaceVectorField faceNormals(mesh.Sf()/mesh.magSf());
......@@ -192,7 +192,8 @@ forAll(isNeiInterpolatedFace, faceI)
if (cellId != -1)
{
const vector& n = faceNormals[faceI];
vector n1 = vector::zero;
vector n1(Zero);
// 2-D cases
if (mesh.nSolutionD() == 2)
{
......
......@@ -266,7 +266,7 @@ void VoFPatchTransfer::correct
getModelProperty<scalarField>
(
"patchTransferredMasses",
scalarField(patchTransferredMasses_.size(), 0)
scalarField(patchTransferredMasses_.size(), Zero)
)
);
......@@ -302,7 +302,7 @@ void VoFPatchTransfer::patchTransferredMassTotals
getModelProperty<scalarField>
(
"patchTransferredMasses",
scalarField(patchTransferredMasses_.size(), 0)
scalarField(patchTransferredMasses_.size(), Zero)
)
);
......
......@@ -48,8 +48,8 @@ Foam::DTRMParticle::DTRMParticle
)
:
particle(mesh, is, readFields, newFormat),
p0_(point::zero),
p1_(point::zero),
p0_(Zero),
p1_(Zero),
I0_(0),
I_(0),
dA_(0),
......
......@@ -67,7 +67,7 @@ Foam::vector Foam::radiation::noReflection::R
const vector& n
) const
{
return (vector::zero);
return vector::zero;
}
......
......@@ -4,7 +4,7 @@
kappaEff = thermo->kappa() + rho*cp*turbulence->nut()/Prt;
pDivU = dimensionedScalar("pDivU", p.dimensions()/dimTime, 0.0);
pDivU = dimensionedScalar("pDivU", p.dimensions()/dimTime, Zero);
if (thermo->pDivU())
{
......
......@@ -44,7 +44,7 @@ fixedMultiPhaseHeatFluxFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF),
q_(p.size(), 0.0),
q_(p.size(), Zero),
relax_(1.0)
{}
......@@ -131,9 +131,9 @@ void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::updateCoeffs()
const scalarField& Tp = *this;
scalarField A(Tp.size(), scalar(0));
scalarField B(Tp.size(), scalar(0));
scalarField Q(Tp.size(), scalar(0));
scalarField A(Tp.size(), Zero);
scalarField B(Tp.size(), Zero);
scalarField Q(Tp.size(), Zero);
forAll(fluid.phases(), phasei)
{
......
......@@ -43,7 +43,7 @@ tractionDisplacementFvPatchVectorField
:
fixedGradientFvPatchVectorField(p, iF),
traction_(p.size(), Zero),
pressure_(p.size(), 0.0)
pressure_(p.size(), Zero)
{
fvPatchVectorField::operator=(patchInternalField());
gradient() = Zero;
......
......@@ -43,7 +43,7 @@ tractionDisplacementCorrectionFvPatchVectorField
:
fixedGradientFvPatchVectorField(p, iF),
traction_(p.size(), Zero),
pressure_(p.size(), 0.0)
pressure_(p.size(), Zero)
{
fvPatchVectorField::operator=(patchInternalField());
gradient() = Zero;
......
......@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
Info<< "cll1:" << cll1 << endl;
// Resize and assign row by row
labelList row0(2, label(0));
labelList row0(2, Zero);
labelList row1(3, label(1));
labelList rowSizes(2);
......
......@@ -94,7 +94,7 @@ int main(int argc, char *argv[])
false
),
mesh,
dimensionedVector(vector::zero)
dimensionedVector(Zero)
);
fld.boundaryFieldRef()[0] == function1().value(x0);
......
......@@ -61,7 +61,7 @@ void testMapDistribute()
// Send all ones to processor indicated by .first()
// Count how many to send
labelList nSend(Pstream::nProcs(), 0);
labelList nSend(Pstream::nProcs(), Zero);
forAll(complexData, i)
{
label procI = complexData[i].first();
......
......@@ -404,7 +404,7 @@ void testPointSync(const polyMesh& mesh, Random& rndGen)
// Test masterPoints
{
labelList nMasters(mesh.nPoints(), 0);
labelList nMasters(mesh.nPoints(), Zero);
bitSet isMasterPoint(syncTools::getMasterPoints(mesh));
......@@ -480,7 +480,7 @@ void testEdgeSync(const polyMesh& mesh, Random& rndGen)
// Test masterEdges
{
labelList nMasters(edges.size(), 0);
labelList nMasters(edges.size(), Zero);
bitSet isMasterEdge(syncTools::getMasterEdges(mesh));
......@@ -549,7 +549,7 @@ void testFaceSync(const polyMesh& mesh, Random& rndGen)
// Test masterFaces
{
labelList nMasters(mesh.nFaces(), 0);
labelList nMasters(mesh.nFaces(), Zero);
bitSet isMasterFace(syncTools::getMasterFaces(mesh));
......
......@@ -606,7 +606,7 @@ int main(int argc, char *argv[])
List<pointEdgeCollapse> allPointInfo;
const globalIndex globalPoints(mesh.nPoints());
labelList pointPriority(mesh.nPoints(), 0);
labelList pointPriority(mesh.nPoints(), Zero);
cutter.consistentCollapse
(
......
......@@ -263,7 +263,7 @@ int main(int argc, char *argv[])
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
labelList(mesh.nCells(), 0)
labelList(mesh.nCells(), Zero)
);
if (readLevel)
......
......@@ -752,7 +752,7 @@ int main(int argc, char *argv[])
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
labelList(mesh.nCells(), 0)
labelList(mesh.nCells(), Zero)
);
label maxLevel = max(refLevel);
......
......@@ -542,7 +542,7 @@ int main(int argc, char *argv[])
// Now split the boundary faces into external and internal faces. All
// faces go into faceZones and external faces go into patches.
List<faceList> patchFaces(slPatchCells.size());
labelList patchNFaces(slPatchCells.size(), 0);
labelList patchNFaces(slPatchCells.size(), Zero);
forAll(boundary, patchi)
{
const faceList& bFaces = boundary[patchi];
......
......@@ -936,7 +936,7 @@ int main(int argc, char *argv[])
labelListList cellFaces(nCells);
labelList nFacesInCell(nCells, 0);
labelList nFacesInCell(nCells, Zero);
forAll(cellFaces, celli)
{
......
......@@ -911,7 +911,7 @@ int main(int argc, char *argv[])
List<pointEdgeCollapse> allPointInfo;
const globalIndex globalPoints(mesh.nPoints());
labelList pointPriority(mesh.nPoints(), 0);
labelList pointPriority(mesh.nPoints(), Zero);
collapser.consistentCollapse
(
......
......@@ -219,7 +219,7 @@ Foam::cellList Foam::extrudedMesh::extrudedCells
}
// Current face count per cell.
labelList nCellFaces(eCells.size(), 0);
labelList nCellFaces(eCells.size(), Zero);
label facei = 0;
......
......@@ -2053,11 +2053,11 @@ int main(int argc, char *argv[])
// Count how many patches on special edges of extrudePatch are necessary
// - zoneXXX_sides
// - zoneXXX_zoneYYY
labelList zoneSidePatch(zoneNames.size(), 0);
labelList zoneSidePatch(zoneNames.size(), Zero);
// Patch to use for minZone
labelList zoneZonePatch_min(zoneNames.size()*zoneNames.size(), 0);
labelList zoneZonePatch_min(zoneNames.size()*zoneNames.size(), Zero);
// Patch to use for maxZone
labelList zoneZonePatch_max(zoneNames.size()*zoneNames.size(), 0);
labelList zoneZonePatch_max(zoneNames.size()*zoneNames.size(), Zero);
countExtrudePatches
(
......
......@@ -285,7 +285,7 @@ int main(int argc, char *argv[])
List<pointEdgeCollapse> allPointInfo;
const globalIndex globalPoints(mesh().nPoints());
labelList pointPriority(mesh().nPoints(), 0);
labelList pointPriority(mesh().nPoints(), Zero);
collapser.consistentCollapse
(
......
......@@ -44,7 +44,7 @@ Foam::DistributedDelaunayMesh<Triangulation>::buildMap
// ~~~~~~~~~~~~~~~~~~
// 1. Count
labelList nSend(Pstream::nProcs(), 0);
labelList nSend(Pstream::nProcs(), Zero);
forAll(toProc, i)
{
......
......@@ -77,7 +77,7 @@ void Foam::PrintTable<KeyType, DataType>::print
label largestKeyLength = 6;
label largestDataLength = 0;
List<label> largestProcSize(Pstream::nProcs(), 0);
labelList largestProcSize(Pstream::nProcs(), Zero);
forAll(procData, proci)
{
......
......@@ -51,7 +51,7 @@ Foam::autoPtr<Foam::mapDistribute> Foam::backgroundMeshDecomposition::buildMap
// ~~~~~~~~~~~~~~~~~~
// 1. Count
labelList nSend(Pstream::nProcs(), 0);
labelList nSend(Pstream::nProcs(), Zero);
forAll(toProc, i)
{
......@@ -337,7 +337,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
(
cellsToRemove,
exposedFaces,
labelList(exposedFaces.size(), 0), // patchID dummy
labelList(exposedFaces.size(), Zero), // patchID dummy
meshMod
);
......@@ -793,8 +793,8 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
meshCutter_
(
mesh_,
labelList(mesh_.nCells(), 0),
labelList(mesh_.nPoints(), 0)
labelList(mesh_.nCells(), Zero),
labelList(mesh_.nPoints(), Zero)
),
boundaryFacesPtr_(),
bFTreePtr_(),
......
......@@ -1063,7 +1063,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
// Check for cells with one internal face only
labelList nInternalFaces(pMesh.nCells(), label(0));
labelList nInternalFaces(pMesh.nCells(), Zero);
for (label fI = 0; fI < pMesh.nInternalFaces(); fI++)
{
......
......@@ -902,7 +902,7 @@ void Foam::conformalVoronoiMesh::createMultipleEdgePointGroup
const List<extendedFeatureEdgeMesh::sideVolumeType>& normalVolumeTypes =
feMesh.normalVolumeTypes();
labelList nNormalTypes(4, label(0));
labelList nNormalTypes(4, Zero);
forAll(edNormalIs, edgeNormalI)
{
......
......@@ -210,7 +210,7 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
//
// // From all Delaunay vertices to cell (positive index)
// // or patch face (negative index)
// labelList vertexToDualAddressing(number_of_vertices(), 0);
// labelList vertexToDualAddressing(number_of_vertices(), Zero);
//
// forAll(cellToDelaunayVertex, celli)
// {
......@@ -525,7 +525,7 @@ void Foam::conformalVoronoiMesh::reorderPoints
Info<< incrIndent << indent << "Reordering points into internal/external"
<< endl;
labelList oldToNew(points.size(), label(0));
labelList oldToNew(points.size(), Zero);
// Find points that are internal
for (label fI = nInternalFaces; fI < faces.size(); ++fI)
......@@ -611,7 +611,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
const fvMesh& sortMesh = sortMeshPtr();
// Rotation on new faces.
labelList rotation(faces.size(), label(0));
labelList rotation(faces.size(), Zero);
labelList faceMap(faces.size(), label(-1));
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
......@@ -660,7 +660,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
patchDicts[patchi].get<label>("startFace");
labelList patchFaceMap(nPatchFaces, label(-1));
labelList patchFaceRotation(nPatchFaces, label(0));
labelList patchFaceRotation(nPatchFaces, Zero);
bool changed = refCast<const processorPolyPatch>(pp).order
(
......
......@@ -83,7 +83,7 @@ bool Foam::conformalVoronoiMesh::distributeBackground(const Triangulation& mesh)
meshSearch cellSearch(bMesh, polyMesh::FACE_PLANES);