From 95dcb6ded7de30faaa3cb43b3d1fd0c77ce88259 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Sat, 10 Jan 2009 20:28:06 +0100 Subject: [PATCH] Simplify checking of container (List/HashTable, strings) sizes - can use 'XX.empty()' instead of 'XX.size() == 0', 'XX.size() < 1' or 'XX.size() <= 0' or for simpler coding. It also has the same number of characters as '!XX.size()' and /might/ be more readable - many size checking had 'XX.size() > 0', 'XX.size() != 0', or 'XX.size() >= 1' when a simple 'XX.size()' suffices --- .../combustion/PDRFoam/PDRFoamAutoRefine.C | 7 +-- .../advanced/autoRefineMesh/autoRefineMesh.C | 6 +-- .../mesh/advanced/modifyMesh/modifyMesh.C | 17 ++++--- .../refinementLevel/refinementLevel.C | 2 +- .../mesh/advanced/splitCells/splitCells.C | 2 +- .../mesh/conversion/cfx4ToFoam/cfx4ToFoam.C | 2 +- .../fluentMeshToFoam/fluentMeshToFoam.L | 6 +-- .../mesh/conversion/gmshToFoam/gmshToFoam.C | 12 ++--- .../ideasUnvToFoam/ideasUnvToFoam.C | 2 +- .../netgenNeutralToFoam/netgenNeutralToFoam.C | 2 +- .../polyDualMesh/makePolyDualMesh.C | 4 +- .../conversion/polyDualMesh/meshDualiser.C | 15 +++--- .../mesh/conversion/sammToFoam/readCouples.C | 4 +- .../starToFoam/createCoupleMatches.C | 31 ++++++------ .../mesh/conversion/starToFoam/starMesh.C | 2 +- .../conversion/tetgenToFoam/tetgenToFoam.C | 12 ++--- .../mesh/generation/blockMesh/blockMesh.C | 2 +- .../mesh/generation/blockMesh/blockMeshApp.C | 2 +- .../generation/blockMesh/mergePatchPairs.C | 2 +- .../manipulation/checkMesh/checkTopology.C | 4 +- .../manipulation/createPatch/createPatch.C | 4 +- .../manipulation/mergeMeshes/mergePolyMesh.C | 19 ++++---- .../mesh/manipulation/objToVTK/objToVTK.C | 2 +- .../mesh/manipulation/refineMesh/refineMesh.C | 2 +- .../mesh/manipulation/setSet/setSet.C | 24 +++++----- .../mesh/manipulation/splitMesh/splitMesh.C | 4 +- .../splitMeshRegions/splitMeshRegions.C | 6 +-- .../mesh/manipulation/stitchMesh/stitchMesh.C | 2 +- .../transformPoints/transformPoints.C | 2 +- .../decomposePar/distributeCells.C | 4 +- .../reconstructPar/reconstructPar.C | 4 +- .../foamToEnsight/ensightField.C | 8 ++-- .../foamToEnsight/ensightMesh.C | 16 +++---- .../foamToEnsight/ensightWriteBinary.C | 2 +- .../foamToEnsightParts/validateFields.H | 4 +- .../foamToFieldview9/foamToFieldview9.C | 2 +- .../dataConversion/foamToGMV/gmvOutput.H | 2 +- .../foamToGMV/gmvOutputLagrangian.H | 33 +++---------- .../dataConversion/foamToGMV/gmvOutputSpray.H | 9 +--- .../dataConversion/foamToVTK/foamToVTK.C | 2 +- .../dataConversion/foamToVTK/readFields.C | 2 +- .../dataConversion/foamToVTK/vtkMesh.C | 4 +- .../dataConversion/foamToVTK/vtkMesh.H | 4 +- .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H | 5 ++ .../ensightFoamReader/USERD_set_filenames.H | 4 +- .../ensightFoamReader/getLagrangianScalar.H | 13 ++--- .../ensightFoamReader/getLagrangianVector.H | 10 +--- .../fieldview9Reader/fieldview9Reader.C | 7 ++- .../fieldview9Reader/readerDatabase.C | 8 ++-- .../preProcessing/mapFields/mapLagrangian.C | 4 +- .../surface/surfaceCheck/surfaceCheck.C | 6 +-- .../surface/surfaceClean/collapseBase.C | 2 +- .../surfaceFeatureConvert.C | 16 +++---- .../surfaceSplitByPatch/surfaceSplitByPatch.C | 2 +- .../surface/surfaceSubset/surfaceSubset.C | 8 ++-- .../surfaceTransformPoints.C | 2 +- src/OSspecific/Unix/Unix.C | 28 +++++------ src/OSspecific/Unix/printStack.C | 4 +- .../StaticHashTable/StaticHashTable.C | 4 +- .../StaticHashTable/StaticHashTableI.H | 4 +- src/OpenFOAM/db/IOobjectList/IOobjectList.C | 6 +-- src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C | 2 +- src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C | 2 +- src/OpenFOAM/db/IOstreams/Pstreams/OPstream.C | 12 ++--- src/OpenFOAM/db/Time/timeSelector.C | 2 +- src/OpenFOAM/db/dictionary/dictionary.C | 10 ++-- .../primitiveEntry/primitiveEntry.C | 14 ++++-- .../primitiveEntry/primitiveEntry.H | 6 +-- .../db/regIOobject/regIOobjectWrite.C | 2 +- .../Fields/symmTensorField/symmTensorField.C | 2 +- .../fields/Fields/tensorField/tensorField.C | 2 +- .../CalcPatchToPatchWeights.C | 2 +- .../meshes/bandCompression/bandCompression.C | 2 +- src/OpenFOAM/meshes/boundBox/boundBox.C | 2 +- src/OpenFOAM/meshes/meshTools/matchPoints.C | 2 +- src/OpenFOAM/meshes/meshTools/mergePoints.C | 4 +- .../pointMesh/pointMeshMapper/pointMapper.C | 10 ++-- .../mapPolyMesh/cellMapper/cellMapper.C | 26 +++++----- .../mapPolyMesh/faceMapper/faceMapper.C | 18 +++---- .../mapPolyMesh/mapDistribute/mapDistribute.C | 8 ++-- .../mapDistribute/mapDistributeTemplates.C | 24 +++++----- .../polyBoundaryMesh/polyBoundaryMesh.C | 4 +- src/OpenFOAM/meshes/polyMesh/polyMesh.C | 9 +--- .../basic/coupled/coupledPolyPatch.H | 4 +- .../constraint/cyclic/cyclicPolyPatch.C | 4 +- .../PrimitivePatch/PrimitivePatchAddressing.C | 2 +- .../PrimitivePatchLocalPointOrder.C | 2 +- .../PrimitivePatchExtraCleanup.C | 2 +- .../PrimitivePatchExtraSearch.C | 4 +- .../primitiveMeshCheck/primitiveMeshCheck.C | 4 +- .../primitiveMesh/primitivePatch/patchZones.C | 4 +- .../primitiveMesh/primitivePatch/walkPatch.C | 47 +++++++------------ src/OpenFOAM/primitives/bools/bool/bool.H | 3 +- src/OpenFOAM/primitives/bools/bool/boolIO.C | 7 ++- src/OpenFOAM/primitives/nil/nil.H | 5 +- .../primitives/strings/fileName/fileName.C | 6 +-- src/OpenFOAM/primitives/strings/word/wordI.H | 10 ++-- src/OpenFOAM/primitives/strings/word/wordIO.C | 2 +- src/Pstream/gamma/OPwrite.C | 2 +- src/Pstream/mpi/IPread.C | 2 +- src/Pstream/mpi/OPwrite.C | 2 +- .../autoHexMeshDriver/autoHexMeshDriver.C | 2 +- .../autoHexMeshDriver/autoLayerDriver.C | 2 +- .../autoHexMeshDriver/autoRefineDriver.C | 4 +- .../autoHexMeshDriver/autoSnapDriver.C | 12 ++--- .../meshRefinement/meshRefinement.C | 6 +-- .../meshRefinement/meshRefinementBaffles.C | 8 ++-- .../refinementSurfaces/refinementSurfaces.C | 16 +++---- .../autoHexMesh/shellSurfaces/shellSurfaces.C | 2 +- src/conversion/meshTables/boundaryRegion.C | 6 +-- src/conversion/meshTables/cellTable.C | 6 +-- .../meshWriter/starcd/STARCDMeshWriter.C | 8 ++-- src/conversion/polyDualMesh/polyDualMesh.C | 8 ++-- .../hierarchGeomDecomp/hierarchGeomDecomp.C | 12 +++-- .../metisDecomp/metisDecomp.C | 4 +- .../parMetisDecomp/parMetisDecomp.C | 12 ++--- .../dynamicRefineFvMesh/dynamicRefineFvMesh.C | 12 ++--- src/dynamicMesh/attachDetach/attachDetach.C | 12 ++--- src/dynamicMesh/boundaryMesh/boundaryMesh.C | 32 ++++++------- .../fvMeshDistribute/fvMeshDistribute.C | 12 ++--- .../layerAdditionRemoval.C | 6 +-- src/dynamicMesh/meshCut/cellCuts/cellCuts.C | 35 +++++--------- .../meshCut/cellLooper/hexCellLooper.C | 23 +++++---- .../meshCut/cellLooper/topoCellLooper.C | 15 +++--- .../meshCutAndRemove/meshCutAndRemove.C | 38 +++++++-------- .../meshModifiers/meshCutter/meshCutter.C | 37 +++++++-------- .../multiDirRefinement/multiDirRefinement.C | 4 +- .../motionSmoother/motionSmoother.C | 6 +-- .../polyMeshAdder/faceCoupleInfo.C | 32 +++++-------- .../attachPolyTopoChanger.C | 17 ++++--- .../polyTopoChange/addPatchCellLayer.C | 35 +++++++------- .../polyTopoChange/addPatchCellLayer.H | 4 +- .../polyTopoChange/combineFaces.C | 2 +- .../polyTopoChange/edgeCollapser.C | 2 +- .../polyTopoChange/faceCollapser.C | 2 +- .../polyTopoChange/polyTopoChange/hexRef8.C | 4 +- .../polyTopoChange/localPointRegion.C | 8 ++-- .../polyTopoChange/polyTopoChange.C | 14 +++--- .../polyTopoChange/polyTopoChangeI.H | 2 +- .../polyTopoChange/refinementHistory.C | 4 +- .../polyTopoChange/removePoints.H | 2 +- .../slidingInterface/coupleSlidingInterface.C | 4 +- .../enrichedPatch/enrichedPatchCutFaces.C | 2 +- .../enrichedPatch/enrichedPatchFaces.C | 4 +- .../slidingInterface/slidingInterface.C | 6 +-- src/edgeMesh/edgeMesh.C | 2 +- .../derived/fan/fanFvPatchField.C | 4 +- .../timeVaryingMappedFixedValueFvPatchField.C | 2 +- .../finiteVolume/fvSchemes/fvSchemes.C | 22 +++------ .../extendedStencil/faceStencil/faceStencil.C | 4 +- src/finiteVolume/fvMesh/fvMesh.C | 7 +-- .../skewCorrected/skewCorrectionVectors.C | 2 +- .../displacementInterpolationFvMotionSolver.C | 2 +- .../inverseDistanceDiffusivity.C | 2 +- ...aceSlipDisplacementPointPatchVectorField.C | 2 +- src/lagrangian/basic/Particle/Particle.C | 2 +- src/lagrangian/dieselSpray/parcel/parcelIO.C | 2 +- .../definedHollowCone/definedHollowCone.C | 4 +- .../molecule/distribution/distribution.C | 6 +-- .../tetherPotentialList/tetherPotentialList.C | 4 +- src/meshTools/cellDist/cellDistFuncs.C | 2 +- src/meshTools/cellFeatures/cellFeatures.C | 2 +- .../directMappedPolyPatch.C | 6 +-- src/meshTools/indexedOctree/indexedOctree.C | 30 ++++++------ src/meshTools/indexedOctree/indexedOctree.H | 2 +- src/meshTools/octree/octree.C | 4 +- src/meshTools/octree/octreeLine.C | 2 +- src/meshTools/octree/treeBoundBox.C | 4 +- src/meshTools/octree/treeNode.C | 8 +--- .../polyMeshZipUpCells/polyMeshZipUpCells.C | 2 +- src/meshTools/regionSplit/regionSplit.C | 6 +-- .../searchableSurface/searchableBox.C | 2 +- .../searchableSurface/searchablePlate.C | 2 +- .../searchableSurface/searchableSphere.C | 2 +- .../searchableSurfacesQueries.C | 2 +- .../searchableSurface/triSurfaceMesh.C | 2 +- .../nearestToPoint/nearestToPoint.C | 2 +- .../intersectedSurface/edgeSurface.C | 2 +- .../intersectedSurface/intersectedSurface.C | 4 +- .../surfaceIntersection/edgeIntersections.C | 4 +- .../surfaceIntersection/surfaceIntersection.C | 2 +- .../surfaceIntersectionFuncs.C | 2 +- .../orientedSurface/orientedSurface.C | 4 +- .../twoDPointCorrector/twoDPointCorrector.C | 6 +-- src/sampling/cuttingPlane/cuttingPlane.H | 2 +- .../calculateMeshToMeshAddressing.C | 2 +- .../meshToMesh/calculateMeshToMeshWeights.C | 2 +- src/sampling/probes/probes.C | 2 +- src/sampling/sampledSet/cloud/cloudSet.C | 2 +- src/sampling/sampledSet/curve/curveSet.C | 15 +++--- src/sampling/sampledSet/face/faceOnlySet.C | 13 +++-- .../sampledSet/sampledSets/sampledSets.C | 2 +- src/sampling/sampledSet/uniform/uniformSet.C | 13 +++-- .../sampledSurface/isoSurface/isoSurface.C | 8 ++-- .../isoSurface/isoSurfaceCell.C | 26 ++++------ .../sampledSurface/sampledSurfaceTemplates.C | 2 +- .../BasicMeshedSurface/BasicMeshedSurface.C | 2 +- src/surfMesh/MeshedSurface/MeshedSurface.C | 8 ++-- .../UnsortedMeshedSurface.C | 8 ++-- .../surfaceFormats/nas/NASsurfaceFormat.C | 2 +- .../surfaceFormats/surfaceFormatsCore.C | 2 +- .../chemkinReader/chemkinLexer.L | 10 ++-- .../linearValveFvMesh/linearValveFvMesh.C | 10 ++-- .../linearValveLayersFvMesh.C | 10 ++-- .../mixerFvMesh/mixerFvMesh.C | 8 ++-- .../movingConeTopoFvMesh.C | 12 ++--- .../meshTriangulation/meshTriangulation.C | 4 +- .../geometricSurfacePatch.C | 6 +-- .../triSurface/interfaces/NAS/readNAS.C | 2 +- .../triSurface/interfaces/TRI/readTRI.C | 2 +- src/triSurface/triSurface/triSurface.C | 8 ++-- 211 files changed, 713 insertions(+), 832 deletions(-) diff --git a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C index 78ac403e99..7573b8f537 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(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 6ad19ab287..82e6f2c4c9 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 a153b0ac66..67fdc0807e 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 > edgesToCollapse(dict.lookup("edgesToCollapse")); - bool collapseEdge = edgesToCollapse.size() > 0; + bool collapseEdge = edgesToCollapse.size(); List > cellsToPyramidise(dict.lookup("cellsToSplit")); - bool cellsToSplit = cellsToPyramidise.size() > 0; + bool cellsToSplit = cellsToPyramidise.size(); //List > // 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 16747f4134..25b13eba88 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 ff6d22940c..4e5b501b85 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 bb0a01fd1b..df84d13a79 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 b4acf24445..7b385bfe06 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 d3d732205c..62edc15af0 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(0), fz, cz); } diff --git a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C index 477d2ba06c..520be5b146 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 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 546aaa7439..6d41c037e6 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 26eb18e26d..3470fd71cc 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 4492a6f6b6..2a307e5df2 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 d55d49242d..161123803e 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 c4ff20791a..910df915d8 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 > 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 f5fbb9f860..a495ae0362 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 4f9c369c7d..7fcf2a586b 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 5a273f7acb..640971ada0 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 1c3bd34a22..1723fa5101 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