mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user