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

@ -29,8 +29,8 @@
); );
} }
scalarList Y0(nSpecie, 0.0); scalarList Y0(nSpecie, Zero);
scalarList X0(nSpecie, 0.0); scalarList X0(nSpecie, Zero);
dictionary fractions(initialConditions.subDict("fractions")); dictionary fractions(initialConditions.subDict("fractions"));
if (fractionBasis == "mole") if (fractionBasis == "mole")

View File

@ -44,7 +44,7 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
psiName_("thermo:psi"), psiName_("thermo:psi"),
muName_("thermo:mu"), muName_("thermo:mu"),
accommodationCoeff_(1.0), accommodationCoeff_(1.0),
Twall_(p.size(), 0.0), Twall_(p.size(), Zero),
gamma_(1.4) gamma_(1.4)
{ {
refValue() = 0.0; refValue() = 0.0;

View File

@ -45,7 +45,7 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
muName_("thermo:mu"), muName_("thermo:mu"),
tauMCName_("tauMC"), tauMCName_("tauMC"),
accommodationCoeff_(1.0), accommodationCoeff_(1.0),
Uwall_(p.size(), vector(0.0, 0.0, 0.0)), Uwall_(p.size(), Zero),
thermalCreep_(true), thermalCreep_(true),
curvature_(true) curvature_(true)
{} {}

View File

@ -12,7 +12,7 @@ PtrList<radiation::radiationModel> radiation(fluidRegions.size());
List<scalar> initialMassFluid(fluidRegions.size()); List<scalar> initialMassFluid(fluidRegions.size());
List<label> pRefCellFluid(fluidRegions.size(), -1); 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); List<bool> frozenFlowFluid(fluidRegions.size(), false);
PtrList<dimensionedScalar> rhoMax(fluidRegions.size()); PtrList<dimensionedScalar> rhoMax(fluidRegions.size());

View File

@ -248,7 +248,7 @@ forAll(fluidRegions, i)
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
fluidRegions[i], fluidRegions[i],
dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0) dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero)
) )
); );

View File

@ -1 +1 @@
List<scalar> cumulativeContErr(fluidRegions.size(), 0.0); List<scalar> cumulativeContErr(fluidRegions.size(), Zero);

View File

@ -11,7 +11,7 @@ labelListList donorCell(mesh.nInternalFaces());
scalarListList weightCellCells(mesh.nInternalFaces()); scalarListList weightCellCells(mesh.nInternalFaces());
// Interpolated HbyA faces // Interpolated HbyA faces
vectorField UIntFaces(mesh.nInternalFaces(), vector::zero); vectorField UIntFaces(mesh.nInternalFaces(), Zero);
// Determine receptor neighbour cells // Determine receptor neighbour cells
labelList receptorNeigCell(mesh.nInternalFaces(), -1); labelList receptorNeigCell(mesh.nInternalFaces(), -1);
@ -23,7 +23,7 @@ labelList receptorNeigCell(mesh.nInternalFaces(), -1);
label nZones = gMax(zoneID)+1; label nZones = gMax(zoneID)+1;
PtrList<fvMeshSubset> meshParts(nZones); PtrList<fvMeshSubset> meshParts(nZones);
labelList nCellsPerZone(nZones, 0); labelList nCellsPerZone(nZones, Zero);
// A mesh subset for each zone // A mesh subset for each zone
forAll(meshParts, zonei) forAll(meshParts, zonei)
@ -173,7 +173,7 @@ labelList receptorNeigCell(mesh.nInternalFaces(), -1);
} }
// contravariant U // contravariant U
vectorField U1Contrav(mesh.nInternalFaces(), vector::zero); vectorField U1Contrav(mesh.nInternalFaces(), Zero);
surfaceVectorField faceNormals(mesh.Sf()/mesh.magSf()); surfaceVectorField faceNormals(mesh.Sf()/mesh.magSf());
@ -192,7 +192,8 @@ forAll(isNeiInterpolatedFace, faceI)
if (cellId != -1) if (cellId != -1)
{ {
const vector& n = faceNormals[faceI]; const vector& n = faceNormals[faceI];
vector n1 = vector::zero; vector n1(Zero);
// 2-D cases // 2-D cases
if (mesh.nSolutionD() == 2) if (mesh.nSolutionD() == 2)
{ {

View File

@ -266,7 +266,7 @@ void VoFPatchTransfer::correct
getModelProperty<scalarField> getModelProperty<scalarField>
( (
"patchTransferredMasses", "patchTransferredMasses",
scalarField(patchTransferredMasses_.size(), 0) scalarField(patchTransferredMasses_.size(), Zero)
) )
); );
@ -302,7 +302,7 @@ void VoFPatchTransfer::patchTransferredMassTotals
getModelProperty<scalarField> getModelProperty<scalarField>
( (
"patchTransferredMasses", "patchTransferredMasses",
scalarField(patchTransferredMasses_.size(), 0) scalarField(patchTransferredMasses_.size(), Zero)
) )
); );

View File

@ -48,8 +48,8 @@ Foam::DTRMParticle::DTRMParticle
) )
: :
particle(mesh, is, readFields, newFormat), particle(mesh, is, readFields, newFormat),
p0_(point::zero), p0_(Zero),
p1_(point::zero), p1_(Zero),
I0_(0), I0_(0),
I_(0), I_(0),
dA_(0), dA_(0),

View File

@ -67,7 +67,7 @@ Foam::vector Foam::radiation::noReflection::R
const vector& n const vector& n
) const ) const
{ {
return (vector::zero); return vector::zero;
} }

View File

