diff --git a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C index 78ac403e998d48dbd2d916c35659466e0dd4a2f5..7573b8f53708ed8462774ff9bfa6927600e670e6 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C @@ -26,7 +26,7 @@ Application PDRFoam Description - Compressible premixed/partially-premixed combustion solver with turbulence + Compressible premixed/partially-premixed combustion solver with turbulence modelling. Combusting RANS code using the b-Xi two-equation model. @@ -121,7 +121,8 @@ scalar StCoNum = 0.0; // Test : disable refinement for some cells PackedList<1>& protectedCell = refCast<dynamicRefineFvMesh>(mesh).protectedCell(); - if (protectedCell.size() == 0) + + if (protectedCell.empty()) { protectedCell.setSize(mesh.nCells()); protectedCell = 0; @@ -135,7 +136,7 @@ scalar StCoNum = 0.0; } } - //volScalarField pIndicator("pIndicator", + //volScalarField pIndicator("pIndicator", // p*(fvc::laplacian(p)) // / ( // magSqr(fvc::grad(p)) diff --git a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C index 6ad19ab28797930c0b709ccca2e02f92bd2d861c..82e6f2c4c912863c9c8948bfbe8dcb47813a0b63 100644 --- a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C +++ b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C @@ -413,7 +413,7 @@ bool limitRefinementLevel } } - if (addCutCells.size() > 0) + if (addCutCells.size()) { // Add cells to cutCells. @@ -479,7 +479,7 @@ void doRefinement { const labelList& added = addedCells[oldCellI]; - if (added.size() > 0) + if (added.size()) { // Give all cells resulting from split the refinement level // of the master. @@ -895,7 +895,7 @@ int main(int argc, char *argv[]) << " Selected for refinement :" << cutCells.size() << nl << endl; - if (cutCells.size() == 0) + if (cutCells.empty()) { Info<< "Stopping refining since 0 cells selected to be refined ..." << nl << endl; diff --git a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C index a153b0ac665a7fb4d8ba861c4202a2b48bdbdc8b..67fdc0807e5975a624666afc16f8523afcaac306 100644 --- a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C +++ b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C @@ -358,18 +358,21 @@ int main(int argc, char *argv[]) ( dict.lookup("facesToTriangulate") ); + bool cutBoundary = - pointsToMove.size() > 0 - || edgesToSplit.size() > 0 - || facesToTriangulate.size() > 0; + ( + pointsToMove.size() + || edgesToSplit.size() + || facesToTriangulate.size() + ); List<Pair<point> > edgesToCollapse(dict.lookup("edgesToCollapse")); - bool collapseEdge = edgesToCollapse.size() > 0; + bool collapseEdge = edgesToCollapse.size(); List<Pair<point> > cellsToPyramidise(dict.lookup("cellsToSplit")); - bool cellsToSplit = cellsToPyramidise.size() > 0; + bool cellsToSplit = cellsToPyramidise.size(); //List<Tuple<pointField,point> > // cellsToCreate(dict.lookup("cellsToCreate")); @@ -523,7 +526,7 @@ int main(int argc, char *argv[]) Info<< nl << "There was a problem in one of the inputs in the" << " dictionary. Not modifying mesh." << endl; } - else if (cellToPyrCentre.size() > 0) + else if (cellToPyrCentre.size()) { Info<< nl << "All input cells located. Modifying mesh." << endl; @@ -555,7 +558,7 @@ int main(int argc, char *argv[]) Info << "Writing modified mesh to time " << runTime.value() << endl; mesh.write(); } - else if (edgeToPos.size() > 0) + else if (edgeToPos.size()) { Info<< nl << "All input edges located. Modifying mesh." << endl; diff --git a/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C b/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C index 16747f413469d93b55ada8f0cebed1ce21892028..25b13eba8889f021551daa940dd17cbeb81ff48d 100644 --- a/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C +++ b/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C @@ -336,7 +336,7 @@ int main(int argc, char *argv[]) ) {} - if (refCells.size() > 0) + if (refCells.size()) { Info<< "Collected " << refCells.size() << " cells that need to be" << " refined to get closer to overall 2:1 refinement level limit" diff --git a/applications/utilities/mesh/advanced/splitCells/splitCells.C b/applications/utilities/mesh/advanced/splitCells/splitCells.C index ff6d22940c3af74ef78aaee09eb435e5a0527509..4e5b501b8526e55d02ff6f52260326ee4b48d639 100644 --- a/applications/utilities/mesh/advanced/splitCells/splitCells.C +++ b/applications/utilities/mesh/advanced/splitCells/splitCells.C @@ -652,7 +652,7 @@ int main(int argc, char *argv[]) // Remove cut cells from cellsToCut (Note:only relevant if -readSet) forAll(cuts.cellLoops(), cellI) { - if (cuts.cellLoops()[cellI].size() > 0) + if (cuts.cellLoops()[cellI].size()) { //Info<< "Removing cut cell " << cellI << " from wishlist" // << endl; diff --git a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C index bb0a01fd1babc1ad5a2bf93f7649c7d5d262a130..df84d13a79cff7c21c9e16742a95f60b5130d492 100644 --- a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C +++ b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C @@ -584,7 +584,7 @@ int main(int argc, char *argv[]) forAll (rawPatches, patchI) { - if (rawPatches[patchI].size() > 0 && cfxPatchTypes[patchI] != "BLKBDY") + if (rawPatches[patchI].size() && cfxPatchTypes[patchI] != "BLKBDY") { // Check if this name has been already created label existingPatch = -1; diff --git a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L index b4acf24445c322983d5dc3653493c6be1dd2d1ef..7b385bfe0615ab2cec06838f4ca6fe0992647c58 100644 --- a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L @@ -1,4 +1,4 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | @@ -1486,7 +1486,7 @@ int main(int argc, char *argv[]) } defaultBoundaryFaces.shrink(); - if(defaultBoundaryFaces.size() != 0) + if (defaultBoundaryFaces.size()) { Warning << " fluent mesh has " << defaultBoundaryFaces.size() << " undefined boundary faces." << endl @@ -1695,7 +1695,7 @@ int main(int argc, char *argv[]) // soon negating the need for double output if (writeSets) { - if (cellGroupZoneID.size() > 1 ) + if (cellGroupZoneID.size() > 1) { Info<< "Writing cell sets" << endl; diff --git a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C index d3d732205ccfc64fa3e6c37553f31db8cf6e0461..62edc15af03dd7db103ff4fae7be2a5f184ca6eb 100644 --- a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C +++ b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C @@ -667,7 +667,7 @@ void readCells const labelList& zCells = zoneCells[zoneI]; - if (zCells.size() > 0) + if (zCells.size()) { Info<< " " << zoneI << '\t' << zCells.size() << endl; } @@ -778,7 +778,7 @@ int main(int argc, char *argv[]) forAll(zoneCells, zoneI) { - if (zoneCells[zoneI].size() > 0) + if (zoneCells[zoneI].size()) { nValidCellZones++; } @@ -910,7 +910,7 @@ int main(int argc, char *argv[]) const labelList& zFaces = zoneFaces[zoneI]; - if (zFaces.size() > 0) + if (zFaces.size()) { nValidFaceZones++; @@ -940,7 +940,7 @@ int main(int argc, char *argv[]) forAll(zoneCells, zoneI) { - if (zoneCells[zoneI].size() > 0) + if (zoneCells[zoneI].size()) { label physReg = zoneToPhys[zoneI]; @@ -979,7 +979,7 @@ int main(int argc, char *argv[]) forAll(zoneFaces, zoneI) { - if (zoneFaces[zoneI].size() > 0) + if (zoneFaces[zoneI].size()) { label physReg = zoneToPhys[zoneI]; @@ -1011,7 +1011,7 @@ int main(int argc, char *argv[]) } } - if (cz.size() > 0 || fz.size() > 0) + if (cz.size() || fz.size()) { mesh.addZones(List<pointZone*>(0), fz, cz); } diff --git a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C index 477d2ba06ccc222872e003b3ec517b3d49b0022a..520be5b1463205fceef61a57facf1ea2c36a6c79 100644 --- a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C +++ b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C @@ -752,7 +752,7 @@ int main(int argc, char *argv[]) List<faceList> patchFaceVerts; - if (dofVertIndices.size() > 0) + if (dofVertIndices.size()) { // Use the vertex constraints to patch. Is of course bit dodgy since // face goes on patch if all its vertices are on a constraint. diff --git a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C index 546aaa7439103271933d99198c08b1b951132541..6d41c037e6655224ba715d21a4f299e1c021577d 100644 --- a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C +++ b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C @@ -242,7 +242,7 @@ int main(int argc, char *argv[]) } - if (vertsToBoundary.size() > 0) + if (vertsToBoundary.size()) { // Didn't find cells connected to boundary faces. WarningIn(args.executable()) diff --git a/applications/utilities/mesh/conversion/polyDualMesh/makePolyDualMesh.C b/applications/utilities/mesh/conversion/polyDualMesh/makePolyDualMesh.C index 26eb18e26d0f59e3b2a4fa7a1f3aed8169f80d1f..3470fd71cc71e56c07cc0d087beef364f3c0d58d 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/makePolyDualMesh.C +++ b/applications/utilities/mesh/conversion/polyDualMesh/makePolyDualMesh.C @@ -229,7 +229,7 @@ void simpleMarkFeatures if (doNotPreserveFaceZones) { - if (faceZones.size() > 0) + if (faceZones.size()) { WarningIn("simpleMarkFeatures(..)") << "Detected " << faceZones.size() @@ -239,7 +239,7 @@ void simpleMarkFeatures } else { - if (faceZones.size() > 0) + if (faceZones.size()) { Info<< "Detected " << faceZones.size() << " faceZones. Preserving these by marking their" diff --git a/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.C b/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.C index 4492a6f6b66d911cf96595ed9a5240ad11ff49c5..2a307e5df2aaeb7045fa08d11a475eb9c2870aa1 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.C +++ b/applications/utilities/mesh/conversion/polyDualMesh/meshDualiser.C @@ -38,10 +38,7 @@ Class // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(meshDualiser, 0); -} +defineTypeNameAndDebug(Foam::meshDualiser, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -735,7 +732,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint ) << "Walked from face on patch:" << patchI << " to face:" << faceI << " fc:" << mesh_.faceCentres()[faceI] - << " on patch:" << patches.whichPatch(faceI) + << " on patch:" << patches.whichPatch(faceI) << abort(FatalError); } @@ -886,7 +883,7 @@ Foam::meshDualiser::meshDualiser(const polyMesh& mesh) faceToDualPoint_(mesh_.nFaces(), -1), edgeToDualPoint_(mesh_.nEdges(), -1) {} - + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -1083,7 +1080,7 @@ void Foam::meshDualiser::setRefinement { label pointI = multiCellFeaturePoints[i]; - if (pointToDualCells_[pointI].size() > 0) + if (pointToDualCells_[pointI].size()) { FatalErrorIn ( @@ -1133,7 +1130,7 @@ void Foam::meshDualiser::setRefinement // Normal points forAll(mesh_.points(), pointI) { - if (pointToDualCells_[pointI].size() == 0) + if (pointToDualCells_[pointI].empty()) { pointToDualCells_[pointI].setSize(1); pointToDualCells_[pointI][0] = meshMod.addCell @@ -1241,7 +1238,7 @@ void Foam::meshDualiser::setRefinement const edge& e = mesh_.edges()[edgeI]; // We need a point on the edge if not all cells on both sides - // are the same. + // are the same. const labelList& eCells = mesh_.edgeCells()[edgeI]; diff --git a/applications/utilities/mesh/conversion/sammToFoam/readCouples.C b/applications/utilities/mesh/conversion/sammToFoam/readCouples.C index d55d49242d37bbf8c5032bcb4bfc943e40b43e35..161123803ec0d0489d9513c917a4c346fc1733e8 100644 --- a/applications/utilities/mesh/conversion/sammToFoam/readCouples.C +++ b/applications/utilities/mesh/conversion/sammToFoam/readCouples.C @@ -136,7 +136,7 @@ void sammMesh::readCouples() forAll (curFaces, faceI) { - if (curFaces[faceI].size() == 0) + if (curFaces[faceI].empty()) { zeroSizeFound++; } @@ -153,7 +153,7 @@ void sammMesh::readCouples() forAll (oldFaces, faceI) { - if (oldFaces[faceI].size() > 0) + if (oldFaces[faceI].size()) { curFaces[nFaces] = oldFaces[faceI]; diff --git a/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C b/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C index c4ff20791a4c6fdd38fc53d734316eba77661513..910df915d839cda42d432296690ee11c57cfc3a5 100644 --- a/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C +++ b/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C @@ -45,12 +45,11 @@ void starMesh::createCoupleMatches() // existing points list // Estimate the number of cells affected by couple matches - const label cellMapSize = - min - ( - cellShapes_.size()/10, - couples_.size()*2 - ); + const label cellMapSize = min + ( + cellShapes_.size()/10, + couples_.size()*2 + ); // Store newly created faces for each cell Map<SLList<face> > cellAddedFaces(cellMapSize); @@ -322,7 +321,7 @@ void starMesh::createCoupleMatches() // A new point is created. Warning: // using original edge for accuracy. - // + // coupleFacePoints.append (P + alpha*curMasterEdge.vec(points_)); } @@ -338,7 +337,7 @@ void starMesh::createCoupleMatches() // master edge and vice versa. The problem is that // no symmetry exists, i.e. both operations needs // to be done separately for both master and slave - // side. + // side. // Master side // check if the first or second point of slave edge is @@ -625,11 +624,11 @@ void starMesh::createCoupleMatches() // Eliminate all zero-length edges face newMasterFace(labelList(tmpMasterFace.size(), labelMax)); - + // insert first point by hand. Careful: the first one is // used for comparison to allow the edge collapse across // point zero. - // + // newMasterFace[0] = tmpMasterFace[0]; label nMaster = 0; @@ -823,7 +822,7 @@ void starMesh::createCoupleMatches() // insert first point by hand. Careful: the first one is // used for comparison to allow the edge collapse across // point zero. - // + // newSlaveFace[0] = tmpSlaveFace[0]; label nSlave = 0; @@ -1097,7 +1096,7 @@ void starMesh::createCoupleMatches() << "edges to consider: " << edgesToConsider << endl; # endif - if (edgesToConsider.size() == 0) + if (edgesToConsider.empty()) { FatalErrorIn("void starMesh::createCoupleMatches()") << setprecision(12) @@ -1420,7 +1419,7 @@ void starMesh::createCoupleMatches() } // end of arbitrary match } - if (couples_.size() > 0) + if (couples_.size()) { // Loop through all cells and reset faces for removal to zero size const labelList crfToc = cellRemovedFaces.toc(); @@ -1442,7 +1441,7 @@ void starMesh::createCoupleMatches() cellFaces_[curCell][curRemovedFacesIter()].setSize(0); } - if (curRemovedFaces.size() > 0) + if (curRemovedFaces.size()) { // reset the shape pointer to unknown cellShapes_[curCell] = cellShape(*unknownPtr_, labelList(0)); @@ -1468,7 +1467,7 @@ void starMesh::createCoupleMatches() // copy original faces that have not been removed forAll (oldFaces, faceI) { - if (oldFaces[faceI].size() > 0) + if (oldFaces[faceI].size()) { newFaces[nNewFaces] = oldFaces[faceI]; nNewFaces++; @@ -1491,7 +1490,7 @@ void starMesh::createCoupleMatches() // reset the size of the face list newFaces.setSize(nNewFaces); - if (curAddedFaces.size() > 0) + if (curAddedFaces.size()) { // reset the shape pointer to unknown cellShapes_[curCell] = cellShape(*unknownPtr_, labelList(0)); diff --git a/applications/utilities/mesh/conversion/starToFoam/starMesh.C b/applications/utilities/mesh/conversion/starToFoam/starMesh.C index f5fbb9f86036eb9436207260dda5d2275d2464a4..a495ae03624437cc6d0a5e769ebf4ae0d9c49b8e 100644 --- a/applications/utilities/mesh/conversion/starToFoam/starMesh.C +++ b/applications/utilities/mesh/conversion/starToFoam/starMesh.C @@ -264,7 +264,7 @@ starMesh::starMesh readCouples(); - if (couples_.size() > 0) + if (couples_.size()) { createCoupleMatches(); } diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C index 4f9c369c7df4d10b97dba68b3b8f7dc60fb4af66..7fcf2a586b57d510fc0ca648cd393dc27cc30c34 100644 --- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C +++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) { nodeStream.getLine(line); } - while((line.size() > 0) && (line[0] == '#')); + while (line.size() && line[0] == '#'); IStringStream nodeLine(line); @@ -193,7 +193,7 @@ int main(int argc, char *argv[]) { nodeStream.getLine(line); - if ((line.size() > 0) && (line[0] != '#')) + if (line.size() && line[0] != '#') { IStringStream nodeLine(line); @@ -237,7 +237,7 @@ int main(int argc, char *argv[]) { eleStream.getLine(line); } - while((line.size() > 0) && (line[0] == '#')); + while (line.size() && line[0] == '#'); IStringStream eleLine(line); @@ -281,7 +281,7 @@ int main(int argc, char *argv[]) { eleStream.getLine(line); - if ((line.size() > 0) && (line[0] != '#')) + if (line.size() && line[0] != '#') { IStringStream eleLine(line); @@ -356,7 +356,7 @@ int main(int argc, char *argv[]) { faceStream.getLine(line); } - while((line.size() > 0) && (line[0] == '#')); + while (line.size() && line[0] == '#'); IStringStream faceLine(line); @@ -398,7 +398,7 @@ int main(int argc, char *argv[]) { faceStream.getLine(line); - if ((line.size() > 0) && (line[0] != '#')) + if (line.size() && line[0] != '#') { IStringStream faceLine(line); diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.C b/applications/utilities/mesh/generation/blockMesh/blockMesh.C index 5a273f7acbb61b31ea6ddf72d5e00ba309ed5a55..640971ada099b069f25467cf1bb6f97a199bd754 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMesh.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMesh.C @@ -118,7 +118,7 @@ Foam::label Foam::blockMesh::numZonedBlocks() const forAll(*this, blockI) { - if (operator[](blockI).blockDef().zoneName().size() > 0) + if (operator[](blockI).blockDef().zoneName().size()) { num++; } diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index 1c3bd34a220326be93370ba652646fe697cdf274..1723fa51019e6e0fa419677058500a890da6b7f3 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -278,7 +278,7 @@ int main(int argc, char *argv[]) const labelListList& blockCells = b.cells(); const word& zoneName = b.blockDef().zoneName(); - if (zoneName.size() > 0) + if (zoneName.size()) { HashTable<label>::const_iterator iter = zoneMap.find(zoneName); diff --git a/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.C b/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.C index 6d7e80d74e3dc31b67bfd6f5ef30e4147d256247..3347db180bbe769eefeb5a41762550409e5b16e2 100644 --- a/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.C +++ b/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.C @@ -1,6 +1,6 @@ Info<< "Creating merge patch pairs" << nl << endl; - if (mergePatchPairs.size() > 0) + if (mergePatchPairs.size()) { // Create and add point and face zones and mesh modifiers List<pointZone*> pz(mergePatchPairs.size()); diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C index 2596ae61501f4b20bea2abb4b76f515b5b51326b..de69375595c0d970d1293e40b7c0f309a2d2a270 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C @@ -177,7 +177,7 @@ Foam::label Foam::checkTopology primitivePatch::surfaceTopo pTyp = pp.surfaceType(); - if (pp.size() == 0) + if (pp.empty()) { Pout<< setw(34) << "ok (empty)"; } @@ -232,7 +232,7 @@ Foam::label Foam::checkTopology Pout<< endl; } - if (points.size() > 0) + if (points.size()) { Pout<< " <<Writing " << points.size() << " conflicting points to set " diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index 238d8232f03b13e666267a999a3f3f61a836da2d..d6d58dd5420344939489025ad5456f315dc67bb9 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -172,7 +172,7 @@ void filterPatches(polyMesh& mesh) if (isA<processorPolyPatch>(pp)) { - if (pp.size() > 0) + if (pp.size()) { allPatches.append ( @@ -586,7 +586,7 @@ int main(int argc, char *argv[]) // 1. Add all new patches // ~~~~~~~~~~~~~~~~~~~~~~ - if (patchSources.size() > 0) + if (patchSources.size()) { // Old and new patches. DynamicList<polyPatch*> allPatches(patches.size()+patchSources.size()); diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C index 292d2a0056a400f1ebc24f7624ea70cbda351e0e..616cfb4ce74b274996d3a770e7cdd4b1248d10d1 100644 --- a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C +++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C @@ -34,10 +34,7 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(mergePolyMesh, 1); -} +defineTypeNameAndDebug(Foam::mergePolyMesh, 1); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -142,7 +139,7 @@ Foam::mergePolyMesh::mergePolyMesh(const IOobject& io) // Point zones wordList curPointZoneNames = pointZones().names(); - if (curPointZoneNames.size() > 0) + if (curPointZoneNames.size()) { pointZoneNames_.setCapacity(2*curPointZoneNames.size()); } @@ -155,7 +152,7 @@ Foam::mergePolyMesh::mergePolyMesh(const IOobject& io) // Face zones wordList curFaceZoneNames = faceZones().names(); - if (curFaceZoneNames.size() > 0) + if (curFaceZoneNames.size()) { faceZoneNames_.setCapacity(2*curFaceZoneNames.size()); } @@ -167,7 +164,7 @@ Foam::mergePolyMesh::mergePolyMesh(const IOobject& io) // Cell zones wordList curCellZoneNames = cellZones().names(); - if (curCellZoneNames.size() > 0) + if (curCellZoneNames.size()) { cellZoneNames_.setCapacity(2*curCellZoneNames.size()); } @@ -333,11 +330,11 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m) newOwn = own[faceI]; if (newOwn > -1) newOwn = renumberCells[newOwn]; - if (newPatch > -1) + if (newPatch > -1) { newNei = -1; - } - else + } + else { newNei = nei[faceI]; newNei = renumberCells[newNei]; @@ -373,7 +370,7 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m) ) ); } - + } diff --git a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C index dcec2e27bd6d5c3606f052b4c57d8baa3304dfd3..07190e49f9842dbfbae3f00ec5d7544934ff9df6 100644 --- a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C +++ b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C @@ -48,7 +48,7 @@ string getLine(std::ifstream& is) { std::getline(is, line); } - while((line.size() > 0) && (line[0] == '#')); + while (line.size() && line[0] == '#'); return line; } diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C index de684afe48631d33327106252e1924a4fbe76d73..95c7973d2c4bffbcb3de3bfefd8abb69cf420b97 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C @@ -485,7 +485,7 @@ int main(int argc, char *argv[]) { const labelList& added = oldToNew[oldCellI]; - if (added.size() > 0) + if (added.size()) { forAll(added, i) { diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C index 0bfa7b7aba55852956215cd10a021ea772781284..8f49a947665988024e48fe7b9948e5a830b5612c 100644 --- a/applications/utilities/mesh/manipulation/setSet/setSet.C +++ b/applications/utilities/mesh/manipulation/setSet/setSet.C @@ -89,7 +89,7 @@ void backup const word& toName ) { - if (fromSet.size() > 0) + if (fromSet.size()) { Pout<< " Backing up " << fromName << " into " << toName << endl; @@ -284,7 +284,7 @@ void printAllSets(const polyMesh& mesh, Ostream& os) polyMesh::meshSubDir/"sets" ); IOobjectList cellSets(objects.lookupClass(cellSet::typeName)); - if (cellSets.size() > 0) + if (cellSets.size()) { os << "cellSets:" << endl; forAllConstIter(IOobjectList, cellSets, iter) @@ -294,7 +294,7 @@ void printAllSets(const polyMesh& mesh, Ostream& os) } } IOobjectList faceSets(objects.lookupClass(faceSet::typeName)); - if (faceSets.size() > 0) + if (faceSets.size()) { os << "faceSets:" << endl; forAllConstIter(IOobjectList, faceSets, iter) @@ -304,7 +304,7 @@ void printAllSets(const polyMesh& mesh, Ostream& os) } } IOobjectList pointSets(objects.lookupClass(pointSet::typeName)); - if (pointSets.size() > 0) + if (pointSets.size()) { os << "pointSets:" << endl; forAllConstIter(IOobjectList, pointSets, iter) @@ -347,7 +347,7 @@ bool doCommand bool ok = true; // Set to work on - autoPtr<topoSet> currentSetPtr(NULL); + autoPtr<topoSet> currentSetPtr; word sourceType; @@ -383,7 +383,7 @@ bool doCommand currentSet.resize(max(currentSet.size(), typSize)); } - if (!currentSetPtr.valid()) + if (currentSetPtr.empty()) { Pout<< " Cannot construct/load set " << topoSet::localPath(mesh, setName) << endl; @@ -522,7 +522,7 @@ bool doCommand Pout<< fIOErr.message().c_str() << endl; - if (sourceType.size() != 0) + if (sourceType.size()) { Pout<< topoSetSource::usage(sourceType).c_str(); } @@ -533,7 +533,7 @@ bool doCommand Pout<< fErr.message().c_str() << endl; - if (sourceType.size() != 0) + if (sourceType.size()) { Pout<< topoSetSource::usage(sourceType).c_str(); } @@ -571,7 +571,7 @@ commandStatus parseType IStringStream& is ) { - if (setType.size() == 0) + if (setType.empty()) { Pout<< "Type 'help' for usage information" << endl; @@ -689,7 +689,7 @@ commandStatus parseAction(const word& actionName) { commandStatus stat = INVALID; - if (actionName.size() != 0) + if (actionName.size()) { try { @@ -792,7 +792,7 @@ int main(int argc, char *argv[]) std::getline(*fileStreamPtr, rawLine); - if (rawLine.size() > 0) + if (rawLine.size()) { Pout<< "Doing:" << rawLine << endl; } @@ -821,7 +821,7 @@ int main(int argc, char *argv[]) # endif } - if (rawLine.size() == 0 || rawLine[0] == '#') + if (rawLine.empty() || rawLine[0] == '#') { continue; } diff --git a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C index f71be6ac7d3da436d83b363db4ae7f09ae2e47c3..aef00fe7e9be1ab42f0b03920591c620ecc3f312 100644 --- a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C +++ b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C @@ -100,10 +100,10 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name) << exit(FatalError); } - if (bMesh[patchI].size() != 0) + if (bMesh[patchI].size()) { FatalErrorIn("checkPatch(const polyBoundaryMesh&, const word&)") - << "Patch " << name << " is present but not of zero size" + << "Patch " << name << " is present but non-zero size" << exit(FatalError); } } diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index d52403f0b12cbd9f64de96932d048b3d20cfd17e..e3cb83ad389333efb4596c5fb573eec16ff1ce4c 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -878,7 +878,7 @@ void createAndWriteRegion { const polyPatch& pp = newPatches[patchI]; - if (isA<processorPolyPatch>(pp) && pp.size() > 0) + if (isA<processorPolyPatch>(pp) && pp.size()) { oldToNew[patchI] = newI++; } @@ -1049,7 +1049,7 @@ label findCorrespondingZone labelList regionCells = findIndices(cellRegion, regionI); - if (regionCells.size() == 0) + if (regionCells.empty()) { // My local portion is empty. Maps to any empty cellZone. Mark with // special value which can get overwritten by other processors. @@ -1200,7 +1200,7 @@ int main(int argc, char *argv[]) boolList blockedFace; // Read from faceSet - if (blockedFacesName.size() > 0) + if (blockedFacesName.size()) { faceSet blockedFaceSet(mesh, blockedFacesName); Info<< "Read " << returnReduce(blockedFaceSet.size(), sumOp<label>()) diff --git a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C index 54e3cd1b784ccc7cbcae2d30c7256327d05b4861..4773654752d599663071422bb44f1795e9dadaaf 100644 --- a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C +++ b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C @@ -82,7 +82,7 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name) << exit(FatalError); } - if (bMesh[patchI].size() == 0) + if (bMesh[patchI].empty()) { FatalErrorIn("checkPatch(const polyBoundaryMesh&, const word&)") << "Patch " << name << " is present but zero size" diff --git a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C index 208066016ee2ee09abb1dd541483f99fa056f727..4b50082e1049fe97e780345c26bbab3a63095a4f 100644 --- a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C +++ b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) ); - if (args.options().size() == 0) + if (args.options().empty()) { FatalErrorIn(args.executable()) << "No options supplied, please use one or more of " diff --git a/applications/utilities/parallelProcessing/decomposePar/distributeCells.C b/applications/utilities/parallelProcessing/decomposePar/distributeCells.C index bfe9e585da016e0564b69f76e68a412a5848690b..ad78b2a9142c0f1dfa0352b89bc786555d469b46 100644 --- a/applications/utilities/parallelProcessing/decomposePar/distributeCells.C +++ b/applications/utilities/parallelProcessing/decomposePar/distributeCells.C @@ -104,7 +104,7 @@ void domainDecomposition::distributeCells() } } - if (sameProcFaces.size() > 0) + if (sameProcFaces.size()) { Info<< "Selected " << sameProcFaces.size() << " faces whose owner and neighbour cell should be kept on the" @@ -123,7 +123,7 @@ void domainDecomposition::distributeCells() *this ); - if (sameProcFaces.size() == 0) + if (sameProcFaces.empty()) { cellToProc_ = decomposePtr().decompose(cellCentres()); } diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index 9e686f9b2ed6b7900ebf87bcb3d25541446fecd8..9e250916cd23fc16a8818706b1c2fe95fc4d5551 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) args ); - if (!timeDirs.size()) + if (timeDirs.empty()) { FatalErrorIn(args.executable()) << "No times selected" @@ -319,7 +319,7 @@ int main(int argc, char *argv[]) } - if (cloudObjects.size() > 0) + if (cloudObjects.size()) { // Pass2: reconstruct the cloud forAllConstIter(HashTable<IOobjectList>, cloudObjects, iter) diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C index e7b481adc28e2ab10bcde37bbc3035d4bb4acc6d..980a3c61536eb12601d6b541c187409108722878 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C @@ -558,7 +558,7 @@ void ensightFieldAscii GeometricField<Type, fvPatchField, volMesh> vf(fieldObject, mesh); - if (!patchNames.size()) + if (patchNames.empty()) { if (Pstream::master()) { @@ -633,7 +633,7 @@ void ensightFieldAscii const word& patchName = iter.key(); const labelList& patchProcessors = iter(); - if (!patchNames.size() || patchNames.found(patchName)) + if (patchNames.empty() || patchNames.found(patchName)) { if (patchIndices.found(patchName)) { @@ -734,7 +734,7 @@ void ensightFieldBinary GeometricField<Type, fvPatchField, volMesh> vf(fieldObject, mesh); - if (!patchNames.size()) + if (patchNames.empty()) { if (Pstream::master()) { @@ -805,7 +805,7 @@ void ensightFieldBinary const word& patchName = iter.key(); const labelList& patchProcessors = iter(); - if (!patchNames.size() || patchNames.found(patchName)) + if (patchNames.empty() || patchNames.found(patchName)) { if (patchIndices.found(patchName)) { diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C index 537fa7d075b21b80890296028ab6fed1de56b5f5..b69a9264c124845c74669733762e95e45592660c 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C @@ -129,7 +129,7 @@ Foam::ensightMesh::ensightMesh { wordList patchNameList(IStringStream(args.options()["patches"])()); - if (!patchNameList.size()) + if (patchNameList.empty()) { patchNameList = allPatchNames_.toc(); } @@ -163,7 +163,7 @@ Foam::ensightMesh::ensightMesh label nHexes = 0; label nPolys = 0; - if (!patchNames_.size()) + if (patchNames_.empty()) { forAll(cellShapes, celli) { @@ -267,7 +267,7 @@ Foam::ensightMesh::ensightMesh const word& patchName = iter.key(); nFacePrimitives nfp; - if (!patchNames_.size() || patchNames_.found(patchName)) + if (patchNames_.empty() || patchNames_.found(patchName)) { if (patchIndices_.found(patchName)) { @@ -403,7 +403,7 @@ void Foam::ensightMesh::writePrimsBinary numElem = cellShapes.size(); - if (cellShapes.size() > 0) + if (cellShapes.size()) { // All the cellShapes have the same number of elements! int numIntElem = cellShapes.size()*cellShapes[0].size(); @@ -917,7 +917,7 @@ void Foam::ensightMesh::writeAscii labelList pointOffsets(Pstream::nProcs(), 0); - if (!patchNames_.size()) + if (patchNames_.empty()) { label nPoints = points.size(); Pstream::gather(nPoints, sumOp<label>()); @@ -1044,7 +1044,7 @@ void Foam::ensightMesh::writeAscii { const labelList& patchProcessors = iter(); - if (!patchNames_.size() || patchNames_.found(iter.key())) + if (patchNames_.empty() || patchNames_.found(iter.key())) { const word& patchName = iter.key(); const nFacePrimitives& nfp = nPatchPrims_.find(patchName)(); @@ -1244,7 +1244,7 @@ void Foam::ensightMesh::writeBinary labelList pointOffsets(Pstream::nProcs(), 0); - if (!patchNames_.size()) + if (patchNames_.empty()) { label nPoints = points.size(); Pstream::gather(nPoints, sumOp<label>()); @@ -1373,7 +1373,7 @@ void Foam::ensightMesh::writeBinary iCount ++; const labelList& patchProcessors = iter(); - if (!patchNames_.size() || patchNames_.found(iter.key())) + if (patchNames_.empty() || patchNames_.found(iter.key())) { const word& patchName = iter.key(); const nFacePrimitives& nfp = nPatchPrims_.find(patchName)(); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightWriteBinary.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightWriteBinary.C index 8e3faa359f7296f516fd28a973965e2b423d494d..f5d74775305687065c1731ceb0c142542fe7a0a1 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightWriteBinary.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightWriteBinary.C @@ -57,7 +57,7 @@ void writeEnsDataBinary std::ofstream& ensightFile ) { - if (sf.size() > 0) + if (sf.size()) { List<float> temp(sf.size()); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/validateFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/validateFields.H index 3a4d626efb6f85ad892eca1448b50f4427a7abfc..6c640b41fa57efee651b694891cf819d460caeac 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/validateFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/validateFields.H @@ -77,9 +77,9 @@ forAllIter(HashTable<HashTable<word> >, cloudFields, cloudIter) } } - if (!cloudIter().size()) + if (cloudIter().empty()) { - Info<< "removing cloud " << cloudName<< endl; + Info<< "removing cloud " << cloudName << endl; cloudFields.erase(cloudIter); } } diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C index 63f9a45ee7314f265b05f02465b4ea4579c2245b..81ac4facac9209f06fe61ba8e5503c60f0764260 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C +++ b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C @@ -227,7 +227,7 @@ int main(int argc, char *argv[]) # include "getFieldNames.H" bool hasLagrangian = false; - if ((sprayScalarNames.size() > 0) || (sprayVectorNames.size() > 0)) + if (sprayScalarNames.size() || sprayVectorNames.size()) { hasLagrangian = true; } diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H index 45d5b3fc2f3522816b232307340307a40f8a607b..76f834c431c063ee2d2e3908d1e8ae6c000c602d 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutput.H @@ -80,7 +80,7 @@ for(label i=0; i < nTypes; i++) wordList lagrangianScalarNames = objects.names("scalarField"); wordList lagrangianVectorNames = objects.names("vectorField"); - if (particles.size() > 0) + if (particles.size()) { # include "gmvOutputLagrangian.H" } diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputLagrangian.H b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputLagrangian.H index 4fa7ee1ec56f3a4bbbb693ba82760e74193a3858..89c126c1e3ed50d4cbfb786483010bb95a6663f4 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputLagrangian.H +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputLagrangian.H @@ -49,16 +49,11 @@ forAll(lagrangianScalarNames, i) ) ); - if (s.size() != 0) + if (s.size()) { gmvFile << name << nl; - for - ( - label n = 0; - n < s.size(); - n++ - ) + for (label n = 0; n < s.size(); n++) { gmvFile << s[n] << token::SPACE; } @@ -85,16 +80,11 @@ forAll(lagrangianVectorNames, i) ) ); - if (v.size() != 0) + if (v.size()) { gmvFile << name + "x" << nl; - for - ( - label n = 0; - n < v.size(); - n++ - ) + for (label n = 0; n < v.size(); n++) { gmvFile << v[n].x() << token::SPACE; } @@ -102,12 +92,7 @@ forAll(lagrangianVectorNames, i) gmvFile << name + "y" << nl; - for - ( - label n = 0; - n < v.size(); - n++ - ) + for (label n = 0; n < v.size(); n++) { gmvFile << v[n].y() << token::SPACE; } @@ -115,19 +100,13 @@ forAll(lagrangianVectorNames, i) gmvFile << name + "z" << nl; - for - ( - label n = 0; - n < v.size(); - n++ - ) + for (label n = 0; n < v.size(); n++) { gmvFile << v[n].z() << token::SPACE; } gmvFile << nl; } - } diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputSpray.H b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputSpray.H index 682f9e27e0d0bd824557c1acff0d821f9c4d8340..f5d5b3c8c6da8716330c851c546e3092696128dd 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputSpray.H +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/gmvOutputSpray.H @@ -47,16 +47,11 @@ forAll(lagrangianScalarNames, i) ) ); - if (s.size() != 0) + if (s.size()) { gmvFile << name << nl; - for - ( - label n = 0; - n < s.size(); - n++ - ) + for (label n = 0; n < s.size(); n++) { gmvFile << s[n] << token::SPACE; } diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index e60ebc144803c006bb0b002b06d5af03ae471717..45c5f3799691e479e453dd664af447a2f45895bc 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -339,7 +339,7 @@ int main(int argc, char *argv[]) ( args.options().found("time") || args.options().found("latestTime") - || cellSetName.size() > 0 + || cellSetName.size() || regionName != polyMesh::defaultRegion ) { diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/readFields.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/readFields.C index 27d8fa0e97e01cf5bf01e9a7610961c99cacf5cb..838d5e29710230793f815d0bf0d52186741b4f01 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/readFields.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/readFields.C @@ -58,7 +58,7 @@ void readFields ++iter ) { - if (!selectedFields.size() || selectedFields.found(iter()->name())) + if (selectedFields.empty() || selectedFields.found(iter()->name())) { fields.set ( diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/vtkMesh.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/vtkMesh.C index 7552e07e27c7180e97a3ddc6d640009361d695e3..b8376e2a9926f24a89772b6e5049c7ce09d9109c 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/vtkMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/vtkMesh.C @@ -47,7 +47,7 @@ Foam::vtkMesh::vtkMesh subsetter_(baseMesh), setName_(setName) { - if (setName.size() > 0) + if (setName.size()) { // Read cellSet using whole mesh cellSet currentSet(baseMesh_, setName_); @@ -71,7 +71,7 @@ Foam::polyMesh::readUpdateState Foam::vtkMesh::readUpdate() topoPtr_.clear(); - if (setName_.size() > 0) + if (setName_.size()) { Info<< "Subsetting mesh based on cellSet " << setName_ << endl; diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/vtkMesh.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/vtkMesh.H index 7e6f411699fd70d7d126b68187406d4308651410..d2b1e9f0e32e66816734c3738dc114941f484e0b 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/vtkMesh.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/vtkMesh.H @@ -105,13 +105,13 @@ public: //- Check if running subMesh bool useSubMesh() const { - return setName_.size() > 0; + return setName_.size(); } //- topology const vtkTopo& topo() const { - if (!topoPtr_.valid()) + if (topoPtr_.empty()) { topoPtr_.reset(new vtkTopo(mesh())); } diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index a26ba88a5c294c64d185e90546a1d2ff71c7c68f..cb25ac50895f3a6ccc5d85b97822ff91ebf65bb4 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -154,6 +154,11 @@ class vtkPV3Foam return size_; } + bool empty() const + { + return (size_ == 0); + } + void reset() { start_ = -1; diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H index 74bcac3b7867d7d269cc253276e842fa9549b62e..f01839a9308d826bfe3fdb26c5bda279ee437e39 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H @@ -147,14 +147,14 @@ int USERD_set_filenames bool lagrangianNamesFound = false; label n = 0; - while ((!lagrangianNamesFound) && (n<Num_time_steps)) + while (!lagrangianNamesFound && n < Num_time_steps) { runTime.setTime(TimeList[n+1], n+1); Cloud<passiveParticle> lagrangian(*meshPtr); n++; - if (lagrangian.size()>0) + if (lagrangian.size()) { lagrangianNamesFound = true; } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianScalar.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianScalar.H index de8f4ffaf9894e4f90fc615ae27fd5c45f50ed12..e9259e3cc78693babd080d7e841b55ab9867e096 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianScalar.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianScalar.H @@ -4,7 +4,6 @@ nVar -= Num_variables - nSprayVariables; if (nVar >= 0) { - word name = lagrangianScalarNames[nVar]; IOField<scalar> s @@ -20,15 +19,9 @@ if (nVar >= 0) ) ); - if (s.size() != 0) + if (s.size()) { - - for - ( - label n = 0; - n < s.size(); - n++ - ) + for (label n = 0; n < s.size(); n++) { var_array[n+1] = s[n]; } @@ -36,7 +29,7 @@ if (nVar >= 0) } else { - //Info << "getLagrangianScalar: nVar = " << nVar << endl; + // Info << "getLagrangianScalar: nVar = " << nVar << endl; return Z_UNDEF; } diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H index 59f2806a32ad40591950e38544de7870182fd8ae..42fcc8560fd7067df52e8ee65832a8069028b7e3 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H @@ -21,16 +21,10 @@ if (nVar >= 0) ) ); - if (v.size() != 0) + if (v.size()) { - for - ( - label n = 0; - n < v.size(); - n++ - ) + for (label n = 0; n < v.size(); n++) { - if (component == 0) { var_array[n+1] = v[n].x(); diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C b/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C index 604046862d1fcffe08cc2f38e5193cb41849aad5..10b29fc8b31d1814b1c2a461157f8465b408feb2 100644 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C +++ b/applications/utilities/postProcessing/graphics/fieldview9Reader/fieldview9Reader.C @@ -235,7 +235,7 @@ static void createFieldNames HashSet<word> surfScalarHash; HashSet<word> surfVectorHash; - if (setName.size() == 0) + if (setName.empty()) { forAll(Times, timeI) { @@ -536,13 +536,12 @@ void user_query_file_function fileName caseName(rootAndCase.name()); // handle trailing '/' - if (caseName.size() == 0) + if (caseName.empty()) { caseName = rootDir.name(); - rootDir = rootDir.path(); + rootDir = rootDir.path(); } - Info<< "rootDir : " << rootDir << endl << "caseName : " << caseName << endl << "setName : " << setName << endl; diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C b/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C index 82d49c1135537486745b41407521facd15ceb5bb..09f63f50da7b69708a6430d87ee9c8e02f762609 100644 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C +++ b/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C @@ -150,7 +150,7 @@ const Foam::fvMesh& Foam::readerDatabase::mesh() const << "No mesh set" << abort(FatalError); } - if (setName_.size() == 0) + if (setName_.empty()) { return *meshPtr_; } @@ -265,7 +265,7 @@ void Foam::readerDatabase::loadMesh() IOobject::AUTO_WRITE ); - if (setName_.size() != 0) + if (setName_.size()) { Info<< "Subsetting mesh based on cellSet " << setName_ << endl; @@ -294,9 +294,9 @@ Foam::polyMesh::readUpdateState Foam::readerDatabase::setTime // Update loaded mesh meshChange = meshPtr_->readUpdate(); - if ((setName_.size() != 0) && (meshChange != polyMesh::UNCHANGED)) + if (setName_.size() && meshChange != polyMesh::UNCHANGED) { - Info<< "Subsetting mesh based on " << setName_ << endl; + Info<< "Subsetting mesh based on " << setName_ << endl; fvMeshSubset& mesh = *meshPtr_; diff --git a/applications/utilities/preProcessing/mapFields/mapLagrangian.C b/applications/utilities/preProcessing/mapFields/mapLagrangian.C index 6f593c1309d628f7d44d7e798f2d3d6d59bdb308..e57aa9761c81370d6d20ab1dd8af1c00a53cb8c8 100644 --- a/applications/utilities/preProcessing/mapFields/mapLagrangian.C +++ b/applications/utilities/preProcessing/mapFields/mapLagrangian.C @@ -206,7 +206,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp) // Do closer inspection for unmapped particles // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - if (unmappedSource.size() > 0) + if (unmappedSource.size()) { meshSearch targetSearcher(meshTarget, false); @@ -237,7 +237,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp) Info<< " after additional mesh searching found " << targetParcels.size() << " parcels in target mesh." << endl; - if (addParticles.size() > 0) + if (addParticles.size()) { IOPosition<passiveParticle>(targetParcels).write(); diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C index 6ad1a6e9504aed0b2d93f79670f1a9075c58d111..e7b789007475cfd40617116532e1e0a98a0cc3d8 100644 --- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C +++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C @@ -242,9 +242,7 @@ int main(int argc, char *argv[]) } } - illegalFaces.shrink(); - - if (illegalFaces.size() > 0) + if (illegalFaces.size()) { Pout<< "Surface has " << illegalFaces.size() << " illegal triangles." << endl; @@ -628,7 +626,7 @@ int main(int argc, char *argv[]) triSurfaceSearch querySurf(surf); surfaceIntersection inter(querySurf); - if ((inter.cutEdges().size() == 0) && (inter.cutPoints().size() == 0)) + if (inter.cutEdges().empty() && inter.cutPoints().empty()) { Pout<< "Surface is not self-intersecting" << endl; } diff --git a/applications/utilities/surface/surfaceClean/collapseBase.C b/applications/utilities/surface/surfaceClean/collapseBase.C index 4c4f366af4603ba3ac72c87e17ac3d6ee30834d1..58168e5722a9a3cc79d59b0866209dfc368d099d 100644 --- a/applications/utilities/surface/surfaceClean/collapseBase.C +++ b/applications/utilities/surface/surfaceClean/collapseBase.C @@ -860,7 +860,7 @@ label collapseBase(triSurface& surf, const scalar minLen) splitWeights ); - if (splitVerts.size() > 0) + if (splitVerts.size()) { // Split edge using splitVerts. All non-collapsed triangles // using edge will get split. diff --git a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C index 6daf7928a37563e16f5b7d7edff1a349a1de0ec6..046f9cefe8778808a4edd79c76870a8e5aade9dc 100644 --- a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C +++ b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C @@ -49,9 +49,9 @@ void readNASEdges edgeList& allEdges ) { - IFstream OBJfile(inFileName); + IFstream is(inFileName); - if (!OBJfile.good()) + if (!is.good()) { FatalErrorIn("readNASEdges") << "Cannot read file " << inFileName @@ -68,14 +68,14 @@ void readNASEdges DynamicList<label> edgeIndices; - while (OBJfile.good()) + while (is.good()) { string line; - OBJfile.getLine(line); + is.getLine(line); - if (line.size() > 0 && line[0] == '$') + if (line.empty() || line[0] == '$') { - // Skip comment + // Skip empty and comment continue; } @@ -87,9 +87,9 @@ void readNASEdges while (true) { string buf; - OBJfile.getLine(buf); + is.getLine(buf); - if (buf.size() > 72 && buf[72]=='+') + if (buf.size() > 72 && buf[72] == '+') { line += buf.substr(8, 64); } diff --git a/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C b/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C index fa5f26ae30f10fef21b74d3a4dfb4f74eac576f8..71ab4c8b01da1ee05f882d7d87eca95dbfbea09d 100644 --- a/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C +++ b/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) word patchName = pp.name(); - if (patchName.size() == 0) + if (patchName.empty()) { patchName = "patch" + Foam::name(patchI); } diff --git a/applications/utilities/surface/surfaceSubset/surfaceSubset.C b/applications/utilities/surface/surfaceSubset/surfaceSubset.C index 2ffc384aa0e9b14c4a7bc7677dd31ef196ebfab3..1c1a725cad267ae5cca8e2389dba06bac8987aac 100644 --- a/applications/utilities/surface/surfaceSubset/surfaceSubset.C +++ b/applications/utilities/surface/surfaceSubset/surfaceSubset.C @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) meshSubsetDict.lookup("zone") ); - if ((markedZone.size() != 0) && (markedZone.size() != 2)) + if (markedZone.size() && markedZone.size() != 2) { FatalErrorIn(args.executable()) << "zone specification should be two points, min and max of " @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) // pick up faces connected to "localPoints" // - if (markedPoints.size() > 0) + if (markedPoints.size()) { Info << "Found " << markedPoints.size() << " marked point(s)." << endl; @@ -153,7 +153,7 @@ int main(int argc, char *argv[]) // pick up faces connected to "edges" // - if (markedEdges.size() > 0) + if (markedEdges.size()) { Info << "Found " << markedEdges.size() << " marked edge(s)." << endl; @@ -293,7 +293,7 @@ int main(int argc, char *argv[]) // Number of additional faces picked up because of addFaceNeighbours label nFaceNeighbours = 0; - if (markedFaces.size() > 0) + if (markedFaces.size()) { Info << "Found " << markedFaces.size() << " marked face(s)." << endl; diff --git a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C index 7d5bc0e1bdcddd25c192d00b2429422bb930354b..cf1020009b2a80e9bf7ac430eca075da6d852225 100644 --- a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C +++ b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) Info<< "Writing surf to " << outFileName << " ..." << endl; - if (args.options().size() == 0) + if (args.options().empty()) { FatalErrorIn(args.executable()) << "No options supplied, please use one or more of " diff --git a/src/OSspecific/Unix/Unix.C b/src/OSspecific/Unix/Unix.C index fa92f10b2789ccb15f1a4477b4159e517086618b..659eca203ee6bcfb4cc7ae3e89c031b701df982b 100644 --- a/src/OSspecific/Unix/Unix.C +++ b/src/OSspecific/Unix/Unix.C @@ -284,7 +284,7 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory) bool Foam::mkDir(const fileName& pathName, mode_t mode) { // empty names are meaningless - if (!pathName.size()) + if (pathName.empty()) { return false; } @@ -567,10 +567,10 @@ Foam::fileNameList Foam::readDir { fileName fName(list->d_name); - // ignore files begining with ., i.e. ., .. and .??* - if (fName.size() > 0 && fName[size_t(0)] != '.') + // ignore files begining with ., i.e. '.', '..' and '.*' + if (fName.size() && fName[0] != '.') { - word fileNameExt = fName.ext(); + word fExt = fName.ext(); if ( @@ -578,11 +578,11 @@ Foam::fileNameList Foam::readDir || ( type == fileName::FILE - && fName[fName.size()-1] != '~' - && fileNameExt != "bak" - && fileNameExt != "BAK" - && fileNameExt != "old" - && fileNameExt != "save" + && fName[fName.size()-1] != '~' + && fExt != "bak" + && fExt != "BAK" + && fExt != "old" + && fExt != "save" ) ) { @@ -593,7 +593,7 @@ Foam::fileNameList Foam::readDir dirEntries.setSize(dirEntries.size() + maxNnames); } - if (filtergz && fileNameExt == "gz") + if (filtergz && fExt == "gz") { dirEntries[nEntries++] = fName.lessExt(); } @@ -616,17 +616,17 @@ Foam::fileNameList Foam::readDir } -// Copy, recursively if necessary, the source top the destination +// Copy, recursively if necessary, the source to the destination bool Foam::cp(const fileName& src, const fileName& dest) { - fileName destFile(dest); - // Make sure source exists. if (!exists(src)) { return false; } + fileName destFile(dest); + // Check type of source file. if (src.type() == fileName::FILE) { @@ -676,7 +676,7 @@ bool Foam::cp(const fileName& src, const fileName& dest) destFile = destFile/src.component(src.components().size() -1); } - // Make sure the destination directory extists. + // Make sure the destination directory exists. if (!dir(destFile) && !mkDir(destFile)) { return false; diff --git a/src/OSspecific/Unix/printStack.C b/src/OSspecific/Unix/printStack.C index 30a1ef886338fb227084c5fb4642609629aa13e8..a6c2743298b8d320cba12c569960776c28f5a028 100644 --- a/src/OSspecific/Unix/printStack.C +++ b/src/OSspecific/Unix/printStack.C @@ -149,7 +149,7 @@ void getSymbolForRaw const word& address ) { - if (filename.size() > 0 && filename[0] == '/') + if (filename.size() && filename[0] == '/') { string fcnt = pOpen ( @@ -189,7 +189,7 @@ void error::printStack(Ostream& os) string::size_type space = line.rfind(' ') + 1; fileName libPath = line.substr(space, line.size()-space); - if (libPath.size() > 0 && libPath[0] == '/') + if (libPath.size() && libPath[0] == '/') { string offsetString(line.substr(0, line.find('-'))); IStringStream offsetStr(offsetString); diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C index 992205afaf9244faed5d730dd84c4e2293605dc9..3ba659c83dd183747d92c7bfff8a11b6fa3c388b 100644 --- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C +++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C @@ -476,8 +476,8 @@ void Foam::StaticHashTable<T, Key, Hash>::operator= } - // could be zero-sized from a previous transfer() - if (keys_.size() == 0) + // keys could be empty from a previous transfer() + if (keys_.empty()) { keys_.setSize(rhs.keys_.size()); objects_.setSize(keys_.size()); diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H index 93317105a82542bee5d435fb9e648044a994502c..d9bfaae0b809e658fcab2064c1c1b8acc47f3e68 100644 --- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H +++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableI.H @@ -328,7 +328,7 @@ Foam::StaticHashTable<T, Key, Hash>::begin() // Find first non-empty entry forAll(keys_, hashIdx) { - if (keys_[hashIdx].size() > 0) + if (keys_[hashIdx].size()) { return iterator(*this, hashIdx, 0); } @@ -360,7 +360,7 @@ Foam::StaticHashTable<T, Key, Hash>::begin() const // Find first non-empty entry forAll(keys_, hashIdx) { - if (keys_[hashIdx].size() > 0) + if (keys_[hashIdx].size()) { return const_iterator(*this, hashIdx, 0); } diff --git a/src/OpenFOAM/db/IOobjectList/IOobjectList.C b/src/OpenFOAM/db/IOobjectList/IOobjectList.C index c7cf618589f5a00845e87b63be24c37075425952..9f923d8fceaea82f8c7288c83ffe7068b61500b0 100644 --- a/src/OpenFOAM/db/IOobjectList/IOobjectList.C +++ b/src/OpenFOAM/db/IOobjectList/IOobjectList.C @@ -52,7 +52,7 @@ Foam::IOobjectList::IOobjectList { newInstance = db.time().findInstancePath(instant(instance)); - if (!newInstance.size()) + if (newInstance.empty()) { return; } @@ -181,7 +181,7 @@ Foam::wordList Foam::IOobjectList::names() const { wordList objectNames(size()); - label count=0; + label count = 0; for ( HashPtrTable<IOobject>::const_iterator iter = begin(); @@ -200,7 +200,7 @@ Foam::wordList Foam::IOobjectList::names(const word& ClassName) const { wordList objectNames(size()); - label count=0; + label count = 0; for ( HashPtrTable<IOobject>::const_iterator iter = begin(); diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C index 18cf8b891a283e57630b89367a02cbe6b8544215..b4be5d37fe8f28b001877fd52fad71051ae27878 100644 --- a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C +++ b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C @@ -42,7 +42,7 @@ Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname) ifPtr_(NULL), compression_(IOstream::UNCOMPRESSED) { - if (!pathname.size()) + if (pathname.empty()) { if (IFstream::debug) { diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C index b78e5f07de0f9ba08cbc27b7bdca403f8afc5398..bc6c2a03cc3bf085ecfd060bf485e417b1709dbb 100644 --- a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C +++ b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C @@ -46,7 +46,7 @@ Foam::OFstreamAllocator::OFstreamAllocator : ofPtr_(NULL) { - if (!pathname.size()) + if (pathname.empty()) { if (OFstream::debug) { diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/OPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/OPstream.C index bb4258af11e58f132a4dc4755814b7cbc74aa179..8e754ce2fd54ecb047a28982aae150d7c321a1be 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/OPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/OPstream.C @@ -136,17 +136,17 @@ Foam::Ostream& Foam::OPstream::write(const char* str) { word nonWhiteChars(string::validate<word>(str)); - if (nonWhiteChars.size() == 0) + if (nonWhiteChars.size() == 1) { - return *this; + return write(nonWhiteChars.c_str()[1]); } - else if (nonWhiteChars.size() == 1) + else if (nonWhiteChars.size()) { - return write(nonWhiteChars.c_str()[1]); + return write(nonWhiteChars); } else { - return write(nonWhiteChars); + return *this; } } diff --git a/src/OpenFOAM/db/Time/timeSelector.C b/src/OpenFOAM/db/Time/timeSelector.C index 01ed2e67aa0a515089fb38c1cd7af215400c165c..8b91422fac4a57d8aab97864f757a55ae3fe3e54 100644 --- a/src/OpenFOAM/db/Time/timeSelector.C +++ b/src/OpenFOAM/db/Time/timeSelector.C @@ -236,7 +236,7 @@ Foam::List<Foam::instant> Foam::timeSelector::select0 { instantList timeDirs = timeSelector::select(runTime.times(), args); - if (!timeDirs.size()) + if (timeDirs.empty()) { FatalErrorIn(args.executable()) << "No times selected" diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index 27a4dcc1bb1f0bb67ace4833d6009b2ce13ff201..8acc6e71ff89e5692286a0d0076d960852abd905 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -46,7 +46,7 @@ bool Foam::dictionary::findInPatterns DLList<autoPtr<regExp> >::const_iterator& reLink ) const { - if (patternEntries_.size() > 0) + if (patternEntries_.size()) { while (wcLink != patternEntries_.end()) { @@ -76,7 +76,7 @@ bool Foam::dictionary::findInPatterns DLList<autoPtr<regExp> >::iterator& reLink ) { - if (patternEntries_.size() > 0) + if (patternEntries_.size()) { while (wcLink != patternEntries_.end()) { @@ -240,7 +240,7 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const } else { - if (patternEntries_.size() > 0) + if (patternEntries_.size()) { DLList<entry*>::const_iterator wcLink = patternEntries_.begin(); DLList<autoPtr<regExp> >::const_iterator reLink = @@ -276,7 +276,7 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr if (iter == hashedEntries_.end()) { - if (patternMatch && patternEntries_.size() > 0) + if (patternMatch && patternEntries_.size()) { DLList<entry*>::const_iterator wcLink = patternEntries_.begin(); @@ -315,7 +315,7 @@ Foam::entry* Foam::dictionary::lookupEntryPtr if (iter == hashedEntries_.end()) { - if (patternMatch && patternEntries_.size() > 0) + if (patternMatch && patternEntries_.size()) { DLList<entry*>::iterator wcLink = patternEntries_.begin(); diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.C b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.C index 257876eed5a5bb86cd159aaebdd79dac4e3e3b78..be5977ee062bcd39c29a750eb1d9f1df8014b7d0 100644 --- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.C +++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.C @@ -113,15 +113,19 @@ Foam::dictionary& Foam::primitiveEntry::dict() } -void Foam::primitiveEntry::insert(const tokenList& varTokens, const label i) +void Foam::primitiveEntry::insert +( + const tokenList& varTokens, + const label posI +) { tokenList& tokens = *this; - if (!varTokens.size()) + if (varTokens.empty()) { label end = tokens.size() - 1; - for(label j=i; j<end; j++) + for (label j=posI; j<end; j++) { tokens[j] = tokens[j+1]; } @@ -135,7 +139,7 @@ void Foam::primitiveEntry::insert(const tokenList& varTokens, const label i) label end = tokens.size() - 1; label offset = varTokens.size() - 1; - for(label j=end; j>i; j--) + for (label j=end; j>posI; j--) { tokens[j] = tokens[j-offset]; } @@ -143,7 +147,7 @@ void Foam::primitiveEntry::insert(const tokenList& varTokens, const label i) forAll(varTokens, j) { - tokens[i + j] = varTokens[j]; + tokens[posI + j] = varTokens[j]; } } diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H index 93f1534ff143d071a9638c9fcc491b3676ed3834..c5189c1520d6c2ddb955f300d27c9d9c7eb1edf0 100644 --- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H +++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H @@ -58,7 +58,7 @@ namespace Foam class dictionary; /*---------------------------------------------------------------------------*\ - Class primitiveEntry Declaration + Class primitiveEntry Declaration \*---------------------------------------------------------------------------*/ class primitiveEntry @@ -99,8 +99,8 @@ public: //- Read the complete entry from the given stream void readEntry(const dictionary&, Istream&); - //- Insert the given tokens at token i - void insert(const tokenList&, const label i); + //- Insert the given tokens at token posI + void insert(const tokenList&, const label posI); public: diff --git a/src/OpenFOAM/db/regIOobject/regIOobjectWrite.C b/src/OpenFOAM/db/regIOobject/regIOobjectWrite.C index 98b9c9dd1b5896c6f758901d90c8a121539523d8..1ca027b247d6742af7890d9326e440d7d2645745 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobjectWrite.C +++ b/src/OpenFOAM/db/regIOobject/regIOobjectWrite.C @@ -55,7 +55,7 @@ bool regIOobject::writeObject return false; } - if (!instance().size()) + if (instance().empty()) { SeriousErrorIn("regIOobject::write()") << "instance undefined for object " << name() diff --git a/src/OpenFOAM/fields/Fields/symmTensorField/symmTensorField.C b/src/OpenFOAM/fields/Fields/symmTensorField/symmTensorField.C index 062735bf26b0cc1bbec7217433dce2cc17f8a2dd..a157dee0a0dc18a45d0bcdfe826365e5e75f0227 100644 --- a/src/OpenFOAM/fields/Fields/symmTensorField/symmTensorField.C +++ b/src/OpenFOAM/fields/Fields/symmTensorField/symmTensorField.C @@ -50,7 +50,7 @@ UNARY_FUNCTION(symmTensor, symmTensor, cof) void inv(Field<symmTensor>& tf, const UList<symmTensor>& tf1) { - if (!tf.size()) + if (tf.empty()) { return; } diff --git a/src/OpenFOAM/fields/Fields/tensorField/tensorField.C b/src/OpenFOAM/fields/Fields/tensorField/tensorField.C index 5596d1fdd714885678f7585c46bb82d3e26b7721..a2dbccb3fccd476e1992c1de7ad6b31de545d5b7 100644 --- a/src/OpenFOAM/fields/Fields/tensorField/tensorField.C +++ b/src/OpenFOAM/fields/Fields/tensorField/tensorField.C @@ -49,7 +49,7 @@ UNARY_FUNCTION(tensor, tensor, cof) void inv(Field<tensor>& tf, const UList<tensor>& tf1) { - if (!tf.size()) + if (tf.empty()) { return; } diff --git a/src/OpenFOAM/interpolations/patchToPatchInterpolation/CalcPatchToPatchWeights.C b/src/OpenFOAM/interpolations/patchToPatchInterpolation/CalcPatchToPatchWeights.C index 7d5a76ca7201179e4f12c4076d38cb82a9f20c65..534cb5e1075d67fff0fc0742a4d730d801bc0c87 100644 --- a/src/OpenFOAM/interpolations/patchToPatchInterpolation/CalcPatchToPatchWeights.C +++ b/src/OpenFOAM/interpolations/patchToPatchInterpolation/CalcPatchToPatchWeights.C @@ -312,7 +312,7 @@ void PatchToPatchInterpolation<FromPatch, ToPatch>::calcFaceAddressing() const if ( m < directHitTol // Direct hit - || neighbours.size() == 0 + || neighbours.empty() ) { faceWeights.set(faceI, new scalarField(1)); diff --git a/src/OpenFOAM/meshes/bandCompression/bandCompression.C b/src/OpenFOAM/meshes/bandCompression/bandCompression.C index e721118db29b3b2b6ac867aa1712879573109197..bebfcb64fbf0073b25fa28f7535e6d172133e485 100644 --- a/src/OpenFOAM/meshes/bandCompression/bandCompression.C +++ b/src/OpenFOAM/meshes/bandCompression/bandCompression.C @@ -73,7 +73,7 @@ labelList bandCompression(const labelListList& cellCellAddressing) // neighbours. If the neighbour in question has not been visited, // add it to the end of the nextCell list - while (nextCell.size() > 0) + while (nextCell.size()) { currentCell = nextCell.removeHead(); diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.C b/src/OpenFOAM/meshes/boundBox/boundBox.C index 9ff80d26fa21fdbcf53e14830f3d7433865b74e0..15de6f2cf7f5b575e98e3a5e8c697188c9b6f4b3 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBox.C +++ b/src/OpenFOAM/meshes/boundBox/boundBox.C @@ -50,7 +50,7 @@ const Foam::boundBox Foam::boundBox::invertedBox void Foam::boundBox::calculate(const pointField& points, const bool doReduce) { - if (points.size() == 0) + if (points.empty()) { min_ = point::zero; max_ = point::zero; diff --git a/src/OpenFOAM/meshes/meshTools/matchPoints.C b/src/OpenFOAM/meshes/meshTools/matchPoints.C index ad8726ea2b302e5823759c9c603949adf65e4628..826a0185b5d92647b78f811a2ae3b5dab9b227e4 100644 --- a/src/OpenFOAM/meshes/meshTools/matchPoints.C +++ b/src/OpenFOAM/meshes/meshTools/matchPoints.C @@ -49,7 +49,7 @@ bool Foam::matchPoints if (origin == point(VGREAT, VGREAT, VGREAT)) { - if (pts1.size() > 0) + if (pts1.size()) { compareOrigin = sum(pts1)/pts1.size(); } diff --git a/src/OpenFOAM/meshes/meshTools/mergePoints.C b/src/OpenFOAM/meshes/meshTools/mergePoints.C index 19f544d64e27cb3ffc4e4b5bb320b2b5a3279977..a4a82386b8ddda0d521c5edb05dd0c85bc3103b4 100644 --- a/src/OpenFOAM/meshes/meshTools/mergePoints.C +++ b/src/OpenFOAM/meshes/meshTools/mergePoints.C @@ -44,7 +44,7 @@ bool Foam::mergePoints if (origin == point(VGREAT, VGREAT, VGREAT)) { - if (points.size() > 0) + if (points.size()) { compareOrigin = sum(points)/points.size(); } @@ -57,7 +57,7 @@ bool Foam::mergePoints // Storage for merged points newPoints.setSize(points.size()); - if (points.size() == 0) + if (points.empty()) { return false; } diff --git a/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointMapper.C b/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointMapper.C index 59b547490e6c9bc6c8922dc35d3f6b09daca19ca..2cfd6e848cfaedfaa0181e388d80ecbc767d4d7d 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointMapper.C +++ b/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointMapper.C @@ -97,7 +97,7 @@ void Foam::pointMapper::calcAddressing() const label pointI = cfc[cfcI].index(); - if (addr[pointI].size() > 0) + if (addr[pointI].size()) { FatalErrorIn("void pointMapper::calcAddressing() const") << "Master point " << pointI @@ -118,7 +118,7 @@ void Foam::pointMapper::calcAddressing() const forAll (cm, pointI) { - if (cm[pointI] > -1 && addr[pointI].size() == 0) + if (cm[pointI] > -1 && addr[pointI].empty()) { // Mapped from a single point addr[pointI] = labelList(1, cm[pointI]); @@ -135,7 +135,7 @@ void Foam::pointMapper::calcAddressing() const forAll (addr, pointI) { - if (addr[pointI].size() == 0) + if (addr[pointI].empty()) { // Mapped from a dummy point. Take point 0 with weight 1. addr[pointI] = labelList(1, 0); @@ -175,7 +175,7 @@ Foam::pointMapper::pointMapper(const pointMesh& pMesh, const mapPolyMesh& mpm) insertedPointLabelsPtr_(NULL) { // Check for possibility of direct mapping - if (mpm_.pointsFromPointsMap().size() == 0) + if (mpm_.pointsFromPointsMap().empty()) { direct_ = true; } @@ -185,7 +185,7 @@ Foam::pointMapper::pointMapper(const pointMesh& pMesh, const mapPolyMesh& mpm) } // Check for inserted points - if (direct_ && (mpm_.pointMap().size() == 0 || min(mpm_.pointMap()) > -1)) + if (direct_ && (mpm_.pointMap().empty() || min(mpm_.pointMap()) > -1)) { insertedPoints_ = false; } diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/cellMapper/cellMapper.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/cellMapper/cellMapper.C index b6b4bccf81356b9571ad41d4199d22f9c728b880..dc1930a5e0822d054a39b60f50d97d70563feffc 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/cellMapper/cellMapper.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/cellMapper/cellMapper.C @@ -86,7 +86,7 @@ void Foam::cellMapper::calcAddressing() const weightsPtr_ = new scalarListList(mesh_.nCells()); scalarListList& w = *weightsPtr_; - + const List<objectMap>& cfp = mpm_.cellsFromPointsMap(); forAll (cfp, cfpI) @@ -96,7 +96,7 @@ void Foam::cellMapper::calcAddressing() const label cellI = cfp[cfpI].index(); - if (addr[cellI].size() > 0) + if (addr[cellI].size()) { FatalErrorIn("void cellMapper::calcAddressing() const") << "Master cell " << cellI @@ -118,7 +118,7 @@ void Foam::cellMapper::calcAddressing() const label cellI = cfe[cfeI].index(); - if (addr[cellI].size() > 0) + if (addr[cellI].size()) { FatalErrorIn("void cellMapper::calcAddressing() const") << "Master cell " << cellI @@ -140,7 +140,7 @@ void Foam::cellMapper::calcAddressing() const label cellI = cff[cffI].index(); - if (addr[cellI].size() > 0) + if (addr[cellI].size()) { FatalErrorIn("void cellMapper::calcAddressing() const") << "Master cell " << cellI @@ -162,7 +162,7 @@ void Foam::cellMapper::calcAddressing() const label cellI = cfc[cfcI].index(); - if (addr[cellI].size() > 0) + if (addr[cellI].size()) { FatalErrorIn("void cellMapper::calcAddressing() const") << "Master cell " << cellI @@ -183,7 +183,7 @@ void Foam::cellMapper::calcAddressing() const forAll (cm, cellI) { - if (cm[cellI] > -1 && addr[cellI].size() == 0) + if (cm[cellI] > -1 && addr[cellI].empty()) { // Mapped from a single cell addr[cellI] = labelList(1, cm[cellI]); @@ -200,7 +200,7 @@ void Foam::cellMapper::calcAddressing() const forAll (addr, cellI) { - if (addr[cellI].size() == 0) + if (addr[cellI].empty()) { // Mapped from a dummy cell addr[cellI] = labelList(1, 0); @@ -242,10 +242,10 @@ Foam::cellMapper::cellMapper(const mapPolyMesh& mpm) // Check for possibility of direct mapping if ( - mpm_.cellsFromPointsMap().size() == 0 - && mpm_.cellsFromEdgesMap().size() == 0 - && mpm_.cellsFromFacesMap().size() == 0 - && mpm_.cellsFromCellsMap().size() == 0 + mpm_.cellsFromPointsMap().empty() + && mpm_.cellsFromEdgesMap().empty() + && mpm_.cellsFromFacesMap().empty() + && mpm_.cellsFromCellsMap().empty() ) { direct_ = true; @@ -256,7 +256,7 @@ Foam::cellMapper::cellMapper(const mapPolyMesh& mpm) } // Check for inserted cells - if (direct_ && (mpm_.cellMap().size() == 0 || min(mpm_.cellMap()) > -1)) + if (direct_ && (mpm_.cellMap().empty() || min(mpm_.cellMap()) > -1)) { insertedCells_ = false; } @@ -412,7 +412,7 @@ const Foam::labelList& Foam::cellMapper::insertedObjectLabels() const return *insertedCellLabelsPtr_; } - + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/faceMapper/faceMapper.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/faceMapper/faceMapper.C index 0196a92f626cc9d122db8a0581c2a82df1928c1e..d9c54126c238aa523adcd4d668481efeb2b557ef 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/faceMapper/faceMapper.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/faceMapper/faceMapper.C @@ -96,7 +96,7 @@ void Foam::faceMapper::calcAddressing() const label faceI = ffp[ffpI].index(); - if (addr[faceI].size() > 0) + if (addr[faceI].size()) { FatalErrorIn("void faceMapper::calcAddressing() const") << "Master face " << faceI @@ -118,7 +118,7 @@ void Foam::faceMapper::calcAddressing() const label faceI = ffe[ffeI].index(); - if (addr[faceI].size() > 0) + if (addr[faceI].size()) { FatalErrorIn("void faceMapper::calcAddressing() const") << "Master face " << faceI @@ -140,7 +140,7 @@ void Foam::faceMapper::calcAddressing() const label faceI = fff[fffI].index(); - if (addr[faceI].size() > 0) + if (addr[faceI].size()) { FatalErrorIn("void faceMapper::calcAddressing() const") << "Master face " << faceI @@ -160,7 +160,7 @@ void Foam::faceMapper::calcAddressing() const forAll (fm, faceI) { - if (fm[faceI] > -1 && addr[faceI].size() == 0) + if (fm[faceI] > -1 && addr[faceI].empty()) { // Mapped from a single face addr[faceI] = labelList(1, fm[faceI]); @@ -178,7 +178,7 @@ void Foam::faceMapper::calcAddressing() const forAll (addr, faceI) { - if (addr[faceI].size() == 0) + if (addr[faceI].empty()) { // Mapped from a dummy face addr[faceI] = labelList(1, 0); @@ -220,9 +220,9 @@ Foam::faceMapper::faceMapper(const mapPolyMesh& mpm) // Check for possibility of direct mapping if ( - mpm_.facesFromPointsMap().size() == 0 - && mpm_.facesFromEdgesMap().size() == 0 - && mpm_.facesFromFacesMap().size() == 0 + mpm_.facesFromPointsMap().empty() + && mpm_.facesFromEdgesMap().empty() + && mpm_.facesFromFacesMap().empty() ) { direct_ = true; @@ -233,7 +233,7 @@ Foam::faceMapper::faceMapper(const mapPolyMesh& mpm) } // Check for inserted faces - if (direct_ && (mpm_.faceMap().size() == 0 || min(mpm_.faceMap()) > -1)) + if (direct_ && (mpm_.faceMap().empty() || min(mpm_.faceMap()) > -1)) { insertedFaces_ = false; } diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C index 429b75b983c8c06eab1c5ef1895460db1290ddc1..5dac2ebe9c83f54f79a12c6349d4f13477acc90f 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C @@ -48,12 +48,12 @@ Foam::List<Foam::labelPair> Foam::mapDistribute::schedule { if (procI != Pstream::myProcNo()) { - if (subMap[procI].size() > 0) + if (subMap[procI].size()) { // I need to send to procI commsSet.insert(labelPair(Pstream::myProcNo(), procI)); } - if (constructMap[procI].size() > 0) + if (constructMap[procI].size()) { // I need to receive from procI commsSet.insert(labelPair(procI, Pstream::myProcNo())); @@ -288,7 +288,7 @@ void Foam::mapDistribute::compact(const boolList& elemIsUsed) { const labelList& map = constructMap_[domain]; - if (domain != Pstream::myProcNo() && map.size() > 0) + if (domain != Pstream::myProcNo() && map.size()) { boolList& subField = sendFields[domain]; subField.setSize(map.size()); @@ -315,7 +315,7 @@ void Foam::mapDistribute::compact(const boolList& elemIsUsed) { const labelList& map = subMap_[domain]; - if (domain != Pstream::myProcNo() && map.size() > 0) + if (domain != Pstream::myProcNo() && map.size()) { recvFields[domain].setSize(map.size()); IPstream::read diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C index 46204b35545344633754eb6d65deb632fbd34f50..08e12b876eda2167a404c8879bda855ddd2ada2e 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C @@ -50,7 +50,7 @@ void Foam::mapDistribute::distribute { const labelList& map = subMap[domain]; - if (domain != Pstream::myProcNo() && map.size() > 0) + if (domain != Pstream::myProcNo() && map.size()) { List<T> subField(map.size()); forAll(map, i) @@ -86,7 +86,7 @@ void Foam::mapDistribute::distribute { const labelList& map = constructMap[domain]; - if (domain != Pstream::myProcNo() && map.size() > 0) + if (domain != Pstream::myProcNo() && map.size()) { IPstream fromNbr(Pstream::blocking, domain); List<T> subField(fromNbr); @@ -227,7 +227,7 @@ void Foam::mapDistribute::distribute { const labelList& map = subMap[domain]; - if (domain != Pstream::myProcNo() && map.size() > 0) + if (domain != Pstream::myProcNo() && map.size()) { List<T>& subField = sendFields[domain]; subField.setSize(map.size()); @@ -254,7 +254,7 @@ void Foam::mapDistribute::distribute { const labelList& map = constructMap[domain]; - if (domain != Pstream::myProcNo() && map.size() > 0) + if (domain != Pstream::myProcNo() && map.size()) { recvFields[domain].setSize(map.size()); IPstream::read @@ -303,14 +303,14 @@ void Foam::mapDistribute::distribute OPstream::waitRequests(); IPstream::waitRequests(); - + // Collect neighbour fields for (label domain = 0; domain < Pstream::nProcs(); domain++) { const labelList& map = constructMap[domain]; - if (domain != Pstream::myProcNo() && map.size() > 0) + if (domain != Pstream::myProcNo() && map.size()) { if (recvFields[domain].size() != map.size()) { @@ -372,7 +372,7 @@ void Foam::mapDistribute::distribute { const labelList& map = subMap[domain]; - if (domain != Pstream::myProcNo() && map.size() > 0) + if (domain != Pstream::myProcNo() && map.size()) { List<T> subField(map.size()); forAll(map, i) @@ -409,7 +409,7 @@ void Foam::mapDistribute::distribute { const labelList& map = constructMap[domain]; - if (domain != Pstream::myProcNo() && map.size() > 0) + if (domain != Pstream::myProcNo() && map.size()) { IPstream fromNbr(Pstream::blocking, domain); List<T> subField(fromNbr); @@ -550,7 +550,7 @@ void Foam::mapDistribute::distribute { const labelList& map = subMap[domain]; - if (domain != Pstream::myProcNo() && map.size() > 0) + if (domain != Pstream::myProcNo() && map.size()) { List<T>& subField = sendFields[domain]; subField.setSize(map.size()); @@ -577,7 +577,7 @@ void Foam::mapDistribute::distribute { const labelList& map = constructMap[domain]; - if (domain != Pstream::myProcNo() && map.size() > 0) + if (domain != Pstream::myProcNo() && map.size()) { recvFields[domain].setSize(map.size()); IPstream::read @@ -625,14 +625,14 @@ void Foam::mapDistribute::distribute OPstream::waitRequests(); IPstream::waitRequests(); - + // Collect neighbour fields for (label domain = 0; domain < Pstream::nProcs(); domain++) { const labelList& map = constructMap[domain]; - if (domain != Pstream::myProcNo() && map.size() > 0) + if (domain != Pstream::myProcNo() && map.size()) { if (recvFields[domain].size() != map.size()) { diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index 20085cb361a72fe103c00bced8f2300b2673c334..261a952b064f05c9efaf2058e92e53f5896dcb8d 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -251,7 +251,7 @@ Foam::polyBoundaryMesh::neighbourEdges() const } } - if (pointsToEdge.size() > 0) + if (pointsToEdge.size()) { FatalErrorIn("polyBoundaryMesh::neighbourEdges() const") << "Not all boundary edges of patches match up." << nl @@ -425,7 +425,7 @@ Foam::labelHashSet Foam::polyBoundaryMesh::patchSet // of all patch names for matches labelList patchIDs = findStrings(patchNames[i], allPatchNames); - if (patchIDs.size() == 0) + if (patchIDs.empty()) { WarningIn("polyBoundaryMesh::patchSet(const wordList&)") << "Cannot find any patch names matching " << patchNames[i] diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index 65b9ec641267bcf87bf212732299de5c8608e182..a1b10f0d8a6cc9a9ddff2454e269775937d8b034 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -814,7 +814,7 @@ void Foam::polyMesh::addPatches const bool validBoundary ) { - if (boundaryMesh().size() > 0) + if (boundaryMesh().size()) { FatalErrorIn ( @@ -858,12 +858,7 @@ void Foam::polyMesh::addZones const List<cellZone*>& cz ) { - if - ( - pointZones().size() > 0 - || faceZones().size() > 0 - || cellZones().size() > 0 - ) + if (pointZones().size() || faceZones().size() || cellZones().size()) { FatalErrorIn ( diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H index 1562740a3158a03bf35c65e2ddf1d89d70814af4..690fb1083b4a4fce2f27c84df711fe8e5d33ea10 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H @@ -47,7 +47,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class coupledPolyPatch Declaration + Class coupledPolyPatch Declaration \*---------------------------------------------------------------------------*/ class coupledPolyPatch @@ -256,7 +256,7 @@ public: //- Are the cyclic planes parallel bool parallel() const { - return forwardT_.size() == 0; + return forwardT_.empty(); } //- Return face transformation tensor diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 593a0bb2d8c2ae11fff834da145fa4a6e8d71bb4..1e42d48ea3bd4cceb6c4c95ae23465084c56658d 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -86,7 +86,7 @@ Foam::label Foam::cyclicPolyPatch::findMaxArea void Foam::cyclicPolyPatch::calcTransforms() { - if (size() > 0) + if (size()) { const pointField& points = this->points(); @@ -1111,7 +1111,7 @@ bool Foam::cyclicPolyPatch::order rotation.setSize(pp.size()); rotation = 0; - if (pp.size() == 0) + if (pp.empty()) { // No faces, nothing to change. return false; diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C index 490981735c535db148d18209191945403f703453..4fcf243dd5e3f8d82943d1a0eba816bf92bcdb57 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C @@ -211,7 +211,7 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::calcAddressing() forAll (neiFaces, nfI) { - if (neiFaces[nfI].size() > 0 && neiFaces[nfI][0] < minNei) + if (neiFaces[nfI].size() && neiFaces[nfI][0] < minNei) { nextNei = nfI; minNei = neiFaces[nfI][0]; diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchLocalPointOrder.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchLocalPointOrder.C index 70f2241cbaa1c4aba648678ca6b0766a9a317335..cb6987bd2113e6ad819428be5ead01509c41ac93 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchLocalPointOrder.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchLocalPointOrder.C @@ -127,7 +127,7 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>:: } } } - } while (faceOrder.size() > 0); + } while (faceOrder.size()); } } diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraCleanup.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraCleanup.C index a1ef18bece758c713f710d560b98ead423baa99d..e34b2a2a44ca4bc912095f55be9550b9db0b41ce 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraCleanup.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraCleanup.C @@ -53,7 +53,7 @@ checkEdges // boundary edges have one face // interior edges have two faces - if (myFaces.size() == 0) + if (myFaces.empty()) { FatalErrorIn ( diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C index 1f859b03cc8794708c2091bde62af127578d47b8..0d56d9be1eafe920a315e493b3124e86b2c21f5a 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C @@ -97,12 +97,12 @@ void Foam::PrimitivePatchExtra<Face, FaceList, PointField, PointType>::markZone } } - if (newChangedFaces.size() == 0) + if (newChangedFaces.empty()) { break; } - // New dynamicList: can leave dynamicList unshrunk + // transfer from dynamic to normal list changedFaces.transfer(newChangedFaces); } } diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C index 5795efc28bf16f5a54343c81231a545658c55601..8938faf69bcea9d710ed2cb749322802f84b6ad4 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C @@ -760,7 +760,7 @@ bool primitiveMesh::checkPoints forAll (pf, pointI) { - if (pf[pointI].size() == 0) + if (pf[pointI].empty()) { if (setPtr) { @@ -776,7 +776,7 @@ bool primitiveMesh::checkPoints { const labelList& pc = pointCells(pointI); - if (pc.size() == 0) + if (pc.empty()) { if (setPtr) { diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/patchZones.C b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/patchZones.C index c5ab576e69e8ad756c5b74bbbb6476c973a7cb3a..080ee1cd759a7d4123f5d124621291d334bdeb95 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/patchZones.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/patchZones.C @@ -130,7 +130,7 @@ void patchZones::markZone(label faceI) << endl; } - if (changedEdges.size() == 0) + if (changedEdges.empty()) { break; } @@ -144,7 +144,7 @@ void patchZones::markZone(label faceI) << endl; } - if (changedFaces.size() == 0) + if (changedEdges.empty()) { break; } diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/walkPatch.C b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/walkPatch.C index e5fedccabde52fc3c0cc48c9b08b06d719c589c7..f49c8beca8baef9edc740b22808a8333bdeccc74 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/walkPatch.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/walkPatch.C @@ -29,22 +29,14 @@ Description #include "walkPatch.H" #include "ListOps.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -defineTypeNameAndDebug(walkPatch, 0); - +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +defineTypeNameAndDebug(Foam::walkPatch, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // Get other face using v0, v1 (in localFaces numbering). Or -1. -label walkPatch::getNeighbour +Foam::label Foam::walkPatch::getNeighbour ( const label faceI, const label fp, @@ -104,19 +96,11 @@ label walkPatch::getNeighbour const labelList& eFaces = pp_.edgeFaces()[nbrEdgeI]; - if (eFaces.size() > 2 || eFaces.size() <= 0) + if (eFaces.size() == 1) { - FatalErrorIn("getNeighbour") - << "Illegal surface on patch. Face " << faceI - << " at vertices " << v0 << ',' << v1 << " has more than 2" - << " or less than 1 neighbours" << abort(FatalError); return -1; } - else if (eFaces.size() == 1) - { - return -1; - } - else + else if (eFaces.size() == 2) { label nbrFaceI = eFaces[0]; @@ -127,12 +111,21 @@ label walkPatch::getNeighbour return nbrFaceI; } + else + { + FatalErrorIn("getNeighbour") + << "Illegal surface on patch. Face " << faceI + << " at vertices " << v0 << ',' << v1 + << " has fewer than 1 or more than 2 neighbours" + << abort(FatalError); + return -1; + } } // Gets labels of changed faces and enterVertices on faces. // Returns labels of faces changed and enterVertices on them. -void walkPatch::faceToFace +void Foam::walkPatch::faceToFace ( const labelList& changedFaces, const labelList& enterVerts, @@ -149,7 +142,7 @@ void walkPatch::faceToFace { label faceI = changedFaces[i]; label enterVertI = enterVerts[i]; - + if (!visited_[faceI]) { // Do this face @@ -225,7 +218,7 @@ Foam::walkPatch::walkPatch // Corresponding list of entry vertices labelList enterVerts(1, enterVertI); - while(1) + while (true) { labelList nbrFaces; labelList nbrEnterVerts; @@ -240,7 +233,7 @@ Foam::walkPatch::walkPatch ); - if (nbrFaces.size() == 0) + if (nbrFaces.empty()) { break; } @@ -254,8 +247,4 @@ Foam::walkPatch::walkPatch } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/bools/bool/bool.H b/src/OpenFOAM/primitives/bools/bool/bool.H index f21c7471e0aa22968975949651c0bff9f3eae8ec..3538d942399c9eca9ac9a6794a547163bdd02568 100644 --- a/src/OpenFOAM/primitives/bools/bool/bool.H +++ b/src/OpenFOAM/primitives/bools/bool/bool.H @@ -26,8 +26,7 @@ Primitive bool Description - C++ 4.0 supports a builtin type bool but older compilers do not. - This is a simple typedef to emulate the standard bool type. + System bool SourceFiles boolIO.C diff --git a/src/OpenFOAM/primitives/bools/bool/boolIO.C b/src/OpenFOAM/primitives/bools/bool/boolIO.C index 298624b271ee92e02b2e20d6f5d2f37e40e91a56..b5636b5890e0db24f72608a7ca08fa4252229c8f 100644 --- a/src/OpenFOAM/primitives/bools/bool/boolIO.C +++ b/src/OpenFOAM/primitives/bools/bool/boolIO.C @@ -23,10 +23,9 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - Reads an bool from an input stream, for a given version - number and File format. If an ascii File is being read, - then the line numbers are counted and an erroneous read - ised. + Reads an bool from an input stream, for a given version number and file + format. If an ASCII file is being read, then the line numbers are counted + and an erroneous read is reported. \*---------------------------------------------------------------------------*/ diff --git a/src/OpenFOAM/primitives/nil/nil.H b/src/OpenFOAM/primitives/nil/nil.H index c6fd97eaaf346934a283c9f1586fc18505802d93..320438ddc5bb255ff53d86f7cbf6354127cef6c9 100644 --- a/src/OpenFOAM/primitives/nil/nil.H +++ b/src/OpenFOAM/primitives/nil/nil.H @@ -26,7 +26,10 @@ Class Foam::nil Description - A class without any storage. Used, for example, in HashSet. + A zero-sized class without any storage. Used, for example, in HashSet. + +Note + A zero-sized class actually does still require at least 1 byte storage. \*---------------------------------------------------------------------------*/ diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.C b/src/OpenFOAM/primitives/strings/fileName/fileName.C index 8545d03a95c79ef545ca80aeddc49fae085f573b..6a7e2056c690b0178058474a0ca211be81daf564 100644 --- a/src/OpenFOAM/primitives/strings/fileName/fileName.C +++ b/src/OpenFOAM/primitives/strings/fileName/fileName.C @@ -238,9 +238,9 @@ void Foam::fileName::operator=(const char* str) Foam::fileName Foam::operator/(const string& a, const string& b) { - if (a.size() > 0) // First string non-null + if (a.size()) // First string non-null { - if (b.size() > 0) // Second string non-null + if (b.size()) // Second string non-null { return fileName(a + '/' + b); } @@ -251,7 +251,7 @@ Foam::fileName Foam::operator/(const string& a, const string& b) } else // First string null { - if (b.size() > 0) // Second string non-null + if (b.size()) // Second string non-null { return b; } diff --git a/src/OpenFOAM/primitives/strings/word/wordI.H b/src/OpenFOAM/primitives/strings/word/wordI.H index 24942c70c8fba4af91c74130f31e0de307e543b2..f84b99be437cb79e2cb271aee98f9a86af79ab8d 100644 --- a/src/OpenFOAM/primitives/strings/word/wordI.H +++ b/src/OpenFOAM/primitives/strings/word/wordI.H @@ -162,17 +162,17 @@ inline void Foam::word::operator=(const char* q) inline Foam::word Foam::operator&(const word& a, const word& b) { - if (!b.size()) - { - return a; - } - else + if (b.size()) { string ub = b; ub.string::operator[](0) = char(toupper(ub.string::operator[](0))); return a + ub; } + else + { + return a; + } } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/strings/word/wordIO.C b/src/OpenFOAM/primitives/strings/word/wordIO.C index 37cbaa79cf4dd044fca39784d86dd44d7162571b..093a282846ef82f2cb6f7b80956c6cb5b0a93347 100644 --- a/src/OpenFOAM/primitives/strings/word/wordIO.C +++ b/src/OpenFOAM/primitives/strings/word/wordIO.C @@ -61,7 +61,7 @@ Foam::Istream& Foam::operator>>(Istream& is, word& w) string::stripInvalid<word>(w); // flag empty strings and bad chars as an error - if (!w.size() || w.size() != t.stringToken().size()) + if (w.empty() || w.size() != t.stringToken().size()) { is.setBad(); FatalIOErrorIn("operator>>(Istream&, word&)", is) diff --git a/src/Pstream/gamma/OPwrite.C b/src/Pstream/gamma/OPwrite.C index fedc525d65685c75d2ac15fb774ff2315d296f61..00eaa13f817efd505686b6a71f6e429440e6fcf5 100644 --- a/src/Pstream/gamma/OPwrite.C +++ b/src/Pstream/gamma/OPwrite.C @@ -98,7 +98,7 @@ bool OPstream::write << Foam::abort(FatalError); } - if (maxSendSize.size() == 0) + if (maxSendSize.empty()) { // Intialize maxSendSize to the initial size of the receive buffers. maxSendSize.setSize(Pstream::nProcs()); diff --git a/src/Pstream/mpi/IPread.C b/src/Pstream/mpi/IPread.C index ad3c915e7ec9255290633ddd4674e94c638920c6..2b6953765abadd555e2c2cf8ab10d2b82eb787b9 100644 --- a/src/Pstream/mpi/IPread.C +++ b/src/Pstream/mpi/IPread.C @@ -191,7 +191,7 @@ Foam::label Foam::IPstream::read void Foam::IPstream::waitRequests() { - if (IPstream_outstandingRequests_.size() > 0) + if (IPstream_outstandingRequests_.size()) { if ( diff --git a/src/Pstream/mpi/OPwrite.C b/src/Pstream/mpi/OPwrite.C index 9b2ecda89025d1cfff26cc8332e8d8bba9bf687a..230a366ebdfa948a742d2b9ef95177ce8579a88a 100644 --- a/src/Pstream/mpi/OPwrite.C +++ b/src/Pstream/mpi/OPwrite.C @@ -129,7 +129,7 @@ bool Foam::OPstream::write void Foam::OPstream::waitRequests() { - if (OPstream_outstandingRequests_.size() > 0) + if (OPstream_outstandingRequests_.size()) { if ( diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C index 300ed06c5e21d70372a53d89ebb24d6d8285c0ac..7a3152b494e0c0824e1ae7576f3edff7c6ed947e 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C @@ -351,7 +351,7 @@ Foam::autoHexMeshDriver::autoHexMeshDriver //// in when snapping) // //labelList namedSurfaces(surfaces().getNamedSurfaces()); - //if (namedSurfaces.size() > 0) + //if (namedSurfaces.size()) //{ // Info<< nl // << "Introducing cyclics for faceZones" << nl diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index c8e9baafe59d97b085385f92a10dfffbf6abcd2f..b384902710536955ebe0cbf93440b0441b97f46d 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -2420,7 +2420,7 @@ void Foam::autoLayerDriver::getLayerCellsFaces { const labelList& layer = layerFaces[oldPatchFaceI]; - if (layer.size() > 0) + if (layer.size()) { for (label i = 1; i < layer.size()-1; i++) { diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index 93fa342507d5c3a9d95dad657e8c4d0215724731..f6023764612f9cf3710397026f093e3bb003c081 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -143,7 +143,7 @@ Foam::label Foam::autoRefineDriver::featureEdgeRefine label iter = 0; - if (featureMeshes.size() > 0 && maxIter > 0) + if (featureMeshes.size() && maxIter > 0) { for (; iter < maxIter; iter++) { @@ -541,7 +541,7 @@ void Foam::autoRefineDriver::zonify // into that surface's faceZone. All cells inside faceZone get given the // same cellZone. - if (meshRefiner_.surfaces().getNamedSurfaces().size() > 0) + if (meshRefiner_.surfaces().getNamedSurfaces().size()) { Info<< nl << "Introducing zones for interfaces" << nl diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index adcd9c5aeb7d9eee7d79657f5cf028707b27d5dd..a4cd0a504dd35d54f619fb1080b904de0386930d 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -73,7 +73,7 @@ void Foam::autoSnapDriver::getZonedSurfaces forAll(faceZoneNames, surfI) { - if (faceZoneNames[surfI].size() > 0) + if (faceZoneNames[surfI].size()) { zonedSurfaces[zonedI++] = surfI; } @@ -103,7 +103,7 @@ Foam::Map<Foam::label> Foam::autoSnapDriver::getZoneBafflePatches forAll(faceZoneNames, surfI) { - if (faceZoneNames[surfI].size() > 0) + if (faceZoneNames[surfI].size()) { // Get zone label zoneI = fZones.findZoneID(faceZoneNames[surfI]); @@ -718,7 +718,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::createZoneBaffles autoPtr<mapPolyMesh> map; // No need to sync; all processors will have all same zonedSurfaces. - if (zonedSurfaces.size() > 0) + if (zonedSurfaces.size()) { fvMesh& mesh = meshRefiner_.mesh(); @@ -806,7 +806,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::mergeZoneBaffles // No need to sync; all processors will have all same zonedSurfaces. label nBaffles = returnReduce(baffles.size(), sumOp<label>()); - if (zonedSurfaces.size() > 0 && nBaffles > 0) + if (zonedSurfaces.size() && nBaffles > 0) { // Merge any baffles Info<< "Converting " << nBaffles << " baffles back into zoned faces ..." @@ -1122,7 +1122,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface forAll(hitInfo, i) { - label pointI = zonePointIndices[i]; + label pointI = zonePointIndices[i]; if (hitInfo[i].hit()) { @@ -1391,7 +1391,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface forAll(fZone, i) { isZonedFace.set(fZone[i], 1); - } + } } } diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index c80e6a4881a763f7cde07dfceb36512e78366578..4b10b84763ade9dd403aed308ec5534710d20516 100644 --- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C @@ -1060,7 +1060,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance forAll(fzNames, surfI) { - if (fzNames[surfI].size() > 0) + if (fzNames[surfI].size()) { // Get zone label zoneI = fZones.findZoneID(fzNames[surfI]); @@ -1713,7 +1713,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions labelList exposedFaces(cellRemover.getExposedFaces(cellsToRemove)); - if (exposedFaces.size() > 0) + if (exposedFaces.size()) { FatalErrorIn ( @@ -2148,7 +2148,7 @@ void Foam::meshRefinement::write { dumpRefinementLevel(); } - if (flag&OBJINTERSECTIONS && prefix.size()>0) + if (flag & OBJINTERSECTIONS && prefix.size()) { dumpIntersections(prefix); } diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C index 79d698bef6c276641b72ad79bfc38b684048cd06..2d7ca7314bcd5e5228c75b6598940f71764cff5a 100644 --- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C @@ -241,7 +241,7 @@ void Foam::meshRefinement::getBafflePatches label baffleI = 0; forAll(cellZoneNames, surfI) { - if (cellZoneNames[surfI].size() > 0) + if (cellZoneNames[surfI].size()) { if (debug) { @@ -1385,7 +1385,7 @@ void Foam::meshRefinement::baffleAndSplitMesh faceSet problemTopo(mesh_, "problemFacesTopo", 100); const labelList facePatchTopo - ( + ( markFacesOnProblemCells ( removeEdgeConnectedCells, @@ -1605,7 +1605,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh // Patch for exposed faces for lack of anything sensible. label defaultPatch = 0; - if (globalToPatch.size() > 0) + if (globalToPatch.size()) { defaultPatch = globalToPatch[0]; } @@ -2155,7 +2155,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify // Set using geometric test // ~~~~~~~~~~~~~~~~~~~~~~~~ - if (closedNamedSurfaces.size() > 0) + if (closedNamedSurfaces.size()) { findCellZoneGeometric ( diff --git a/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C b/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C index bf728dfe48770558c41b8e4c9d96457e4a81b4c8..6277740b9ae74c040e757fa51d9563a040d8a386 100644 --- a/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C +++ b/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C @@ -416,12 +416,12 @@ Foam::refinementSurfaces::refinementSurfaces // Get indices of unnamed surfaces (surfaces without faceZoneName) Foam::labelList Foam::refinementSurfaces::getUnnamedSurfaces() const { - labelList anonymousSurfaces(faceZoneNames_.size()); + labelList anonymousSurfaces(faceZoneNames_.size()); label i = 0; forAll(faceZoneNames_, surfI) { - if (faceZoneNames_[surfI].size() == 0) + if (faceZoneNames_[surfI].empty()) { anonymousSurfaces[i++] = surfI; } @@ -440,7 +440,7 @@ Foam::labelList Foam::refinementSurfaces::getNamedSurfaces() const label namedI = 0; forAll(faceZoneNames_, surfI) { - if (faceZoneNames_[surfI].size() > 0) + if (faceZoneNames_[surfI].size()) { namedSurfaces[namedI++] = surfI; } @@ -574,7 +574,7 @@ void Foam::refinementSurfaces::findHigherIntersection surfaceLevel.setSize(start.size()); surfaceLevel = -1; - if (surfaces_.size() == 0) + if (surfaces_.empty()) { return; } @@ -614,14 +614,14 @@ void Foam::refinementSurfaces::findHigherIntersection if (hitInfo[hitI].hit()) { // Check if minLevelField for this surface. - if (minLevelField.size() > 0) + if (minLevelField.size()) { minLocalLevel = minLevelField[hitI]; } else { // Use the min level for the surface instead. Assume - // single region 0. + // single region 0. minLocalLevel = minLevel(surfI, 0); } } @@ -673,7 +673,7 @@ void Foam::refinementSurfaces::findAllHigherIntersections surfaceLevel.setSize(start.size()); surfaceNormal.setSize(start.size()); - if (surfaces_.size() == 0) + if (surfaces_.empty()) { return; } @@ -969,7 +969,7 @@ void Foam::refinementSurfaces::findNearestRegion List<pointIndexHit> localHits ( - IndirectList<pointIndexHit> + IndirectList<pointIndexHit> ( hitInfo, localIndices diff --git a/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C b/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C index 492ceaa58e26ad6527fc7db9d11e3c91d23cb141..9c06ccddea6156ba9ff0c1215cf0c6af1cd130ad 100644 --- a/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C +++ b/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C @@ -170,7 +170,7 @@ void Foam::shellSurfaces::orient() { const triSurfaceMesh& shell = refCast<const triSurfaceMesh>(s); - if (shell.triSurface::size() > 0) + if (shell.triSurface::size()) { const pointField& points = shell.points(); diff --git a/src/conversion/meshTables/boundaryRegion.C b/src/conversion/meshTables/boundaryRegion.C index 73b9abcd36cd7ac263494e848a21da3fe33971ae..b5c278887fa3429bf4831fe25132b2a321e6c7b8 100644 --- a/src/conversion/meshTables/boundaryRegion.C +++ b/src/conversion/meshTables/boundaryRegion.C @@ -114,7 +114,7 @@ Foam::Map<Foam::word> Foam::boundaryRegion::names { lookup.insert(iter.key(), lookupName); } - } + } return lookup; } @@ -139,7 +139,7 @@ Foam::Map<Foam::word> Foam::boundaryRegion::boundaryTypes() const Foam::label Foam::boundaryRegion::findIndex(const word& name) const { - if (!name.size()) + if (name.empty()) { return -1; } @@ -254,7 +254,7 @@ void Foam::boundaryRegion::operator=(const Map<dictionary>& rhs) void Foam::boundaryRegion::rename(const dictionary& mapDict) { - if (!mapDict.size()) + if (mapDict.empty()) { return; } diff --git a/src/conversion/meshTables/cellTable.C b/src/conversion/meshTables/cellTable.C index 6b3789eb02d5cf42999bb364bf2c01f320a40b04..5239e6bc12c1c7a64fca235fa3cfdfa6ddb17ad7 100644 --- a/src/conversion/meshTables/cellTable.C +++ b/src/conversion/meshTables/cellTable.C @@ -208,7 +208,7 @@ Foam::word Foam::cellTable::name(const label& id) const Foam::label Foam::cellTable::findIndex(const word& name) const { - if (!name.size()) + if (name.empty()) { return -1; } @@ -466,7 +466,7 @@ void Foam::cellTable::addCellZones forAll(zoneCells, zoneI) { zoneCells[zoneI].shrink(); - if (zoneCells[zoneI].size() > 0) + if (zoneCells[zoneI].size()) { zoneUsed[nZone++] = zoneI; } @@ -509,7 +509,7 @@ void Foam::cellTable::addCellZones void Foam::cellTable::combine(const dictionary& mapDict, labelList& tableIds) { - if (!mapDict.size()) + if (mapDict.empty()) { return; } diff --git a/src/conversion/meshWriter/starcd/STARCDMeshWriter.C b/src/conversion/meshWriter/starcd/STARCDMeshWriter.C index 60533149489abedeccb607f3d41fc058b6e14995..5d4bc7920514777991e4a9aba0439dac0d5a75b8 100644 --- a/src/conversion/meshWriter/starcd/STARCDMeshWriter.C +++ b/src/conversion/meshWriter/starcd/STARCDMeshWriter.C @@ -92,7 +92,7 @@ void Foam::meshWriters::STARCD::getCellTable() { cellTableId_.transfer(ioList); - if (!cellTable_.size()) + if (cellTable_.empty()) { Info<< "no cellTable information available" << endl; } @@ -116,7 +116,7 @@ void Foam::meshWriters::STARCD::getCellTable() if (useCellZones) { - if (!cellTable_.size()) + if (cellTable_.empty()) { Info<< "created cellTable from cellZones" << endl; cellTable_ = mesh_; @@ -500,7 +500,7 @@ bool Foam::meshWriters::STARCD::write(const fileName& meshName) const { fileName baseName(meshName); - if (!baseName.size()) + if (baseName.empty()) { baseName = meshWriter::defaultMeshName; @@ -535,7 +535,7 @@ bool Foam::meshWriters::STARCD::writeSurface { fileName baseName(meshName); - if (!baseName.size()) + if (baseName.empty()) { baseName = meshWriter::defaultSurfaceName; diff --git a/src/conversion/polyDualMesh/polyDualMesh.C b/src/conversion/polyDualMesh/polyDualMesh.C index 7d12bab37f3c1bd53e8ee8f1a7ad2da11f69c67f..0db23c7ed63d6fc146230c7b9262d389fdb640b3 100644 --- a/src/conversion/polyDualMesh/polyDualMesh.C +++ b/src/conversion/polyDualMesh/polyDualMesh.C @@ -758,7 +758,7 @@ void Foam::polyDualMesh::calcDual allBoundary.checkPointManifold(true, &nonManifoldPoints); - if (nonManifoldPoints.size() > 0) + if (nonManifoldPoints.size()) { nonManifoldPoints.write(); @@ -1151,7 +1151,7 @@ void Foam::polyDualMesh::calcDual dynDualOwner.shrink(); dynDualNeighbour.shrink(); dynDualRegion.shrink(); - + OFstream str("dualInternalFaces.obj"); Pout<< "polyDualMesh::calcDual : dumping internal faces to " << str.name() << endl; @@ -1163,7 +1163,7 @@ void Foam::polyDualMesh::calcDual forAll(dynDualFaces, dualFaceI) { const face& f = dynDualFaces[dualFaceI]; - + str<< 'f'; forAll(f, fp) { @@ -1229,7 +1229,7 @@ void Foam::polyDualMesh::calcDual forAll(dualFaces, dualFaceI) { const face& f = dualFaces[dualFaceI]; - + str<< 'f'; forAll(f, fp) { diff --git a/src/decompositionAgglomeration/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C b/src/decompositionAgglomeration/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C index 722deab57c3e346a8be0f62fd6d7c45ea97ce4ba..882123c526a9849cc7d23b0e627eb1219dbdfb3f 100644 --- a/src/decompositionAgglomeration/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C +++ b/src/decompositionAgglomeration/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C @@ -236,14 +236,18 @@ void Foam::hierarchGeomDecomp::sortComponent scalar minCoord = returnReduce ( - (sortedCoord.size() > 0 ? sortedCoord[0] : GREAT), + ( + sortedCoord.size() + ? sortedCoord[0] + : GREAT + ), minOp<scalar>() ); scalar maxCoord = returnReduce ( ( - sortedCoord.size() > 0 + sortedCoord.size() ? sortedCoord[sortedCoord.size()-1] : -GREAT ), @@ -251,7 +255,7 @@ void Foam::hierarchGeomDecomp::sortComponent ); if (debug) - { + { Pout<< "sortComponent : minCoord:" << minCoord << " maxCoord:" << maxCoord << endl; } @@ -274,7 +278,7 @@ void Foam::hierarchGeomDecomp::sortComponent // Value at right of bin (leftIndex+localSize-1) scalar rightCoord = -GREAT; - + if (bin == n_[compI]-1) { // Last bin. Copy all. diff --git a/src/decompositionAgglomeration/decompositionMethods/metisDecomp/metisDecomp.C b/src/decompositionAgglomeration/decompositionMethods/metisDecomp/metisDecomp.C index 5d368642b68d49d67b1546ca98f14e3d09032396..b4a643562f0f21bbd6a60c7b535b3ce5a80b1201 100644 --- a/src/decompositionAgglomeration/decompositionMethods/metisDecomp/metisDecomp.C +++ b/src/decompositionAgglomeration/decompositionMethods/metisDecomp/metisDecomp.C @@ -220,12 +220,12 @@ Foam::label Foam::metisDecomp::decompose int* vwgtPtr = NULL; int* adjwgtPtr = NULL; - if (cellWeights.size() > 0) + if (cellWeights.size()) { vwgtPtr = cellWeights.begin(); wgtFlag += 2; // Weights on vertices } - if (faceWeights.size() > 0) + if (faceWeights.size()) { adjwgtPtr = faceWeights.begin(); wgtFlag += 1; // Weights on edges diff --git a/src/decompositionAgglomeration/parMetisDecomp/parMetisDecomp.C b/src/decompositionAgglomeration/parMetisDecomp/parMetisDecomp.C index 73c8160af783087132042040189d0232ba59ab58..c6c6e061e92b63f28e20523b2dd5c2f0a1f902fc 100644 --- a/src/decompositionAgglomeration/parMetisDecomp/parMetisDecomp.C +++ b/src/decompositionAgglomeration/parMetisDecomp/parMetisDecomp.C @@ -188,7 +188,7 @@ Foam::label Foam::parMetisDecomp::decompose << SubField<floatScalar>(xyz, nDims*nCells, nDims*startCell) << ( - (cellWeights.size() > 0) + cellWeights.size() ? static_cast<const Field<int>&> ( Field<int>::subField(cellWeights, nCells, startCell) @@ -197,7 +197,7 @@ Foam::label Foam::parMetisDecomp::decompose ) << ( - (faceWeights.size() > 0) + faceWeights.size() ? static_cast<const Field<int>&> ( Field<int>::subField(faceWeights, nFaces, startFace) @@ -206,11 +206,11 @@ Foam::label Foam::parMetisDecomp::decompose ); // Remove data that has been sent - if (faceWeights.size() > 0) + if (faceWeights.size()) { faceWeights.setSize(faceWeights.size()-nFaces); } - if (cellWeights.size() > 0) + if (cellWeights.size()) { cellWeights.setSize(cellWeights.size()-nCells); } @@ -255,12 +255,12 @@ Foam::label Foam::parMetisDecomp::decompose int* vwgtPtr = NULL; int* adjwgtPtr = NULL; - if (cellWeights.size() > 0) + if (cellWeights.size()) { vwgtPtr = cellWeights.begin(); wgtFlag += 2; // Weights on vertices } - if (faceWeights.size() > 0) + if (faceWeights.size()) { adjwgtPtr = faceWeights.begin(); wgtFlag += 1; // Weights on edges diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index 99fc1b78fd3999fa8a3c6d18507825ed9f832d62..2cb639cb63d623b708cd958cef67537515a1aef3 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C @@ -66,7 +66,7 @@ void dynamicRefineFvMesh::calculateProtectedCells PackedList<1>& unrefineableCell ) const { - if (protectedCell_.size() == 0) + if (protectedCell_.empty()) { unrefineableCell.clear(); return; @@ -375,7 +375,7 @@ autoPtr<mapPolyMesh> dynamicRefineFvMesh::refine } } } - } + } @@ -383,7 +383,7 @@ autoPtr<mapPolyMesh> dynamicRefineFvMesh::refine meshCutter_.updateMesh(map); // Update numbering of protectedCell_ - if (protectedCell_.size() > 0) + if (protectedCell_.size()) { PackedList<1> newProtectedCell(nCells(), 0); @@ -536,7 +536,7 @@ autoPtr<mapPolyMesh> dynamicRefineFvMesh::unrefine meshCutter_.updateMesh(map); // Update numbering of protectedCell_ - if (protectedCell_.size() > 0) + if (protectedCell_.size()) { PackedList<1> newProtectedCell(nCells(), 0); @@ -703,7 +703,7 @@ labelList dynamicRefineFvMesh::selectRefineCells cellLevel[cellI] < maxRefinement && candidateCell.get(cellI) == 1 && ( - unrefineableCell.size() == 0 + unrefineableCell.empty() || unrefineableCell.get(cellI) == 0 ) ) @@ -724,7 +724,7 @@ labelList dynamicRefineFvMesh::selectRefineCells cellLevel[cellI] == level && candidateCell.get(cellI) == 1 && ( - unrefineableCell.size() == 0 + unrefineableCell.empty() || unrefineableCell.get(cellI) == 0 ) ) diff --git a/src/dynamicMesh/attachDetach/attachDetach.C b/src/dynamicMesh/attachDetach/attachDetach.C index 777407492a542a00551de8f88646b80c0139db01..43305938cb8355009a8f8f3f9df35dedacda6d94 100644 --- a/src/dynamicMesh/attachDetach/attachDetach.C +++ b/src/dynamicMesh/attachDetach/attachDetach.C @@ -83,8 +83,8 @@ void Foam::attachDetach::checkDefinition() // Check the sizes and set up state if ( - mesh.boundaryMesh()[masterPatchID_.index()].size() == 0 - && mesh.boundaryMesh()[slavePatchID_.index()].size() == 0 + mesh.boundaryMesh()[masterPatchID_.index()].empty() + && mesh.boundaryMesh()[slavePatchID_.index()].empty() ) { // Boundary is attached @@ -96,7 +96,7 @@ void Foam::attachDetach::checkDefinition() state_ = ATTACHED; // Check if there are faces in the master zone - if (mesh.faceZones()[faceZoneID_.index()].size() == 0) + if (mesh.faceZones()[faceZoneID_.index()].empty()) { FatalErrorIn ( @@ -121,7 +121,7 @@ void Foam::attachDetach::checkDefinition() } } - if (bouFacesInZone.size() > 0) + if (bouFacesInZone.size()) { FatalErrorIn ( @@ -196,7 +196,7 @@ void Foam::attachDetach::checkDefinition() } } - if (zoneProblemFaces.size() > 0) + if (zoneProblemFaces.size()) { FatalErrorIn ( @@ -222,7 +222,7 @@ void Foam::attachDetach::checkDefinition() if ( !triggersOK - || (triggerTimes_.size() < 1 && !manualTrigger()) + || (triggerTimes_.empty() && !manualTrigger()) ) { FatalErrorIn diff --git a/src/dynamicMesh/boundaryMesh/boundaryMesh.C b/src/dynamicMesh/boundaryMesh/boundaryMesh.C index 28396e291886bc53325dc455f1eef06f167314cf..494cda92951aaad1b4962d781ddb6f0d6a57353b 100644 --- a/src/dynamicMesh/boundaryMesh/boundaryMesh.C +++ b/src/dynamicMesh/boundaryMesh/boundaryMesh.C @@ -37,10 +37,7 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(boundaryMesh, 0); -} +defineTypeNameAndDebug(Foam::boundaryMesh, 0); // Normal along which to divide faces into categories (used in getNearest) const Foam::vector Foam::boundaryMesh::splitNormal_(3, 2, 1); @@ -394,14 +391,13 @@ void Foam::boundaryMesh::markZone while(1) { - changedEdges = - faceToEdge - ( - borderEdge, - currentZone, - changedFaces, - edgeZone - ); + changedEdges = faceToEdge + ( + borderEdge, + currentZone, + changedFaces, + edgeZone + ); if (debug) { @@ -410,7 +406,7 @@ void Foam::boundaryMesh::markZone << endl; } - if (changedEdges.size() == 0) + if (changedEdges.empty()) { break; } @@ -424,7 +420,7 @@ void Foam::boundaryMesh::markZone << endl; } - if (changedFaces.size() == 0) + if (changedFaces.empty()) { break; } @@ -604,7 +600,7 @@ void Foam::boundaryMesh::readTriSurface(const fileName& fName) { triSurface surf(fName); - if (surf.size() <= 0) + if (surf.empty()) { return; } @@ -1239,7 +1235,7 @@ void Foam::boundaryMesh::patchify // Pass2: // Change patch type for face - if (newPatchPtrList.size() > 0) + if (newPatchPtrList.size()) { List<DynamicList<label> > patchFaces(nNewPatches); @@ -1597,7 +1593,7 @@ void Foam::boundaryMesh::deletePatch(const word& patchName) << abort(FatalError); } - if (patches_[delPatchI].size() != 0) + if (patches_[delPatchI].size()) { FatalErrorIn("boundaryMesh::deletePatch(const word&") << "Trying to delete non-empty patch " << patchName @@ -1715,7 +1711,7 @@ void Foam::boundaryMesh::changeFaces { label patchID = patchIDs[faceI]; - if ((patchID < 0) || (patchID >= patches_.size())) + if (patchID < 0 || patchID >= patches_.size()) { FatalErrorIn("boundaryMesh::changeFaces(const labelList&)") << "PatchID " << patchID << " out of range" diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index 31138b5e68b3af6fe231709f0c1e6937d959b6db..38e040506f1d9567879d62d45a77a5af17b66d0b 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -196,7 +196,7 @@ void Foam::fvMeshDistribute::printMeshInfo(const fvMesh& mesh) << endl; } - if (mesh.pointZones().size() > 0) + if (mesh.pointZones().size()) { Pout<< "PointZones:" << endl; forAll(mesh.pointZones(), zoneI) @@ -207,7 +207,7 @@ void Foam::fvMeshDistribute::printMeshInfo(const fvMesh& mesh) << endl; } } - if (mesh.faceZones().size() > 0) + if (mesh.faceZones().size()) { Pout<< "FaceZones:" << endl; forAll(mesh.faceZones(), zoneI) @@ -218,7 +218,7 @@ void Foam::fvMeshDistribute::printMeshInfo(const fvMesh& mesh) << endl; } } - if (mesh.cellZones().size() > 0) + if (mesh.cellZones().size()) { Pout<< "CellZones:" << endl; forAll(mesh.cellZones(), zoneI) @@ -392,7 +392,7 @@ void Foam::fvMeshDistribute::deleteTrailingPatch() const_cast<polyBoundaryMesh&>(mesh_.boundaryMesh()); fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh_.boundary()); - if (polyPatches.size() == 0) + if (polyPatches.empty()) { FatalErrorIn("fvMeshDistribute::deleteTrailingPatch(fvMesh&)") << "No patches in mesh" @@ -410,7 +410,7 @@ void Foam::fvMeshDistribute::deleteTrailingPatch() << " : " << polyPatches[sz-1].name() << " size:" << nFaces << endl; } - if (nFaces != 0) + if (nFaces) { FatalErrorIn("fvMeshDistribute::deleteTrailingPatch()") << "There are still " << nFaces << " faces in patch to be deleted " @@ -2035,7 +2035,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute forAll(constructPatchMap, procI) { - if (procI != sendProc && constructPatchMap[procI].size() > 0) + if (procI != sendProc && constructPatchMap[procI].size()) { // Processor already in mesh (either myProcNo or received) inplaceRenumber(oldCellMap, constructCellMap[procI]); diff --git a/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.C b/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.C index 27a54a0556debf859aa1cae3c4a11f314a43c3e7..934484a7975dab7b3d0ed8a84908df4163c9f753 100644 --- a/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.C +++ b/src/dynamicMesh/layerAdditionRemoval/layerAdditionRemoval.C @@ -80,13 +80,13 @@ void Foam::layerAdditionRemoval::checkDefinition() << abort(FatalError); } - if (topoChanger().mesh().faceZones()[faceZoneID_.index()].size() == 0) + if (topoChanger().mesh().faceZones()[faceZoneID_.index()].empty()) { FatalErrorIn ( "void Foam::layerAdditionRemoval::checkDefinition()" - ) << "Face extrusion zone contains no faces. Please check your " - << "mesh definition." + ) << "Face extrusion zone contains no faces. " + << " Please check your mesh definition." << abort(FatalError); } diff --git a/src/dynamicMesh/meshCut/cellCuts/cellCuts.C b/src/dynamicMesh/meshCut/cellCuts/cellCuts.C index 45b2da5168a78bcedcd9448b14f8535224867570..7e0e1fbb8d072ddf4fb0d74f672d6133d3d3709f 100644 --- a/src/dynamicMesh/meshCut/cellCuts/cellCuts.C +++ b/src/dynamicMesh/meshCut/cellCuts/cellCuts.C @@ -37,12 +37,7 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - -defineTypeNameAndDebug(cellCuts, 0); - -} +defineTypeNameAndDebug(Foam::cellCuts, 0); // * * * * * * * * * * * * * Private Static Functions * * * * * * * * * * * // @@ -2012,7 +2007,7 @@ void Foam::cellCuts::setFromCellLoops() { const labelList& loop = cellLoops_[cellI]; - if (loop.size() > 0) + if (loop.size()) { // Storage for cross-face cuts Map<edge> faceSplitCuts(loop.size()); @@ -2203,7 +2198,7 @@ void Foam::cellCuts::setFromCellLoops const labelList& loop = cellLoops[cellLabelI]; - if (loop.size() > 0) + if (loop.size()) { const scalarField& loopWeights = cellLoopWeights[cellLabelI]; @@ -2296,7 +2291,7 @@ void Foam::cellCuts::setFromCellCutter } } - if (debug && invalidCutCells.size() > 0) + if (debug && invalidCutCells.size()) { invalidCutCells.shrink(); invalidCutLoops.shrink(); @@ -2408,7 +2403,7 @@ void Foam::cellCuts::setFromCellCutter } } - if (debug && invalidCutCells.size() > 0) + if (debug && invalidCutCells.size()) { invalidCutCells.shrink(); invalidCutLoops.shrink(); @@ -2458,7 +2453,7 @@ void Foam::cellCuts::orientPlanesAndLoops() { const labelList& loop = cellLoops_[cellI]; - if (loop.size() > 0 && cellAnchorPoints_[cellI].size() == 0) + if (loop.size() && cellAnchorPoints_[cellI].empty()) { // Leave anchor points empty if illegal loop. calcAnchors @@ -2477,9 +2472,9 @@ void Foam::cellCuts::orientPlanesAndLoops() } forAll(cellAnchorPoints_, cellI) { - if (cellLoops_[cellI].size() > 0) + if (cellLoops_[cellI].size()) { - if (cellAnchorPoints_[cellI].size() == 0) + if (cellAnchorPoints_[cellI].empty()) { FatalErrorIn("orientPlanesAndLoops()") << "No anchor points for cut cell " << cellI << endl @@ -2499,7 +2494,7 @@ void Foam::cellCuts::orientPlanesAndLoops() forAll(cellLoops_, cellI) { - if (cellLoops_[cellI].size() > 0) + if (cellLoops_[cellI].size()) { nLoops_++; } @@ -2545,7 +2540,7 @@ void Foam::cellCuts::calcLoopsAndAddressing(const labelList& cutCells) { const labelList& loop = cellLoops_[cellI]; - if (loop.size() > 0) + if (loop.size()) { Pout<< "cell:" << cellI << " "; writeCuts(Pout, loop, loopWeights(loop)); @@ -2632,7 +2627,7 @@ void Foam::cellCuts::check() const const labelList& loop = cellLoops_[cellI]; - if (loop.size() > 0 && anchors.size() == 0) + if (loop.size() && anchors.empty()) { FatalErrorIn("cellCuts::check()") << "cell:" << cellI << " loop:" << loop @@ -2671,11 +2666,7 @@ void Foam::cellCuts::check() const label own = mesh().faceOwner()[faceI]; label nei = mesh().faceNeighbour()[faceI]; - if - ( - cellLoops_[own].size() == 0 - && cellLoops_[nei].size() == 0 - ) + if (cellLoops_[own].empty() && cellLoops_[nei].empty()) { FatalErrorIn("cellCuts::check()") << "Internal face:" << faceI << " cut by " << iter() @@ -2689,7 +2680,7 @@ void Foam::cellCuts::check() const { label own = mesh().faceOwner()[faceI]; - if (cellLoops_[own].size() == 0) + if (cellLoops_[own].empty()) { FatalErrorIn("cellCuts::check()") << "Boundary face:" << faceI << " cut by " << iter() diff --git a/src/dynamicMesh/meshCut/cellLooper/hexCellLooper.C b/src/dynamicMesh/meshCut/cellLooper/hexCellLooper.C index 4a6aa1d5a9f8651051840271f770fefda1e6b262..73f7bca59e4920f6e6b3a1867036187cc95f83cc 100644 --- a/src/dynamicMesh/meshCut/cellLooper/hexCellLooper.C +++ b/src/dynamicMesh/meshCut/cellLooper/hexCellLooper.C @@ -206,23 +206,22 @@ bool Foam::hexCellLooper::cut } else { - success = - geomCellLooper::cut - ( - refDir, - cellI, - vertIsCut, - edgeIsCut, - edgeWeight, - - loop, - loopWeights - ); + success = geomCellLooper::cut + ( + refDir, + cellI, + vertIsCut, + edgeIsCut, + edgeWeight, + + loop, + loopWeights + ); } if (debug) { - if (loop.size() == 0) + if (loop.empty()) { WarningIn("hexCellLooper") << "could not cut cell " << cellI << endl; diff --git a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C index 7c20fa191bb4041d60b3def468a8589bf894390d..3572546e75bed5fea96f56a80f8dcd69b4848527 100644 --- a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C +++ b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C @@ -510,15 +510,14 @@ void Foam::topoCellLooper::walkSplitHex { // Normal vertex on edge of face. Get edges connected to it // which are not on faceI. - labelList nextEdges = - getVertEdgesNonFace - ( - cellI, - faceI, - vertI - ); + labelList nextEdges = getVertEdgesNonFace + ( + cellI, + faceI, + vertI + ); - if (nextEdges.size() == 0) + if (nextEdges.empty()) { // Cross to other face (there is only one since no edges) const labelList& pFaces = mesh().pointFaces()[vertI]; diff --git a/src/dynamicMesh/meshCut/meshModifiers/meshCutAndRemove/meshCutAndRemove.C b/src/dynamicMesh/meshCut/meshModifiers/meshCutAndRemove/meshCutAndRemove.C index 0ebf692ab3a2d965e0feecc4fbbf958cecbf119d..6cbf8ecfc0d3da07da0cd78f7549540081383e22 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/meshCutAndRemove/meshCutAndRemove.C +++ b/src/dynamicMesh/meshCut/meshModifiers/meshCutAndRemove/meshCutAndRemove.C @@ -38,13 +38,7 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - -defineTypeNameAndDebug(meshCutAndRemove, 0); - -} - +defineTypeNameAndDebug(Foam::meshCutAndRemove, 0); // * * * * * * * * * * * * * Private Static Functions * * * * * * * * * * * // @@ -116,12 +110,12 @@ Foam::label Foam::meshCutAndRemove::findCutCell { label cellI = cellLabels[labelI]; - if (cuts.cellLoops()[cellI].size() > 0) + if (cuts.cellLoops()[cellI].size()) { return cellI; } } - return -1; + return -1; } @@ -151,7 +145,7 @@ Foam::label Foam::meshCutAndRemove::findInternalFacePoint } } - if (pointLabels.size() == 0) + if (pointLabels.empty()) { FatalErrorIn("meshCutAndRemove::findInternalFacePoint(const labelList&)") << "Empty pointLabels" << abort(FatalError); @@ -212,7 +206,7 @@ void Foam::meshCutAndRemove::faceCells own = mesh().faceOwner()[faceI]; - if (cellLoops[own].size() > 0 && (firstCommon(f, anchorPts[own]) == -1)) + if (cellLoops[own].size() && firstCommon(f, anchorPts[own]) == -1) { // owner has been split and this is the removed part. own = -1; @@ -224,7 +218,7 @@ void Foam::meshCutAndRemove::faceCells { nei = mesh().faceNeighbour()[faceI]; - if (cellLoops[nei].size() > 0 && (firstCommon(f, anchorPts[nei]) == -1)) + if (cellLoops[nei].size() && firstCommon(f, anchorPts[nei]) == -1) { nei = -1; } @@ -711,7 +705,7 @@ void Foam::meshCutAndRemove::setRefinement { const labelList& loop = cellLoops[cellI]; - if (loop.size() > 0) + if (loop.size()) { // Cell is cut. Uses only anchor points and loop itself. forAll(loop, fp) @@ -740,7 +734,7 @@ void Foam::meshCutAndRemove::setRefinement { usedPoint[cPoints[i]] = true; } - } + } } @@ -822,7 +816,7 @@ void Foam::meshCutAndRemove::setRefinement { const labelList& loop = cellLoops[cellI]; - if (loop.size() > 0) + if (loop.size()) { if (cutPatch[cellI] < 0 || cutPatch[cellI] >= patches.size()) { @@ -918,7 +912,7 @@ void Foam::meshCutAndRemove::setRefinement // Renumber face to include split edges. face newFace(addEdgeCutsToFace(faceI)); - + // Edge splitting the face. Convert edge to new vertex numbering. const edge& splitEdge = iter(); @@ -984,7 +978,7 @@ void Foam::meshCutAndRemove::setRefinement label f0Own = -1; label f1Own = -1; - if (cellLoops[own].size() == 0) + if (cellLoops[own].empty()) { // Owner side is not split so keep both halves. f0Own = own; @@ -1031,7 +1025,7 @@ void Foam::meshCutAndRemove::setRefinement if (nei != -1) { - if (cellLoops[nei].size() == 0) + if (cellLoops[nei].empty()) { f0Nei = nei; f1Nei = nei; @@ -1097,7 +1091,7 @@ void Foam::meshCutAndRemove::setRefinement bool modifiedFaceI = false; if (f0Own == -1) - { + { if (f0Nei != -1) { // f0 becomes external face (note:modFace will reverse face) @@ -1125,7 +1119,7 @@ void Foam::meshCutAndRemove::setRefinement // f1 is added face (if at all) if (f1Own == -1) - { + { if (f1Nei == -1) { // f1 not needed. @@ -1225,7 +1219,7 @@ void Foam::meshCutAndRemove::setRefinement { const labelList& eFaces = mesh().edgeFaces()[edgeI]; - forAll(eFaces, i) + forAll(eFaces, i) { label faceI = eFaces[i]; @@ -1397,7 +1391,7 @@ void Foam::meshCutAndRemove::updateMesh(const mapPolyMesh& map) (debug & 2) && (e != newE || newAddedPointI != addedPointI) ) - { + { Pout<< "meshCutAndRemove::updateMesh :" << " updating addedPoints for edge " << e << " from " << addedPointI diff --git a/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.C b/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.C index e13c0a738b1f5e233969f443667c2e4abf90a0ea..6a97db625685b39f31f1c7f7cc6a764e5ec77289 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.C +++ b/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.C @@ -39,12 +39,7 @@ Description // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - -defineTypeNameAndDebug(meshCutter, 0); - -} +defineTypeNameAndDebug(Foam::meshCutter, 0); // * * * * * * * * * * * * * Private Static Functions * * * * * * * * * * * // @@ -111,12 +106,12 @@ Foam::label Foam::meshCutter::findCutCell { label cellI = cellLabels[labelI]; - if (cuts.cellLoops()[cellI].size() > 0) + if (cuts.cellLoops()[cellI].size()) { return cellI; } } - return -1; + return -1; } @@ -146,7 +141,7 @@ Foam::label Foam::meshCutter::findInternalFacePoint } } - if (pointLabels.size() == 0) + if (pointLabels.empty()) { FatalErrorIn("meshCutter::findInternalFacePoint(const labelList&)") << "Empty pointLabels" << abort(FatalError); @@ -173,7 +168,7 @@ void Foam::meshCutter::faceCells own = mesh().faceOwner()[faceI]; - if (cellLoops[own].size() > 0 && uses(f, anchorPts[own])) + if (cellLoops[own].size() && uses(f, anchorPts[own])) { own = addedCells_[own]; } @@ -184,7 +179,7 @@ void Foam::meshCutter::faceCells { nei = mesh().faceNeighbour()[faceI]; - if (cellLoops[nei].size() > 0 && uses(f, anchorPts[nei])) + if (cellLoops[nei].size() && uses(f, anchorPts[nei])) { nei = addedCells_[nei]; } @@ -653,7 +648,7 @@ void Foam::meshCutter::setRefinement forAll(cellLoops, cellI) { - if (cellLoops[cellI].size() > 0) + if (cellLoops[cellI].size()) { // Add a cell to the existing cell label addedCellI = @@ -688,7 +683,7 @@ void Foam::meshCutter::setRefinement { const labelList& loop = cellLoops[cellI]; - if (loop.size() > 0) + if (loop.size()) { // // Convert loop (=list of cuts) into proper face. @@ -769,7 +764,7 @@ void Foam::meshCutter::setRefinement // Renumber face to include split edges. face newFace(addEdgeCutsToFace(faceI)); - + // Edge splitting the face. Convert cuts to new vertex numbering. const edge& splitEdge = iter(); @@ -832,7 +827,7 @@ void Foam::meshCutter::setRefinement label f0Owner = -1; label f1Owner = -1; - if (cellLoops[own].size() == 0) + if (cellLoops[own].empty()) { f0Owner = own; f1Owner = own; @@ -875,7 +870,7 @@ void Foam::meshCutter::setRefinement if (nei != -1) { - if (cellLoops[nei].size() == 0) + if (cellLoops[nei].empty()) { f0Neighbour = nei; f1Neighbour = nei; @@ -935,7 +930,7 @@ void Foam::meshCutter::setRefinement { const labelList& eFaces = mesh().edgeFaces()[edgeI]; - forAll(eFaces, i) + forAll(eFaces, i) { label faceI = eFaces[i]; @@ -970,7 +965,7 @@ void Foam::meshCutter::setRefinement forAll(cellLoops, cellI) { - if (cellLoops[cellI].size() > 0) + if (cellLoops[cellI].size()) { const labelList& cllFaces = mesh().cells()[cellI]; @@ -991,7 +986,7 @@ void Foam::meshCutter::setRefinement ", polyTopoChange&)" ) << "Problem: edges added to face which does " << " not use a marked cut" << endl - << "faceI:" << faceI << endl + << "faceI:" << faceI << endl << "face:" << f << endl << "newFace:" << addEdgeCutsToFace(faceI) << abort(FatalError); @@ -1000,7 +995,7 @@ void Foam::meshCutter::setRefinement // Get (new or original) owner and neighbour of faceI label own, nei; faceCells(cuts, faceI, own, nei); - + modFace ( meshMod, @@ -1142,7 +1137,7 @@ void Foam::meshCutter::updateMesh(const mapPolyMesh& morphMap) (debug & 2) && (e != newE || newAddedPointI != addedPointI) ) - { + { Pout<< "meshCutter::updateMesh :" << " updating addedPoints for edge " << e << " from " << addedPointI diff --git a/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C b/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C index de9f54ac39af5f6bf4b6bd89db2214f711390aed..60a27f53659a752f543d76c483fcdbc5b8619236 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C +++ b/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C @@ -196,7 +196,7 @@ void Foam::multiDirRefinement::addCells labelList& added = addedCells_[masterI]; - if (added.size() == 0) + if (added.empty()) { added.setSize(2); added[0] = masterI; @@ -383,7 +383,7 @@ void Foam::multiDirRefinement::refineHex8 { label oldCellI = cellMap[cellI]; - if (addedCells_[oldCellI].size() > 0) + if (addedCells_[oldCellI].size()) { addedCells_[oldCellI][nAddedCells[oldCellI]++] = cellI; } diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.C b/src/dynamicMesh/motionSmoother/motionSmoother.C index 3015274ba515ea931472862a3f397738fc508597..5307352302ffd0001f8240139ed237d23358bf09 100644 --- a/src/dynamicMesh/motionSmoother/motionSmoother.C +++ b/src/dynamicMesh/motionSmoother/motionSmoother.C @@ -826,7 +826,7 @@ bool Foam::motionSmoother::scaleMesh const label nAllowableErrors ) { - if (!smoothMesh && adaptPatchIDs_.size() == 0) + if (!smoothMesh && adaptPatchIDs_.empty()) { FatalErrorIn("motionSmoother::scaleMesh(const bool") << "You specified both no movement on the internal mesh points" @@ -992,7 +992,7 @@ bool Foam::motionSmoother::scaleMesh << endl; } - if (adaptPatchIDs_.size() != 0) + if (adaptPatchIDs_.size()) { // Scale conflicting patch points scaleField(pp_.meshPoints(), usedPoints, errorReduction, scale_); @@ -1005,7 +1005,7 @@ bool Foam::motionSmoother::scaleMesh for (label i = 0; i < nSmoothScale; i++) { - if (adaptPatchIDs_.size() != 0) + if (adaptPatchIDs_.size()) { // Smooth patch values pointScalarField oldScale(scale_); diff --git a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C index b8a028b84b6a3a7fdf45afea5e61f3b63a9a2e3d..237a2f3cb7dc27052faba2c1e5607a75a9380f1f 100644 --- a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C +++ b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C @@ -36,12 +36,7 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - -defineTypeNameAndDebug(faceCoupleInfo, 0); - -} +defineTypeNameAndDebug(Foam::faceCoupleInfo, 0); const Foam::scalar Foam::faceCoupleInfo::angleTol_ = 1E-3; @@ -541,7 +536,7 @@ void Foam::faceCoupleInfo::setCutEdgeToPoints(const labelList& cutToMasterEdges) const labelList& stringedEdges = masterToCutEdges[masterEdgeI]; - if (stringedEdges.size() == 0) + if (stringedEdges.empty()) { FatalErrorIn ( @@ -1421,16 +1416,15 @@ Foam::label Foam::faceCoupleInfo::geometricMatchEdgeFaces { label masterFaceI = masterFaces[i]; - if (masterToCutFaces[masterFaces[i]].size() == 0) + if (masterToCutFaces[masterFaces[i]].empty()) { - scalar dist = - maxDistance - ( - cutF, - cutPoints, - masterPatch()[masterFaceI], - masterPatch().points() - ); + scalar dist = maxDistance + ( + cutF, + cutPoints, + masterPatch()[masterFaceI], + masterPatch().points() + ); if (dist < minDist) { @@ -2065,7 +2059,7 @@ Foam::faceCoupleInfo::faceCoupleInfo if ( - masterAddressing.size() > 0 + masterAddressing.size() && min(masterAddressing) < masterMesh.nInternalFaces() ) { @@ -2079,7 +2073,7 @@ Foam::faceCoupleInfo::faceCoupleInfo } if ( - slaveAddressing.size() > 0 + slaveAddressing.size() && min(slaveAddressing) < slaveMesh.nInternalFaces() ) { @@ -2156,7 +2150,7 @@ Foam::Map<Foam::labelList> Foam::faceCoupleInfo::makeMap forAll(lst, i) { - if (lst[i].size() > 0) + if (lst[i].size()) { map.insert(i, lst[i]); } diff --git a/src/dynamicMesh/polyTopoChange/attachPolyTopoChanger/attachPolyTopoChanger.C b/src/dynamicMesh/polyTopoChange/attachPolyTopoChanger/attachPolyTopoChanger.C index 1dd63f38c81891be41026946d1db238b56d8b68d..73b285f74edb2293d03bf051ad12cc733550e398 100644 --- a/src/dynamicMesh/polyTopoChange/attachPolyTopoChanger/attachPolyTopoChanger.C +++ b/src/dynamicMesh/polyTopoChange/attachPolyTopoChanger/attachPolyTopoChanger.C @@ -85,16 +85,15 @@ void Foam::attachPolyTopoChanger::attach(const bool removeEmptyPatches) forAll (oldPatches, patchI) { - if (oldPatches[patchI].size() > 0) + if (oldPatches[patchI].size()) { - newPatches[nNewPatches] = - oldPatches[patchI].clone - ( - mesh_.boundaryMesh(), - nNewPatches, - oldPatches[patchI].size(), - oldPatches[patchI].start() - ).ptr(); + newPatches[nNewPatches] = oldPatches[patchI].clone + ( + mesh_.boundaryMesh(), + nNewPatches, + oldPatches[patchI].size(), + oldPatches[patchI].start() + ).ptr(); nNewPatches++; } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C index 65836c81c875b1158533b741dba8b48111e694c1..6015f1b64a00a3f9601bc55f496c4e44b29e4ebb 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C @@ -196,8 +196,8 @@ bool Foam::addPatchCellLayer::sameEdgeNeighbour return !doneEdge[edgeI] // not yet handled && ( - addedPoints_[e[0]].size() != 0 // is extruded - || addedPoints_[e[1]].size() != 0 + addedPoints_[e[0]].size() // is extruded + || addedPoints_[e[1]].size() ) && ( nbrFace(globalEdgeFaces, edgeI, thisGlobalFaceI) @@ -232,10 +232,7 @@ Foam::labelPair Foam::addPatchCellLayer::getEdgeString if ( !doneEdge[edgeI] - && ( - addedPoints_[e[0]].size() != 0 - || addedPoints_[e[1]].size() != 0 - ) + && ( addedPoints_[e[0]].size() || addedPoints_[e[1]].size() ) ) { startFp = fp; @@ -529,7 +526,7 @@ Foam::labelListList Foam::addPatchCellLayer::addedCells { const labelList& faceLabels = layerFaces[patchFaceI]; - if (faceLabels.size() > 0) + if (faceLabels.size()) { labelList& added = layerCells[patchFaceI]; added.setSize(faceLabels.size()-1); @@ -862,7 +859,7 @@ void Foam::addPatchCellLayer::setRefinement forAll(firstLayerDisp, patchPointI) { - if (addedPoints_[patchPointI].size() > 0) + if (addedPoints_[patchPointI].size()) { label meshPointI = meshPoints[patchPointI]; @@ -965,7 +962,7 @@ void Foam::addPatchCellLayer::setRefinement { label meshFaceI = pp.addressing()[patchFaceI]; - if (addedCells[patchFaceI].size() > 0) + if (addedCells[patchFaceI].size()) { layerFaces_[patchFaceI].setSize(addedCells[patchFaceI].size() + 1); layerFaces_[patchFaceI][0] = meshFaceI; @@ -981,7 +978,7 @@ void Foam::addPatchCellLayer::setRefinement { forAll(f, fp) { - if (addedPoints_[f[fp]].size() == 0) + if (addedPoints_[f[fp]].empty()) { // Keep original point newFace[fp] = meshPoints[f[fp]]; @@ -1045,7 +1042,7 @@ void Foam::addPatchCellLayer::setRefinement // forAll(pp, patchFaceI) { - if (addedCells[patchFaceI].size() > 0) + if (addedCells[patchFaceI].size()) { label meshFaceI = pp.addressing()[patchFaceI]; @@ -1235,15 +1232,15 @@ void Foam::addPatchCellLayer::setRefinement { // layer 0 gets all the truncation of neighbouring // faces with more layers. - if (addedPoints_[vEnd].size() != 0) + if (addedPoints_[vEnd].size()) { - newFp += + newFp += addedPoints_[vEnd].size() - numEdgeSideFaces; } - if (addedPoints_[vStart].size() != 0) + if (addedPoints_[vStart].size()) { newFp += - addedPoints_[vStart].size() - numEdgeSideFaces; + addedPoints_[vStart].size() - numEdgeSideFaces; } } @@ -1266,7 +1263,7 @@ void Foam::addPatchCellLayer::setRefinement forAll(stringedVerts, stringedI) { label v = stringedVerts[stringedI]; - if (addedPoints_[v].size() > 0) + if (addedPoints_[v].size()) { label offset = addedPoints_[v].size() - numEdgeSideFaces; @@ -1287,7 +1284,7 @@ void Foam::addPatchCellLayer::setRefinement // add points between stringed vertices (end) if (numEdgeSideFaces < addedPoints_[vEnd].size()) { - if (i == 0 && addedPoints_[vEnd].size() != 0) + if (i == 0 && addedPoints_[vEnd].size()) { label offset = addedPoints_[vEnd].size() - numEdgeSideFaces; @@ -1306,7 +1303,7 @@ void Foam::addPatchCellLayer::setRefinement forAllReverse(stringedVerts, stringedI) { label v = stringedVerts[stringedI]; - if (addedPoints_[v].size() > 0) + if (addedPoints_[v].size()) { label offset = addedPoints_[v].size() - numEdgeSideFaces; @@ -1327,7 +1324,7 @@ void Foam::addPatchCellLayer::setRefinement // add points between stringed vertices (start) if (numEdgeSideFaces < addedPoints_[vStart].size()) { - if (i == 0 && addedPoints_[vStart].size() != 0) + if (i == 0 && addedPoints_[vStart].size()) { label offset = addedPoints_[vStart].size() - numEdgeSideFaces; diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.H index a1bb3f24db36a0c00529c3fa93aec9a09b649424..ea6a7674e46d6d11275b6990497944c39c0e9002 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.H @@ -135,9 +135,9 @@ class addPatchCellLayer void operator()(labelList& x, const labelList& y) const { - if (x.size() == 0) + if (x.empty()) { - if (y.size() > 0) + if (y.size()) { x = y; } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/combineFaces.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/combineFaces.C index 59cbdfd408ae79409af458979e467483e2a7ee20..caa3642f5c9d1d4e78404a565c4d3e2db30fb6fd 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/combineFaces.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/combineFaces.C @@ -897,7 +897,7 @@ void Foam::combineFaces::setUnrefinement faceList& faces = faceSetsVertices_[setI]; - if (faces.size() == 0) + if (faces.empty()) { FatalErrorIn ( diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C index 0d2e4cb2cf05b382a5afeec363a5110c4f9300c5..53357139ac679b176bb77eee6cea0b31ef2bac96 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C @@ -304,7 +304,7 @@ bool Foam::edgeCollapser::collapseEdge(const label edgeI, const label master) label freeRegion = -1; - if (freeRegions_.size() > 0) + if (freeRegions_.size()) { freeRegion = freeRegions_.removeHead(); diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/faceCollapser.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/faceCollapser.C index 57a9738861f0e64a1411cf32e52e3776578772a2..3bb5c345d3d7ec1e2ae83dada361e3376a8e811b 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/faceCollapser.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/faceCollapser.C @@ -441,7 +441,7 @@ void Foam::faceCollapser::setRefinement } } - if (edgePoints.size() > 0) + if (edgePoints.size()) { edgePoints.shrink(); diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C index ca81927fcc0cbc73f4c44268fc57233dae251b3b..fa5ae3ae9d5fae369303360c4e592b0516cda7fb 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C @@ -532,7 +532,7 @@ Foam::label Foam::hexRef8::getAnchorCell const label pointI ) const { - if (cellAnchorPoints[cellI].size() > 0) + if (cellAnchorPoints[cellI].size()) { label index = findIndex(cellAnchorPoints[cellI], pointI); @@ -4017,7 +4017,7 @@ Foam::labelListList Foam::hexRef8::setRefinement { const labelList& addedCells = cellAddedCells[cellI]; - if (addedCells.size() > 0) + if (addedCells.size()) { // Cell was split. history_.storeSplit(cellI, addedCells); diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/localPointRegion.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/localPointRegion.C index d54c1bd92dee5add4d34e9e2e1b6779f2dbc8ba4..76a38381e825c0f87da0980c22987eb6732854e0 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/localPointRegion.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/localPointRegion.C @@ -45,7 +45,7 @@ public: void operator()(face& x, const face& y) const { - if (x.size() > 0) + if (x.size()) { label j = 0; forAll(x, i) @@ -134,7 +134,7 @@ void Foam::localPointRegion::countPointRegions { const face& f = mesh.faces()[faceI]; - if (minRegion[faceI].size() == 0) + if (minRegion[faceI].empty()) { FatalErrorIn("localPointRegion::countPointRegions(..)") << "Face from candidateFace without minRegion set." << endl @@ -364,7 +364,7 @@ void Foam::localPointRegion::calcPointRegions { label faceI = cFaces[cFaceI]; - if (minRegion[faceI].size() > 0) + if (minRegion[faceI].size()) { const face& f = mesh.faces()[faceI]; @@ -391,7 +391,7 @@ void Foam::localPointRegion::calcPointRegions { label faceI = cFaces[cFaceI]; - if (minRegion[faceI].size() > 0) + if (minRegion[faceI].size()) { const face& f = mesh.faces()[faceI]; diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C index 2c7502ebcaa38d25d5b90eeb718943352eceab8e..0a469523061b9d6510fde0d7ddf3cb0bea663462 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C @@ -286,7 +286,7 @@ void Foam::polyTopoChange::getMergeSets objectMap& mergeSet = cellsFromCells[setI]; - if (mergeSet.masterObjects().size() == 0) + if (mergeSet.masterObjects().empty()) { // First occurrence of master cell mergeCellI @@ -569,7 +569,7 @@ Foam::label Foam::polyTopoChange::getCellOrder } } } - while (nextCell.size() > 0); + while (nextCell.size()); } } @@ -1223,7 +1223,7 @@ void Foam::polyTopoChange::calcFaceInflationMaps facesFromPoints.setSize(faceFromPoint_.size()); - if (faceFromPoint_.size() > 0) + if (faceFromPoint_.size()) { label nFacesFromPoints = 0; @@ -1269,7 +1269,7 @@ void Foam::polyTopoChange::calcFaceInflationMaps facesFromEdges.setSize(faceFromEdge_.size()); - if (faceFromEdge_.size() > 0) + if (faceFromEdge_.size()) { label nFacesFromEdges = 0; @@ -1333,7 +1333,7 @@ void Foam::polyTopoChange::calcCellInflationMaps { cellsFromPoints.setSize(cellFromPoint_.size()); - if (cellFromPoint_.size() > 0) + if (cellFromPoint_.size()) { label nCellsFromPoints = 0; @@ -1351,7 +1351,7 @@ void Foam::polyTopoChange::calcCellInflationMaps cellsFromEdges.setSize(cellFromEdge_.size()); - if (cellFromEdge_.size() > 0) + if (cellFromEdge_.size()) { label nCellsFromEdges = 0; @@ -1369,7 +1369,7 @@ void Foam::polyTopoChange::calcCellInflationMaps cellsFromFaces.setSize(cellFromFace_.size()); - if (cellFromFace_.size() > 0) + if (cellFromFace_.size()) { label nCellsFromFaces = 0; diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChangeI.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChangeI.H index 67edf19ff6e2dd2428dd6b7682739a8e923fc0e7..e2ea3c2869ed221a50c265a1b6a59238879e6af9 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChangeI.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChangeI.H @@ -40,7 +40,7 @@ inline bool Foam::polyTopoChange::pointRemoved(const label pointI) const inline bool Foam::polyTopoChange::faceRemoved(const label faceI) const { - return faces_[faceI].size() == 0; + return faces_[faceI].empty(); } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C index a4cce8716afd40907d739a2289c034c98f69d7d4..4d3f6d969623596ea7e6f6bcd3f11add3cb65b3a 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C @@ -153,7 +153,7 @@ Foam::Istream& Foam::operator>>(Istream& is, refinementHistory::splitCell8& sc) is >> sc.parent_ >> addedCells; - if (addedCells.size() > 0) + if (addedCells.size()) { sc.addedCellsPtr_.reset(new FixedList<label, 8>(addedCells)); } @@ -216,7 +216,7 @@ Foam::label Foam::refinementHistory::allocateSplitCell { label index = -1; - if (freeSplitCells_.size() > 0) + if (freeSplitCells_.size()) { index = freeSplitCells_.remove(); diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/removePoints.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/removePoints.H index c6463c557c87c26bef6cc289567945f05019b358..0ea48b115f3ca57a9fec74e3f2a4dfb8fd29ea45 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/removePoints.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/removePoints.H @@ -74,7 +74,7 @@ class removePoints { if (y.size() > 0) { - if (x.size() == 0) + if (x.empty()) { x = y; } diff --git a/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C b/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C index c7003c5e1421c2af3644bc2d42755f3c46486f2f..82e77d76740542a500cfe0be5ccfbd7302bde215 100644 --- a/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C +++ b/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C @@ -1277,7 +1277,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const // Get points on current edge const labelList& curPime = pime[curEdges[curEdgeI]]; - if (curPime.size() > 0) + if (curPime.size()) { changed = true; // Pout << "curPime: " << curPime << endl; @@ -1562,7 +1562,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const // Get points on current edge const labelList& curPise = pise[curEdges[curEdgeI]]; - if (curPise.size() > 0) + if (curPise.size()) { changed = true; // Pout << "curPise: " << curPise << endl; diff --git a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchCutFaces.C b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchCutFaces.C index 6b090fb0d428e400d41dd661ec41147191877649..d15a6ddea53fa4c55a507725e5802826e420ab84 100644 --- a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchCutFaces.C +++ b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchCutFaces.C @@ -151,7 +151,7 @@ void Foam::enrichedPatch::calcCutFaces() const vector normal = curLocalFace.normal(lp); normal /= mag(normal); - while (edgeSeeds.size() > 0) + while (edgeSeeds.size()) { // Pout << "edgeSeeds.size(): " << edgeSeeds.size() << endl; const edge curEdge = edgeSeeds.removeHead(); diff --git a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchFaces.C b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchFaces.C index 85f01c7d37a1943631611dc6f8ca3712ee0a13cc..bad4dd118e535aab507f8122f7ce12203bdd8883 100644 --- a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchFaces.C +++ b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchFaces.C @@ -136,7 +136,7 @@ void Foam::enrichedPatch::calcEnrichedFaces // Info << "slavePointsOnEdge for " << curEdges[i] << ": " << slavePointsOnEdge << endl; // If there are no points on the edge, skip everything // If there is only one point, no need for sorting - if (slavePointsOnEdge.size() > 0) + if (slavePointsOnEdge.size()) { // Sort edge points in order scalarField edgePointWeights(slavePointsOnEdge.size()); @@ -287,7 +287,7 @@ void Foam::enrichedPatch::calcEnrichedFaces // If there are no points on the edge, skip everything // If there is only one point, no need for sorting - if (masterPointsOnEdge.size() > 0) + if (masterPointsOnEdge.size()) { // Sort edge points in order scalarField edgePointWeights(masterPointsOnEdge.size()); diff --git a/src/dynamicMesh/slidingInterface/slidingInterface.C b/src/dynamicMesh/slidingInterface/slidingInterface.C index 78b0581331a43c0a78ada08a07d43c9280e62163..0f8dd3603af39d6de31a581a915de396546a7d93 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterface.C +++ b/src/dynamicMesh/slidingInterface/slidingInterface.C @@ -90,8 +90,8 @@ void Foam::slidingInterface::checkDefinition() // Check the sizes and set up state if ( - mesh.faceZones()[masterFaceZoneID_.index()].size() == 0 - || mesh.faceZones()[slaveFaceZoneID_.index()].size() == 0 + mesh.faceZones()[masterFaceZoneID_.index()].empty() + || mesh.faceZones()[slaveFaceZoneID_.index()].empty() ) { FatalErrorIn("void slidingInterface::checkDefinition()") @@ -431,7 +431,7 @@ void Foam::slidingInterface::modifyMotionPoints(pointField& motionPoints) const // Get point from the cut zone const labelList& cutPoints = mesh.pointZones()[cutPointZoneID_.index()]; - if (cutPoints.size() > 0 && !projectedSlavePointsPtr_) + if (cutPoints.size() && !projectedSlavePointsPtr_) { return; } diff --git a/src/edgeMesh/edgeMesh.C b/src/edgeMesh/edgeMesh.C index 576bfb17384ae6d6ab43ce04ffeef7c6fc6f68ea..6a3933c84f4d417c7949f39ba686f1a132b0b0dd 100644 --- a/src/edgeMesh/edgeMesh.C +++ b/src/edgeMesh/edgeMesh.C @@ -123,7 +123,7 @@ Foam::label Foam::edgeMesh::regions(labelList& edgeRegion) const edgeRegion[startEdgeI] = currentRegion; labelList edgesToVisit(1, startEdgeI); - while (edgesToVisit.size() > 0) + while (edgesToVisit.size()) { // neighbours of current edgesToVisit DynamicList<label> newEdgesToVisit(edgesToVisit.size()); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C index 89fc89bfcbf2d0c57204745cf41140c89c5cccd9..78bf1745353454effb3dbbd01207790b88af7fa4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C @@ -131,7 +131,7 @@ void fanFvPatchField<Type>::autoMap jumpCyclicFvPatchField<Type>::autoMap(m); // Jump is half size. Expand to full size, map and truncate. - if (jump_.size() > 0 && jump_.size() == this->size()/2) + if (jump_.size() && jump_.size() == this->size()/2) { label oldSize = jump_.size(); jump_.setSize(this->size()); @@ -157,7 +157,7 @@ void fanFvPatchField<Type>::rmap jumpCyclicFvPatchField<Type>::rmap(ptf, addr); // Jump is half size. Expand to full size, map and truncate. - if (jump_.size() > 0 && jump_.size() == this->size()/2) + if (jump_.size() && jump_.size() == this->size()/2) { label oldSize = jump_.size(); jump_.setSize(this->size()); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index 3465757afbd64b6935cf0b5c6005f776003d65ba..d29b694acab500882a8e739442ff41f2ad243f4a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -207,7 +207,7 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::autoMap ) { fixedValueFvPatchField<Type>::autoMap(m); - if (startSampledValues_.size() > 0) + if (startSampledValues_.size()) { startSampledValues_.autoMap(m); endSampledValues_.autoMap(m); diff --git a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C index 4f87176be1e4c1dfc89c53c78f7d802497188250..979d85e0d10ab2df814fb9dc2e2860e5aef895f9 100644 --- a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C +++ b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C @@ -358,11 +358,7 @@ ITstream& fvSchemes::ddtScheme(const word& name) const Info<< "Lookup ddtScheme for " << name << endl; } - if - ( - ddtSchemes_.found(name) - || !defaultDdtScheme_.size() - ) + if (ddtSchemes_.found(name) || defaultDdtScheme_.empty()) { return ddtSchemes_.lookup(name); } @@ -381,11 +377,7 @@ ITstream& fvSchemes::d2dt2Scheme(const word& name) const Info<< "Lookup d2dt2Scheme for " << name << endl; } - if - ( - d2dt2Schemes_.found(name) - || !defaultD2dt2Scheme_.size() - ) + if (d2dt2Schemes_.found(name) || defaultD2dt2Scheme_.empty()) { return d2dt2Schemes_.lookup(name); } @@ -407,7 +399,7 @@ ITstream& fvSchemes::interpolationScheme(const word& name) const if ( interpolationSchemes_.found(name) - || !defaultInterpolationScheme_.size() + || defaultInterpolationScheme_.empty() ) { return interpolationSchemes_.lookup(name); @@ -427,7 +419,7 @@ ITstream& fvSchemes::divScheme(const word& name) const Info<< "Lookup divScheme for " << name << endl; } - if (divSchemes_.found(name) || !defaultDivScheme_.size()) + if (divSchemes_.found(name) || defaultDivScheme_.empty()) { return divSchemes_.lookup(name); } @@ -446,7 +438,7 @@ ITstream& fvSchemes::gradScheme(const word& name) const Info<< "Lookup gradScheme for " << name << endl; } - if (gradSchemes_.found(name) || !defaultGradScheme_.size()) + if (gradSchemes_.found(name) || defaultGradScheme_.empty()) { return gradSchemes_.lookup(name); } @@ -465,7 +457,7 @@ ITstream& fvSchemes::snGradScheme(const word& name) const Info<< "Lookup snGradScheme for " << name << endl; } - if (snGradSchemes_.found(name) || !defaultSnGradScheme_.size()) + if (snGradSchemes_.found(name) || defaultSnGradScheme_.empty()) { return snGradSchemes_.lookup(name); } @@ -484,7 +476,7 @@ ITstream& fvSchemes::laplacianScheme(const word& name) const Info<< "Lookup laplacianScheme for " << name << endl; } - if (laplacianSchemes_.found(name) || !defaultLaplacianScheme_.size()) + if (laplacianSchemes_.found(name) || defaultLaplacianScheme_.empty()) { return laplacianSchemes_.lookup(name); } diff --git a/src/finiteVolume/fvMesh/extendedStencil/faceStencil/faceStencil.C b/src/finiteVolume/fvMesh/extendedStencil/faceStencil/faceStencil.C index b3d72c3b5a1d258a49d74cef6f995c05ef6440ec..1812d2648d3ab53c7777c2edc62c318c700d4877 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/faceStencil/faceStencil.C +++ b/src/finiteVolume/fvMesh/extendedStencil/faceStencil/faceStencil.C @@ -245,9 +245,9 @@ void Foam::faceStencil::unionEqOp::operator() const labelList& y ) const { - if (y.size() > 0) + if (y.size()) { - if (x.size() == 0) + if (x.empty()) { x = y; } diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 8d47225f6ca7ec234b0a07b9f442e84006143e4a..1192ef23577a5419231b10e9c23fe54aec6b8b19 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -58,10 +58,7 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(fvMesh, 0); -} +defineTypeNameAndDebug(Foam::fvMesh, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -302,7 +299,7 @@ void Foam::fvMesh::addFvPatches const bool validBoundary ) { - if (boundary().size() > 0) + if (boundary().size()) { FatalErrorIn ( diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C index 2d58e88dd3d4073e04c994a92d80e309134ef3d8..34a8419f4db91dcb41407b22b6504fecf7c6ae98 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/skewCorrected/skewCorrectionVectors.C @@ -135,7 +135,7 @@ void Foam::skewCorrectionVectors::makeSkewCorrectionVectors() const scalar skewCoeff = 0.0; - if (Sf.internalField().size() > 0) + if (Sf.internalField().size()) { skewCoeff = max(mag(SkewCorrVecs)/mag(d)).value(); } diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C index dfb7d4ac6169bb87cc1a8cbf56c3ac705ea17573..178d1d1b2a4d116d0401b3a3e9b7d4f684d734ce 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C @@ -362,7 +362,7 @@ Foam::displacementInterpolationFvMotionSolver::curPoints() const vectorField zoneDisp(displacements_.size(), vector::zero); forAll(zoneDisp, zoneI) { - if (times_[zoneI].size() > 0) + if (times_[zoneI].size()) { zoneDisp[zoneI] = interpolateXY ( diff --git a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C index 5a289b7b5b6dc341b598deaf359a079190f21874..09dfcae98a107d94c6b0848815462422267ec752 100644 --- a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C @@ -75,7 +75,7 @@ Foam::tmp<Foam::scalarField> Foam::inverseDistanceDiffusivity::y() const labelHashSet patchSet(mesh.boundaryMesh().patchSet(patchNames_)); - if (patchSet.size() > 0) + if (patchSet.size()) { return tmp<scalarField> ( diff --git a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C index 9e5c5eb5952a81e1c26f37ca062e637f60316e3b..68e0151f85e6b48c664a51a7fcc6dfa467ea73e4 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C @@ -195,7 +195,7 @@ void surfaceSlipDisplacementPointPatchVectorField::evaluate // Get fixed points (bit of a hack) const pointZone* zonePtr = NULL; - if (frozenPointsZone_.size() > 0) + if (frozenPointsZone_.size()) { const pointZoneMesh& pZones = mesh.pointZones(); diff --git a/src/lagrangian/basic/Particle/Particle.C b/src/lagrangian/basic/Particle/Particle.C index c3a57c5cd0d18fd68bcd665993b3e469b9d64414..ec1d09a00f94244a5183af5a09fe41aae70f216c 100644 --- a/src/lagrangian/basic/Particle/Particle.C +++ b/src/lagrangian/basic/Particle/Particle.C @@ -231,7 +231,7 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace facei_ = -1; scalar trackFraction = 0.0; - if (faces.size() == 0) // inside cell + if (faces.empty()) // inside cell { trackFraction = 1.0; position_ = endPosition; diff --git a/src/lagrangian/dieselSpray/parcel/parcelIO.C b/src/lagrangian/dieselSpray/parcel/parcelIO.C index aeee1e1844b2c07234d5e5bd72fe6ff910d0f075..d84f2bb195c27b41588df1a99a4a7c27a72a431a 100644 --- a/src/lagrangian/dieselSpray/parcel/parcelIO.C +++ b/src/lagrangian/dieselSpray/parcel/parcelIO.C @@ -172,7 +172,7 @@ void Foam::parcel::readFields } // read the liquid molar fractions - if (c.size() > 0) + if (c.size()) { Cloud<parcel>::const_iterator iter = c.begin(); const parcel& p0 = iter(); diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C index 331f2df5bc9a499850a3910fd208233880d9815a..fce8ea2321c687214a1a87a148e346f7b553dd48 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C @@ -90,7 +90,7 @@ definedHollowConeInjector::definedHollowConeInjector } // check number of entries in innerConeAngle list - if (innerConeAngle_.size() < 1) + if (innerConeAngle_.empty()) { FatalError << "definedHollowConeInjector::definedHollowConeInjector" << "(const dictionary& dict, spray& sm)\n" @@ -99,7 +99,7 @@ definedHollowConeInjector::definedHollowConeInjector } // check number of entries in outerConeAngle list - if (outerConeAngle_.size() < 1) + if (outerConeAngle_.empty()) { FatalError << "definedHollowConeInjector::definedHollowConeInjector" << "(const dictionary& dict, spray& sm)\n" diff --git a/src/lagrangian/molecularDynamics/molecule/distribution/distribution.C b/src/lagrangian/molecularDynamics/molecule/distribution/distribution.C index 6788cdcd282b015566d27f565c36af890ef62f83..a4a08b08fa6efd78597d0be45985c227f4d094ad 100644 --- a/src/lagrangian/molecularDynamics/molecule/distribution/distribution.C +++ b/src/lagrangian/molecularDynamics/molecule/distribution/distribution.C @@ -232,11 +232,9 @@ void distribution::insertMissingKeys() sort(keys); - label k; - - if (keys.size() > 0) + if (keys.size()) { - for (k = keys[0]; k < keys[keys.size()-1]; k++) + for (label k = keys[0]; k < keys[keys.size()-1]; k++) { iter = find(k); diff --git a/src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.C b/src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.C index 1bc4d6bdbb6c9218855f1512527490e5dbf70536..6bb5a43da3128fba56f010f87f08dd59b603c24a 100644 --- a/src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.C +++ b/src/lagrangian/molecularDynamics/potential/tetherPotential/tetherPotentialList/tetherPotentialList.C @@ -35,11 +35,11 @@ void Foam::tetherPotentialList::readTetherPotentialDict const List<label>& tetherIds ) { - if (!tetherIds.size()) + if (tetherIds.empty()) { Info<< nl << "No tethered molecules found." << endl; - idMap_.setSize(0); + idMap_.clear(); } else { diff --git a/src/meshTools/cellDist/cellDistFuncs.C b/src/meshTools/cellDist/cellDistFuncs.C index 3952f435d6b5c8975131b70e2094d323ada4b1d8..8bc65470bcf053f2d80257052eb8b91bbf23f118 100644 --- a/src/meshTools/cellDist/cellDistFuncs.C +++ b/src/meshTools/cellDist/cellDistFuncs.C @@ -263,7 +263,7 @@ Foam::label Foam::cellDistFuncs::getPointNeighbours nbs.erase(nb); } - if (nbs.size() != 0) + if (nbs.size()) { FatalErrorIn("getPointNeighbours") << "Problem: fast pointNeighbours routine did not find " diff --git a/src/meshTools/cellFeatures/cellFeatures.C b/src/meshTools/cellFeatures/cellFeatures.C index 4f9c3341fbb5eacd5fb6d71648ecba2667319585..605624473b5ab3e343a4e86196c287093b6990cf 100644 --- a/src/meshTools/cellFeatures/cellFeatures.C +++ b/src/meshTools/cellFeatures/cellFeatures.C @@ -282,7 +282,7 @@ void Foam::cellFeatures::calcSuperFaces() const label superFaceI = toSuperFace[faceI]; - if (faces[superFaceI].size() == 0) + if (faces[superFaceI].empty()) { // Superface not yet constructed. diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C index dfbbcee14507123eb456e83742e7bd37fd0cf286..5d54517f0be968dc746c89eb46f0dc3dd6a8d8cf 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C @@ -139,7 +139,7 @@ void Foam::directMappedPolyPatch::findSamples { case NEARESTCELL: { - if (samplePatch_.size() != 0 && samplePatch_ != "none") + if (samplePatch_.size() && samplePatch_ != "none") { FatalErrorIn ( @@ -196,7 +196,7 @@ void Foam::directMappedPolyPatch::findSamples const polyPatch& pp = boundaryMesh()[patchI]; - if (pp.size() == 0) + if (pp.empty()) { forAll(samples, sampleI) { @@ -267,7 +267,7 @@ void Foam::directMappedPolyPatch::findSamples case NEARESTFACE: { - if (samplePatch_.size() != 0 && samplePatch_ != "none") + if (samplePatch_.size() && samplePatch_ != "none") { FatalErrorIn ( diff --git a/src/meshTools/indexedOctree/indexedOctree.C b/src/meshTools/indexedOctree/indexedOctree.C index 233dac95f5bb3749d5b4b0c2634f62d9957125b4..385fb2d314df2796f7f8f32572d879ef2fcb7e84 100644 --- a/src/meshTools/indexedOctree/indexedOctree.C +++ b/src/meshTools/indexedOctree/indexedOctree.C @@ -224,7 +224,7 @@ Foam::indexedOctree<Type>::divide { labelList& subIndices = dividedIndices[octant]; - if (subIndices.size() > 0) + if (subIndices.size()) { if (!replaced) { @@ -1052,7 +1052,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine { pointIndexHit hitInfo; - if (nodes_.size() > 0) + if (nodes_.size()) { const treeBoundBox& treeBb = nodes_[0].bb_; @@ -1457,11 +1457,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest label nearestShapeI = -1; point nearestPoint; - if (nodes_.size() == 0) - { - nearestPoint = vector::zero; - } - else + if (nodes_.size()) { findNearest ( @@ -1473,6 +1469,10 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest nearestPoint ); } + else + { + nearestPoint = vector::zero; + } return pointIndexHit(nearestShapeI != -1, nearestPoint, nearestShapeI); } @@ -1489,11 +1489,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest label nearestShapeI = -1; point nearestPoint; - if (nodes_.size() == 0) - { - nearestPoint = vector::zero; - } - else + if (nodes_.size()) { findNearest ( @@ -1506,6 +1502,10 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest nearestPoint ); } + else + { + nearestPoint = vector::zero; + } return pointIndexHit(nearestShapeI != -1, nearestPoint, nearestShapeI); } @@ -1544,7 +1544,7 @@ Foam::labelList Foam::indexedOctree<Type>::findBox // Storage for labels of shapes inside bb. Size estimate. labelHashSet elements(shapes_.size() / 100); - if (nodes_.size() > 0) + if (nodes_.size()) { findBox(0, searchBox, elements); } @@ -1561,7 +1561,7 @@ Foam::labelBits Foam::indexedOctree<Type>::findNode const point& sample ) const { - if (nodes_.size() == 0) + if (nodes_.empty()) { // Empty tree. Return what? return nodePlusOctant(nodeI, 0); @@ -1599,7 +1599,7 @@ Foam::indexedOctree<Type>::getVolumeType const point& sample ) const { - if (nodes_.size() == 0) + if (nodes_.empty()) { return UNKNOWN; } diff --git a/src/meshTools/indexedOctree/indexedOctree.H b/src/meshTools/indexedOctree/indexedOctree.H index 68e63626e4fe834b06c434a4f3617aade5c2a60d..b4aad9a3052f520a6ffd599a921f31645f32e933 100644 --- a/src/meshTools/indexedOctree/indexedOctree.H +++ b/src/meshTools/indexedOctree/indexedOctree.H @@ -372,7 +372,7 @@ public: //- Top bounding box const treeBoundBox& bb() const { - if (nodes_.size() == 0) + if (nodes_.empty()) { FatalErrorIn("indexedOctree<Type>::bb() const") << "Tree is empty" << abort(FatalError); diff --git a/src/meshTools/octree/octree.C b/src/meshTools/octree/octree.C index 0dbda8434a8815afa6346ac95a617c1648a64d65..554af3ad5abc41e23063436cf00a521a9ca276c6 100644 --- a/src/meshTools/octree/octree.C +++ b/src/meshTools/octree/octree.C @@ -621,12 +621,12 @@ void Foam::octree<Type>::printStats(Ostream& os) const << " nLeaves :" << nLeaves() << endl << " nEntries :" << nEntries() << endl; - if (nLeaves() > 0 && shapes().size() > 0) + if (nLeaves() && shapes().size()) { os << " Cells per leaf :" << scalar(nEntries())/nLeaves() - << endl + << nl << " Every cell in :" << scalar(nEntries())/shapes().size() << " cubes" << endl; diff --git a/src/meshTools/octree/octreeLine.C b/src/meshTools/octree/octreeLine.C index 540721e9503aa98e07a8e9075fa24321553c0ac0..76e56177b6a1583fefed864dd6ec387829158d12 100644 --- a/src/meshTools/octree/octreeLine.C +++ b/src/meshTools/octree/octreeLine.C @@ -120,7 +120,7 @@ bool Foam::octreeLine<Type>::getNextLeaf() // Get intersections and sort. calcSortedIntersections(); } - while (sortedIntersections_.size() == 0); + while (sortedIntersections_.empty()); return true; } diff --git a/src/meshTools/octree/treeBoundBox.C b/src/meshTools/octree/treeBoundBox.C index c511f7475805431e9e684ceb3dc3ef87d364cb5f..ce62c471924a26b1d138f2d49b0e6c91a42dd5b7 100644 --- a/src/meshTools/octree/treeBoundBox.C +++ b/src/meshTools/octree/treeBoundBox.C @@ -117,7 +117,7 @@ Foam::treeBoundBox::treeBoundBox(const UList<point>& points) : boundBox() { - if (points.size() == 0) + if (points.empty()) { WarningIn ( @@ -148,7 +148,7 @@ Foam::treeBoundBox::treeBoundBox : boundBox() { - if (points.size() == 0 || meshPoints.size() == 0) + if (points.empty() || meshPoints.empty()) { WarningIn ( diff --git a/src/meshTools/octree/treeNode.C b/src/meshTools/octree/treeNode.C index a0ff57fffe2aec3ad59da02b637c9bfb0d6bafc1..3e503f13a08be5552b8d07364f964efab7bda5fc 100644 --- a/src/meshTools/octree/treeNode.C +++ b/src/meshTools/octree/treeNode.C @@ -1381,11 +1381,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const treeNode<Type>& tn) { if (tn.subNodes_[octant]) { - if - ( - tn.isNode(octant) - || (tn.getLeafPtr(octant)->indices().size() != 0) - ) + if (tn.isNode(octant) || tn.getLeafPtr(octant)->indices().size()) { nPtrs++; } @@ -1409,7 +1405,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const treeNode<Type>& tn) os << token::SPACE << octant << token::SPACE << *subNodePtr << token::NL; } - else if (tn.getLeafPtr(octant)->indices().size() != 0) + else if (tn.getLeafPtr(octant)->indices().size()) { // treeLeaf: mark by putting index invalid const treeLeaf<Type>* subLeafPtr = tn.getLeafPtr(octant); diff --git a/src/meshTools/polyMeshZipUpCells/polyMeshZipUpCells.C b/src/meshTools/polyMeshZipUpCells/polyMeshZipUpCells.C index ec18bbeeb0700fba5eb8a7b3abab5b1c8ba9e5d3..0d4ec63faa85b81bb425257a43825df670026ef1 100644 --- a/src/meshTools/polyMeshZipUpCells/polyMeshZipUpCells.C +++ b/src/meshTools/polyMeshZipUpCells/polyMeshZipUpCells.C @@ -720,7 +720,7 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh) } } - if (problemCells.size() > 0) + if (problemCells.size()) { // This cycle has failed. Print out the problem cells labelList toc(problemCells.toc()); diff --git a/src/meshTools/regionSplit/regionSplit.C b/src/meshTools/regionSplit/regionSplit.C index b3152b44b21953e0a51f0d973ae679d0ee82ae36..667a2ddc5d102bfe7d8d8b1906d416f48f58f515 100644 --- a/src/meshTools/regionSplit/regionSplit.C +++ b/src/meshTools/regionSplit/regionSplit.C @@ -131,7 +131,7 @@ void Foam::regionSplit::fillSeedMask // Loop over changed faces. MeshWave in small. - while (changedFaces.size() > 0) + while (changedFaces.size()) { //if (debug) //{ @@ -265,7 +265,7 @@ Foam::label Foam::regionSplit::calcRegionSplit { if (debug) { - if (blockedFace.size() > 0) + if (blockedFace.size()) { // Check that blockedFace is synced. boolList syncBlockedFace(blockedFace); @@ -292,7 +292,7 @@ Foam::label Foam::regionSplit::calcRegionSplit // -2 blocked labelList faceRegion(mesh_.nFaces(), -1); - if (blockedFace.size() > 0) + if (blockedFace.size()) { forAll(blockedFace, faceI) { diff --git a/src/meshTools/searchableSurface/searchableBox.C b/src/meshTools/searchableSurface/searchableBox.C index 49e7ed65eb10db5da1430f70519b67969e869d80..cb9ca7e4426cbc0397baf64d7188f2f9f5e1213e 100644 --- a/src/meshTools/searchableSurface/searchableBox.C +++ b/src/meshTools/searchableSurface/searchableBox.C @@ -194,7 +194,7 @@ Foam::searchableBox::~searchableBox() const Foam::wordList& Foam::searchableBox::regions() const { - if (regions_.size() == 0) + if (regions_.empty()) { regions_.setSize(1); regions_[0] = "region0"; diff --git a/src/meshTools/searchableSurface/searchablePlate.C b/src/meshTools/searchableSurface/searchablePlate.C index e737c1cfa5697df704796cd5ba1c2d0dd5842402..8d61564287ca48726138435efe1079e66fcfdc20 100644 --- a/src/meshTools/searchableSurface/searchablePlate.C +++ b/src/meshTools/searchableSurface/searchablePlate.C @@ -244,7 +244,7 @@ Foam::searchablePlate::~searchablePlate() const Foam::wordList& Foam::searchablePlate::regions() const { - if (regions_.size() == 0) + if (regions_.empty()) { regions_.setSize(1); regions_[0] = "region0"; diff --git a/src/meshTools/searchableSurface/searchableSphere.C b/src/meshTools/searchableSurface/searchableSphere.C index 9b2b93ffb461087ac58d4ee644bb82e166ee5d0a..ba5a1888cfb343f39605b49b8111083427d7562c 100644 --- a/src/meshTools/searchableSurface/searchableSphere.C +++ b/src/meshTools/searchableSurface/searchableSphere.C @@ -151,7 +151,7 @@ Foam::searchableSphere::~searchableSphere() const Foam::wordList& Foam::searchableSphere::regions() const { - if (regions_.size() == 0) + if (regions_.empty()) { regions_.setSize(1); regions_[0] = "region0"; diff --git a/src/meshTools/searchableSurface/searchableSurfacesQueries.C b/src/meshTools/searchableSurface/searchableSurfacesQueries.C index 51e0b43259734235ec627f7f4928a656d548bde5..7b8ef5c685d619a0fc6c3065aa5ab0f908ccd46b 100644 --- a/src/meshTools/searchableSurface/searchableSurfacesQueries.C +++ b/src/meshTools/searchableSurface/searchableSurfacesQueries.C @@ -482,7 +482,7 @@ void Foam::searchableSurfacesQueries::findAllIntersections hitSurfaces.setSize(start.size()); hitInfo.setSize(start.size()); - if (surfacesToTest.size() == 0) + if (surfacesToTest.empty()) { return; } diff --git a/src/meshTools/searchableSurface/triSurfaceMesh.C b/src/meshTools/searchableSurface/triSurfaceMesh.C index 6803fb4def4551b42147e293feee085637372fbe..ad8ffc5927326f3c68171421bc171755f08fbc0a 100644 --- a/src/meshTools/searchableSurface/triSurfaceMesh.C +++ b/src/meshTools/searchableSurface/triSurfaceMesh.C @@ -298,7 +298,7 @@ const Foam::indexedOctree<Foam::treeDataEdge>& const Foam::wordList& Foam::triSurfaceMesh::regions() const { - if (regions_.size() == 0) + if (regions_.empty()) { regions_.setSize(patches().size()); forAll(regions_, regionI) diff --git a/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.C b/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.C index 77fa2046f252e1acb7426314d46664a3040ed7d3..a2ef93da4bc7d88aff93dc614f9ed5a6d42db4be 100644 --- a/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.C +++ b/src/meshTools/sets/pointSources/nearestToPoint/nearestToPoint.C @@ -62,7 +62,7 @@ void Foam::nearestToPoint::combine(topoSet& set, const bool add) const { const pointField& pts = mesh_.points(); - if (pts.size() > 0) + if (pts.size()) { label minPointI = 0; scalar minDistSqr = magSqr(pts[minPointI] - points_[pointI]); diff --git a/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C b/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C index daa59aad0d5ce36021b070cea924e7764f8d5fa3..8d73f64d5187a2a4b058dafd2f77864d314d0575 100644 --- a/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C +++ b/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C @@ -181,7 +181,7 @@ Foam::edgeSurface::edgeSurface // Store current top of allEdges. label freeNewEdgeI = allEdges.size(); - if (extraVerts.size() == 0) + if (extraVerts.empty()) { // No cuts across this edge. Note that vertices do not need to be // renumbered. diff --git a/src/meshTools/triSurface/booleanOps/intersectedSurface/intersectedSurface.C b/src/meshTools/triSurface/booleanOps/intersectedSurface/intersectedSurface.C index 21a1227dc57b20ff608f538babf25f1bcc0d3c00..eadfeb7c4b664bc2debb273e897b1c25b0007831 100644 --- a/src/meshTools/triSurface/booleanOps/intersectedSurface/intersectedSurface.C +++ b/src/meshTools/triSurface/booleanOps/intersectedSurface/intersectedSurface.C @@ -341,7 +341,7 @@ Foam::intersectedSurface::calcPointEdgeAddressing iter().shrink(); // Check on dangling points. - if (iter().size() < 1) + if (iter().empty()) { FatalErrorIn ( @@ -1171,7 +1171,7 @@ Foam::intersectedSurface::intersectedSurface faceMap_(0), nSurfacePoints_(surf.nPoints()) { - if ((inter.cutPoints().size() == 0) && (inter.cutEdges().size() == 0)) + if (inter.cutPoints().empty() && inter.cutEdges().empty()) { // No intersection. Make straight copy. triSurface::operator=(surf); diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C index 42cbef8daba28aeb7e2091796dce2209eaa034ce..f3ee58ed0b1539df188661f46ceac9bd896cc228 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C @@ -255,7 +255,7 @@ bool Foam::edgeIntersections::inlinePerturb const labelList& edgeEnds = classification_[edgeI]; - if (edgeEnds.size() > 0) + if (edgeEnds.size()) { bool perturbStart = false; bool perturbEnd = false; @@ -701,7 +701,7 @@ Foam::label Foam::edgeIntersections::removeDegenerates // Transfer and test. edgesToTest.transfer(newEdgesToTest); - if (edgesToTest.size() == 0) + if (edgesToTest.empty()) { FatalErrorIn("perturb") << "oops" << abort(FatalError); } diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C index af3d5e7e196be1a0ee269902af63a391f3e77c2d..da78384e5cd38bd8fed118d8e0262880a886923a 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C @@ -1044,7 +1044,7 @@ Foam::surfaceIntersection::surfaceIntersection transfer(allCutPoints, cutPoints_); // Shortcut. - if ((cutPoints_.size() == 0) && (cutEdges_.size() == 0)) + if (cutPoints_.empty() && cutEdges_.empty()) { if (debug) { diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersectionFuncs.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersectionFuncs.C index 258e579fde4391250b0a3038c2659551ec8ea033..711ede3cd2c0dd50a3862c5e0fee06710e798b3d 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersectionFuncs.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersectionFuncs.C @@ -291,7 +291,7 @@ void Foam::surfaceIntersection::writeIntersectedEdges { const labelList& extraVerts = edgeCutVerts[edgeI]; - if (extraVerts.size() != 0) + if (extraVerts.size()) { const edge& e = surf.edges()[edgeI]; diff --git a/src/meshTools/triSurface/orientedSurface/orientedSurface.C b/src/meshTools/triSurface/orientedSurface/orientedSurface.C index 4cbbf0461f9e2ad366cf9ed7f40fbb6c7f3e1b97..911d06747ae1d21f6b2bcf9608f31cdb2b08f002 100644 --- a/src/meshTools/triSurface/orientedSurface/orientedSurface.C +++ b/src/meshTools/triSurface/orientedSurface/orientedSurface.C @@ -245,7 +245,7 @@ void Foam::orientedSurface::propagateOrientation << endl; } - if (changedEdges.size() == 0) + if (changedEdges.empty()) { break; } @@ -259,7 +259,7 @@ void Foam::orientedSurface::propagateOrientation << endl; } - if (changedFaces.size() == 0) + if (changedFaces.empty()) { break; } diff --git a/src/meshTools/twoDPointCorrector/twoDPointCorrector.C b/src/meshTools/twoDPointCorrector/twoDPointCorrector.C index aec5c87fb0466b0abadfa5e87a768aa446dcd9c3..c5c0e3d4da38cee88fbc4f2c3e6f49cd5c98b742 100644 --- a/src/meshTools/twoDPointCorrector/twoDPointCorrector.C +++ b/src/meshTools/twoDPointCorrector/twoDPointCorrector.C @@ -84,11 +84,7 @@ void twoDPointCorrector::calcAddressing() const { forAll (patches, patchI) { - if - ( - isA<emptyPolyPatch>(patches[patchI]) - && patches[patchI].size() > 0 - ) + if (isA<emptyPolyPatch>(patches[patchI]) && patches[patchI].size()) { pn = patches[patchI].faceAreas()[0]; diff --git a/src/sampling/cuttingPlane/cuttingPlane.H b/src/sampling/cuttingPlane/cuttingPlane.H index dbd86ca011829965db7b9f659ef2ce7ec50a47c6..b7e31ef906d46973d48c7612c1bf4548024b3c49 100644 --- a/src/sampling/cuttingPlane/cuttingPlane.H +++ b/src/sampling/cuttingPlane/cuttingPlane.H @@ -159,7 +159,7 @@ public: //- Return true or false to question: have any cells been cut? bool cut() const { - return (cutCells_.size() != 0); + return cutCells_.size(); } //- Sample the cell field diff --git a/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshAddressing.C b/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshAddressing.C index 3a0975662cf552f15b8b1bf67deb0840d51e8613..8233d24ea58b74af1e8161628959f68d0c83488d 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshAddressing.C +++ b/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshAddressing.C @@ -160,7 +160,7 @@ void meshToMesh::calcAddressing() fromMeshPatches_.find(patchMap_.find(toPatch.name())())() ]; - if (fromPatch.size() == 0) + if (fromPatch.empty()) { WarningIn("meshToMesh::calcAddressing()") << "Source patch " << fromPatch.name() diff --git a/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshWeights.C b/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshWeights.C index f14bd41fef52abc69657a06dd64625d0eb72b985..0133dee52b0cb2e07450a9a96e83c7169c10e03f 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshWeights.C +++ b/src/sampling/meshToMeshInterpolation/meshToMesh/calculateMeshToMeshWeights.C @@ -70,7 +70,7 @@ void meshToMesh::calculateInverseDistanceWeights() const if ( m < directHitTol // Direct hit - || neighbours.size() == 0 + || neighbours.empty() ) { invDistCoeffs[celli].setSize(1); diff --git a/src/sampling/probes/probes.C b/src/sampling/probes/probes.C index a1cca58b0aeb3c5c7b355e55b7347d701103a27d..f0596ea5631a7431e26552f9ae4d2c4c77e22b26 100644 --- a/src/sampling/probes/probes.C +++ b/src/sampling/probes/probes.C @@ -41,7 +41,7 @@ namespace Foam void Foam::probes::findCells(const fvMesh& mesh) { - if (cellList_.size() == 0) + if (cellList_.empty()) { cellList_.setSize(probeLocations_.size()); diff --git a/src/sampling/sampledSet/cloud/cloudSet.C b/src/sampling/sampledSet/cloud/cloudSet.C index b0b1f3f886ae37ba8ded5b5cdd92a2bb41d2328c..bc82887ee4b00a90a87076a4199c5c2fccef37ed 100644 --- a/src/sampling/sampledSet/cloud/cloudSet.C +++ b/src/sampling/sampledSet/cloud/cloudSet.C @@ -156,7 +156,7 @@ Foam::cloudSet::~cloudSet() Foam::point Foam::cloudSet::getRefPoint(const List<point>& pts) const { - if (pts.size() > 0) + if (pts.size()) { // Use first samplePt as starting point return pts[0]; diff --git a/src/sampling/sampledSet/curve/curveSet.C b/src/sampling/sampledSet/curve/curveSet.C index 1ef624c8d25f563c3a469951f9b8edd2b1cb4584..7b0a0b8e0350641344626e3cf5692ec0c5155c74 100644 --- a/src/sampling/sampledSet/curve/curveSet.C +++ b/src/sampling/sampledSet/curve/curveSet.C @@ -184,17 +184,16 @@ void Foam::curveSet::calcSamples // Get all boundary intersections - List<pointIndexHit> bHits = - searchEngine().intersections - ( - sampleCoords_[sampleI], - sampleCoords_[sampleI+1] - ); + List<pointIndexHit> bHits = searchEngine().intersections + ( + sampleCoords_[sampleI], + sampleCoords_[sampleI+1] + ); point bPoint(GREAT, GREAT, GREAT); label bFaceI = -1; - if (bHits.size() > 0) + if (bHits.size()) { bPoint = bHits[0].hitPoint(); bFaceI = bHits[0].index(); @@ -400,7 +399,7 @@ Foam::curveSet::~curveSet() Foam::point Foam::curveSet::getRefPoint(const List<point>& pts) const { - if (pts.size() > 0) + if (pts.size()) { // Use first samplePt as starting point return pts[0]; diff --git a/src/sampling/sampledSet/face/faceOnlySet.C b/src/sampling/sampledSet/face/faceOnlySet.C index 09c41d36d0877f55ed54c992eb57fe3f024d2624..fba774f802159abdb6eb7f326b5981fa9284420f 100644 --- a/src/sampling/sampledSet/face/faceOnlySet.C +++ b/src/sampling/sampledSet/face/faceOnlySet.C @@ -121,17 +121,16 @@ void Foam::faceOnlySet::calcSamples // Get all boundary intersections - List<pointIndexHit> bHits = - searchEngine().intersections - ( - start_ - smallVec, - end_ + smallVec - ); + List<pointIndexHit> bHits = searchEngine().intersections + ( + start_ - smallVec, + end_ + smallVec + ); point bPoint(GREAT, GREAT, GREAT); label bFaceI = -1; - if (bHits.size() > 0) + if (bHits.size()) { bPoint = bHits[0].hitPoint(); bFaceI = bHits[0].index(); diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C index 52374b19c82242208f3d0a75ef824f3e75e25cba..f09a82e30aeab74afb48ce2e390fc1b1721afbd7 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.C +++ b/src/sampling/sampledSet/sampledSets/sampledSets.C @@ -195,7 +195,7 @@ void Foam::sampledSets::combineSampledSets // Get reference point (note: only master has all points) point refPt; - if (allPts.size() > 0) + if (allPts.size()) { refPt = samplePts.getRefPoint(allPts); } diff --git a/src/sampling/sampledSet/uniform/uniformSet.C b/src/sampling/sampledSet/uniform/uniformSet.C index 99bde6fb134787ae14a46658cad544ce82f4fb6d..9b25ba42345fec8675b38487d194cf3d82286c00 100644 --- a/src/sampling/sampledSet/uniform/uniformSet.C +++ b/src/sampling/sampledSet/uniform/uniformSet.C @@ -238,17 +238,16 @@ void Foam::uniformSet::calcSamples const scalar smallDist = mag(smallVec); // Get all boundary intersections - List<pointIndexHit> bHits = - searchEngine().intersections - ( - start_ - smallVec, - end_ + smallVec - ); + List<pointIndexHit> bHits = searchEngine().intersections + ( + start_ - smallVec, + end_ + smallVec + ); point bPoint(GREAT, GREAT, GREAT); label bFaceI = -1; - if (bHits.size() > 0) + if (bHits.size()) { bPoint = bHits[0].hitPoint(); bFaceI = bHits[0].index(); diff --git a/src/sampling/sampledSurface/isoSurface/isoSurface.C b/src/sampling/sampledSurface/isoSurface/isoSurface.C index 98cc2e12d9c158729481b0e669aef4bd4c600813..8522dd844255507adfd201323dbcd81cf311b3ed 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurface.C +++ b/src/sampling/sampledSurface/isoSurface/isoSurface.C @@ -274,9 +274,7 @@ Foam::pointIndexHit Foam::isoSurface::collapseSurface { pointIndexHit info(false, vector::zero, localTris.size()); - if (localTris.size() == 0) - {} - else if (localTris.size() == 1) + if (localTris.size() == 1) { const labelledTri& tri = localTris[0]; info.setPoint(tri.centre(localPoints)); @@ -303,7 +301,7 @@ Foam::pointIndexHit Foam::isoSurface::collapseSurface info.setHit(); } } - else + else if (localTris.size()) { // Check if single region. Rare situation. triSurface surf @@ -1071,7 +1069,7 @@ void Foam::isoSurface::walkOrientation changedFaces.append(seedTriI); - while (changedFaces.size() > 0) + while (changedFaces.size()) { DynamicList<label> newChangedFaces(changedFaces.size()); diff --git a/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C b/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C index b34e4727873f7fc3e3d40ba7d6f6ed56e1a17122..52398eafa4dd97531dc2db37f3b059c27ebed9d6 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C +++ b/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C @@ -289,9 +289,7 @@ Foam::pointIndexHit Foam::isoSurfaceCell::collapseSurface { pointIndexHit info(false, vector::zero, localTris.size()); - if (localTris.size() == 0) - {} - else if (localTris.size() == 1) + if (localTris.size() == 1) { const labelledTri& tri = localTris[0]; info.setPoint(tri.centre(localPoints)); @@ -318,7 +316,7 @@ Foam::pointIndexHit Foam::isoSurfaceCell::collapseSurface info.setHit(); } } - else + else if (localTris.size()) { // Check if single region. Rare situation. triSurface surf @@ -404,11 +402,7 @@ void Foam::isoSurfaceCell::calcSnappedCc } } - if (localPoints.size() == 0) - { - // No near intersections - } - else if (localPoints.size() == 1) + if (localPoints.size() == 1) { // No need for any analysis. snappedCc[cellI] = snappedPoints.size(); @@ -432,7 +426,7 @@ void Foam::isoSurfaceCell::calcSnappedCc // << " intersections down to " // << snappedPoints[snappedCc[cellI]] << endl; } - else + else if (localPoints.size()) { // Need to analyse forAll(cFaces, cFaceI) @@ -719,11 +713,7 @@ void Foam::isoSurfaceCell::calcSnappedPoint } } - if (localTriPoints.size() == 0) - { - // No near intersections - } - else if (localTriPoints.size() == 3) + if (localTriPoints.size() == 3) { // Single triangle. No need for any analysis. Average points. pointField points; @@ -734,7 +724,7 @@ void Foam::isoSurfaceCell::calcSnappedPoint // << " replacing coord:" << mesh_.points()[pointI] // << " by average:" << collapsedPoint[pointI] << endl; } - else + else if (localTriPoints.size()) { // Convert points into triSurface. @@ -1124,7 +1114,7 @@ void Foam::isoSurfaceCell::walkOrientation changedFaces.append(seedTriI); - while (changedFaces.size() > 0) + while (changedFaces.size()) { DynamicList<label> newChangedFaces(changedFaces.size()); @@ -1636,7 +1626,7 @@ Foam::isoSurfaceCell::isoSurfaceCell //// ones so limited benefit (e.g. 60 v.s. 88 triangles) //void Foam::isoSurfaceCell::combineCellTriangles() //{ -// if (size() > 0) +// if (size()) // { // DynamicList<labelledTri> newTris(size()); // DynamicList<label> newTriToCell(size()); diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurfaceTemplates.C b/src/sampling/sampledSurface/sampledSurface/sampledSurfaceTemplates.C index c3dc6490a83e4e7db0b2ec2ccc111c711cb25d49..3aff356cef21ce74cc1faf1245baf1d50aa8dd41 100644 --- a/src/sampling/sampledSurface/sampledSurface/sampledSurfaceTemplates.C +++ b/src/sampling/sampledSurface/sampledSurface/sampledSurfaceTemplates.C @@ -29,7 +29,7 @@ License template<class Type> bool Foam::sampledSurface::checkFieldSize(const Field<Type>& field) const { - if (faces().size() == 0 || field.size() == 0) + if (faces().empty() || field.empty()) { return false; } diff --git a/src/surfMesh/BasicMeshedSurface/BasicMeshedSurface.C b/src/surfMesh/BasicMeshedSurface/BasicMeshedSurface.C index 1df3b917d15aae9138b42eeb023f643d1a4f1da2..73cdeb6b111b0ca19ec03519a2ad596d81c63aea 100644 --- a/src/surfMesh/BasicMeshedSurface/BasicMeshedSurface.C +++ b/src/surfMesh/BasicMeshedSurface/BasicMeshedSurface.C @@ -438,7 +438,7 @@ Foam::label Foam::BasicMeshedSurface<Face>::triangulate // remember the number of *additional* faces nTri -= faceLst.size(); - if (this->points().size() == 0) + if (this->points().empty()) { // triangulate without points // simple face triangulation around f[0] diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.C b/src/surfMesh/MeshedSurface/MeshedSurface.C index c260f5765b7126c6ec6ab19f1b59103fa13805e7..7c0dc9cdcdb565e0109d0ae3b311c4c1c5c7a05a 100644 --- a/src/surfMesh/MeshedSurface/MeshedSurface.C +++ b/src/surfMesh/MeshedSurface/MeshedSurface.C @@ -423,13 +423,13 @@ template<class Face> void Foam::MeshedSurface<Face>::onePatch(const word& name) { word patchName(name); - if (!patchName.size()) + if (patchName.empty()) { - if (patches_.size() >= 1) + if (patches_.size()) { patchName = patches_[0].name(); } - if (!patchName.size()) + if (patchName.empty()) { patchName = "patch0"; } @@ -537,7 +537,7 @@ void Foam::MeshedSurface<Face>::remapFaces // recalculate the patch start/size if (&faceMap && faceMap.size()) { - if (patches_.size() == 0) + if (patches_.empty()) { onePatch(); } diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C index 7cd2c6d1baba8c7542a6ea9c774b2227e29c92ed..cb1997c2251d4500f5fb4ec8f8d0859a48e0f5a9 100644 --- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C +++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C @@ -307,13 +307,13 @@ void Foam::UnsortedMeshedSurface<Face>::onePatch(const word& name) regions_ = 0; word patchName(name); - if (!patchName.size()) + if (patchName.empty()) { - if (patches_.size() >= 1) + if (patches_.size()) { patchName = patches_[0].name(); } - if (!patchName.size()) + if (patchName.empty()) { patchName = "patch0"; } @@ -404,7 +404,7 @@ void Foam::UnsortedMeshedSurface<Face>::remapFaces // re-assign the region Ids if (&faceMap && faceMap.size()) { - if (patches_.size() == 0) + if (patches_.empty()) { onePatch(); } diff --git a/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.C b/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.C index d195443acfdc93cfeb2460e316810e1534607e3d..2c214162d074a2639b2c72de5bff8b1713fc75ac 100644 --- a/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.C +++ b/src/surfMesh/surfaceFormats/nas/NASsurfaceFormat.C @@ -169,7 +169,7 @@ bool Foam::fileFormats::NASsurfaceFormat<Face>::read // Skip empty or comment - if (line.size() == 0 || line[0] == '$') + if (line.empty() || line[0] == '$') { continue; } diff --git a/src/surfMesh/surfaceFormats/surfaceFormatsCore.C b/src/surfMesh/surfaceFormats/surfaceFormatsCore.C index 9c5ccd80a1f238f09f0c3f8e2c54f45f0a2bef82..4201e1d888f179c36ac9e73c7eeafb12f7f5287b 100644 --- a/src/surfMesh/surfaceFormats/surfaceFormatsCore.C +++ b/src/surfMesh/surfaceFormats/surfaceFormatsCore.C @@ -56,7 +56,7 @@ Foam::fileFormats::surfaceFormatsCore::getLineNoComment { is.getLine(line); } - while ((line.size() == 0 || line[0] == '#') && is.good()); + while ((line.empty() || line[0] == '#') && is.good()); return line; } diff --git a/src/thermophysicalModels/combustion/chemistryReaders/chemkinReader/chemkinLexer.L b/src/thermophysicalModels/combustion/chemistryReaders/chemkinReader/chemkinLexer.L index f403ae4496dc67885dd6dbf5a9712129e86f8855..d32e172daec2b66d0330a231fae88c3e260ffc71 100644 --- a/src/thermophysicalModels/combustion/chemistryReaders/chemkinReader/chemkinLexer.L +++ b/src/thermophysicalModels/combustion/chemistryReaders/chemkinReader/chemkinLexer.L @@ -1,4 +1,4 @@ -/*---------------------------------------------------------------------------*\ +/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | @@ -863,7 +863,7 @@ bool finishReaction = false; { case unimolecularFallOffReactionType: { - if (!pDependentSpecieName.size()) + if (pDependentSpecieName.empty()) { FatalErrorIn("chemkinReader::lex()") << "LOW keyword given for a unimolecular fall-off" @@ -898,7 +898,7 @@ bool finishReaction = false; case chemicallyActivatedBimolecularReactionType: { - if (!pDependentSpecieName.size()) + if (pDependentSpecieName.empty()) { FatalErrorIn("chemkinReader::lex()") << "HIGH keyword given for a chemically" @@ -935,7 +935,7 @@ bool finishReaction = false; case TroeReactionType: { - if (!pDependentSpecieName.size()) + if (pDependentSpecieName.empty()) { FatalErrorIn("chemkinReader::lex()") << "TROE keyword given for a" @@ -969,7 +969,7 @@ bool finishReaction = false; case SRIReactionType: { - if (!pDependentSpecieName.size()) + if (pDependentSpecieName.empty()) { FatalErrorIn("chemkinReader::lex()") << "SRI keyword given for a" diff --git a/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C b/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C index 1871007784b98b577bdfab3927a921c748d26a5c..bef2864e3e2fff4b669618b1432cac616b783fdf 100644 --- a/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C +++ b/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C @@ -49,10 +49,10 @@ void Foam::linearValveFvMesh::addZonesAndModifiers() if ( - pointZones().size() > 0 - || faceZones().size() > 0 - || cellZones().size() > 0 - || topoChanger_.size() > 0 + pointZones().size() + || faceZones().size() + || cellZones().size() + || topoChanger_.size() ) { Info<< "void linearValveFvMesh::addZonesAndModifiers() : " @@ -235,7 +235,7 @@ bool Foam::linearValveFvMesh::attached() const { if ( - result + result != refCast<const slidingInterface>(topoChanges[modI]).attached() ) { diff --git a/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C b/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C index fc4a96ec9abc596a13400596f8edb2cf38d8beae..9dd4c56c2f74d6a780108d60830da31e5f829329 100644 --- a/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C +++ b/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C @@ -51,10 +51,10 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers() if ( - pointZones().size() > 0 - || faceZones().size() > 0 - || cellZones().size() > 0 - || topoChanger_.size() > 0 + pointZones().size() + || faceZones().size() + || cellZones().size() + || topoChanger_.size() ) { Info<< "void linearValveLayersFvMesh::addZonesAndModifiers() : " @@ -287,7 +287,7 @@ bool Foam::linearValveLayersFvMesh::attached() const { if ( - result + result != refCast<const slidingInterface>(topoChanges[modI]).attached() ) { diff --git a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C b/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C index 1fc143ff75c0fa3122605f7d8bd9641111052a78..2e42a81c0f39e2e37c6dcb5abf35ab727dc42c43 100644 --- a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C +++ b/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C @@ -49,10 +49,10 @@ void Foam::mixerFvMesh::addZonesAndModifiers() if ( - pointZones().size() > 0 - || faceZones().size() > 0 - || cellZones().size() > 0 - || topoChanger_.size() > 0 + pointZones().size() + || faceZones().size() + || cellZones().size() + || topoChanger_.size() ) { Info<< "void mixerFvMesh::addZonesAndModifiers() : " diff --git a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C index 42e603e6774a4f8a0b19338cadfebf53886c14e3..2ebc9f7ff0b4de983076571b682b3aeea1bef5dd 100644 --- a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C +++ b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C @@ -88,10 +88,10 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers() if ( - pointZones().size() > 0 - || faceZones().size() > 0 - || cellZones().size() > 0 - || topoChanger_.size() > 0 + pointZones().size() + || faceZones().size() + || cellZones().size() + || topoChanger_.size() ) { Info<< "void movingConeTopoFvMesh::addZonesAndModifiers() : " @@ -133,7 +133,7 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers() << flipZone1[nZoneFaces1] << endl; nZoneFaces1++; } - else if + else if ( fc[faceI].x() > -0.00701 && fc[faceI].x() < -0.00699 @@ -326,7 +326,7 @@ bool Foam::movingConeTopoFvMesh::update() vector curMotionVel_ = motionVelAmplitude_* - Foam::sin(time().value()*M_PI/motionVelPeriod_); + Foam::sin(time().value()*M_PI/motionVelPeriod_); Pout<< "time:" << time().value() << " curMotionVel_:" << curMotionVel_ << " curLeft:" << curLeft_ << " curRight:" << curRight_ diff --git a/src/triSurface/meshTriangulation/meshTriangulation.C b/src/triSurface/meshTriangulation/meshTriangulation.C index 134c5d7f7a2cf0aab140ba3a8a378cfaec65eb02..49066b804d63be401bc44e0394992678eafa63a7 100644 --- a/src/triSurface/meshTriangulation/meshTriangulation.C +++ b/src/triSurface/meshTriangulation/meshTriangulation.C @@ -364,7 +364,7 @@ Foam::meshTriangulation::meshTriangulation // Triangulate face. Fall back to naive triangulation if failed. faceTriangulation faceTris(points, faces[faceI], true); - if (faceTris.size() == 0) + if (faceTris.empty()) { WarningIn("meshTriangulation::meshTriangulation") << "Could not find triangulation for face " << faceI @@ -427,7 +427,7 @@ Foam::meshTriangulation::meshTriangulation // Triangulate face faceTriangulation faceTris(points, faces[faceI], true); - if (faceTris.size() == 0) + if (faceTris.empty()) { WarningIn("meshTriangulation::meshTriangulation") << "Could not find triangulation for face " << faceI diff --git a/src/triSurface/triSurface/geometricSurfacePatch/geometricSurfacePatch.C b/src/triSurface/triSurface/geometricSurfacePatch/geometricSurfacePatch.C index dd49ad72d168200e4ea553d20183a16ee56dec98..1154d64c5607b9d7ce29414fc245e7c89121eec8 100644 --- a/src/triSurface/triSurface/geometricSurfacePatch/geometricSurfacePatch.C +++ b/src/triSurface/triSurface/geometricSurfacePatch/geometricSurfacePatch.C @@ -60,7 +60,7 @@ geometricSurfacePatch::geometricSurfacePatch boundaryIndex_(index) { - if (geometricType_.size() == 0) + if (geometricType_.empty()) { geometricType_ = "empty"; } @@ -74,7 +74,7 @@ geometricSurfacePatch::geometricSurfacePatch(Istream& is, const label index) name_(is), boundaryIndex_(index) { - if (geometricType_.size() == 0) + if (geometricType_.empty()) { geometricType_ = "empty"; } @@ -93,7 +93,7 @@ geometricSurfacePatch::geometricSurfacePatch name_(name), boundaryIndex_(index) { - if (geometricType_.size() == 0) + if (geometricType_.empty()) { geometricType_ = "empty"; } diff --git a/src/triSurface/triSurface/interfaces/NAS/readNAS.C b/src/triSurface/triSurface/interfaces/NAS/readNAS.C index 393484e87bc3cb78ba3b67cbcfb93c6b078fd9b5..13b6a7573c7b3119654f66d87ea1f9c655b93780 100644 --- a/src/triSurface/triSurface/interfaces/NAS/readNAS.C +++ b/src/triSurface/triSurface/interfaces/NAS/readNAS.C @@ -169,7 +169,7 @@ bool triSurface::readNAS(const fileName& fName) } - if (line.size() == 0 || line[0] == '$') + if (line.empty() || line[0] == '$') { // Skip empty or comment continue; diff --git a/src/triSurface/triSurface/interfaces/TRI/readTRI.C b/src/triSurface/triSurface/interfaces/TRI/readTRI.C index bd78acff1517e36e89c4b699a4647a23846ffcf4..c0452e46aafe3e058e0f30f8dede8a28c3e1170f 100644 --- a/src/triSurface/triSurface/interfaces/TRI/readTRI.C +++ b/src/triSurface/triSurface/interfaces/TRI/readTRI.C @@ -67,7 +67,7 @@ bool triSurface::readTRI(const fileName& TRIfileName) { string line = getLineNoComment(TRIfile); - if (line.size() == 0) + if (line.empty()) { break; } diff --git a/src/triSurface/triSurface/triSurface.C b/src/triSurface/triSurface/triSurface.C index ff56e2ce4e4062303062ea489afdecec8d4f2340..9ec6de95f5b44dcbc140779a160a3ce7f36dad9b 100644 --- a/src/triSurface/triSurface/triSurface.C +++ b/src/triSurface/triSurface/triSurface.C @@ -178,7 +178,7 @@ Foam::string Foam::triSurface::getLineNoComment(IFstream& is) { is.getLine(line); } - while((line.size() == 0 || line[0] == '#') && is.good()); + while ((line.empty() || line[0] == '#') && is.good()); return line; } @@ -327,7 +327,7 @@ void Foam::triSurface::checkEdges(const bool verbose) { const labelList& myFaces = eFaces[edgeI]; - if (myFaces.size() == 0) + if (myFaces.empty()) { FatalErrorIn("triSurface::checkEdges(bool verbose)") << "Edge " << edgeI << " with vertices " << edges()[edgeI] @@ -638,7 +638,7 @@ Foam::surfacePatchList Foam::triSurface::calcPatches(labelList& faceMap) const // Extend regions label maxRegion = patches_.size()-1; // for non-compacted regions - if (faceMap.size() > 0) + if (faceMap.size()) { maxRegion = max ( @@ -1007,7 +1007,7 @@ void Foam::triSurface::markZone } } - if (newChangedFaces.size() == 0) + if (newChangedFaces.empty()) { break; }