mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -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);
|
||||
|
||||
labelList cellVertices(bMesh.nCells(), label(0));
|
||||
labelList cellVertices(bMesh.nCells(), Zero);
|
||||
|
||||
for
|
||||
(
|
||||
|
||||
@ -613,7 +613,7 @@ Foam::Field<bool> Foam::conformationSurfaces::inside
|
||||
const pointField& samplePts
|
||||
) 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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
return wellOutside(pointField(1, samplePt), scalarField(1, 0))[0];
|
||||
return wellOutside(pointField(1, samplePt), scalarField(1, Zero))[0];
|
||||
//return !inside(samplePt);
|
||||
}
|
||||
|
||||
|
||||
@ -416,7 +416,7 @@ bool Foam::autoDensity::fillBox
|
||||
|
||||
pointField linePoints(nLine, Zero);
|
||||
|
||||
scalarField lineSizes(nLine, 0.0);
|
||||
scalarField lineSizes(nLine, Zero);
|
||||
|
||||
for (label i = 0; i < surfRes_; i++)
|
||||
{
|
||||
|
||||
@ -113,7 +113,7 @@ Foam::searchableBoxFeatures::features() const
|
||||
surfacePoints[treeBoundBox::edges[eI].end()]
|
||||
- surfacePoints[treeBoundBox::edges[eI].start()];
|
||||
|
||||
normalDirections[eI] = labelList(2, label(0));
|
||||
normalDirections[eI] = labelList(2, Zero);
|
||||
for (label j = 0; j < 2; ++j)
|
||||
{
|
||||
const vector cross =
|
||||
|
||||
@ -131,7 +131,7 @@ Foam::searchablePlateFeatures::features() const
|
||||
surface().points()()[edges[eI].end()]
|
||||
- surface().points()()[edges[eI].start()];
|
||||
|
||||
normalDirections[eI] = labelList(2, label(0));
|
||||
normalDirections[eI] = labelList(2, Zero);
|
||||
for (label j = 0; j < 2; ++j)
|
||||
{
|
||||
const vector cross =
|
||||
|
||||
@ -108,9 +108,9 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
|
||||
labelList regionOffset(surfi);
|
||||
|
||||
labelList globalMinLevel(surfi, 0);
|
||||
labelList globalMaxLevel(surfi, 0);
|
||||
labelList globalLevelIncr(surfi, 0);
|
||||
labelList globalMinLevel(surfi, Zero);
|
||||
labelList globalMaxLevel(surfi, Zero);
|
||||
labelList globalLevelIncr(surfi, Zero);
|
||||
PtrList<dictionary> globalPatchInfo(surfi);
|
||||
List<Map<label>> regionMinLevel(surfi);
|
||||
List<Map<label>> regionMaxLevel(surfi);
|
||||
@ -263,8 +263,8 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
}
|
||||
|
||||
// Rework surface specific information into information per global region
|
||||
labelList minLevel(nRegions, 0);
|
||||
labelList maxLevel(nRegions, 0);
|
||||
labelList minLevel(nRegions, Zero);
|
||||
labelList maxLevel(nRegions, Zero);
|
||||
labelList gapLevel(nRegions, -1);
|
||||
PtrList<dictionary> patchInfo(nRegions);
|
||||
|
||||
|
||||
@ -319,7 +319,7 @@ Foam::label Foam::checkTopology
|
||||
|
||||
if (allTopology)
|
||||
{
|
||||
labelList nInternalFaces(mesh.nCells(), 0);
|
||||
labelList nInternalFaces(mesh.nCells(), Zero);
|
||||
|
||||
for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user