@ -4,7 +4,7 @@
kappaEff = thermo->kappa() + rho*cp*turbulence->nut()/Prt; 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()) if (thermo->pDivU())
{ {

View File

@ -44,7 +44,7 @@ fixedMultiPhaseHeatFluxFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(p, iF), fixedValueFvPatchScalarField(p, iF),
q_(p.size(), 0.0), q_(p.size(), Zero),
relax_(1.0) relax_(1.0)
{} {}
@ -131,9 +131,9 @@ void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::updateCoeffs()
const scalarField& Tp = *this; const scalarField& Tp = *this;
scalarField A(Tp.size(), scalar(0)); scalarField A(Tp.size(), Zero);
scalarField B(Tp.size(), scalar(0)); scalarField B(Tp.size(), Zero);
scalarField Q(Tp.size(), scalar(0)); scalarField Q(Tp.size(), Zero);
forAll(fluid.phases(), phasei) forAll(fluid.phases(), phasei)
{ {

View File

@ -43,7 +43,7 @@ tractionDisplacementFvPatchVectorField
: :
fixedGradientFvPatchVectorField(p, iF), fixedGradientFvPatchVectorField(p, iF),
traction_(p.size(), Zero), traction_(p.size(), Zero),
pressure_(p.size(), 0.0) pressure_(p.size(), Zero)
{ {
fvPatchVectorField::operator=(patchInternalField()); fvPatchVectorField::operator=(patchInternalField());
gradient() = Zero; gradient() = Zero;

View File

@ -43,7 +43,7 @@ tractionDisplacementCorrectionFvPatchVectorField
: :
fixedGradientFvPatchVectorField(p, iF), fixedGradientFvPatchVectorField(p, iF),
traction_(p.size(), Zero), traction_(p.size(), Zero),
pressure_(p.size(), 0.0) pressure_(p.size(), Zero)
{ {
fvPatchVectorField::operator=(patchInternalField()); fvPatchVectorField::operator=(patchInternalField());
gradient() = Zero; gradient() = Zero;

View File

@ -47,7 +47,7 @@ int main(int argc, char *argv[])
Info<< "cll1:" << cll1 << endl; Info<< "cll1:" << cll1 << endl;
// Resize and assign row by row // Resize and assign row by row
labelList row0(2, label(0)); labelList row0(2, Zero);
labelList row1(3, label(1)); labelList row1(3, label(1));
labelList rowSizes(2); labelList rowSizes(2);

View File

@ -94,7 +94,7 @@ int main(int argc, char *argv[])
false false
), ),
mesh, mesh,
dimensionedVector(vector::zero) dimensionedVector(Zero)
); );
fld.boundaryFieldRef()[0] == function1().value(x0); fld.boundaryFieldRef()[0] == function1().value(x0);

View File

@ -61,7 +61,7 @@ void testMapDistribute()
// Send all ones to processor indicated by .first() // Send all ones to processor indicated by .first()
// Count how many to send // Count how many to send
labelList nSend(Pstream::nProcs(), 0); labelList nSend(Pstream::nProcs(), Zero);
forAll(complexData, i) forAll(complexData, i)
{ {
label procI = complexData[i].first(); label procI = complexData[i].first();

View File

@ -404,7 +404,7 @@ void testPointSync(const polyMesh& mesh, Random& rndGen)
// Test masterPoints // Test masterPoints
{ {
labelList nMasters(mesh.nPoints(), 0); labelList nMasters(mesh.nPoints(), Zero);
bitSet isMasterPoint(syncTools::getMasterPoints(mesh)); bitSet isMasterPoint(syncTools::getMasterPoints(mesh));
@ -480,7 +480,7 @@ void testEdgeSync(const polyMesh& mesh, Random& rndGen)
// Test masterEdges // Test masterEdges
{ {
labelList nMasters(edges.size(), 0); labelList nMasters(edges.size(), Zero);
bitSet isMasterEdge(syncTools::getMasterEdges(mesh)); bitSet isMasterEdge(syncTools::getMasterEdges(mesh));
@ -549,7 +549,7 @@ void testFaceSync(const polyMesh& mesh, Random& rndGen)
// Test masterFaces // Test masterFaces
{ {
labelList nMasters(mesh.nFaces(), 0); labelList nMasters(mesh.nFaces(), Zero);
bitSet isMasterFace(syncTools::getMasterFaces(mesh)); bitSet isMasterFace(syncTools::getMasterFaces(mesh));

View File

@ -606,7 +606,7 @@ int main(int argc, char *argv[])
List<pointEdgeCollapse> allPointInfo; List<pointEdgeCollapse> allPointInfo;
const globalIndex globalPoints(mesh.nPoints()); const globalIndex globalPoints(mesh.nPoints());
labelList pointPriority(mesh.nPoints(), 0); labelList pointPriority(mesh.nPoints(), Zero);
cutter.consistentCollapse cutter.consistentCollapse
( (

View File

@ -263,7 +263,7 @@ int main(int argc, char *argv[])
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
labelList(mesh.nCells(), 0) labelList(mesh.nCells(), Zero)
); );
if (readLevel) if (readLevel)

View File

@ -752,7 +752,7 @@ int main(int argc, char *argv[])
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
labelList(mesh.nCells(), 0) labelList(mesh.nCells(), Zero)
); );
label maxLevel = max(refLevel); label maxLevel = max(refLevel);

View File

@ -542,7 +542,7 @@ int main(int argc, char *argv[])
// Now split the boundary faces into external and internal faces. All // Now split the boundary faces into external and internal faces. All
// faces go into faceZones and external faces go into patches. // faces go into faceZones and external faces go into patches.
List<faceList> patchFaces(slPatchCells.size()); List<faceList> patchFaces(slPatchCells.size());
labelList patchNFaces(slPatchCells.size(), 0); labelList patchNFaces(slPatchCells.size(), Zero);
forAll(boundary, patchi) forAll(boundary, patchi)
{ {
const faceList& bFaces = boundary[patchi]; const faceList& bFaces = boundary[patchi];

View File

@ -936,7 +936,7 @@ int main(int argc, char *argv[])
labelListList cellFaces(nCells); labelListList cellFaces(nCells);
labelList nFacesInCell(nCells, 0); labelList nFacesInCell(nCells, Zero);
forAll(cellFaces, celli) forAll(cellFaces, celli)
{ {

View File

@ -911,7 +911,7 @@ int main(int argc, char *argv[])
List<pointEdgeCollapse> allPointInfo; List<pointEdgeCollapse> allPointInfo;
const globalIndex globalPoints(mesh.nPoints()); const globalIndex globalPoints(mesh.nPoints());
labelList pointPriority(mesh.nPoints(), 0); labelList pointPriority(mesh.nPoints(), Zero);
collapser.consistentCollapse collapser.consistentCollapse
( (

View File

@ -219,7 +219,7 @@ Foam::cellList Foam::extrudedMesh::extrudedCells
} }
// Current face count per cell. // Current face count per cell.
labelList nCellFaces(eCells.size(), 0); labelList nCellFaces(eCells.size(), Zero);
label facei = 0; label facei = 0;

View File

@ -2053,11 +2053,11 @@ int main(int argc, char *argv[])
// Count how many patches on special edges of extrudePatch are necessary // Count how many patches on special edges of extrudePatch are necessary
// - zoneXXX_sides // - zoneXXX_sides
// - zoneXXX_zoneYYY // - zoneXXX_zoneYYY
labelList zoneSidePatch(zoneNames.size(), 0); labelList zoneSidePatch(zoneNames.size(), Zero);
// Patch to use for minZone // 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 // Patch to use for maxZone
labelList zoneZonePatch_max(zoneNames.size()*zoneNames.size(), 0); labelList zoneZonePatch_max(zoneNames.size()*zoneNames.size(), Zero);
countExtrudePatches countExtrudePatches
( (

View File

@ -285,7 +285,7 @@ int main(int argc, char *argv[])
List<pointEdgeCollapse> allPointInfo; List<pointEdgeCollapse> allPointInfo;
const globalIndex globalPoints(mesh().nPoints()); const globalIndex globalPoints(mesh().nPoints());
labelList pointPriority(mesh().nPoints(), 0); labelList pointPriority(mesh().nPoints(), Zero);
collapser.consistentCollapse collapser.consistentCollapse
( (

View File

@ -44,7 +44,7 @@ Foam::DistributedDelaunayMesh<Triangulation>::buildMap
// ~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~
// 1. Count // 1. Count
labelList nSend(Pstream::nProcs(), 0); labelList nSend(Pstream::nProcs(), Zero);
forAll(toProc, i) forAll(toProc, i)
{ {

View File

@ -77,7 +77,7 @@ void Foam::PrintTable<KeyType, DataType>::print
label largestKeyLength = 6; label largestKeyLength = 6;
label largestDataLength = 0; label largestDataLength = 0;
List<label> largestProcSize(Pstream::nProcs(), 0); labelList largestProcSize(Pstream::nProcs(), Zero);
forAll(procData, proci) forAll(procData, proci)
{ {

View File

@ -51,7 +51,7 @@ Foam::autoPtr<Foam::mapDistribute> Foam::backgroundMeshDecomposition::buildMap
// ~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~
// 1. Count // 1. Count
labelList nSend(Pstream::nProcs(), 0); labelList nSend(Pstream::nProcs(), Zero);
forAll(toProc, i) forAll(toProc, i)
{ {
@ -337,7 +337,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
( (
cellsToRemove, cellsToRemove,
exposedFaces, exposedFaces,
labelList(exposedFaces.size(), 0), // patchID dummy labelList(exposedFaces.size(), Zero), // patchID dummy
meshMod meshMod
); );
@ -793,8 +793,8 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
meshCutter_ meshCutter_
( (
mesh_, mesh_,
labelList(mesh_.nCells(), 0), labelList(mesh_.nCells(), Zero),
labelList(mesh_.nPoints(), 0) labelList(mesh_.nPoints(), Zero)
), ),
boundaryFacesPtr_(), boundaryFacesPtr_(),
bFTreePtr_(), bFTreePtr_(),

View File

@ -1063,7 +1063,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
// Check for cells with one internal face only // 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++) for (label fI = 0; fI < pMesh.nInternalFaces(); fI++)
{ {

View File

@ -902,7 +902,7 @@ void Foam::conformalVoronoiMesh::createMultipleEdgePointGroup
const List<extendedFeatureEdgeMesh::sideVolumeType>& normalVolumeTypes = const List<extendedFeatureEdgeMesh::sideVolumeType>& normalVolumeTypes =
feMesh.normalVolumeTypes(); feMesh.normalVolumeTypes();
labelList nNormalTypes(4, label(0)); labelList nNormalTypes(4, Zero);
forAll(edNormalIs, edgeNormalI) forAll(edNormalIs, edgeNormalI)
{ {

View File

@ -210,7 +210,7 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
// //
// // From all Delaunay vertices to cell (positive index) // // From all Delaunay vertices to cell (positive index)
// // or patch face (negative index) // // or patch face (negative index)
// labelList vertexToDualAddressing(number_of_vertices(), 0); // labelList vertexToDualAddressing(number_of_vertices(), Zero);
// //
// forAll(cellToDelaunayVertex, celli) // forAll(cellToDelaunayVertex, celli)
// { // {
@ -525,7 +525,7 @@ void Foam::conformalVoronoiMesh::reorderPoints
Info<< incrIndent << indent << "Reordering points into internal/external" Info<< incrIndent << indent << "Reordering points into internal/external"
<< endl; << endl;
labelList oldToNew(points.size(), label(0)); labelList oldToNew(points.size(), Zero);
// Find points that are internal // Find points that are internal
for (label fI = nInternalFaces; fI < faces.size(); ++fI) for (label fI = nInternalFaces; fI < faces.size(); ++fI)
@ -611,7 +611,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
const fvMesh& sortMesh = sortMeshPtr(); const fvMesh& sortMesh = sortMeshPtr();
// Rotation on new faces. // Rotation on new faces.
labelList rotation(faces.size(), label(0)); labelList rotation(faces.size(), Zero);
labelList faceMap(faces.size(), label(-1)); labelList faceMap(faces.size(), label(-1));
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking); PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
@ -660,7 +660,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
patchDicts[patchi].get<label>("startFace"); patchDicts[patchi].get<label>("startFace");
labelList patchFaceMap(nPatchFaces, label(-1)); labelList patchFaceMap(nPatchFaces, label(-1));
labelList patchFaceRotation(nPatchFaces, label(0)); labelList patchFaceRotation(nPatchFaces, Zero);
bool changed = refCast<const processorPolyPatch>(pp).order bool changed = refCast<const processorPolyPatch>(pp).order
( (

View File

@ -83,7 +83,7 @@ bool Foam::conformalVoronoiMesh::distributeBackground(const Triangulation& mesh)
meshSearch cellSearch(bMesh, polyMesh::FACE_PLANES); meshSearch cellSearch(bMesh, polyMesh::FACE_PLANES);
labelList cellVertices(bMesh.nCells(), label(0)); labelList cellVertices(bMesh.nCells(), Zero);
for for
( (

View File

@ -613,7 +613,7 @@ Foam::Field<bool> Foam::conformationSurfaces::inside
const pointField& samplePts const pointField& samplePts
) const ) const
{ {
return wellInside(samplePts, scalarField(samplePts.size(), 0.0)); return wellInside(samplePts, scalarField(samplePts.size(), Zero));
} }
@ -622,7 +622,7 @@ bool Foam::conformationSurfaces::inside
const point& samplePt const point& samplePt
) const ) const
{ {
return wellInside(pointField(1, samplePt), scalarField(1, 0))[0]; return wellInside(pointField(1, samplePt), scalarField(1, Zero))[0];
} }
@ -631,7 +631,7 @@ Foam::Field<bool> Foam::conformationSurfaces::outside
const pointField& samplePts const pointField& samplePts
) const ) const
{ {
return wellOutside(samplePts, scalarField(samplePts.size(), 0.0)); return wellOutside(samplePts, scalarField(samplePts.size(), Zero));
} }
@ -640,7 +640,7 @@ bool Foam::conformationSurfaces::outside
const point& samplePt const point& samplePt
) const ) const
{ {
return wellOutside(pointField(1, samplePt), scalarField(1, 0))[0]; return wellOutside(pointField(1, samplePt), scalarField(1, Zero))[0];
//return !inside(samplePt); //return !inside(samplePt);
} }

View File

@ -416,7 +416,7 @@ bool Foam::autoDensity::fillBox
pointField linePoints(nLine, Zero); pointField linePoints(nLine, Zero);
scalarField lineSizes(nLine, 0.0); scalarField lineSizes(nLine, Zero);
for (label i = 0; i < surfRes_; i++) for (label i = 0; i < surfRes_; i++)
{ {

View File

@ -113,7 +113,7 @@ Foam::searchableBoxFeatures::features() const
surfacePoints[treeBoundBox::edges[eI].end()] surfacePoints[treeBoundBox::edges[eI].end()]
- surfacePoints[treeBoundBox::edges[eI].start()]; - surfacePoints[treeBoundBox::edges[eI].start()];
normalDirections[eI] = labelList(2, label(0)); normalDirections[eI] = labelList(2, Zero);
for (label j = 0; j < 2; ++j) for (label j = 0; j < 2; ++j)
{ {
const vector cross = const vector cross =

View File

@ -131,7 +131,7 @@ Foam::searchablePlateFeatures::features() const
surface().points()()[edges[eI].end()] surface().points()()[edges[eI].end()]
- surface().points()()[edges[eI].start()]; - surface().points()()[edges[eI].start()];
normalDirections[eI] = labelList(2, label(0)); normalDirections[eI] = labelList(2, Zero);
for (label j = 0; j < 2; ++j) for (label j = 0; j < 2; ++j)
{ {
const vector cross = const vector cross =

View File

@ -108,9 +108,9 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
labelList regionOffset(surfi); labelList regionOffset(surfi);
labelList globalMinLevel(surfi, 0); labelList globalMinLevel(surfi, Zero);
labelList globalMaxLevel(surfi, 0); labelList globalMaxLevel(surfi, Zero);
labelList globalLevelIncr(surfi, 0); labelList globalLevelIncr(surfi, Zero);
PtrList<dictionary> globalPatchInfo(surfi); PtrList<dictionary> globalPatchInfo(surfi);
List<Map<label>> regionMinLevel(surfi); List<Map<label>> regionMinLevel(surfi);
List<Map<label>> regionMaxLevel(surfi); List<Map<label>> regionMaxLevel(surfi);
@ -263,8 +263,8 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
} }
// Rework surface specific information into information per global region // Rework surface specific information into information per global region
labelList minLevel(nRegions, 0); labelList minLevel(nRegions, Zero);
labelList maxLevel(nRegions, 0); labelList maxLevel(nRegions, Zero);
labelList gapLevel(nRegions, -1); labelList gapLevel(nRegions, -1);
PtrList<dictionary> patchInfo(nRegions); PtrList<dictionary> patchInfo(nRegions);

View File

@ -319,7 +319,7 @@ Foam::label Foam::checkTopology
if (allTopology) if (allTopology)
{ {
labelList nInternalFaces(mesh.nCells(), 0); labelList nInternalFaces(mesh.nCells(), Zero);
for (label facei = 0; facei < mesh.nInternalFaces(); facei++) for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
{ {

View File

@ -577,7 +577,7 @@ int main(int argc, char *argv[])
} }
// Add faces to faceZones // Add faces to faceZones
labelList nFaces(mesh.faceZones().size(), 0); labelList nFaces(mesh.faceZones().size(), Zero);
forAll(faceToZoneID, facei) forAll(faceToZoneID, facei)
{ {
label zoneID = faceToZoneID[facei]; label zoneID = faceToZoneID[facei];

View File

@ -550,7 +550,7 @@ int main(int argc, char *argv[])
// Dump duplicated points (if any) // Dump duplicated points (if any)
const labelList& pointMap = map().pointMap(); const labelList& pointMap = map().pointMap();
labelList nDupPerPoint(map().nOldPoints(), 0); labelList nDupPerPoint(map().nOldPoints(), Zero);
pointSet dupPoints(mesh, "duplicatedPoints", 100); pointSet dupPoints(mesh, "duplicatedPoints", 100);

View File

@ -271,7 +271,7 @@ Foam::mirrorFvMesh::mirrorFvMesh
} }
// Mirror boundary faces patch by patch // Mirror boundary faces patch by patch
labelList newPatchSizes(boundary().size(), 0); labelList newPatchSizes(boundary().size(), Zero);
labelList newPatchStarts(boundary().size(), -1); labelList newPatchStarts(boundary().size(), -1);
forAll(boundaryMesh(), patchi) forAll(boundaryMesh(), patchi)

View File

@ -130,7 +130,7 @@ int main(int argc, char *argv[])
} }
{ {
// Number of (master)faces per edge // Number of (master)faces per edge
labelList nMasterFaces(patch.nEdges(), 0); labelList nMasterFaces(patch.nEdges(), Zero);
forAll(faceLabels, facei) forAll(faceLabels, facei)
{ {

View File

@ -130,8 +130,8 @@ void getBand
scalar& sumSqrIntersect // scalar to avoid overflow scalar& sumSqrIntersect // scalar to avoid overflow
) )
{ {
labelList cellBandwidth(nCells, 0); labelList cellBandwidth(nCells, Zero);
scalarField nIntersect(nCells, 0.0); scalarField nIntersect(nCells, Zero);
forAll(neighbour, facei) forAll(neighbour, facei)
{ {

View File

@ -1149,7 +1149,7 @@ label findCorrespondingRegion
) )
{ {
// Per region the number of cells in zoneI // Per region the number of cells in zoneI
labelList cellsInZone(nCellRegions, 0); labelList cellsInZone(nCellRegions, Zero);
forAll(cellRegion, celli) forAll(cellRegion, celli)
{ {
@ -1267,7 +1267,7 @@ void matchRegions
getZoneID(mesh, cellZones, zoneID, neiZoneID); getZoneID(mesh, cellZones, zoneID, neiZoneID);
// Sizes per cellzone // Sizes per cellzone
labelList zoneSizes(cellZones.size(), 0); labelList zoneSizes(cellZones.size(), Zero);
{ {
List<wordList> zoneNames(Pstream::nProcs()); List<wordList> zoneNames(Pstream::nProcs());
zoneNames[Pstream::myProcNo()] = cellZones.names(); zoneNames[Pstream::myProcNo()] = cellZones.names();
@ -1753,7 +1753,7 @@ int main(int argc, char *argv[])
// Sizes per region // Sizes per region
// ~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~
labelList regionSizes(nCellRegions, 0); labelList regionSizes(nCellRegions, Zero);
forAll(cellRegion, celli) forAll(cellRegion, celli)
{ {

View File

@ -244,7 +244,7 @@ void Foam::domainDecomposition::decomposeMesh()
label nInterfaces = interPatchFaces[proci].size(); label nInterfaces = interPatchFaces[proci].size();
subPatchIDs[proci].setSize(nInterfaces, labelList(1, label(-1))); subPatchIDs[proci].setSize(nInterfaces, labelList(1, label(-1)));
subPatchStarts[proci].setSize(nInterfaces, labelList(1, label(0))); subPatchStarts[proci].setSize(nInterfaces, labelList(1, Zero));
} }

View File

@ -115,7 +115,7 @@ void Foam::domainDecomposition::processInterCyclics
{ {
label nIntfcs = interPatchFaces[proci].size(); label nIntfcs = interPatchFaces[proci].size();
subPatchIDs[proci].setSize(nIntfcs, labelList(1, patchi)); subPatchIDs[proci].setSize(nIntfcs, labelList(1, patchi));
subPatchStarts[proci].setSize(nIntfcs, labelList(1, label(0))); subPatchStarts[proci].setSize(nIntfcs, labelList(1, Zero));
} }
} }
} }

View File

@ -180,7 +180,7 @@ Foam::faMeshDecomposition::faMeshDecomposition
faceToProc_(nFaces()), faceToProc_(nFaces()),
procFaceLabels_(nProcs_), procFaceLabels_(nProcs_),
procMeshEdgesMap_(nProcs_), procMeshEdgesMap_(nProcs_),
procNInternalEdges_(nProcs_, 0), procNInternalEdges_(nProcs_, Zero),
procPatchEdgeLabels_(nProcs_), procPatchEdgeLabels_(nProcs_),
procPatchPointAddressing_(nProcs_), procPatchPointAddressing_(nProcs_),
procPatchEdgeAddressing_(nProcs_), procPatchEdgeAddressing_(nProcs_),
@ -991,7 +991,7 @@ void Foam::faMeshDecomposition::decomposeMesh()
// Memory management // Memory management
{ {
labelList pointsUsage(nPoints(), 0); labelList pointsUsage(nPoints(), Zero);
// Globally shared points are the ones used by more than 2 processors // Globally shared points are the ones used by more than 2 processors
// Size the list approximately and gather the points // Size the list approximately and gather the points

View File

@ -2671,7 +2671,7 @@ int main(int argc, char *argv[])
<< endl; << endl;
label nDestProcs = 1; label nDestProcs = 1;
labelList finalDecomp = labelList(mesh.nCells(), 0); labelList finalDecomp = labelList(mesh.nCells(), Zero);
redistributeAndWrite redistributeAndWrite
( (

View File

@ -819,7 +819,7 @@ void Foam::vtkPVFoam::renderPatchNames
// Find the total number of zones // Find the total number of zones
// Each zone will take the patch name // Each zone will take the patch name
// Number of zones per patch ... zero zones should be skipped // 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 // Per global zone number the average face centre position
List<DynamicList<point>> zoneCentre(pbMesh.size()); List<DynamicList<point>> zoneCentre(pbMesh.size());
@ -862,7 +862,7 @@ void Foam::vtkPVFoam::renderPatchNames
nZones[patchi] = pZones.nZones(); nZones[patchi] = pZones.nZones();
labelList zoneNFaces(pZones.nZones(), 0); labelList zoneNFaces(pZones.nZones(), Zero);
// Create storage for additional zone centres // Create storage for additional zone centres
forAll(zoneNFaces, zonei) forAll(zoneNFaces, zonei)

View File

@ -121,7 +121,7 @@ int main(int argc, char *argv[])
// Calculate starting ids for particles on each processor // 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++) for (label i = 0; i < numIds.size()-1; i++)
{ {
startIds[i+1] += startIds[i] + numIds[i]; startIds[i+1] += startIds[i] + numIds[i];

View File

@ -204,7 +204,7 @@ int main(int argc, char *argv[])
Info<< "\n Generating " << nTracks << " tracks" << endl; Info<< "\n Generating " << nTracks << " tracks" << endl;
// Determine length of each track // Determine length of each track
labelList trackLengths(nTracks, 0); labelList trackLengths(nTracks, Zero);
forAll(particleToTrack, i) forAll(particleToTrack, i)
{ {
const label trackI = particleToTrack[i]; const label trackI = particleToTrack[i];
@ -237,7 +237,7 @@ int main(int argc, char *argv[])
const scalarField& age = tage(); const scalarField& age = tage();
List<label> trackSamples(nTracks, 0); labelList trackSamples(nTracks, Zero);
forAll(particleToTrack, i) forAll(particleToTrack, i)
{ {

View File

@ -44,4 +44,4 @@
filePtr.reset(new OFstream(fName)); filePtr.reset(new OFstream(fName));
} }
scalarField samples(nIntervals, 0); scalarField samples(nIntervals, Zero);

View File

@ -485,7 +485,7 @@ int main(int argc, char *argv[])
#include "shootRays.H" #include "shootRays.H"
// Calculate number of visible faces from local index // Calculate number of visible faces from local index
labelList nVisibleFaceFaces(nCoarseFaces, 0); labelList nVisibleFaceFaces(nCoarseFaces, Zero);
forAll(rayStartFace, i) forAll(rayStartFace, i)
{ {
@ -628,7 +628,7 @@ int main(int argc, char *argv[])
0.0 0.0
); );
scalarList patchArea(totalPatches, 0.0); scalarList patchArea(totalPatches, Zero);
if (Pstream::master()) if (Pstream::master())
{ {

View File

@ -57,7 +57,7 @@ Foam::tabulatedWallFunctions::general::interpolationTypeNames_
void Foam::tabulatedWallFunctions::general::invertTable() void Foam::tabulatedWallFunctions::general::invertTable()
{ {
scalarList Rey(uPlus_.size(), 0.0); scalarList Rey(uPlus_.size(), Zero);
// Calculate Reynolds number // Calculate Reynolds number
forAll(uPlus_, i) forAll(uPlus_, i)

View File

@ -1242,7 +1242,7 @@ autoPtr<extendedFeatureEdgeMesh> createEdgeMesh
label nFeatEds = inter.cutEdges().size(); label nFeatEds = inter.cutEdges().size();
DynamicList<vector> normals(2*nFeatEds); DynamicList<vector> normals(2*nFeatEds);
vectorField edgeDirections(nFeatEds, vector::zero); vectorField edgeDirections(nFeatEds, Zero);
DynamicList<extendedFeatureEdgeMesh::sideVolumeType> normalVolumeTypes DynamicList<extendedFeatureEdgeMesh::sideVolumeType> normalVolumeTypes
( (
2*nFeatEds 2*nFeatEds

View File

@ -80,7 +80,7 @@ labelList countBins
{ {
scalar dist = nBins/(max - min); scalar dist = nBins/(max - min);
labelList binCount(nBins, 0); labelList binCount(nBins, Zero);
forAll(vals, i) 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) forAll(surf, facei)
{ {
@ -541,7 +541,7 @@ int main(int argc, char *argv[])
faces faces
), ),
"illegal", "illegal",
scalarField(subSurf.size(), 0.0), scalarField(subSurf.size(), Zero),
false // face based data 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) forAll(surf, facei)
{ {
const labelledTri& f = surf[facei]; const labelledTri& f = surf[facei];

View File

@ -141,7 +141,7 @@ tmp<vectorField> calcPointNormals
{ {
const labelListList& edgeFaces = s.edgeFaces(); const labelListList& edgeFaces = s.edgeFaces();
labelList nNormals(s.nPoints(), 0); labelList nNormals(s.nPoints(), Zero);
forAll(edgeStat, edgeI) forAll(edgeStat, edgeI)
{ {
if (edgeStat[edgeI] != surfaceFeatures::NONE) if (edgeStat[edgeI] != surfaceFeatures::NONE)
@ -355,10 +355,10 @@ tmp<scalarField> avg
const scalarField& edgeWeights 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& res = tres.ref();
scalarField sumWeight(s.nPoints(), 0.0); scalarField sumWeight(s.nPoints(), Zero);
const edgeList& edges = s.edges(); const edgeList& edges = s.edges();
@ -499,7 +499,7 @@ void lloydsSmoothing
const pointField& points = s.points(); const pointField& points = s.points();
vectorField pointSum(s.nPoints(), Zero); vectorField pointSum(s.nPoints(), Zero);
labelList nPointSum(s.nPoints(), 0); labelList nPointSum(s.nPoints(), Zero);
forAll(edges, edgeI) forAll(edges, edgeI)
{ {

View File

@ -49,18 +49,18 @@ namespace Foam
Foam::SIBS::SIBS(const ODESystem& ode, const dictionary& dict) Foam::SIBS::SIBS(const ODESystem& ode, const dictionary& dict)
: :
ODESolver(ode, dict), ODESolver(ode, dict),
a_(iMaxX_, 0.0), a_(iMaxX_, Zero),
alpha_(kMaxX_, 0.0), alpha_(kMaxX_, Zero),
d_p_(n_, kMaxX_, 0.0), d_p_(n_, kMaxX_, Zero),
x_p_(kMaxX_, 0.0), x_p_(kMaxX_, Zero),
err_(kMaxX_, 0.0), err_(kMaxX_, Zero),
yTemp_(n_, 0.0), yTemp_(n_, Zero),
ySeq_(n_, 0.0), ySeq_(n_, Zero),
yErr_(n_, 0.0), yErr_(n_, Zero),
dydx0_(n_), dydx0_(n_),
dfdx_(n_, 0.0), dfdx_(n_, Zero),
dfdy_(n_, 0.0), dfdy_(n_, Zero),
first_(1), first_(1),
epsOld_(-1.0) epsOld_(-1.0)
{} {}

View File

@ -119,7 +119,7 @@ Foam::label Foam::Distribution<Type>::index
// Underflow of this List, storage increase and remapping // Underflow of this List, storage increase and remapping
// required // required
List<scalar> newCmptDistribution(2*cmptDistribution.size(), 0.0); List<scalar> newCmptDistribution(2*cmptDistribution.size(), Zero);
label sOld = cmptDistribution.size(); label sOld = cmptDistribution.size();

View File

@ -70,7 +70,7 @@ Foam::labelListList Foam::invertOneToMany
const labelUList& map const labelUList& map
) )
{ {
labelList sizes(len, 0); labelList sizes(len, Zero);
for (const label newIdx : map) for (const label newIdx : map)
{ {

View File

@ -695,7 +695,7 @@ void Foam::invertManyToMany
) )
{ {
// The output list sizes // The output list sizes
labelList sizes(len, 0); labelList sizes(len, Zero);
for (const InputIntListType& sublist : input) for (const InputIntListType& sublist : input)
{ {

View File

@ -42,6 +42,13 @@ inline Foam::SortableList<T>::SortableList(const label size)
{} {}
template<class T>
inline Foam::SortableList<T>::SortableList(const label size, const zero)
:
List<T>(size, zero())
{}
template<class T> template<class T>
inline Foam::SortableList<T>::SortableList(const label size, const T& val) inline Foam::SortableList<T>::SortableList(const label size, const T& val)
: :

View File

@ -71,7 +71,11 @@ public:
// The indices remain empty until the list is sorted // The indices remain empty until the list is sorted
inline explicit SortableList(const label size); inline explicit SortableList(const label size);
//- Construct given size and initial value. Sort later on //- Construct zero-initialized with given size, sort later.
// The indices remain empty until the list is sorted
inline SortableList(const label size, const zero);
//- Construct given size and initial value, sorting later.
// The indices remain empty until the list is sorted // The indices remain empty until the list is sorted
inline SortableList(const label size, const T& val); inline SortableList(const label size, const T& val);

View File

@ -796,7 +796,7 @@ Foam::label Foam::decomposedBlockData::calcNumProcs
( (
reinterpret_cast<const char*>(&nSendProcs), reinterpret_cast<const char*>(&nSendProcs),
List<int>(nProcs, sizeof(nSendProcs)), List<int>(nProcs, sizeof(nSendProcs)),
List<int>(nProcs, 0), List<int>(nProcs, Zero),
reinterpret_cast<char*>(&n), reinterpret_cast<char*>(&n),
sizeof(n), sizeof(n),
comm comm

View File

@ -58,7 +58,7 @@ void Foam::UPstream::setParRun(const label nProcs, const bool haveThreads)
haveThreads_ = haveThreads; haveThreads_ = haveThreads;
freeCommunicator(UPstream::worldComm); freeCommunicator(UPstream::worldComm);
label comm = allocateCommunicator(-1, labelList(1, label(0)), false); label comm = allocateCommunicator(-1, labelList(1, Zero), false);
if (comm != UPstream::worldComm) if (comm != UPstream::worldComm)
{ {
FatalErrorInFunction FatalErrorInFunction
@ -382,7 +382,7 @@ Foam::UPstream::treeCommunication_(10);
Foam::UPstream::communicator serialComm Foam::UPstream::communicator serialComm
( (
-1, -1,
Foam::labelList(1, Foam::label(0)), Foam::labelList(1, Foam::Zero),
false false
); );

View File

@ -275,9 +275,9 @@ void Foam::Pstream::exchange
List<char*> charRecvBufs(sendBufs.size()); List<char*> charRecvBufs(sendBufs.size());
labelList nRecv(sendBufs.size()); labelList nRecv(sendBufs.size());
labelList startRecv(sendBufs.size(), 0); labelList startRecv(sendBufs.size(), Zero);
labelList nSend(sendBufs.size()); labelList nSend(sendBufs.size());
labelList startSend(sendBufs.size(), 0); labelList startSend(sendBufs.size(), Zero);
for (label iter = 0; iter < nIter; iter++) for (label iter = 0; iter < nIter; iter++)
{ {

View File

@ -25,7 +25,7 @@ Class
Foam::geometricZeroField Foam::geometricZeroField
Description Description
A class representing the concept of a GeometricField of 1 used to avoid A class representing the concept of a GeometricField of 0 used to avoid
unnecessary manipulations for objects which are known to be zero at unnecessary manipulations for objects which are known to be zero at
compile-time. compile-time.
@ -57,6 +57,14 @@ class geometricZeroField
public: public:
// Public typedefs
typedef zeroField Internal;
typedef zeroField Patch;
typedef zeroFieldField Boundary;
typedef zero cmptType;
// Constructors // Constructors
//- Construct null //- Construct null

View File

@ -35,7 +35,7 @@ Foam::curve::curve
const label l const label l
) )
: :
scalarField(l, 0.0), scalarField(l, Zero),
name_(name), name_(name),
style_(style) style_(style)
{} {}

View File

@ -54,7 +54,7 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
) )
: :
IOobject(io), IOobject(io),
List<scalar>(2, 0.0), List<scalar>(2, Zero),
x0_(0.0), x0_(0.0),
dx_(1.0), dx_(1.0),
log10_(false), log10_(false),
@ -93,7 +93,7 @@ Foam::uniformInterpolationTable<Type>::uniformInterpolationTable
IOobject::NO_WRITE, IOobject::NO_WRITE,
false // if used in BCs, could be used by multiple patches false // if used in BCs, could be used by multiple patches
), ),
List<scalar>(2, 0.0), List<scalar>(2, Zero),
x0_(dict.get<scalar>("x0")), x0_(dict.get<scalar>("x0")),
dx_(dict.get<scalar>("dx")), dx_(dict.get<scalar>("dx")),
log10_(dict.lookupOrDefault<Switch>("log10", false)), log10_(dict.lookupOrDefault<Switch>("log10", false)),

View File

@ -41,7 +41,7 @@ void Foam::lduAddressing::calcLosort() const
// Scan the neighbour list to find out how many times the cell // Scan the neighbour list to find out how many times the cell
// appears as a neighbour of the face. Done this way to avoid guessing // appears as a neighbour of the face. Done this way to avoid guessing
// and resizing list // and resizing list
labelList nNbrOfFace(size(), 0); labelList nNbrOfFace(size(), Zero);
const labelUList& nbr = upperAddr(); const labelUList& nbr = upperAddr();
@ -136,7 +136,7 @@ void Foam::lduAddressing::calcLosortStart() const
<< abort(FatalError); << abort(FatalError);
} }
losortStartPtr_ = new labelList(size() + 1, 0); losortStartPtr_ = new labelList(size() + 1, Zero);
labelList& lsrtStart = *losortStartPtr_; labelList& lsrtStart = *losortStartPtr_;
@ -259,7 +259,7 @@ Foam::Tuple2<Foam::label, Foam::scalar> Foam::lduAddressing::band() const
const labelUList& owner = lowerAddr(); const labelUList& owner = lowerAddr();
const labelUList& neighbour = upperAddr(); const labelUList& neighbour = upperAddr();
labelList cellBandwidth(size(), 0); labelList cellBandwidth(size(), Zero);
forAll(neighbour, facei) forAll(neighbour, facei)
{ {

View File

@ -178,7 +178,7 @@ Foam::scalarField& Foam::lduMatrix::lower()
} }
else else
{ {
lowerPtr_ = new scalarField(lduAddr().lowerAddr().size(), 0.0); lowerPtr_ = new scalarField(lduAddr().lowerAddr().size(), Zero);
} }
} }
@ -190,7 +190,7 @@ Foam::scalarField& Foam::lduMatrix::diag()
{ {
if (!diagPtr_) if (!diagPtr_)
{ {
diagPtr_ = new scalarField(lduAddr().size(), 0.0); diagPtr_ = new scalarField(lduAddr().size(), Zero);
} }
return *diagPtr_; return *diagPtr_;
@ -207,7 +207,7 @@ Foam::scalarField& Foam::lduMatrix::upper()
} }
else else
{ {
upperPtr_ = new scalarField(lduAddr().lowerAddr().size(), 0.0); upperPtr_ = new scalarField(lduAddr().lowerAddr().size(), Zero);
} }
} }
@ -225,7 +225,7 @@ Foam::scalarField& Foam::lduMatrix::lower(const label nCoeffs)
} }
else else
{ {
lowerPtr_ = new scalarField(nCoeffs, 0.0); lowerPtr_ = new scalarField(nCoeffs, Zero);
} }
} }
@ -237,7 +237,7 @@ Foam::scalarField& Foam::lduMatrix::diag(const label size)
{ {
if (!diagPtr_) if (!diagPtr_)
{ {
diagPtr_ = new scalarField(size, 0.0); diagPtr_ = new scalarField(size, Zero);
} }
return *diagPtr_; return *diagPtr_;
@ -254,7 +254,7 @@ Foam::scalarField& Foam::lduMatrix::upper(const label nCoeffs)
} }
else else
{ {
upperPtr_ = new scalarField(nCoeffs, 0.0); upperPtr_ = new scalarField(nCoeffs, Zero);
} }
} }

View File

@ -295,7 +295,7 @@ Foam::tmp<Foam::scalarField > Foam::lduMatrix::H1() const
{ {
tmp<scalarField > tH1 tmp<scalarField > tH1
( (
new scalarField(lduAddr().size(), 0.0) new scalarField(lduAddr().size(), Zero)
); );
if (lowerPtr_ || upperPtr_) if (lowerPtr_ || upperPtr_)

View File

@ -70,7 +70,7 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
label maxNnbrs = 10; label maxNnbrs = 10;
// Number of faces for each coarse-cell // Number of faces for each coarse-cell
labelList cCellnFaces(nCoarseCells, 0); labelList cCellnFaces(nCoarseCells, Zero);
// Setup initial packed storage for coarse-cell faces // Setup initial packed storage for coarse-cell faces
labelList cCellFaces(maxNnbrs*nCoarseCells); labelList cCellFaces(maxNnbrs*nCoarseCells);
@ -260,7 +260,11 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
// Get reference to fine-level interfaces // Get reference to fine-level interfaces
const lduInterfacePtrsList& fineInterfaces = interfaceLevel(fineLevelIndex); const lduInterfacePtrsList& fineInterfaces = interfaceLevel(fineLevelIndex);
nPatchFaces_.set(fineLevelIndex, new labelList(fineInterfaces.size(), 0)); nPatchFaces_.set
(
fineLevelIndex,
new labelList(fineInterfaces.size(), Zero)
);
labelList& nPatchFaces = nPatchFaces_[fineLevelIndex]; labelList& nPatchFaces = nPatchFaces_[fineLevelIndex];
patchFaceRestrictAddressing_.set patchFaceRestrictAddressing_.set

View File

@ -135,7 +135,7 @@ Foam::tmp<Foam::labelField> Foam::pairGAMGAgglomeration::agglomerate
// memory management // memory management
{ {
labelList nNbrs(nFineCells, 0); labelList nNbrs(nFineCells, Zero);
forAll(upperAddr, facei) forAll(upperAddr, facei)
{ {

View File

@ -95,7 +95,7 @@ bool Foam::masterCoarsestGAMGProcAgglomeration::agglomerate()
if (nProcs > 1) if (nProcs > 1)
{ {
// Processor restriction map: per processor the coarse processor // Processor restriction map: per processor the coarse processor
labelList procAgglomMap(nProcs, 0); labelList procAgglomMap(nProcs, Zero);
// Master processor // Master processor
labelList masterProcs; labelList masterProcs;

View File

@ -150,7 +150,7 @@ Foam::procFacesGAMGProcAgglomeration::processorAgglomeration
label singleCellMeshComm = UPstream::allocateCommunicator label singleCellMeshComm = UPstream::allocateCommunicator
( (
mesh.comm(), mesh.comm(),
labelList(1, label(0)) // only processor 0 labelList(1, Zero) // only processor 0
); );
scalarField faceWeights; scalarField faceWeights;

View File

@ -253,7 +253,7 @@ void Foam::GAMGSolver::agglomerateInterfaceCoefficients
coarseInterfaceBouCoeffs.set coarseInterfaceBouCoeffs.set
( (
inti, inti,
new scalarField(nPatchFaces[inti], 0.0) new scalarField(nPatchFaces[inti], Zero)
); );
agglomeration_.restrictField agglomeration_.restrictField
( (
@ -265,7 +265,7 @@ void Foam::GAMGSolver::agglomerateInterfaceCoefficients
coarseInterfaceIntCoeffs.set coarseInterfaceIntCoeffs.set
( (
inti, inti,
new scalarField(nPatchFaces[inti], 0.0) new scalarField(nPatchFaces[inti], Zero)
); );
agglomeration_.restrictField agglomeration_.restrictField
( (

View File

@ -80,7 +80,7 @@ Foam::tmp<Foam::scalarField> Foam::GAMGInterface::agglomerateCoeffs
const scalarField& fineCoeffs const scalarField& fineCoeffs
) const ) const
{ {
tmp<scalarField> tcoarseCoeffs(new scalarField(size(), 0.0)); tmp<scalarField> tcoarseCoeffs(new scalarField(size(), Zero));
scalarField& coarseCoeffs = tcoarseCoeffs.ref(); scalarField& coarseCoeffs = tcoarseCoeffs.ref();
if (fineCoeffs.size() != faceRestrictAddressing_.size()) if (fineCoeffs.size() != faceRestrictAddressing_.size())

View File

@ -221,7 +221,7 @@ void Foam::multiply
<< abort(FatalError); << abort(FatalError);
} }
ans = scalarRectangularMatrix(A.m(), C.n(), scalar(0)); ans = scalarRectangularMatrix(A.m(), C.n(), Zero);
for (label i=0; i<A.m(); i++) for (label i=0; i<A.m(); i++)
{ {
@ -265,7 +265,7 @@ void Foam::multiply
<< abort(FatalError); << abort(FatalError);
} }
ans = scalarRectangularMatrix(A.m(), C.n(), scalar(0)); ans = scalarRectangularMatrix(A.m(), C.n(), Zero);
for (label i=0; i<A.m(); i++) for (label i=0; i<A.m(); i++)
{ {

View File

@ -249,7 +249,7 @@ void Foam::multiply
<< abort(FatalError); << abort(FatalError);
} }
ans = Matrix<Form, Type>(A.m(), B.n(), scalar(0)); ans = Matrix<Form, Type>(A.m(), B.n(), Zero);
for (label i=0; i<A.m(); i++) for (label i=0; i<A.m(); i++)
{ {

View File

@ -242,7 +242,7 @@ Foam::commSchedule::commSchedule
// Sort schedule_ by processor // Sort schedule_ by processor
labelList nProcScheduled(nProcs, 0); labelList nProcScheduled(nProcs, Zero);
// Count // Count
forAll(schedule_, i) forAll(schedule_, i)

View File

@ -152,7 +152,7 @@ Foam::labelList Foam::bandCompression
) )
{ {
// Count number of neighbours // Count number of neighbours
labelList numNbrs(offsets.size()-1, 0); labelList numNbrs(offsets.size()-1, Zero);
forAll(numNbrs, celli) forAll(numNbrs, celli)
{ {
label start = offsets[celli]; label start = offsets[celli];

View File

@ -132,7 +132,7 @@ Foam::labelList Foam::lduPrimitiveMesh::upperTriOrder
const labelUList& upper const labelUList& upper
) )
{ {
labelList nNbrs(nCells, 0); labelList nNbrs(nCells, Zero);
// Count number of upper neighbours // Count number of upper neighbours
forAll(lower, facei) forAll(lower, facei)
@ -377,7 +377,7 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh
label nOtherInterfaces = 0; label nOtherInterfaces = 0;
labelList nCoupledFaces(nMeshes, 0); labelList nCoupledFaces(nMeshes, Zero);
for (label procMeshI = 0; procMeshI < nMeshes; procMeshI++) for (label procMeshI = 0; procMeshI < nMeshes; procMeshI++)
{ {

View File

@ -84,9 +84,9 @@ Foam::cellShape Foam::degenerateMatcher::match(const faceList& faces)
return match return match
( (
faces, faces,
labelList(faces.size(), 0), // cell 0 is owner of all faces labelList(faces.size(), Zero), // cell 0 is owner of all faces
0, // cell 0 0, // cell 0
identity(faces.size()) // cell 0 consists of all faces identity(faces.size()) // cell 0 consists of all faces
); );
} }

View File

@ -287,10 +287,10 @@ bool Foam::hexMatcher::isA(const faceList& faces)
return matchShape return matchShape
( (
true, true,
faces, // all faces in mesh faces, // all faces in mesh
labelList(faces.size(), 0), // cell 0 is owner of all faces labelList(faces.size(), Zero), // cell 0 is owner of all faces
0, // cell label 0, // cell label
identity(faces.size()) // faces of cell 0 identity(faces.size()) // faces of cell 0
); );
} }

View File

@ -346,10 +346,10 @@ bool Foam::prismMatcher::isA(const faceList& faces)
return matchShape return matchShape
( (
true, true,
faces, // all faces in mesh faces, // all faces in mesh
labelList(faces.size(), 0), // cell 0 is owner of all faces labelList(faces.size(), Zero), // cell 0 is owner of all faces
0, // cell label 0, // cell label
identity(faces.size()) // faces of cell 0 identity(faces.size()) // faces of cell 0
); );
} }

View File

@ -268,10 +268,10 @@ bool Foam::pyrMatcher::isA(const faceList& faces)
return matchShape return matchShape
( (
true, true,
faces, // all faces in mesh faces, // all faces in mesh
labelList(faces.size(), 0), // cell 0 is owner of all faces labelList(faces.size(), Zero), // cell 0 is owner of all faces
0, // cell label 0, // cell label
identity(faces.size()) // faces of cell 0 identity(faces.size()) // faces of cell 0
); );
} }

View File

@ -227,10 +227,10 @@ bool Foam::tetMatcher::isA(const faceList& faces)
return matchShape return matchShape
( (
true, true,
faces, // all faces in mesh faces, // all faces in mesh
labelList(faces.size(), 0), // cell 0 is owner of all faces labelList(faces.size(), Zero), // cell 0 is owner of all faces
0, // cell label 0, // cell label
identity(faces.size()) // faces of cell 0 identity(faces.size()) // faces of cell 0
); );
} }

View File

@ -273,10 +273,10 @@ bool Foam::tetWedgeMatcher::isA(const faceList& faces)
return matchShape return matchShape
( (
true, true,
faces, // all faces in mesh faces, // all faces in mesh
labelList(faces.size(), 0), // cell 0 is owner of all faces labelList(faces.size(), Zero), // cell 0 is owner of all faces
0, // cell label 0, // cell label
identity(faces.size()) // faces of cell 0 identity(faces.size()) // faces of cell 0
); );
} }

View File

@ -373,10 +373,10 @@ bool Foam::wedgeMatcher::isA(const faceList& faces)
return matchShape return matchShape
( (
true, true,
faces, // all faces in mesh faces, // all faces in mesh
labelList(faces.size(), 0), // cell 0 is owner of all faces labelList(faces.size(), Zero), // cell 0 is owner of all faces
0, // cell label 0, // cell label
identity(faces.size()) // faces of cell 0 identity(faces.size()) // faces of cell 0
); );
} }

View File

@ -118,7 +118,7 @@ void Foam::pointMapper::calcAddressing() const
{ {
// Mapped from a single point // Mapped from a single point
addr[pointi] = labelList(1, cm[pointi]); addr[pointi] = labelList(1, cm[pointi]);
w[pointi] = scalarList(1, 1.0); w[pointi] = scalarList(1, scalar(1));
} }
} }
@ -134,8 +134,8 @@ void Foam::pointMapper::calcAddressing() const
if (addr[pointi].empty()) if (addr[pointi].empty())
{ {
// Mapped from a dummy point. Take point 0 with weight 1. // Mapped from a dummy point. Take point 0 with weight 1.
addr[pointi] = labelList(1, label(0)); addr[pointi] = labelList(1, Zero);
w[pointi] = scalarList(1, 1.0); w[pointi] = scalarList(1, scalar(1));
insertedPoints[nInsertedPoints] = pointi; insertedPoints[nInsertedPoints] = pointi;
nInsertedPoints++; nInsertedPoints++;

View File

@ -83,14 +83,14 @@ void Foam::pointPatchMapper::calcAddressing() const
if (ppm[i] >= 0) if (ppm[i] >= 0)
{ {
addr[i] = labelList(1, ppm[i]); addr[i] = labelList(1, ppm[i]);
w[i] = scalarList(1, 1.0); w[i] = scalarList(1, scalar(1));
} }
else else
{ {
// Inserted point. // Inserted point.
///// Map from point0 (arbitrary choice) ///// Map from point0 (arbitrary choice)
//addr[i] = labelList(1, label(0)); //addr[i] = labelList(1, Zero);
//w[i] = scalarList(1, 1.0); //w[i] = scalarList(1, scalar(1));
hasUnmapped_ = true; hasUnmapped_ = true;
} }
} }

View File

@ -1234,7 +1234,7 @@ void Foam::globalMeshData::calcPointBoundaryFaces
// 1. Count // 1. Count
labelList nPointFaces(coupledPatch().nPoints(), 0); labelList nPointFaces(coupledPatch().nPoints(), Zero);
forAll(bMesh, patchi) forAll(bMesh, patchi)
{ {

View File

@ -262,8 +262,8 @@ void Foam::cellMapper::calcAddressing() const
if (addr[celli].empty()) if (addr[celli].empty())
{ {
// Mapped from a dummy cell // Mapped from a dummy cell
addr[celli] = labelList(1, label(0)); addr[celli] = labelList(1, Zero);
w[celli] = scalarList(1, 1.0); w[celli] = scalarList(1, scalar(1));
insertedCells[nInsertedCells] = celli; insertedCells[nInsertedCells] = celli;
nInsertedCells++; nInsertedCells++;

View File

@ -177,8 +177,8 @@ void Foam::faceMapper::calcAddressing() const
if (addr[facei].empty()) if (addr[facei].empty())
{ {
// Mapped from a dummy face // Mapped from a dummy face
addr[facei] = labelList(1, label(0)); addr[facei] = labelList(1, Zero);
w[facei] = scalarList(1, 1.0); w[facei] = scalarList(1, scalar(1));
insertedFaces[nInsertedFaces] = facei; insertedFaces[nInsertedFaces] = facei;
nInsertedFaces++; nInsertedFaces++;

View File

@ -311,7 +311,7 @@ Foam::mapDistribute::mapDistribute
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Count per transformIndex // Count per transformIndex
label nTrafo = globalTransforms.transformPermutations().size(); label nTrafo = globalTransforms.transformPermutations().size();
labelList nPerTransform(nTrafo, 0); labelList nPerTransform(nTrafo, Zero);
forAll(transformedElements, i) forAll(transformedElements, i)
{ {
labelPair elem = transformedElements[i]; labelPair elem = transformedElements[i];
@ -420,7 +420,7 @@ Foam::mapDistribute::mapDistribute
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Count per transformIndex // Count per transformIndex
label nTrafo = globalTransforms.transformPermutations().size(); label nTrafo = globalTransforms.transformPermutations().size();
labelList nPerTransform(nTrafo, 0); labelList nPerTransform(nTrafo, Zero);
forAll(transformedElements, celli) forAll(transformedElements, celli)
{ {
const labelPairList& elems = transformedElements[celli]; const labelPairList& elems = transformedElements[celli];

View File

@ -289,7 +289,7 @@ void Foam::mapDistributeBase::calcCompactAddressing
compactMap.setSize(Pstream::nProcs()); compactMap.setSize(Pstream::nProcs());
// Count all (non-local) elements needed. Just for presizing map. // Count all (non-local) elements needed. Just for presizing map.
labelList nNonLocal(Pstream::nProcs(), 0); labelList nNonLocal(Pstream::nProcs(), Zero);
forAll(elements, i) forAll(elements, i)
{ {
@ -338,7 +338,7 @@ void Foam::mapDistributeBase::calcCompactAddressing
compactMap.setSize(Pstream::nProcs()); compactMap.setSize(Pstream::nProcs());
// Count all (non-local) elements needed. Just for presizing map. // Count all (non-local) elements needed. Just for presizing map.
labelList nNonLocal(Pstream::nProcs(), 0); labelList nNonLocal(Pstream::nProcs(), Zero);
forAll(cellCells, cellI) forAll(cellCells, cellI)
{ {
@ -616,8 +616,8 @@ Foam::mapDistributeBase::mapDistributeBase
} }
// Per processor the number of samples we have to send/receive. // Per processor the number of samples we have to send/receive.
labelList nSend(Pstream::nProcs(), 0); labelList nSend(Pstream::nProcs(), Zero);
labelList nRecv(Pstream::nProcs(), 0); labelList nRecv(Pstream::nProcs(), Zero);
forAll(sendProcs, sampleI) forAll(sendProcs, sampleI)
{ {

View File

@ -55,7 +55,7 @@ Foam::label Foam::polyMeshTetDecomposition::findSharedBasePoint
const point& oCc = pC[oCI]; const point& oCc = pC[oCI];
List<scalar> tetQualities(2, 0.0); List<scalar> tetQualities(2, Zero);
forAll(f, faceBasePtI) forAll(f, faceBasePtI)
{ {

Some files were not shown because too many files have changed in this diff Show More