Commit 1d85fecf 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 6e8cf684
......@@ -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)
......
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