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:
Mark Olesen
2009-01-10 20:28:06 +01:00
parent 16aaf5b54e
commit 95dcb6ded7
211 changed files with 713 additions and 832 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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());

View File

@ -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);
}

View File

@ -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();

View File

@ -42,7 +42,7 @@ Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname)
ifPtr_(NULL),
compression_(IOstream::UNCOMPRESSED)
{
if (!pathname.size())
if (pathname.empty())
{
if (IFstream::debug)
{

View File

@ -46,7 +46,7 @@ Foam::OFstreamAllocator::OFstreamAllocator
:
ofPtr_(NULL)
{
if (!pathname.size())
if (pathname.empty())
{
if (OFstream::debug)
{

View File

@ -136,18 +136,18 @@ Foam::Ostream& Foam::OPstream::write(const char* str)
{
word nonWhiteChars(string::validate<word>(str));
if (nonWhiteChars.size() == 0)
{
return *this;
}
else if (nonWhiteChars.size() == 1)
if (nonWhiteChars.size() == 1)
{
return write(nonWhiteChars.c_str()[1]);
}
else
else if (nonWhiteChars.size())
{
return write(nonWhiteChars);
}
else
{
return *this;
}
}

View File

@ -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"

View File

@ -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();

View File

@ -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];
}
}

View File

@ -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:

View File

@ -55,7 +55,7 @@ bool regIOobject::writeObject
return false;
}
if (!instance().size())
if (instance().empty())
{
SeriousErrorIn("regIOobject::write()")
<< "instance undefined for object " << name()

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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));

View File

@ -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();

View File

@ -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;

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 * * * * * * * * * * * * * //

View File

@ -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;
}

View File

@ -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

View File

@ -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())
{

View File

@ -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]

View File

@ -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
(

View File

@ -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

View File

@ -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;

View File

@ -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];

View File

@ -127,7 +127,7 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::
}
}
}
} while (faceOrder.size() > 0);
} while (faceOrder.size());
}
}

View File

@ -53,7 +53,7 @@ checkEdges
// boundary edges have one face
// interior edges have two faces
if (myFaces.size() == 0)
if (myFaces.empty())
{
FatalErrorIn
(

View File

@ -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);
}
}

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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)
{
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)
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
// ************************************************************************* //

View File

@ -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

View File

@ -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.
\*---------------------------------------------------------------------------*/

View File

@ -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.
\*---------------------------------------------------------------------------*/

View File

@ -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;
}

View File

@ -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;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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)

View File

@ -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());

View File

@ -191,7 +191,7 @@ Foam::label Foam::IPstream::read
void Foam::IPstream::waitRequests()
{
if (IPstream_outstandingRequests_.size() > 0)
if (IPstream_outstandingRequests_.size())
{
if
(

View File

@ -129,7 +129,7 @@ bool Foam::OPstream::write
void Foam::OPstream::waitRequests()
{
if (OPstream_outstandingRequests_.size() > 0)
if (OPstream_outstandingRequests_.size())
{
if
(

View File

@ -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

View File

@ -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++)
{

View File

@ -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

View File

@ -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);
}
}
}
}

View File

@ -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);
}

View File

@ -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
(

View File

@ -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

View File

@ -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();

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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)
{

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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
)
)

View File

@ -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

View File

@ -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"

View File

@ -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]);

View File

@ -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);
}

View File

@ -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()

View File

@ -206,23 +206,22 @@ bool Foam::hexCellLooper::cut
}
else
{
success =
geomCellLooper::cut
(
refDir,
cellI,
vertIsCut,
edgeIsCut,
edgeWeight,
success = geomCellLooper::cut
(
refDir,
cellI,
vertIsCut,
edgeIsCut,
edgeWeight,
loop,
loopWeights
);
loop,
loopWeights
);
}
if (debug)
{
if (loop.size() == 0)
if (loop.empty())
{
WarningIn("hexCellLooper")
<< "could not cut cell " << cellI << endl;

View File

@ -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];

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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_);

View File

@ -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]);
}

View File

@ -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++;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -897,7 +897,7 @@ void Foam::combineFaces::setUnrefinement
faceList& faces = faceSetsVertices_[setI];
if (faces.size() == 0)
if (faces.empty())
{
FatalErrorIn
(

View File

@ -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();

View File

@ -441,7 +441,7 @@ void Foam::faceCollapser::setRefinement
}
}
if (edgePoints.size() > 0)
if (edgePoints.size())
{
edgePoints.shrink();

View File

@ -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);

View File

@ -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];

View File

@ -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;

View File

@ -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();
}

View File

@ -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();

View File

@ -74,7 +74,7 @@ class removePoints
{
if (y.size() > 0)
{
if (x.size() == 0)
if (x.empty())
{
x = y;
}

View File

@ -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;

View File

@ -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();

View File

@ -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());

View File

@ -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;
}

View File

@ -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());

View File

@ -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());

View File

@ -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);

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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
(

View File

@ -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();
}

View File

@ -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
(

View File

@ -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>
(

View File

@ -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();

View File

@ -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;

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