Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2009-01-13 15:51:09 +00:00
318 changed files with 2034 additions and 1437 deletions

View File

@ -26,7 +26,7 @@ Application
PDRFoam PDRFoam
Description Description
Compressible premixed/partially-premixed combustion solver with turbulence Compressible premixed/partially-premixed combustion solver with turbulence
modelling. modelling.
Combusting RANS code using the b-Xi two-equation model. Combusting RANS code using the b-Xi two-equation model.
@ -121,7 +121,8 @@ scalar StCoNum = 0.0;
// Test : disable refinement for some cells // Test : disable refinement for some cells
PackedList<1>& protectedCell = PackedList<1>& protectedCell =
refCast<dynamicRefineFvMesh>(mesh).protectedCell(); refCast<dynamicRefineFvMesh>(mesh).protectedCell();
if (protectedCell.size() == 0)
if (protectedCell.empty())
{ {
protectedCell.setSize(mesh.nCells()); protectedCell.setSize(mesh.nCells());
protectedCell = 0; protectedCell = 0;
@ -135,7 +136,7 @@ scalar StCoNum = 0.0;
} }
} }
//volScalarField pIndicator("pIndicator", //volScalarField pIndicator("pIndicator",
// p*(fvc::laplacian(p)) // p*(fvc::laplacian(p))
// / ( // / (
// magSqr(fvc::grad(p)) // magSqr(fvc::grad(p))

View File

@ -28,7 +28,7 @@ Class
Description Description
Simple SCOPEBlendXiEq model for XiEq based on SCOPEXiEqs correlation Simple SCOPEBlendXiEq model for XiEq based on SCOPEXiEqs correlation
with a linear correction function to give a plausible profile for XiEq. with a linear correction function to give a plausible profile for XiEq.
See \link SCOPELaminarFlameSpeed.H \endlink for details on the SCOPE See @link SCOPELaminarFlameSpeed.H @endlink for details on the SCOPE
laminar flame speed model. laminar flame speed model.
SourceFiles SourceFiles

View File

@ -27,8 +27,8 @@ Class
Description Description
This is the equilibrium level of the flame wrinkling generated by This is the equilibrium level of the flame wrinkling generated by
inestability. It is a constant (default 2.5). It is used in instability. It is a constant (default 2.5). It is used in
\link XiModel.H \endlink. @link XiModel.H @endlink.
SourceFiles SourceFiles
instability.C instability.C

View File

@ -39,7 +39,7 @@ int main(int argc, char *argv[])
wordHashSet setA(0); wordHashSet setA(0);
HashTable<label, word> tableA; HashTable<label, word> tableA;
HashTable<empty> tableB; HashTable<nil> tableB;
Map<label> mapA; Map<label> mapA;
setA.insert("kjhk"); setA.insert("kjhk");
@ -49,9 +49,9 @@ int main(int argc, char *argv[])
tableA.insert("value2", 2); tableA.insert("value2", 2);
tableA.insert("value3", 3); tableA.insert("value3", 3);
tableB.insert("value4", empty()); tableB.insert("value4", nil());
tableB.insert("value5", empty()); tableB.insert("value5", nil());
tableB.insert("value6", empty()); tableB.insert("value6", nil());
mapA.set(1, 1); mapA.set(1, 1);
mapA.set(2, 2); mapA.set(2, 2);
@ -66,7 +66,7 @@ int main(int argc, char *argv[])
Info<< wordHashSet(setA) << endl; Info<< wordHashSet(setA) << endl;
Info<< "create from HashTable<T>: "; Info<< "create from HashTable<T>: ";
Info<< wordHashSet(tableA) << endl; Info<< wordHashSet(tableA) << endl;
Info<< "create from HashTable<empty>: "; Info<< "create from HashTable<nil>: ";
Info<< wordHashSet(tableB) << endl; Info<< wordHashSet(tableB) << endl;
Info<< "create from Map<label>: "; Info<< "create from Map<label>: ";

View File

@ -100,12 +100,12 @@ int main()
<< "\ntable2" << table1 << nl << "\ntable2" << table1 << nl
<< "\ntable3" << table3 << nl; << "\ntable3" << table3 << nl;
Info<< "\ndelete table2" << nl; Info<< "\nerase table2 by iterator" << nl;
forAllIter(HASHTABLE_CLASS<double>, table2, iter) forAllIter(HASHTABLE_CLASS<double>, table2, iter)
{ {
Info<< "deleting " << iter.key() << " => " << iter() << " ... "; Info<< "erasing " << iter.key() << " => " << iter() << " ... ";
table2.erase(iter); table2.erase(iter);
Info<< "deleted" << endl; Info<< "erased" << endl;
} }
Info<< "\ntable1" << table1 << nl Info<< "\ntable1" << table1 << nl
@ -134,6 +134,24 @@ int main()
table1.erase(table1.begin()); table1.erase(table1.begin());
Info<< "removed an element - test table1 != table3 : " Info<< "removed an element - test table1 != table3 : "
<< (table1 != table3) << nl; << (table1 != table3) << nl;
// insert a few things into table2
table2.set("ada", 14.0);
table2.set("aeq", 15.0);
table2.set("aaw", 16.0);
table2.set("abs", 17.0);
table2.set("adx", 20.0);
Info<< "\ntable1" << table1 << nl
<< "\ntable2" << table2 << nl;
label nErased = table1.erase(table2);
Info<< "\nerase table2 keys from table1 (removed "
<< nErased << " elements)" << nl
<< "\ntable1" << table1 << nl
<< "\ntable2" << table2 << nl;
Info<< "\nclearStorage table3 ... "; Info<< "\nclearStorage table3 ... ";
table3.clearStorage(); table3.clearStorage();

View File

@ -100,13 +100,13 @@ int main()
<< "\ntable2" << table1 << nl << "\ntable2" << table1 << nl
<< "\ntable3" << table3 << nl; << "\ntable3" << table3 << nl;
Info<< "\ndelete table2" << nl; Info<< "\nerase table2 by iterator" << nl;
forAllIter(HASHTABLE_CLASS<double>, table2, iter) forAllIter(HASHTABLE_CLASS<double>, table2, iter)
{ {
Info<< "deleting " << iter.key() << " => " << iter() << " ... "; Info<< "erasing " << iter.key() << " => " << iter() << " ... ";
table2.erase(iter); table2.erase(iter);
Info<< "deleted" << endl; Info<< "erased" << endl;
} }
Info<< "\ntable1" << table1 << nl Info<< "\ntable1" << table1 << nl
<< "\ntable2" << table2 << nl << "\ntable2" << table2 << nl
@ -134,6 +134,24 @@ int main()
table1.erase(table1.begin()); table1.erase(table1.begin());
Info<< "removed an element - test table1 != table3 : " Info<< "removed an element - test table1 != table3 : "
<< (table1 != table3) << nl; << (table1 != table3) << nl;
// insert a few things into table2
table2.set("ada", 14.0);
table2.set("aeq", 15.0);
table2.set("aaw", 16.0);
table2.set("abs", 17.0);
table2.set("adx", 20.0);
Info<< "\ntable1" << table1 << nl
<< "\ntable2" << table2 << nl;
label nErased = table1.erase(table2);
Info<< "\nerase table2 keys from table1 (removed "
<< nErased << " elements)" << nl
<< "\ntable1" << table1 << nl
<< "\ntable2" << table2 << nl;
Info<< "\nclearStorage table3 ... "; Info<< "\nclearStorage table3 ... ";
table3.clearStorage(); table3.clearStorage();
@ -144,5 +162,4 @@ int main()
return 0; return 0;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,3 @@
foamVersionString.C
EXE = $(FOAM_USER_APPBIN)/foamVersionString

View File

@ -0,0 +1,2 @@
/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */
/* EXE_LIBS = -lfiniteVolume */

View File

@ -0,0 +1,47 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
foamVersionString.C
Description
Print the OpenFOAM version strings.
Simultaneously the smallest possible program to use a minimal bit of
the OpenFOAM library
\*---------------------------------------------------------------------------*/
#include <iostream>
#include "foamVersion.H"
int main()
{
std::cerr
<< "build " << Foam::FOAMbuild << "\n"
<< "version " << Foam::FOAMversion << "\n";
return 0;
}
// ************************************************************************* //

View File

@ -413,7 +413,7 @@ bool limitRefinementLevel
} }
} }
if (addCutCells.size() > 0) if (addCutCells.size())
{ {
// Add cells to cutCells. // Add cells to cutCells.
@ -479,7 +479,7 @@ void doRefinement
{ {
const labelList& added = addedCells[oldCellI]; const labelList& added = addedCells[oldCellI];
if (added.size() > 0) if (added.size())
{ {
// Give all cells resulting from split the refinement level // Give all cells resulting from split the refinement level
// of the master. // of the master.
@ -895,7 +895,7 @@ int main(int argc, char *argv[])
<< " Selected for refinement :" << cutCells.size() << nl << " Selected for refinement :" << cutCells.size() << nl
<< endl; << endl;
if (cutCells.size() == 0) if (cutCells.empty())
{ {
Info<< "Stopping refining since 0 cells selected to be refined ..." Info<< "Stopping refining since 0 cells selected to be refined ..."
<< nl << endl; << nl << endl;

View File

@ -358,18 +358,21 @@ int main(int argc, char *argv[])
( (
dict.lookup("facesToTriangulate") dict.lookup("facesToTriangulate")
); );
bool cutBoundary = bool cutBoundary =
pointsToMove.size() > 0 (
|| edgesToSplit.size() > 0 pointsToMove.size()
|| facesToTriangulate.size() > 0; || edgesToSplit.size()
|| facesToTriangulate.size()
);
List<Pair<point> > edgesToCollapse(dict.lookup("edgesToCollapse")); List<Pair<point> > edgesToCollapse(dict.lookup("edgesToCollapse"));
bool collapseEdge = edgesToCollapse.size() > 0; bool collapseEdge = edgesToCollapse.size();
List<Pair<point> > cellsToPyramidise(dict.lookup("cellsToSplit")); List<Pair<point> > cellsToPyramidise(dict.lookup("cellsToSplit"));
bool cellsToSplit = cellsToPyramidise.size() > 0; bool cellsToSplit = cellsToPyramidise.size();
//List<Tuple<pointField,point> > //List<Tuple<pointField,point> >
// cellsToCreate(dict.lookup("cellsToCreate")); // 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" Info<< nl << "There was a problem in one of the inputs in the"
<< " dictionary. Not modifying mesh." << endl; << " dictionary. Not modifying mesh." << endl;
} }
else if (cellToPyrCentre.size() > 0) else if (cellToPyrCentre.size())
{ {
Info<< nl << "All input cells located. Modifying mesh." << endl; 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; Info << "Writing modified mesh to time " << runTime.value() << endl;
mesh.write(); mesh.write();
} }
else if (edgeToPos.size() > 0) else if (edgeToPos.size())
{ {
Info<< nl << "All input edges located. Modifying mesh." << endl; Info<< nl << "All input edges located. Modifying mesh." << endl;

View File

@ -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" Info<< "Collected " << refCells.size() << " cells that need to be"
<< " refined to get closer to overall 2:1 refinement level limit" << " refined to get closer to overall 2:1 refinement level limit"

View File

@ -652,7 +652,7 @@ int main(int argc, char *argv[])
// Remove cut cells from cellsToCut (Note:only relevant if -readSet) // Remove cut cells from cellsToCut (Note:only relevant if -readSet)
forAll(cuts.cellLoops(), cellI) forAll(cuts.cellLoops(), cellI)
{ {
if (cuts.cellLoops()[cellI].size() > 0) if (cuts.cellLoops()[cellI].size())
{ {
//Info<< "Removing cut cell " << cellI << " from wishlist" //Info<< "Removing cut cell " << cellI << " from wishlist"
// << endl; // << endl;

View File

@ -584,7 +584,7 @@ int main(int argc, char *argv[])
forAll (rawPatches, patchI) 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 // Check if this name has been already created
label existingPatch = -1; label existingPatch = -1;

View File

@ -1,4 +1,4 @@
/*---------------------------------------------------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
@ -1486,7 +1486,7 @@ int main(int argc, char *argv[])
} }
defaultBoundaryFaces.shrink(); defaultBoundaryFaces.shrink();
if(defaultBoundaryFaces.size() != 0) if (defaultBoundaryFaces.size())
{ {
Warning << " fluent mesh has " << defaultBoundaryFaces.size() Warning << " fluent mesh has " << defaultBoundaryFaces.size()
<< " undefined boundary faces." << endl << " undefined boundary faces." << endl
@ -1695,7 +1695,7 @@ int main(int argc, char *argv[])
// soon negating the need for double output // soon negating the need for double output
if (writeSets) if (writeSets)
{ {
if (cellGroupZoneID.size() > 1 ) if (cellGroupZoneID.size() > 1)
{ {
Info<< "Writing cell sets" << endl; Info<< "Writing cell sets" << endl;

View File

@ -667,7 +667,7 @@ void readCells
const labelList& zCells = zoneCells[zoneI]; const labelList& zCells = zoneCells[zoneI];
if (zCells.size() > 0) if (zCells.size())
{ {
Info<< " " << zoneI << '\t' << zCells.size() << endl; Info<< " " << zoneI << '\t' << zCells.size() << endl;
} }
@ -778,7 +778,7 @@ int main(int argc, char *argv[])
forAll(zoneCells, zoneI) forAll(zoneCells, zoneI)
{ {
if (zoneCells[zoneI].size() > 0) if (zoneCells[zoneI].size())
{ {
nValidCellZones++; nValidCellZones++;
} }
@ -910,7 +910,7 @@ int main(int argc, char *argv[])
const labelList& zFaces = zoneFaces[zoneI]; const labelList& zFaces = zoneFaces[zoneI];
if (zFaces.size() > 0) if (zFaces.size())
{ {
nValidFaceZones++; nValidFaceZones++;
@ -940,7 +940,7 @@ int main(int argc, char *argv[])
forAll(zoneCells, zoneI) forAll(zoneCells, zoneI)
{ {
if (zoneCells[zoneI].size() > 0) if (zoneCells[zoneI].size())
{ {
label physReg = zoneToPhys[zoneI]; label physReg = zoneToPhys[zoneI];
@ -979,7 +979,7 @@ int main(int argc, char *argv[])
forAll(zoneFaces, zoneI) forAll(zoneFaces, zoneI)
{ {
if (zoneFaces[zoneI].size() > 0) if (zoneFaces[zoneI].size())
{ {
label physReg = zoneToPhys[zoneI]; label physReg = zoneToPhys[zoneI];
@ -1011,7 +1011,7 @@ int main(int argc, char *argv[])
} }
} }
if (cz.size() > 0 || fz.size() > 0) if (cz.size() || fz.size())
{ {
mesh.addZones(List<pointZone*>(0), fz, cz); mesh.addZones(List<pointZone*>(0), fz, cz);
} }

View File

@ -752,7 +752,7 @@ int main(int argc, char *argv[])
List<faceList> patchFaceVerts; List<faceList> patchFaceVerts;
if (dofVertIndices.size() > 0) if (dofVertIndices.size())
{ {
// Use the vertex constraints to patch. Is of course bit dodgy since // Use the vertex constraints to patch. Is of course bit dodgy since
// face goes on patch if all its vertices are on a constraint. // face goes on patch if all its vertices are on a constraint.

View File

@ -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. // Didn't find cells connected to boundary faces.
WarningIn(args.executable()) WarningIn(args.executable())

View File

@ -229,7 +229,7 @@ void simpleMarkFeatures
if (doNotPreserveFaceZones) if (doNotPreserveFaceZones)
{ {
if (faceZones.size() > 0) if (faceZones.size())
{ {
WarningIn("simpleMarkFeatures(..)") WarningIn("simpleMarkFeatures(..)")
<< "Detected " << faceZones.size() << "Detected " << faceZones.size()
@ -239,7 +239,7 @@ void simpleMarkFeatures
} }
else else
{ {
if (faceZones.size() > 0) if (faceZones.size())
{ {
Info<< "Detected " << faceZones.size() Info<< "Detected " << faceZones.size()
<< " faceZones. Preserving these by marking their" << " faceZones. Preserving these by marking their"

View File

@ -38,10 +38,7 @@ Class
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam defineTypeNameAndDebug(Foam::meshDualiser, 0);
{
defineTypeNameAndDebug(meshDualiser, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -735,7 +732,7 @@ void Foam::meshDualiser::createFacesAroundBoundaryPoint
) << "Walked from face on patch:" << patchI ) << "Walked from face on patch:" << patchI
<< " to face:" << faceI << " to face:" << faceI
<< " fc:" << mesh_.faceCentres()[faceI] << " fc:" << mesh_.faceCentres()[faceI]
<< " on patch:" << patches.whichPatch(faceI) << " on patch:" << patches.whichPatch(faceI)
<< abort(FatalError); << abort(FatalError);
} }
@ -886,7 +883,7 @@ Foam::meshDualiser::meshDualiser(const polyMesh& mesh)
faceToDualPoint_(mesh_.nFaces(), -1), faceToDualPoint_(mesh_.nFaces(), -1),
edgeToDualPoint_(mesh_.nEdges(), -1) edgeToDualPoint_(mesh_.nEdges(), -1)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
@ -1083,7 +1080,7 @@ void Foam::meshDualiser::setRefinement
{ {
label pointI = multiCellFeaturePoints[i]; label pointI = multiCellFeaturePoints[i];
if (pointToDualCells_[pointI].size() > 0) if (pointToDualCells_[pointI].size())
{ {
FatalErrorIn FatalErrorIn
( (
@ -1133,7 +1130,7 @@ void Foam::meshDualiser::setRefinement
// Normal points // Normal points
forAll(mesh_.points(), pointI) forAll(mesh_.points(), pointI)
{ {
if (pointToDualCells_[pointI].size() == 0) if (pointToDualCells_[pointI].empty())
{ {
pointToDualCells_[pointI].setSize(1); pointToDualCells_[pointI].setSize(1);
pointToDualCells_[pointI][0] = meshMod.addCell pointToDualCells_[pointI][0] = meshMod.addCell
@ -1241,7 +1238,7 @@ void Foam::meshDualiser::setRefinement
const edge& e = mesh_.edges()[edgeI]; const edge& e = mesh_.edges()[edgeI];
// We need a point on the edge if not all cells on both sides // 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]; const labelList& eCells = mesh_.edgeCells()[edgeI];

View File

@ -136,7 +136,7 @@ void sammMesh::readCouples()
forAll (curFaces, faceI) forAll (curFaces, faceI)
{ {
if (curFaces[faceI].size() == 0) if (curFaces[faceI].empty())
{ {
zeroSizeFound++; zeroSizeFound++;
} }
@ -153,7 +153,7 @@ void sammMesh::readCouples()
forAll (oldFaces, faceI) forAll (oldFaces, faceI)
{ {
if (oldFaces[faceI].size() > 0) if (oldFaces[faceI].size())
{ {
curFaces[nFaces] = oldFaces[faceI]; curFaces[nFaces] = oldFaces[faceI];

View File

@ -45,12 +45,11 @@ void starMesh::createCoupleMatches()
// existing points list // existing points list
// Estimate the number of cells affected by couple matches // Estimate the number of cells affected by couple matches
const label cellMapSize = const label cellMapSize = min
min (
( cellShapes_.size()/10,
cellShapes_.size()/10, couples_.size()*2
couples_.size()*2 );
);
// Store newly created faces for each cell // Store newly created faces for each cell
Map<SLList<face> > cellAddedFaces(cellMapSize); Map<SLList<face> > cellAddedFaces(cellMapSize);
@ -322,7 +321,7 @@ void starMesh::createCoupleMatches()
// A new point is created. Warning: // A new point is created. Warning:
// using original edge for accuracy. // using original edge for accuracy.
// //
coupleFacePoints.append coupleFacePoints.append
(P + alpha*curMasterEdge.vec(points_)); (P + alpha*curMasterEdge.vec(points_));
} }
@ -338,7 +337,7 @@ void starMesh::createCoupleMatches()
// master edge and vice versa. The problem is that // master edge and vice versa. The problem is that
// no symmetry exists, i.e. both operations needs // no symmetry exists, i.e. both operations needs
// to be done separately for both master and slave // to be done separately for both master and slave
// side. // side.
// Master side // Master side
// check if the first or second point of slave edge is // check if the first or second point of slave edge is
@ -625,11 +624,11 @@ void starMesh::createCoupleMatches()
// Eliminate all zero-length edges // Eliminate all zero-length edges
face newMasterFace(labelList(tmpMasterFace.size(), labelMax)); face newMasterFace(labelList(tmpMasterFace.size(), labelMax));
// insert first point by hand. Careful: the first one is // insert first point by hand. Careful: the first one is
// used for comparison to allow the edge collapse across // used for comparison to allow the edge collapse across
// point zero. // point zero.
// //
newMasterFace[0] = tmpMasterFace[0]; newMasterFace[0] = tmpMasterFace[0];
label nMaster = 0; label nMaster = 0;
@ -823,7 +822,7 @@ void starMesh::createCoupleMatches()
// insert first point by hand. Careful: the first one is // insert first point by hand. Careful: the first one is
// used for comparison to allow the edge collapse across // used for comparison to allow the edge collapse across
// point zero. // point zero.
// //
newSlaveFace[0] = tmpSlaveFace[0]; newSlaveFace[0] = tmpSlaveFace[0];
label nSlave = 0; label nSlave = 0;
@ -1097,7 +1096,7 @@ void starMesh::createCoupleMatches()
<< "edges to consider: " << edgesToConsider << endl; << "edges to consider: " << edgesToConsider << endl;
# endif # endif
if (edgesToConsider.size() == 0) if (edgesToConsider.empty())
{ {
FatalErrorIn("void starMesh::createCoupleMatches()") FatalErrorIn("void starMesh::createCoupleMatches()")
<< setprecision(12) << setprecision(12)
@ -1420,7 +1419,7 @@ void starMesh::createCoupleMatches()
} // end of arbitrary match } // end of arbitrary match
} }
if (couples_.size() > 0) if (couples_.size())
{ {
// Loop through all cells and reset faces for removal to zero size // Loop through all cells and reset faces for removal to zero size
const labelList crfToc = cellRemovedFaces.toc(); const labelList crfToc = cellRemovedFaces.toc();
@ -1442,7 +1441,7 @@ void starMesh::createCoupleMatches()
cellFaces_[curCell][curRemovedFacesIter()].setSize(0); cellFaces_[curCell][curRemovedFacesIter()].setSize(0);
} }
if (curRemovedFaces.size() > 0) if (curRemovedFaces.size())
{ {
// reset the shape pointer to unknown // reset the shape pointer to unknown
cellShapes_[curCell] = cellShape(*unknownPtr_, labelList(0)); cellShapes_[curCell] = cellShape(*unknownPtr_, labelList(0));
@ -1468,7 +1467,7 @@ void starMesh::createCoupleMatches()
// copy original faces that have not been removed // copy original faces that have not been removed
forAll (oldFaces, faceI) forAll (oldFaces, faceI)
{ {
if (oldFaces[faceI].size() > 0) if (oldFaces[faceI].size())
{ {
newFaces[nNewFaces] = oldFaces[faceI]; newFaces[nNewFaces] = oldFaces[faceI];
nNewFaces++; nNewFaces++;
@ -1491,7 +1490,7 @@ void starMesh::createCoupleMatches()
// reset the size of the face list // reset the size of the face list
newFaces.setSize(nNewFaces); newFaces.setSize(nNewFaces);
if (curAddedFaces.size() > 0) if (curAddedFaces.size())
{ {
// reset the shape pointer to unknown // reset the shape pointer to unknown
cellShapes_[curCell] = cellShape(*unknownPtr_, labelList(0)); cellShapes_[curCell] = cellShape(*unknownPtr_, labelList(0));

View File

@ -264,7 +264,7 @@ starMesh::starMesh
readCouples(); readCouples();
if (couples_.size() > 0) if (couples_.size())
{ {
createCoupleMatches(); createCoupleMatches();
} }

View File

@ -160,7 +160,7 @@ int main(int argc, char *argv[])
{ {
nodeStream.getLine(line); nodeStream.getLine(line);
} }
while((line.size() > 0) && (line[0] == '#')); while (line.size() && line[0] == '#');
IStringStream nodeLine(line); IStringStream nodeLine(line);
@ -193,7 +193,7 @@ int main(int argc, char *argv[])
{ {
nodeStream.getLine(line); nodeStream.getLine(line);
if ((line.size() > 0) && (line[0] != '#')) if (line.size() && line[0] != '#')
{ {
IStringStream nodeLine(line); IStringStream nodeLine(line);
@ -237,7 +237,7 @@ int main(int argc, char *argv[])
{ {
eleStream.getLine(line); eleStream.getLine(line);
} }
while((line.size() > 0) && (line[0] == '#')); while (line.size() && line[0] == '#');
IStringStream eleLine(line); IStringStream eleLine(line);
@ -281,7 +281,7 @@ int main(int argc, char *argv[])
{ {
eleStream.getLine(line); eleStream.getLine(line);
if ((line.size() > 0) && (line[0] != '#')) if (line.size() && line[0] != '#')
{ {
IStringStream eleLine(line); IStringStream eleLine(line);
@ -356,7 +356,7 @@ int main(int argc, char *argv[])
{ {
faceStream.getLine(line); faceStream.getLine(line);
} }
while((line.size() > 0) && (line[0] == '#')); while (line.size() && line[0] == '#');
IStringStream faceLine(line); IStringStream faceLine(line);
@ -398,7 +398,7 @@ int main(int argc, char *argv[])
{ {
faceStream.getLine(line); faceStream.getLine(line);
if ((line.size() > 0) && (line[0] != '#')) if (line.size() && line[0] != '#')
{ {
IStringStream faceLine(line); IStringStream faceLine(line);

View File

@ -118,7 +118,7 @@ Foam::label Foam::blockMesh::numZonedBlocks() const
forAll(*this, blockI) forAll(*this, blockI)
{ {
if (operator[](blockI).blockDef().zoneName().size() > 0) if (operator[](blockI).blockDef().zoneName().size())
{ {
num++; num++;
} }

View File

@ -278,7 +278,7 @@ int main(int argc, char *argv[])
const labelListList& blockCells = b.cells(); const labelListList& blockCells = b.cells();
const word& zoneName = b.blockDef().zoneName(); const word& zoneName = b.blockDef().zoneName();
if (zoneName.size() > 0) if (zoneName.size())
{ {
HashTable<label>::const_iterator iter = zoneMap.find(zoneName); HashTable<label>::const_iterator iter = zoneMap.find(zoneName);

View File

@ -1,6 +1,6 @@
Info<< "Creating merge patch pairs" << nl << endl; Info<< "Creating merge patch pairs" << nl << endl;
if (mergePatchPairs.size() > 0) if (mergePatchPairs.size())
{ {
// Create and add point and face zones and mesh modifiers // Create and add point and face zones and mesh modifiers
List<pointZone*> pz(mergePatchPairs.size()); List<pointZone*> pz(mergePatchPairs.size());

View File

@ -177,7 +177,7 @@ Foam::label Foam::checkTopology
primitivePatch::surfaceTopo pTyp = pp.surfaceType(); primitivePatch::surfaceTopo pTyp = pp.surfaceType();
if (pp.size() == 0) if (pp.empty())
{ {
Pout<< setw(34) << "ok (empty)"; Pout<< setw(34) << "ok (empty)";
} }
@ -232,7 +232,7 @@ Foam::label Foam::checkTopology
Pout<< endl; Pout<< endl;
} }
if (points.size() > 0) if (points.size())
{ {
Pout<< " <<Writing " << points.size() Pout<< " <<Writing " << points.size()
<< " conflicting points to set " << " conflicting points to set "

View File

@ -172,7 +172,7 @@ void filterPatches(polyMesh& mesh)
if (isA<processorPolyPatch>(pp)) if (isA<processorPolyPatch>(pp))
{ {
if (pp.size() > 0) if (pp.size())
{ {
allPatches.append allPatches.append
( (
@ -586,7 +586,7 @@ int main(int argc, char *argv[])
// 1. Add all new patches // 1. Add all new patches
// ~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~
if (patchSources.size() > 0) if (patchSources.size())
{ {
// Old and new patches. // Old and new patches.
DynamicList<polyPatch*> allPatches(patches.size()+patchSources.size()); DynamicList<polyPatch*> allPatches(patches.size()+patchSources.size());

View File

@ -34,10 +34,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam defineTypeNameAndDebug(Foam::mergePolyMesh, 1);
{
defineTypeNameAndDebug(mergePolyMesh, 1);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -142,7 +139,7 @@ Foam::mergePolyMesh::mergePolyMesh(const IOobject& io)
// Point zones // Point zones
wordList curPointZoneNames = pointZones().names(); wordList curPointZoneNames = pointZones().names();
if (curPointZoneNames.size() > 0) if (curPointZoneNames.size())
{ {
pointZoneNames_.setCapacity(2*curPointZoneNames.size()); pointZoneNames_.setCapacity(2*curPointZoneNames.size());
} }
@ -155,7 +152,7 @@ Foam::mergePolyMesh::mergePolyMesh(const IOobject& io)
// Face zones // Face zones
wordList curFaceZoneNames = faceZones().names(); wordList curFaceZoneNames = faceZones().names();
if (curFaceZoneNames.size() > 0) if (curFaceZoneNames.size())
{ {
faceZoneNames_.setCapacity(2*curFaceZoneNames.size()); faceZoneNames_.setCapacity(2*curFaceZoneNames.size());
} }
@ -167,7 +164,7 @@ Foam::mergePolyMesh::mergePolyMesh(const IOobject& io)
// Cell zones // Cell zones
wordList curCellZoneNames = cellZones().names(); wordList curCellZoneNames = cellZones().names();
if (curCellZoneNames.size() > 0) if (curCellZoneNames.size())
{ {
cellZoneNames_.setCapacity(2*curCellZoneNames.size()); cellZoneNames_.setCapacity(2*curCellZoneNames.size());
} }
@ -333,11 +330,11 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
newOwn = own[faceI]; newOwn = own[faceI];
if (newOwn > -1) newOwn = renumberCells[newOwn]; if (newOwn > -1) newOwn = renumberCells[newOwn];
if (newPatch > -1) if (newPatch > -1)
{ {
newNei = -1; newNei = -1;
} }
else else
{ {
newNei = nei[faceI]; newNei = nei[faceI];
newNei = renumberCells[newNei]; newNei = renumberCells[newNei];
@ -373,7 +370,7 @@ void Foam::mergePolyMesh::addMesh(const polyMesh& m)
) )
); );
} }
} }

View File

@ -48,7 +48,7 @@ string getLine(std::ifstream& is)
{ {
std::getline(is, line); std::getline(is, line);
} }
while((line.size() > 0) && (line[0] == '#')); while (line.size() && line[0] == '#');
return line; return line;
} }
@ -60,13 +60,13 @@ labelList parseVertices(const string& line)
DynamicList<label> verts; DynamicList<label> verts;
// Assume 'l' is followed by space. // Assume 'l' is followed by space.
label endNum = 1; string::size_type endNum = 1;
do do
{ {
label startNum = line.find_first_not_of(' ', endNum); string::size_type startNum = line.find_first_not_of(' ', endNum);
if (startNum == label(string::npos)) if (startNum == string::npos)
{ {
break; break;
} }
@ -74,7 +74,7 @@ labelList parseVertices(const string& line)
endNum = line.find(' ', startNum); endNum = line.find(' ', startNum);
string vertexSpec; string vertexSpec;
if (endNum != label(string::npos)) if (endNum != string::npos)
{ {
vertexSpec = line.substr(startNum, endNum-startNum); vertexSpec = line.substr(startNum, endNum-startNum);
} }
@ -83,10 +83,10 @@ labelList parseVertices(const string& line)
vertexSpec = line.substr(startNum, line.size() - startNum); vertexSpec = line.substr(startNum, line.size() - startNum);
} }
label slashPos = vertexSpec.find('/'); string::size_type slashPos = vertexSpec.find('/');
label vertI = 0; label vertI = 0;
if (slashPos != label(string::npos)) if (slashPos != string::npos)
{ {
IStringStream intStream(vertexSpec.substr(0, slashPos)); IStringStream intStream(vertexSpec.substr(0, slashPos));

View File

@ -485,7 +485,7 @@ int main(int argc, char *argv[])
{ {
const labelList& added = oldToNew[oldCellI]; const labelList& added = oldToNew[oldCellI];
if (added.size() > 0) if (added.size())
{ {
forAll(added, i) forAll(added, i)
{ {

View File

@ -89,7 +89,7 @@ void backup
const word& toName const word& toName
) )
{ {
if (fromSet.size() > 0) if (fromSet.size())
{ {
Pout<< " Backing up " << fromName << " into " << toName << endl; Pout<< " Backing up " << fromName << " into " << toName << endl;
@ -284,7 +284,7 @@ void printAllSets(const polyMesh& mesh, Ostream& os)
polyMesh::meshSubDir/"sets" polyMesh::meshSubDir/"sets"
); );
IOobjectList cellSets(objects.lookupClass(cellSet::typeName)); IOobjectList cellSets(objects.lookupClass(cellSet::typeName));
if (cellSets.size() > 0) if (cellSets.size())
{ {
os << "cellSets:" << endl; os << "cellSets:" << endl;
forAllConstIter(IOobjectList, cellSets, iter) forAllConstIter(IOobjectList, cellSets, iter)
@ -294,7 +294,7 @@ void printAllSets(const polyMesh& mesh, Ostream& os)
} }
} }
IOobjectList faceSets(objects.lookupClass(faceSet::typeName)); IOobjectList faceSets(objects.lookupClass(faceSet::typeName));
if (faceSets.size() > 0) if (faceSets.size())
{ {
os << "faceSets:" << endl; os << "faceSets:" << endl;
forAllConstIter(IOobjectList, faceSets, iter) forAllConstIter(IOobjectList, faceSets, iter)
@ -304,7 +304,7 @@ void printAllSets(const polyMesh& mesh, Ostream& os)
} }
} }
IOobjectList pointSets(objects.lookupClass(pointSet::typeName)); IOobjectList pointSets(objects.lookupClass(pointSet::typeName));
if (pointSets.size() > 0) if (pointSets.size())
{ {
os << "pointSets:" << endl; os << "pointSets:" << endl;
forAllConstIter(IOobjectList, pointSets, iter) forAllConstIter(IOobjectList, pointSets, iter)
@ -347,7 +347,7 @@ bool doCommand
bool ok = true; bool ok = true;
// Set to work on // Set to work on
autoPtr<topoSet> currentSetPtr(NULL); autoPtr<topoSet> currentSetPtr;
word sourceType; word sourceType;
@ -383,7 +383,7 @@ bool doCommand
currentSet.resize(max(currentSet.size(), typSize)); currentSet.resize(max(currentSet.size(), typSize));
} }
if (!currentSetPtr.valid()) if (currentSetPtr.empty())
{ {
Pout<< " Cannot construct/load set " Pout<< " Cannot construct/load set "
<< topoSet::localPath(mesh, setName) << endl; << topoSet::localPath(mesh, setName) << endl;
@ -522,7 +522,7 @@ bool doCommand
Pout<< fIOErr.message().c_str() << endl; Pout<< fIOErr.message().c_str() << endl;
if (sourceType.size() != 0) if (sourceType.size())
{ {
Pout<< topoSetSource::usage(sourceType).c_str(); Pout<< topoSetSource::usage(sourceType).c_str();
} }
@ -533,7 +533,7 @@ bool doCommand
Pout<< fErr.message().c_str() << endl; Pout<< fErr.message().c_str() << endl;
if (sourceType.size() != 0) if (sourceType.size())
{ {
Pout<< topoSetSource::usage(sourceType).c_str(); Pout<< topoSetSource::usage(sourceType).c_str();
} }
@ -571,7 +571,7 @@ commandStatus parseType
IStringStream& is IStringStream& is
) )
{ {
if (setType.size() == 0) if (setType.empty())
{ {
Pout<< "Type 'help' for usage information" << endl; Pout<< "Type 'help' for usage information" << endl;
@ -689,7 +689,7 @@ commandStatus parseAction(const word& actionName)
{ {
commandStatus stat = INVALID; commandStatus stat = INVALID;
if (actionName.size() != 0) if (actionName.size())
{ {
try try
{ {
@ -792,7 +792,7 @@ int main(int argc, char *argv[])
std::getline(*fileStreamPtr, rawLine); std::getline(*fileStreamPtr, rawLine);
if (rawLine.size() > 0) if (rawLine.size())
{ {
Pout<< "Doing:" << rawLine << endl; Pout<< "Doing:" << rawLine << endl;
} }
@ -821,7 +821,7 @@ int main(int argc, char *argv[])
# endif # endif
} }
if (rawLine.size() == 0 || rawLine[0] == '#') if (rawLine.empty() || rawLine[0] == '#')
{ {
continue; continue;
} }

View File

@ -100,10 +100,10 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
<< exit(FatalError); << exit(FatalError);
} }
if (bMesh[patchI].size() != 0) if (bMesh[patchI].size())
{ {
FatalErrorIn("checkPatch(const polyBoundaryMesh&, const word&)") FatalErrorIn("checkPatch(const polyBoundaryMesh&, const word&)")
<< "Patch " << name << " is present but not of zero size" << "Patch " << name << " is present but non-zero size"
<< exit(FatalError); << exit(FatalError);
} }
} }

View File

@ -878,7 +878,7 @@ void createAndWriteRegion
{ {
const polyPatch& pp = newPatches[patchI]; const polyPatch& pp = newPatches[patchI];
if (isA<processorPolyPatch>(pp) && pp.size() > 0) if (isA<processorPolyPatch>(pp) && pp.size())
{ {
oldToNew[patchI] = newI++; oldToNew[patchI] = newI++;
} }
@ -1049,7 +1049,7 @@ label findCorrespondingZone
labelList regionCells = findIndices(cellRegion, regionI); labelList regionCells = findIndices(cellRegion, regionI);
if (regionCells.size() == 0) if (regionCells.empty())
{ {
// My local portion is empty. Maps to any empty cellZone. Mark with // My local portion is empty. Maps to any empty cellZone. Mark with
// special value which can get overwritten by other processors. // special value which can get overwritten by other processors.
@ -1200,7 +1200,7 @@ int main(int argc, char *argv[])
boolList blockedFace; boolList blockedFace;
// Read from faceSet // Read from faceSet
if (blockedFacesName.size() > 0) if (blockedFacesName.size())
{ {
faceSet blockedFaceSet(mesh, blockedFacesName); faceSet blockedFaceSet(mesh, blockedFacesName);
Info<< "Read " << returnReduce(blockedFaceSet.size(), sumOp<label>()) Info<< "Read " << returnReduce(blockedFaceSet.size(), sumOp<label>())

View File

@ -82,7 +82,7 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
<< exit(FatalError); << exit(FatalError);
} }
if (bMesh[patchI].size() == 0) if (bMesh[patchI].empty())
{ {
FatalErrorIn("checkPatch(const polyBoundaryMesh&, const word&)") FatalErrorIn("checkPatch(const polyBoundaryMesh&, const word&)")
<< "Patch " << name << " is present but zero size" << "Patch " << name << " is present but zero size"

View File

@ -152,7 +152,7 @@ int main(int argc, char *argv[])
); );
if (args.options().size() == 0) if (args.options().empty())
{ {
FatalErrorIn(args.executable()) FatalErrorIn(args.executable())
<< "No options supplied, please use one or more of " << "No options supplied, please use one or more of "

View File

@ -42,6 +42,7 @@ int main(int argc, char *argv[])
{ {
# include "addTimeOptions.H" # include "addTimeOptions.H"
# include "addRegionOption.H"
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
@ -53,7 +54,7 @@ int main(int argc, char *argv[])
runTime.setTime(Times[startTime], startTime); runTime.setTime(Times[startTime], startTime);
# include "createMesh.H" # include "createNamedMesh.H"
for (label i=startTime; i<endTime; i++) for (label i=startTime; i<endTime; i++)
{ {

View File

@ -104,7 +104,7 @@ void domainDecomposition::distributeCells()
} }
} }
if (sameProcFaces.size() > 0) if (sameProcFaces.size())
{ {
Info<< "Selected " << sameProcFaces.size() Info<< "Selected " << sameProcFaces.size()
<< " faces whose owner and neighbour cell should be kept on the" << " faces whose owner and neighbour cell should be kept on the"
@ -123,7 +123,7 @@ void domainDecomposition::distributeCells()
*this *this
); );
if (sameProcFaces.size() == 0) if (sameProcFaces.empty())
{ {
cellToProc_ = decomposePtr().decompose(cellCentres()); cellToProc_ = decomposePtr().decompose(cellCentres());
} }

View File

@ -100,7 +100,7 @@ int main(int argc, char *argv[])
args args
); );
if (!timeDirs.size()) if (timeDirs.empty())
{ {
FatalErrorIn(args.executable()) FatalErrorIn(args.executable())
<< "No times selected" << "No times selected"
@ -113,20 +113,10 @@ int main(int argc, char *argv[])
{ {
regionPrefix = regionName; regionPrefix = regionName;
} }
// Set all times (on reconstructed mesh and on processor meshes)
runTime.setTime(timeDirs[0], 0);
mesh.readUpdate();
forAll (databases, procI)
{
databases[procI].setTime(timeDirs[0], 0);
}
// Read all meshes and addressing to reconstructed mesh // Read all meshes and addressing to reconstructed mesh
processorMeshes procMeshes(databases, regionName); processorMeshes procMeshes(databases, regionName);
// check face addressing for meshes that have been decomposed // check face addressing for meshes that have been decomposed
// with a very old foam version // with a very old foam version
# include "checkFaceAddressingComp.H" # include "checkFaceAddressingComp.H"
@ -319,7 +309,7 @@ int main(int argc, char *argv[])
} }
if (cloudObjects.size() > 0) if (cloudObjects.size())
{ {
// Pass2: reconstruct the cloud // Pass2: reconstruct the cloud
forAllConstIter(HashTable<IOobjectList>, cloudObjects, iter) forAllConstIter(HashTable<IOobjectList>, cloudObjects, iter)

View File

@ -558,7 +558,7 @@ void ensightFieldAscii
GeometricField<Type, fvPatchField, volMesh> vf(fieldObject, mesh); GeometricField<Type, fvPatchField, volMesh> vf(fieldObject, mesh);
if (!patchNames.size()) if (patchNames.empty())
{ {
if (Pstream::master()) if (Pstream::master())
{ {
@ -633,7 +633,7 @@ void ensightFieldAscii
const word& patchName = iter.key(); const word& patchName = iter.key();
const labelList& patchProcessors = iter(); const labelList& patchProcessors = iter();
if (!patchNames.size() || patchNames.found(patchName)) if (patchNames.empty() || patchNames.found(patchName))
{ {
if (patchIndices.found(patchName)) if (patchIndices.found(patchName))
{ {
@ -734,7 +734,7 @@ void ensightFieldBinary
GeometricField<Type, fvPatchField, volMesh> vf(fieldObject, mesh); GeometricField<Type, fvPatchField, volMesh> vf(fieldObject, mesh);
if (!patchNames.size()) if (patchNames.empty())
{ {
if (Pstream::master()) if (Pstream::master())
{ {
@ -805,7 +805,7 @@ void ensightFieldBinary
const word& patchName = iter.key(); const word& patchName = iter.key();
const labelList& patchProcessors = iter(); const labelList& patchProcessors = iter();
if (!patchNames.size() || patchNames.found(patchName)) if (patchNames.empty() || patchNames.found(patchName))
{ {
if (patchIndices.found(patchName)) if (patchIndices.found(patchName))
{ {

View File

@ -129,7 +129,7 @@ Foam::ensightMesh::ensightMesh
{ {
wordList patchNameList(IStringStream(args.options()["patches"])()); wordList patchNameList(IStringStream(args.options()["patches"])());
if (!patchNameList.size()) if (patchNameList.empty())
{ {
patchNameList = allPatchNames_.toc(); patchNameList = allPatchNames_.toc();
} }
@ -163,7 +163,7 @@ Foam::ensightMesh::ensightMesh
label nHexes = 0; label nHexes = 0;
label nPolys = 0; label nPolys = 0;
if (!patchNames_.size()) if (patchNames_.empty())
{ {
forAll(cellShapes, celli) forAll(cellShapes, celli)
{ {
@ -267,7 +267,7 @@ Foam::ensightMesh::ensightMesh
const word& patchName = iter.key(); const word& patchName = iter.key();
nFacePrimitives nfp; nFacePrimitives nfp;
if (!patchNames_.size() || patchNames_.found(patchName)) if (patchNames_.empty() || patchNames_.found(patchName))
{ {
if (patchIndices_.found(patchName)) if (patchIndices_.found(patchName))
{ {
@ -403,7 +403,7 @@ void Foam::ensightMesh::writePrimsBinary
numElem = cellShapes.size(); numElem = cellShapes.size();
if (cellShapes.size() > 0) if (cellShapes.size())
{ {
// All the cellShapes have the same number of elements! // All the cellShapes have the same number of elements!
int numIntElem = cellShapes.size()*cellShapes[0].size(); int numIntElem = cellShapes.size()*cellShapes[0].size();
@ -917,7 +917,7 @@ void Foam::ensightMesh::writeAscii
labelList pointOffsets(Pstream::nProcs(), 0); labelList pointOffsets(Pstream::nProcs(), 0);
if (!patchNames_.size()) if (patchNames_.empty())
{ {
label nPoints = points.size(); label nPoints = points.size();
Pstream::gather(nPoints, sumOp<label>()); Pstream::gather(nPoints, sumOp<label>());
@ -1044,7 +1044,7 @@ void Foam::ensightMesh::writeAscii
{ {
const labelList& patchProcessors = iter(); const labelList& patchProcessors = iter();
if (!patchNames_.size() || patchNames_.found(iter.key())) if (patchNames_.empty() || patchNames_.found(iter.key()))
{ {
const word& patchName = iter.key(); const word& patchName = iter.key();
const nFacePrimitives& nfp = nPatchPrims_.find(patchName)(); const nFacePrimitives& nfp = nPatchPrims_.find(patchName)();
@ -1244,7 +1244,7 @@ void Foam::ensightMesh::writeBinary
labelList pointOffsets(Pstream::nProcs(), 0); labelList pointOffsets(Pstream::nProcs(), 0);
if (!patchNames_.size()) if (patchNames_.empty())
{ {
label nPoints = points.size(); label nPoints = points.size();
Pstream::gather(nPoints, sumOp<label>()); Pstream::gather(nPoints, sumOp<label>());
@ -1373,7 +1373,7 @@ void Foam::ensightMesh::writeBinary
iCount ++; iCount ++;
const labelList& patchProcessors = iter(); const labelList& patchProcessors = iter();
if (!patchNames_.size() || patchNames_.found(iter.key())) if (patchNames_.empty() || patchNames_.found(iter.key()))
{ {
const word& patchName = iter.key(); const word& patchName = iter.key();
const nFacePrimitives& nfp = nPatchPrims_.find(patchName)(); const nFacePrimitives& nfp = nPatchPrims_.find(patchName)();

View File

@ -57,7 +57,7 @@ void writeEnsDataBinary
std::ofstream& ensightFile std::ofstream& ensightFile
) )
{ {
if (sf.size() > 0) if (sf.size())
{ {
List<float> temp(sf.size()); List<float> temp(sf.size());

View File

@ -77,9 +77,9 @@ forAllIter(HashTable<HashTable<word> >, cloudFields, cloudIter)
} }
} }
if (!cloudIter().size()) if (cloudIter().empty())
{ {
Info<< "removing cloud " << cloudName<< endl; Info<< "removing cloud " << cloudName << endl;
cloudFields.erase(cloudIter); cloudFields.erase(cloudIter);
} }
} }

View File

@ -227,7 +227,7 @@ int main(int argc, char *argv[])
# include "getFieldNames.H" # include "getFieldNames.H"
bool hasLagrangian = false; bool hasLagrangian = false;
if ((sprayScalarNames.size() > 0) || (sprayVectorNames.size() > 0)) if (sprayScalarNames.size() || sprayVectorNames.size())
{ {
hasLagrangian = true; hasLagrangian = true;
} }

View File

@ -80,7 +80,7 @@ for(label i=0; i < nTypes; i++)
wordList lagrangianScalarNames = objects.names("scalarField"); wordList lagrangianScalarNames = objects.names("scalarField");
wordList lagrangianVectorNames = objects.names("vectorField"); wordList lagrangianVectorNames = objects.names("vectorField");
if (particles.size() > 0) if (particles.size())
{ {
# include "gmvOutputLagrangian.H" # include "gmvOutputLagrangian.H"
} }

View File

@ -49,16 +49,11 @@ forAll(lagrangianScalarNames, i)
) )
); );
if (s.size() != 0) if (s.size())
{ {
gmvFile << name << nl; gmvFile << name << nl;
for for (label n = 0; n < s.size(); n++)
(
label n = 0;
n < s.size();
n++
)
{ {
gmvFile << s[n] << token::SPACE; gmvFile << s[n] << token::SPACE;
} }
@ -85,16 +80,11 @@ forAll(lagrangianVectorNames, i)
) )
); );
if (v.size() != 0) if (v.size())
{ {
gmvFile << name + "x" << nl; gmvFile << name + "x" << nl;
for for (label n = 0; n < v.size(); n++)
(
label n = 0;
n < v.size();
n++
)
{ {
gmvFile << v[n].x() << token::SPACE; gmvFile << v[n].x() << token::SPACE;
} }
@ -102,12 +92,7 @@ forAll(lagrangianVectorNames, i)
gmvFile << name + "y" << nl; gmvFile << name + "y" << nl;
for for (label n = 0; n < v.size(); n++)
(
label n = 0;
n < v.size();
n++
)
{ {
gmvFile << v[n].y() << token::SPACE; gmvFile << v[n].y() << token::SPACE;
} }
@ -115,19 +100,13 @@ forAll(lagrangianVectorNames, i)
gmvFile << name + "z" << nl; gmvFile << name + "z" << nl;
for for (label n = 0; n < v.size(); n++)
(
label n = 0;
n < v.size();
n++
)
{ {
gmvFile << v[n].z() << token::SPACE; gmvFile << v[n].z() << token::SPACE;
} }
gmvFile << nl; gmvFile << nl;
} }
} }

View File

@ -47,16 +47,11 @@ forAll(lagrangianScalarNames, i)
) )
); );
if (s.size() != 0) if (s.size())
{ {
gmvFile << name << nl; gmvFile << name << nl;
for for (label n = 0; n < s.size(); n++)
(
label n = 0;
n < s.size();
n++
)
{ {
gmvFile << s[n] << token::SPACE; gmvFile << s[n] << token::SPACE;
} }

View File

@ -339,7 +339,7 @@ int main(int argc, char *argv[])
( (
args.options().found("time") args.options().found("time")
|| args.options().found("latestTime") || args.options().found("latestTime")
|| cellSetName.size() > 0 || cellSetName.size()
|| regionName != polyMesh::defaultRegion || regionName != polyMesh::defaultRegion
) )
{ {

View File

@ -58,7 +58,7 @@ void readFields
++iter ++iter
) )
{ {
if (!selectedFields.size() || selectedFields.found(iter()->name())) if (selectedFields.empty() || selectedFields.found(iter()->name()))
{ {
fields.set fields.set
( (

View File

@ -47,7 +47,7 @@ Foam::vtkMesh::vtkMesh
subsetter_(baseMesh), subsetter_(baseMesh),
setName_(setName) setName_(setName)
{ {
if (setName.size() > 0) if (setName.size())
{ {
// Read cellSet using whole mesh // Read cellSet using whole mesh
cellSet currentSet(baseMesh_, setName_); cellSet currentSet(baseMesh_, setName_);
@ -71,7 +71,7 @@ Foam::polyMesh::readUpdateState Foam::vtkMesh::readUpdate()
topoPtr_.clear(); topoPtr_.clear();
if (setName_.size() > 0) if (setName_.size())
{ {
Info<< "Subsetting mesh based on cellSet " << setName_ << endl; Info<< "Subsetting mesh based on cellSet " << setName_ << endl;

View File

@ -105,13 +105,13 @@ public:
//- Check if running subMesh //- Check if running subMesh
bool useSubMesh() const bool useSubMesh() const
{ {
return setName_.size() > 0; return setName_.size();
} }
//- topology //- topology
const vtkTopo& topo() const const vtkTopo& topo() const
{ {
if (!topoPtr_.valid()) if (topoPtr_.empty())
{ {
topoPtr_.reset(new vtkTopo(mesh())); topoPtr_.reset(new vtkTopo(mesh()));
} }

View File

@ -154,6 +154,11 @@ class vtkPV3Foam
return size_; return size_;
} }
bool empty() const
{
return (size_ == 0);
}
void reset() void reset()
{ {
start_ = -1; start_ = -1;

View File

@ -147,14 +147,14 @@ int USERD_set_filenames
bool lagrangianNamesFound = false; bool lagrangianNamesFound = false;
label n = 0; label n = 0;
while ((!lagrangianNamesFound) && (n<Num_time_steps)) while (!lagrangianNamesFound && n < Num_time_steps)
{ {
runTime.setTime(TimeList[n+1], n+1); runTime.setTime(TimeList[n+1], n+1);
Cloud<passiveParticle> lagrangian(*meshPtr); Cloud<passiveParticle> lagrangian(*meshPtr);
n++; n++;
if (lagrangian.size()>0) if (lagrangian.size())
{ {
lagrangianNamesFound = true; lagrangianNamesFound = true;
} }

View File

@ -4,7 +4,6 @@ nVar -= Num_variables - nSprayVariables;
if (nVar >= 0) if (nVar >= 0)
{ {
word name = lagrangianScalarNames[nVar]; word name = lagrangianScalarNames[nVar];
IOField<scalar> s IOField<scalar> s
@ -20,15 +19,9 @@ if (nVar >= 0)
) )
); );
if (s.size() != 0) if (s.size())
{ {
for (label n = 0; n < s.size(); n++)
for
(
label n = 0;
n < s.size();
n++
)
{ {
var_array[n+1] = s[n]; var_array[n+1] = s[n];
} }
@ -36,7 +29,7 @@ if (nVar >= 0)
} }
else else
{ {
//Info << "getLagrangianScalar: nVar = " << nVar << endl; // Info << "getLagrangianScalar: nVar = " << nVar << endl;
return Z_UNDEF; return Z_UNDEF;
} }

View File

@ -21,16 +21,10 @@ if (nVar >= 0)
) )
); );
if (v.size() != 0) if (v.size())
{ {
for for (label n = 0; n < v.size(); n++)
(
label n = 0;
n < v.size();
n++
)
{ {
if (component == 0) if (component == 0)
{ {
var_array[n+1] = v[n].x(); var_array[n+1] = v[n].x();

View File

@ -235,7 +235,7 @@ static void createFieldNames
HashSet<word> surfScalarHash; HashSet<word> surfScalarHash;
HashSet<word> surfVectorHash; HashSet<word> surfVectorHash;
if (setName.size() == 0) if (setName.empty())
{ {
forAll(Times, timeI) forAll(Times, timeI)
{ {
@ -536,13 +536,12 @@ void user_query_file_function
fileName caseName(rootAndCase.name()); fileName caseName(rootAndCase.name());
// handle trailing '/' // handle trailing '/'
if (caseName.size() == 0) if (caseName.empty())
{ {
caseName = rootDir.name(); caseName = rootDir.name();
rootDir = rootDir.path(); rootDir = rootDir.path();
} }
Info<< "rootDir : " << rootDir << endl Info<< "rootDir : " << rootDir << endl
<< "caseName : " << caseName << endl << "caseName : " << caseName << endl
<< "setName : " << setName << endl; << "setName : " << setName << endl;

View File

@ -150,7 +150,7 @@ const Foam::fvMesh& Foam::readerDatabase::mesh() const
<< "No mesh set" << abort(FatalError); << "No mesh set" << abort(FatalError);
} }
if (setName_.size() == 0) if (setName_.empty())
{ {
return *meshPtr_; return *meshPtr_;
} }
@ -265,7 +265,7 @@ void Foam::readerDatabase::loadMesh()
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
); );
if (setName_.size() != 0) if (setName_.size())
{ {
Info<< "Subsetting mesh based on cellSet " << setName_ << endl; Info<< "Subsetting mesh based on cellSet " << setName_ << endl;
@ -294,9 +294,9 @@ Foam::polyMesh::readUpdateState Foam::readerDatabase::setTime
// Update loaded mesh // Update loaded mesh
meshChange = meshPtr_->readUpdate(); meshChange = meshPtr_->readUpdate();
if ((setName_.size() != 0) && (meshChange != polyMesh::UNCHANGED)) if (setName_.size() && meshChange != polyMesh::UNCHANGED)
{ {
Info<< "Subsetting mesh based on " << setName_ << endl; Info<< "Subsetting mesh based on " << setName_ << endl;
fvMeshSubset& mesh = *meshPtr_; fvMeshSubset& mesh = *meshPtr_;

View File

@ -206,7 +206,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
// Do closer inspection for unmapped particles // Do closer inspection for unmapped particles
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (unmappedSource.size() > 0) if (unmappedSource.size())
{ {
meshSearch targetSearcher(meshTarget, false); meshSearch targetSearcher(meshTarget, false);
@ -237,7 +237,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
Info<< " after additional mesh searching found " Info<< " after additional mesh searching found "
<< targetParcels.size() << " parcels in target mesh." << endl; << targetParcels.size() << " parcels in target mesh." << endl;
if (addParticles.size() > 0) if (addParticles.size())
{ {
IOPosition<passiveParticle>(targetParcels).write(); IOPosition<passiveParticle>(targetParcels).write();

View File

@ -242,9 +242,7 @@ int main(int argc, char *argv[])
} }
} }
illegalFaces.shrink(); if (illegalFaces.size())
if (illegalFaces.size() > 0)
{ {
Pout<< "Surface has " << illegalFaces.size() Pout<< "Surface has " << illegalFaces.size()
<< " illegal triangles." << endl; << " illegal triangles." << endl;
@ -628,7 +626,7 @@ int main(int argc, char *argv[])
triSurfaceSearch querySurf(surf); triSurfaceSearch querySurf(surf);
surfaceIntersection inter(querySurf); surfaceIntersection inter(querySurf);
if ((inter.cutEdges().size() == 0) && (inter.cutPoints().size() == 0)) if (inter.cutEdges().empty() && inter.cutPoints().empty())
{ {
Pout<< "Surface is not self-intersecting" << endl; Pout<< "Surface is not self-intersecting" << endl;
} }

View File

@ -860,7 +860,7 @@ label collapseBase(triSurface& surf, const scalar minLen)
splitWeights splitWeights
); );
if (splitVerts.size() > 0) if (splitVerts.size())
{ {
// Split edge using splitVerts. All non-collapsed triangles // Split edge using splitVerts. All non-collapsed triangles
// using edge will get split. // using edge will get split.

View File

@ -49,9 +49,9 @@ void readNASEdges
edgeList& allEdges edgeList& allEdges
) )
{ {
IFstream OBJfile(inFileName); IFstream is(inFileName);
if (!OBJfile.good()) if (!is.good())
{ {
FatalErrorIn("readNASEdges") FatalErrorIn("readNASEdges")
<< "Cannot read file " << inFileName << "Cannot read file " << inFileName
@ -68,14 +68,14 @@ void readNASEdges
DynamicList<label> edgeIndices; DynamicList<label> edgeIndices;
while (OBJfile.good()) while (is.good())
{ {
string line; string line;
OBJfile.getLine(line); is.getLine(line);
if (line.size() > 0 && line[0] == '$') if (line.empty() || line[0] == '$')
{ {
// Skip comment // Skip empty and comment
continue; continue;
} }
@ -87,9 +87,9 @@ void readNASEdges
while (true) while (true)
{ {
string buf; string buf;
OBJfile.getLine(buf); is.getLine(buf);
if (buf.size() > 72 && buf[72]=='+') if (buf.size() > 72 && buf[72] == '+')
{ {
line += buf.substr(8, 64); line += buf.substr(8, 64);
} }

View File

@ -64,7 +64,7 @@ int main(int argc, char *argv[])
word patchName = pp.name(); word patchName = pp.name();
if (patchName.size() == 0) if (patchName.empty())
{ {
patchName = "patch" + Foam::name(patchI); patchName = "patch" + Foam::name(patchI);
} }

View File

@ -86,7 +86,7 @@ int main(int argc, char *argv[])
meshSubsetDict.lookup("zone") meshSubsetDict.lookup("zone")
); );
if ((markedZone.size() != 0) && (markedZone.size() != 2)) if (markedZone.size() && markedZone.size() != 2)
{ {
FatalErrorIn(args.executable()) FatalErrorIn(args.executable())
<< "zone specification should be two points, min and max of " << "zone specification should be two points, min and max of "
@ -115,7 +115,7 @@ int main(int argc, char *argv[])
// pick up faces connected to "localPoints" // pick up faces connected to "localPoints"
// //
if (markedPoints.size() > 0) if (markedPoints.size())
{ {
Info << "Found " << markedPoints.size() << " marked point(s)." << endl; Info << "Found " << markedPoints.size() << " marked point(s)." << endl;
@ -153,7 +153,7 @@ int main(int argc, char *argv[])
// pick up faces connected to "edges" // pick up faces connected to "edges"
// //
if (markedEdges.size() > 0) if (markedEdges.size())
{ {
Info << "Found " << markedEdges.size() << " marked edge(s)." << endl; Info << "Found " << markedEdges.size() << " marked edge(s)." << endl;
@ -293,7 +293,7 @@ int main(int argc, char *argv[])
// Number of additional faces picked up because of addFaceNeighbours // Number of additional faces picked up because of addFaceNeighbours
label nFaceNeighbours = 0; label nFaceNeighbours = 0;
if (markedFaces.size() > 0) if (markedFaces.size())
{ {
Info << "Found " << markedFaces.size() << " marked face(s)." << endl; Info << "Found " << markedFaces.size() << " marked face(s)." << endl;

View File

@ -63,7 +63,7 @@ int main(int argc, char *argv[])
Info<< "Writing surf to " << outFileName << " ..." << endl; Info<< "Writing surf to " << outFileName << " ..." << endl;
if (args.options().size() == 0) if (args.options().empty())
{ {
FatalErrorIn(args.executable()) FatalErrorIn(args.executable())
<< "No options supplied, please use one or more of " << "No options supplied, please use one or more of "

View File

@ -35,7 +35,7 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
if [ "$1" = "-h" -o "$1" = "-help" -o "$#" -ne 2 ] if [ "$1" = "-h" -o "$1" = "-help" -o "$#" -ne 2 ]
then then
cat <<USAGE 1>&2 cat <<USAGE 1>&2
Usage: ${0##*/} srcDir dstDir Usage: ${0##*/} srcDir dstDir
Copy OpenFOAM settings from one case to another, without copying Copy OpenFOAM settings from one case to another, without copying
@ -46,30 +46,23 @@ USAGE
exit 1 exit 1
fi fi
srcDir=$1 srcDir=${1%/}
dstDir=$2 dstDir=${2%/}
if [ ! -d $srcDir ] for i in $srcDir $dstDir
then do
echo "Error: directory '$srcDir' does not exist" [ -d "$i" ] || { echo "Error: directory '$i' does not exist"; exit 1; }
exit 1 done
fi
if [ ! -d $dstDir ]
then
echo "Error: directory '$dstDir' does not exist"
exit 1
fi
# check that the srcDir looks okay # check that the srcDir looks okay
for i in $srcDir/constant $srcDir/system for i in $srcDir/constant $srcDir/system
do do
if [ ! -d $i ] if [ ! -d "$i" ]
then then
echo "Error: no '${i##*/}' directory in '$srcDir'" echo "Error: no '${i##*/}' directory in '$srcDir'"
echo " does not appear to be an OpenFOAM case" echo " does not appear to be an OpenFOAM case"
exit 1 exit 1
fi fi
done done
# files and directories to copy # files and directories to copy
@ -82,19 +75,19 @@ fileList=$(find -H $srcDir -mindepth 1 -maxdepth 1 -not -name "processor*")
for i in $fileList for i in $fileList
do do
name="${i##*/}" name="${i##*/}"
# skip numerical (results) directories (except 0) # skip numerical (results) directories (except 0)
# and things that look like queuing system output or log files # and things that look like log files or queuing system output
case "$name" in case "$name" in
[1-9] | [0-9]?* | foam.[eo][1-9]* | log | *.log ) [1-9] | [0-9]?* | log | *.log | foam.[eo][1-9]* )
echo "$i [skipped]" echo "$i [skipped]"
continue continue
;; ;;
*) *)
echo "$i -> $dstDir/$name" echo "$i -> $dstDir/$name"
rsync --exclude polyMesh --exclude "processor*" -a $i $dstDir rsync --exclude polyMesh --exclude "processor*" -a $i $dstDir
;; ;;
esac esac
done done
# --------------------------------------------------------------- end-of-file # --------------------------------------------------------------- end-of-file

View File

@ -54,9 +54,9 @@ setenv ParaView_DIR $ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
if ( -r $paraviewPython ) then if ( -r $paraviewPython ) then
if ($?PYTHONPATH) then if ($?PYTHONPATH) then
setenv PYTHONPATH ${PYTHONPATH}:$paraviewPython:$ParaView_DIR/lib/${paraviewMajor} setenv PYTHONPATH ${PYTHONPATH}:${paraviewPython}:$ParaView_DIR/lib/${paraviewMajor}
else else
setenv PYTHONPATH $paraviewPython:$ParaView_DIR/lib/${paraviewMajor} setenv PYTHONPATH ${paraviewPython}:$ParaView_DIR/lib/${paraviewMajor}
endif endif
endif endif

View File

@ -36,9 +36,10 @@ export WM_PROJECT=OpenFOAM
# export WM_PROJECT_VERSION=1.5.x # export WM_PROJECT_VERSION=1.5.x
: ${WM_PROJECT_VERSION:=dev}; export WM_PROJECT_VERSION : ${WM_PROJECT_VERSION:=dev}; export WM_PROJECT_VERSION
################################################################################
#!!User: # USER EDITABLE PART
# either set $FOAM_INST_DIR before sourcing this file or set #
# either set $FOAM_INST_DIR before sourcing this file or set
# $foamInstall below to where OpenFOAM is installed # $foamInstall below to where OpenFOAM is installed
# #
# Location of FOAM installation # Location of FOAM installation
@ -47,9 +48,22 @@ foamInstall=$HOME/$WM_PROJECT
# foamInstall=~$WM_PROJECT # foamInstall=~$WM_PROJECT
# foamInstall=/usr/local/$WM_PROJECT # foamInstall=/usr/local/$WM_PROJECT
# foamInstall=/opt/$WM_PROJECT # foamInstall=/opt/$WM_PROJECT
#
# END OF (NORMAL) USER EDITABLE PART
################################################################################
# note the location for later use (eg, in job scripts)
: ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR : ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR
# The old dirs to be cleaned from the various environment variables
# - remove anything under top-level directory.
# NB: the WM_PROJECT_INST_DIR might not be identical between versions
foamOldDirs="$FOAM_INST_DIR $HOME/$WM_PROJECT/$USER"
if [ "$WM_PROJECT_INST_DIR" != "$FOAM_INST_DIR" ]
then
foamOldDirs="$WM_PROJECT_INST_DIR $foamOldDirs"
fi
# Location of site/user files # Location of site/user files
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -169,21 +183,18 @@ USAGE
esac esac
# Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH) # Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath
# Remove anything under top-level foam directory #- Clean PATH
wildCards="$WM_PROJECT_INST_DIR $HOME/$WM_PROJECT/$USER" cleanEnv=`$cleanProg "$PATH" "$foamOldDirs"` && PATH="$cleanEnv"
#- Clean path/PATH
cleanPath=`$cleanProg "$PATH" "$wildCards"` && PATH="$cleanPath"
#- Clean LD_LIBRARY_PATH #- Clean LD_LIBRARY_PATH
cleanPath=`$cleanProg "$LD_LIBRARY_PATH" "$wildCards"` && LD_LIBRARY_PATH="$cleanPath" cleanEnv=`$cleanProg "$LD_LIBRARY_PATH" "$foamOldDirs"` && LD_LIBRARY_PATH="$cleanEnv"
#- Clean MANPATH #- Clean MANPATH
cleanPath=`$cleanProg "$MANPATH" "$wildCards"` && MANPATH="$cleanPath" cleanEnv=`$cleanProg "$MANPATH" "$foamCleanDirs"` && MANPATH="$cleanEnv"
export PATH LD_LIBRARY_PATH MANPATH export PATH LD_LIBRARY_PATH MANPATH
@ -212,29 +223,30 @@ _foamSource $WM_PROJECT_DIR/etc/apps/ensight/bashrc
_foamSource $WM_PROJECT_DIR/etc/apps/cint/bashrc _foamSource $WM_PROJECT_DIR/etc/apps/cint/bashrc
# Again clean environment (path, PATH, MANPATH, LD_LIBRARY_PATH) # Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#- Clean path/PATH. Only remove duplicates #- Clean PATH
cleanPath=`$cleanProg "$PATH"` && PATH="$cleanPath" cleanEnv=`$cleanProg "$PATH"` && PATH="$cleanEnv"
#- Clean LD_LIBRARY_PATH #- Clean LD_LIBRARY_PATH
cleanPath=`$cleanProg "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleanPath" cleanEnv=`$cleanProg "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleanEnv"
#- Clean MANPATH #- Clean MANPATH
cleanPath=`$cleanProg "$MANPATH"` && MANPATH="$cleanPath" cleanEnv=`$cleanProg "$MANPATH"` && MANPATH="$cleanEnv"
export PATH LD_LIBRARY_PATH MANPATH export PATH LD_LIBRARY_PATH MANPATH
#- Clean LD_PRELOAD #- Clean LD_PRELOAD
if [ "$LD_PRELOAD" != "" ]; then if [ "$LD_PRELOAD" != "" ]
cleanPath=`$cleanProg "$LD_PRELOAD"` && LD_PRELOAD="$cleanPath" then
cleanEnv=`$cleanProg "$LD_PRELOAD"` && LD_PRELOAD="$cleanEnv"
export LD_PRELOAD export LD_PRELOAD
fi fi
# cleanup environment: # cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~
unset cleanPath cleanProg foamInstall unset cleanEnv cleanProg foamInstall foamOldDirs
unset _foamSource unset _foamSource
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -688,7 +688,6 @@ DebugSwitches
steadyState 0; steadyState 0;
stl 0; stl 0;
stochasticDispersionRAS 0; stochasticDispersionRAS 0;
string 0;
supersonicFreestream 0; supersonicFreestream 0;
surfaceFeatures 0; surfaceFeatures 0;
surfaceInterpolation 0; surfaceInterpolation 0;

View File

@ -35,7 +35,9 @@ setenv WM_PROJECT OpenFOAM
# setenv WM_PROJECT_VERSION 1.5.x # setenv WM_PROJECT_VERSION 1.5.x
if ( ! $?WM_PROJECT_VERSION ) setenv WM_PROJECT_VERSION dev if ( ! $?WM_PROJECT_VERSION ) setenv WM_PROJECT_VERSION dev
#!!User: ################################################################################
# USER EDITABLE PART
#
# either setenv FOAM_INST_DIR before sourcing this file or set # either setenv FOAM_INST_DIR before sourcing this file or set
# foamInstall below to where OpenFOAM is installed # foamInstall below to where OpenFOAM is installed
# #
@ -45,9 +47,17 @@ set foamInstall = $HOME/$WM_PROJECT
# set foamInstall = ~$WM_PROJECT # set foamInstall = ~$WM_PROJECT
# set foamInstall = /usr/local/$WM_PROJECT # set foamInstall = /usr/local/$WM_PROJECT
# set foamInstall = /opt/$WM_PROJECT # set foamInstall = /opt/$WM_PROJECT
#
# END OF (NORMAL) USER EDITABLE PART
################################################################################
# note the location for later use (eg, in job scripts)
if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall
# The old dirs to be cleaned from the various environment variables
# - remove anything under top-level directory.
# NB: the WM_PROJECT_INST_DIR might not be identical between versions
set foamOldDirs="$FOAM_INST_DIR $HOME/$WM_PROJECT/$LOGNAME"
# Location of site/user files # Location of site/user files
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -165,8 +175,8 @@ default:
endsw endsw
# Clean standard environment variables (path, PATH, MANPATH, LD_LIBRARY_PATH) # Clean standard environment variables (path/PATH, LD_LIBRARY_PATH, MANPATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath set cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath
if (! $?LD_LIBRARY_PATH ) then if (! $?LD_LIBRARY_PATH ) then
@ -176,21 +186,18 @@ if (! $?MANPATH) then
setenv MANPATH '' setenv MANPATH ''
endif endif
# Remove anything under top-level foam directory
set wildCards="$WM_PROJECT_INST_DIR $HOME/$WM_PROJECT/$LOGNAME"
#- Clean path/PATH #- Clean path/PATH
set colonPath=`echo "$path" | sed -e 's/ /:/g'` set colonPath=`echo "$path" | sed -e 's/ /:/g'`
set PATH=`$cleanProg "$colonPath" "$wildCards"` set cleanEnv=`$cleanProg "$colonPath" "$foamOldDirs"`
if ( $status == 0 ) then if ( $status == 0 ) then
set path=`echo "$PATH" | sed -e 's/:/ /g'` set path=`echo "$cleanEnv" | sed -e 's/:/ /g'`
endif endif
#- Clean LD_LIBRARY_PATH #- Clean LD_LIBRARY_PATH
setenv LD_LIBRARY_PATH `$cleanProg "$LD_LIBRARY_PATH" "$wildCards"` setenv LD_LIBRARY_PATH `$cleanProg "$LD_LIBRARY_PATH" "$foamOldDirs"`
#- Clean MANPATH #- Clean MANPATH
setenv MANPATH `$cleanProg "$MANPATH" "$wildCards"` setenv MANPATH `$cleanProg "$MANPATH" "$foamOldDirs"`
# Source project setup files # Source project setup files
@ -205,15 +212,16 @@ _foamSource $WM_PROJECT_DIR/etc/aliases.csh
# _foamSource $WM_PROJECT_DIR/etc/apps/paraview/cshrc # _foamSource $WM_PROJECT_DIR/etc/apps/paraview/cshrc
_foamSource $WM_PROJECT_DIR/etc/apps/paraview3/cshrc _foamSource $WM_PROJECT_DIR/etc/apps/paraview3/cshrc
# _foamSource $WM_PROJECT_DIR/etc/apps/ensight/cshrc # _foamSource $WM_PROJECT_DIR/etc/apps/ensight/cshrc
# _foamSource $WM_PROJECT_DIR/etc/apps/cint/cshrc
# Again clean environment (path, PATH, MANPATH, LD_LIBRARY_PATH) # Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#- Clean path/PATH. Only remove duplicates #- Clean path/PATH
set colonPath=`echo "$path" | sed -e 's/ /:/g'` set colonPath=`echo "$path" | sed -e 's/ /:/g'`
set PATH=`$cleanProg "$colonPath"` set cleanEnv=`$cleanProg "$colonPath"`
if ( $status == 0 ) then if ( $status == 0 ) then
set path=`echo "$PATH" | sed -e 's/:/ /g'` set path=`echo "$cleanEnv" | sed -e 's/:/ /g'`
endif endif
#- Clean LD_LIBRARY_PATH #- Clean LD_LIBRARY_PATH
@ -229,8 +237,7 @@ endif
# cleanup environment: # cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~
unset cleanProg unset cleanEnv cleanProg colonPath foamInstall foamOldDirs
unset wildCards
unset colonPath
unalias _foamSource unalias _foamSource
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
set -x set -x
# update Foam::FOAMversion string if required # update OpenFOAM version strings if required
wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null
wmakeLnInclude -f OpenFOAM wmakeLnInclude -f OpenFOAM

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description Description
UNIX versions of the functions declated in OSspecific.H. UNIX versions of the functions declared in OSspecific.H.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -284,7 +284,7 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
bool Foam::mkDir(const fileName& pathName, mode_t mode) bool Foam::mkDir(const fileName& pathName, mode_t mode)
{ {
// empty names are meaningless // empty names are meaningless
if (!pathName.size()) if (pathName.empty())
{ {
return false; return false;
} }
@ -491,7 +491,7 @@ bool Foam::dir(const fileName& name)
// Return size of file // Return size of file
off_t Foam::size(const fileName& name) off_t Foam::fileSize(const fileName& name)
{ {
fileStat fileStatus(name); fileStat fileStatus(name);
if (fileStatus.isValid()) if (fileStatus.isValid())
@ -541,7 +541,7 @@ Foam::fileNameList Foam::readDir
// Setup empty string list MAXTVALUES long // Setup empty string list MAXTVALUES long
fileNameList dirEntries(maxNnames); fileNameList dirEntries(maxNnames);
// Pointers to the Unix director system // Pointers to the directory entries
DIR *source; DIR *source;
struct dirent *list; struct dirent *list;
@ -567,10 +567,10 @@ Foam::fileNameList Foam::readDir
{ {
fileName fName(list->d_name); fileName fName(list->d_name);
// ignore files begining with ., i.e. ., .. and .??* // ignore files begining with ., i.e. '.', '..' and '.*'
if (fName.size() > 0 && fName[size_t(0)] != '.') if (fName.size() && fName[0] != '.')
{ {
word fileNameExt = fName.ext(); word fExt = fName.ext();
if if
( (
@ -578,11 +578,11 @@ Foam::fileNameList Foam::readDir
|| ||
( (
type == fileName::FILE type == fileName::FILE
&& fName[fName.size()-1] != '~' && fName[fName.size()-1] != '~'
&& fileNameExt != "bak" && fExt != "bak"
&& fileNameExt != "BAK" && fExt != "BAK"
&& fileNameExt != "old" && fExt != "old"
&& fileNameExt != "save" && fExt != "save"
) )
) )
{ {
@ -593,7 +593,7 @@ Foam::fileNameList Foam::readDir
dirEntries.setSize(dirEntries.size() + maxNnames); dirEntries.setSize(dirEntries.size() + maxNnames);
} }
if (filtergz && fileNameExt == "gz") if (filtergz && fExt == "gz")
{ {
dirEntries[nEntries++] = fName.lessExt(); 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) bool Foam::cp(const fileName& src, const fileName& dest)
{ {
fileName destFile(dest);
// Make sure source exists. // Make sure source exists.
if (!exists(src)) if (!exists(src))
{ {
return false; return false;
} }
fileName destFile(dest);
// Check type of source file. // Check type of source file.
if (src.type() == fileName::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); 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)) if (!dir(destFile) && !mkDir(destFile))
{ {
return false; return false;
@ -806,7 +806,7 @@ bool Foam::rmDir(const fileName& directory)
<< "removing directory " << directory << endl; << "removing directory " << directory << endl;
} }
// Pointers to the Unix director system // Pointers to the directory entries
DIR *source; DIR *source;
struct dirent *list; struct dirent *list;

View File

@ -149,7 +149,7 @@ void getSymbolForRaw
const word& address const word& address
) )
{ {
if (filename.size() > 0 && filename[0] == '/') if (filename.size() && filename[0] == '/')
{ {
string fcnt = pOpen string fcnt = pOpen
( (
@ -189,7 +189,7 @@ void error::printStack(Ostream& os)
string::size_type space = line.rfind(' ') + 1; string::size_type space = line.rfind(' ') + 1;
fileName libPath = line.substr(space, line.size()-space); 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('-'))); string offsetString(line.substr(0, line.find('-')));
IStringStream offsetStr(offsetString); IStringStream offsetStr(offsetString);
@ -217,7 +217,7 @@ void error::printStack(Ostream& os)
string::size_type lPos = msg.find('['); string::size_type lPos = msg.find('[');
string::size_type rPos = msg.find(']'); string::size_type rPos = msg.find(']');
if (lPos != string::npos && rPos != string::npos && lPos<rPos) if (lPos != string::npos && rPos != string::npos && lPos < rPos)
{ {
address = msg.substr(lPos+1, rPos-lPos-1); address = msg.substr(lPos+1, rPos-lPos-1);
msg = msg.substr(0, lPos); msg = msg.substr(0, lPos);
@ -232,7 +232,7 @@ void error::printStack(Ostream& os)
// not an absolute path // not an absolute path
if (programFile[0] != '/') if (programFile[0] != '/')
{ {
string tmp = pOpen("which "+programFile); string tmp = pOpen("which " + programFile);
if (tmp[0] == '/' || tmp[0] == '~') if (tmp[0] == '/' || tmp[0] == '~')
{ {
programFile = tmp; programFile = tmp;
@ -243,13 +243,13 @@ void error::printStack(Ostream& os)
string::size_type bracketPos = msg.find('('); string::size_type bracketPos = msg.find('(');
if (bracketPos != string::size_type(string::npos)) if (bracketPos != string::npos)
{ {
string::size_type start = bracketPos+1; string::size_type start = bracketPos+1;
string::size_type plusPos = msg.find('+', start); string::size_type plusPos = msg.find('+', start);
if (plusPos != string::size_type(string::npos)) if (plusPos != string::npos)
{ {
string cName(msg.substr(start, plusPos-start)); string cName(msg.substr(start, plusPos-start));
@ -276,7 +276,7 @@ void error::printStack(Ostream& os)
{ {
string::size_type endBracketPos = msg.find(')', start); string::size_type endBracketPos = msg.find(')', start);
if (endBracketPos != string::size_type(string::npos)) if (endBracketPos != string::npos)
{ {
string fullName(msg.substr(start, endBracketPos-start)); string fullName(msg.substr(start, endBracketPos-start));

View File

@ -14,6 +14,7 @@ primitives/long/longIO.C
primitives/longLong/longLongIO.C primitives/longLong/longLongIO.C
primitives/ulong/ulongIO.C primitives/ulong/ulongIO.C
primitives/label/label.C primitives/label/label.C
primitives/uLabel/uLabel.C
primitives/Scalar/doubleScalar/doubleScalar.C primitives/Scalar/doubleScalar/doubleScalar.C
primitives/Scalar/floatScalar/floatScalar.C primitives/Scalar/floatScalar/floatScalar.C
primitives/Scalar/scalar/scalar.C primitives/Scalar/scalar/scalar.C

View File

@ -51,21 +51,15 @@ class Ostream;
template<class T, class Key, class Hash> class HashPtrTable; template<class T, class Key, class Hash> class HashPtrTable;
template<class T, class Key, class Hash> Istream& operator>> template<class T, class Key, class Hash>
( Istream& operator>>(Istream&, HashPtrTable<T, Key, Hash>&);
Istream&,
HashPtrTable<T, Key, Hash>&
);
template<class T, class Key, class Hash> Ostream& operator<< template<class T, class Key, class Hash>
( Ostream& operator<<(Ostream&, const HashPtrTable<T, Key, Hash>&);
Ostream&,
const HashPtrTable<T, Key, Hash>&
);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class HashPtrTable Declaration Class HashPtrTable Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class T, class Key=word, class Hash=string::hash> template<class T, class Key=word, class Hash=string::hash>

View File

@ -32,19 +32,19 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Key, class Hash> template<class Key, class Hash>
template<class T> template<class AnyType>
Foam::HashSet<Key, Hash>::HashSet(const HashTable<T, Key, Hash>& ht) Foam::HashSet<Key, Hash>::HashSet(const HashTable<AnyType, Key, Hash>& ht)
: :
HashTable<empty, Key, Hash>(ht.size()) HashTable<nil, Key, Hash>(ht.size())
{ {
for for
( (
typename HashTable<T, Key, Hash>::const_iterator iter = ht.begin(); typename HashTable<AnyType, Key, Hash>::const_iterator cit = ht.begin();
iter != ht.end(); cit != ht.end();
++iter ++cit
) )
{ {
insert(iter.key()); insert(cit.key());
} }
} }
@ -126,6 +126,7 @@ void Foam::HashSet<Key, Hash>::operator^=(const HashSet<Key, Hash>& rhs)
} }
// same as HashTable::erase()
template<class Key, class Hash> template<class Key, class Hash>
void Foam::HashSet<Key, Hash>::operator-=(const HashSet<Key, Hash>& rhs) void Foam::HashSet<Key, Hash>::operator-=(const HashSet<Key, Hash>& rhs)
{ {

View File

@ -46,7 +46,7 @@ Description
#define HashSet_H #define HashSet_H
#include "HashTable.H" #include "HashTable.H"
#include "empty.H" #include "nil.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,13 +60,13 @@ namespace Foam
template<class Key=word, class Hash=string::hash> template<class Key=word, class Hash=string::hash>
class HashSet class HashSet
: :
public HashTable<empty, Key, Hash> public HashTable<nil, Key, Hash>
{ {
public: public:
typedef typename HashTable<empty, Key, Hash>::iterator iterator; typedef typename HashTable<nil, Key, Hash>::iterator iterator;
typedef typename HashTable<empty, Key, Hash>::const_iterator const_iterator; typedef typename HashTable<nil, Key, Hash>::const_iterator const_iterator;
// Constructors // Constructors
@ -74,19 +74,19 @@ public:
//- Construct given initial size //- Construct given initial size
HashSet(label size = 100) HashSet(label size = 100)
: :
HashTable<empty, Key, Hash>(size) HashTable<nil, Key, Hash>(size)
{} {}
//- Construct from Istream //- Construct from Istream
HashSet(Istream& is) HashSet(Istream& is)
: :
HashTable<empty, Key, Hash>(is) HashTable<nil, Key, Hash>(is)
{} {}
//- Construct from UList of Key //- Construct from UList of Key
HashSet(const UList<Key>& lst) HashSet(const UList<Key>& lst)
: :
HashTable<empty, Key, Hash>(2*lst.size()) HashTable<nil, Key, Hash>(2*lst.size())
{ {
forAll(lst, i) forAll(lst, i)
{ {
@ -97,24 +97,25 @@ public:
//- Construct as copy //- Construct as copy
HashSet(const HashSet<Key, Hash>& hs) HashSet(const HashSet<Key, Hash>& hs)
: :
HashTable<empty, Key, Hash>(hs) HashTable<nil, Key, Hash>(hs)
{} {}
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
HashSet(const Xfer<HashSet<Key, Hash> >& hs) HashSet(const Xfer<HashSet<Key, Hash> >& hs)
: :
HashTable<empty, Key, Hash>(hs) HashTable<nil, Key, Hash>(hs)
{} {}
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
HashSet(const Xfer<HashTable<empty, Key, Hash> >& hs) HashSet(const Xfer<HashTable<nil, Key, Hash> >& hs)
: :
HashTable<empty, Key, Hash>(hs) HashTable<nil, Key, Hash>(hs)
{} {}
//- Construct from table of contents of the HashTable //- Construct from the keys of another HashTable,
template<class T> // the type of values held is arbitrary.
HashSet(const HashTable<T, Key, Hash>& ht); template<class AnyType>
HashSet(const HashTable<AnyType, Key, Hash>&);
// Member Functions // Member Functions
@ -123,13 +124,13 @@ public:
//- Insert a new entry //- Insert a new entry
bool insert(const Key& key) bool insert(const Key& key)
{ {
return HashTable<empty, Key, Hash>::insert(key, empty()); return HashTable<nil, Key, Hash>::insert(key, nil());
} }
//- Same as insert (cannot overwrite empty content) //- Same as insert (cannot overwrite nil content)
bool set(const Key& key) bool set(const Key& key)
{ {
return HashTable<empty, Key, Hash>::insert(key, empty()); return HashTable<nil, Key, Hash>::insert(key, nil());
} }

View File

@ -388,11 +388,11 @@ bool Foam::HashTable<T, Key, Hash>::erase(const iterator& cit)
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
bool Foam::HashTable<T, Key, Hash>::erase(const Key& key) bool Foam::HashTable<T, Key, Hash>::erase(const Key& key)
{ {
iterator it = find(key); iterator fnd = find(key);
if (it != end()) if (fnd != end())
{ {
return erase(it); return erase(fnd);
} }
else else
{ {
@ -401,6 +401,53 @@ bool Foam::HashTable<T, Key, Hash>::erase(const Key& key)
} }
template<class T, class Key, class Hash>
Foam::label Foam::HashTable<T, Key, Hash>::erase(const UList<Key>& keys)
{
label count = 0;
// Remove listed keys from this table
if (this->size())
{
forAll(keys, keyI)
{
if (erase(keys[keyI]))
{
count++;
}
}
}
return count;
}
template<class T, class Key, class Hash>
template<class AnyType>
Foam::label Foam::HashTable<T, Key, Hash>::erase
(
const HashTable<AnyType, Key, Hash>& rhs
)
{
label count = 0;
// Remove rhs elements from this table
if (this->size())
{
// NOTE: could further optimize depending on which hash is smaller
for (iterator iter = begin(); iter != end(); ++iter)
{
if (rhs.found(iter.key()) && erase(iter))
{
count++;
}
}
}
return count;
}
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
void Foam::HashTable<T, Key, Hash>::resize(const label newSize) void Foam::HashTable<T, Key, Hash>::resize(const label newSize)
{ {

View File

@ -51,20 +51,15 @@ namespace Foam
// Forward declaration of friend functions and operators // Forward declaration of friend functions and operators
template<class T> class List; template<class T> class List;
template<class T> class UList;
template<class T, class Key, class Hash> class HashTable; template<class T, class Key, class Hash> class HashTable;
template<class T, class Key, class Hash> class HashPtrTable; template<class T, class Key, class Hash> class HashPtrTable;
template<class T, class Key, class Hash> Istream& operator>> template<class T, class Key, class Hash>
( Istream& operator>>(Istream&, HashTable<T, Key, Hash>&);
Istream&,
HashTable<T, Key, Hash>&
);
template<class T, class Key, class Hash> Ostream& operator<< template<class T, class Key, class Hash>
( Ostream& operator<<(Ostream&, const HashTable<T, Key, Hash>&);
Ostream&,
const HashTable<T, Key, Hash>&
);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -171,6 +166,9 @@ public:
//- Return number of elements in table. //- Return number of elements in table.
inline label size() const; inline label size() const;
//- Return true if the hash table is empty
inline bool empty() const;
//- Return true if hashedEntry is found in table //- Return true if hashedEntry is found in table
bool found(const Key&) const; bool found(const Key&) const;
@ -200,6 +198,17 @@ public:
//- Erase an hashedEntry specified by given key if in table //- Erase an hashedEntry specified by given key if in table
bool erase(const Key&); bool erase(const Key&);
//- Remove entries given by the listed keys from this HashTable
// Return the number of elements removed
label erase(const UList<Key>&);
//- Remove entries given by the given keys from this HashTable
// Return the number of elements removed.
// The parameter HashTable needs the same type of keys, but
// but the type of values held is arbitrary.
template<class AnyType>
label erase(const HashTable<AnyType, Key, Hash>&);
//- Resize the hash table for efficiency //- Resize the hash table for efficiency
void resize(const label newSize); void resize(const label newSize);

View File

@ -51,6 +51,13 @@ inline Foam::label Foam::HashTable<T, Key, Hash>::size() const
} }
template<class T, class Key, class Hash>
inline bool Foam::HashTable<T, Key, Hash>::empty() const
{
return (nElmts_ == 0);
}
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline bool Foam::HashTable<T, Key, Hash>::insert inline bool Foam::HashTable<T, Key, Hash>::insert
( (

View File

@ -346,6 +346,28 @@ bool Foam::StaticHashTable<T, Key, Hash>::erase(const Key& key)
} }
template<class T, class Key, class Hash>
Foam::label Foam::StaticHashTable<T, Key, Hash>::erase
(
const StaticHashTable<T, Key, Hash>& rhs
)
{
label count = 0;
// Remove rhs elements from this table
// NOTE: could optimize depending on which hash is smaller
for (iterator iter = this->begin(); iter != this->end(); ++iter)
{
if (rhs.found(iter.key()) && erase(iter))
{
count++;
}
}
return count;
}
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
void Foam::StaticHashTable<T, Key, Hash>::resize(const label newSize) void Foam::StaticHashTable<T, Key, Hash>::resize(const label newSize)
{ {
@ -454,8 +476,8 @@ void Foam::StaticHashTable<T, Key, Hash>::operator=
} }
// could be zero-sized from a previous transfer() // keys could be empty from a previous transfer()
if (keys_.size() == 0) if (keys_.empty())
{ {
keys_.setSize(rhs.keys_.size()); keys_.setSize(rhs.keys_.size());
objects_.setSize(keys_.size()); objects_.setSize(keys_.size());

View File

@ -164,6 +164,9 @@ public:
//- Return number of elements in table. //- Return number of elements in table.
inline label size() const; inline label size() const;
//- Return true if the hash table is empty
inline bool empty() const;
//- Return true if hashed entry is found in table //- Return true if hashed entry is found in table
bool found(const Key& key) const; bool found(const Key& key) const;
@ -196,6 +199,10 @@ public:
//- Resize the hash table for efficiency //- Resize the hash table for efficiency
void resize(const label newSize); void resize(const label newSize);
//- Remove entries in the given hash table from this hash table
// Return the number of elements removed
label erase(const StaticHashTable<T, Key, Hash>&);
//- Clear all entries from table //- Clear all entries from table
void clear(); void clear();

View File

@ -38,6 +38,13 @@ inline Foam::label Foam::StaticHashTable<T, Key, Hash>::size() const
} }
template<class T, class Key, class Hash>
inline bool Foam::StaticHashTable<T, Key, Hash>::empty() const
{
return (nElmts_ == 0);
}
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline bool Foam::StaticHashTable<T, Key, Hash>::insert inline bool Foam::StaticHashTable<T, Key, Hash>::insert
( (
@ -321,7 +328,7 @@ Foam::StaticHashTable<T, Key, Hash>::begin()
// Find first non-empty entry // Find first non-empty entry
forAll(keys_, hashIdx) forAll(keys_, hashIdx)
{ {
if (keys_[hashIdx].size() > 0) if (keys_[hashIdx].size())
{ {
return iterator(*this, hashIdx, 0); return iterator(*this, hashIdx, 0);
} }
@ -353,7 +360,7 @@ Foam::StaticHashTable<T, Key, Hash>::begin() const
// Find first non-empty entry // Find first non-empty entry
forAll(keys_, hashIdx) forAll(keys_, hashIdx)
{ {
if (keys_[hashIdx].size() > 0) if (keys_[hashIdx].size())
{ {
return const_iterator(*this, hashIdx, 0); return const_iterator(*this, hashIdx, 0);
} }

View File

@ -122,6 +122,9 @@ public:
//- Return number of elements in list //- Return number of elements in list
inline label size() const; inline label size() const;
//- Return true if the list is empty
inline bool empty() const;
//- Return first entry //- Return first entry
inline link* first(); inline link* first();

View File

@ -81,6 +81,12 @@ inline Foam::label Foam::DLListBase::size() const
} }
inline bool Foam::DLListBase::empty() const
{
return (nElmts_ == 0);
}
inline Foam::DLListBase::link* inline Foam::DLListBase::link*
Foam::DLListBase::first() Foam::DLListBase::first()
{ {

View File

@ -119,6 +119,9 @@ public:
//- Return number of elements in list //- Return number of elements in list
inline label size() const; inline label size() const;
//- Return true if the list is empty
inline bool empty() const;
//- Return first entry //- Return first entry
inline link* first(); inline link* first();

View File

@ -71,6 +71,12 @@ inline Foam::label Foam::SLListBase::size() const
} }
inline bool Foam::SLListBase::empty() const
{
return (nElmts_ == 0);
}
inline Foam::SLListBase::link* inline Foam::SLListBase::link*
Foam::SLListBase::first() Foam::SLListBase::first()
{ {

View File

@ -92,15 +92,6 @@ public:
} }
// Check
//- Is the stack empty
bool empty() const
{
return this->size() == 0;
}
// Edit // Edit
//- Push an element onto the stack //- Push an element onto the stack

View File

@ -92,15 +92,6 @@ public:
} }
// Check
//- Is the stack empty
bool empty() const
{
return this->size() == 0;
}
// Edit // Edit
//- Push an element onto the stack //- Push an element onto the stack

View File

@ -75,6 +75,8 @@ public:
// Access // Access
inline label size() const; inline label size() const;
inline bool empty() const;
inline const UList<T>& posList() const; inline const UList<T>& posList() const;
inline const UList<T>& negList() const; inline const UList<T>& negList() const;
inline const List<label>& addressing() const; inline const List<label>& addressing() const;

View File

@ -49,6 +49,13 @@ inline Foam::label Foam::BiIndirectList<T>::size() const
} }
template<class T>
inline bool Foam::BiIndirectList<T>::empty() const
{
return addressing_.empty();
}
template<class T> template<class T>
inline const Foam::UList<T>& Foam::BiIndirectList<T>::posList() const inline const Foam::UList<T>& Foam::BiIndirectList<T>::posList() const
{ {

View File

@ -126,6 +126,9 @@ public:
//- Return the primary size, i.e. the number of rows //- Return the primary size, i.e. the number of rows
inline label size() const; inline label size() const;
//- Return true if the number of rows is zero
inline bool empty() const;
//- Return the offset table //- Return the offset table
inline const List<label>& offsets() const; inline const List<label>& offsets() const;

View File

@ -74,6 +74,13 @@ inline Foam::label Foam::CompactListList<T>::size() const
} }
template<class T>
inline bool Foam::CompactListList<T>::empty() const
{
return offsets_.empty();
}
template<class T> template<class T>
inline const Foam::List<Foam::label>& Foam::CompactListList<T>::offsets() const inline const Foam::List<Foam::label>& Foam::CompactListList<T>::offsets() const
{ {

View File

@ -69,6 +69,8 @@ public:
// Access // Access
inline label size() const; inline label size() const;
inline bool empty() const;
inline const UList<T>& completeList() const; inline const UList<T>& completeList() const;
inline const List<label>& addressing() const; inline const List<label>& addressing() const;

View File

@ -47,6 +47,13 @@ inline Foam::label Foam::IndirectList<T>::size() const
} }
template<class T>
inline bool Foam::IndirectList<T>::empty() const
{
return addressing_.empty();
}
template<class T> template<class T>
inline const Foam::UList<T>& Foam::IndirectList<T>::completeList() const inline const Foam::UList<T>& Foam::IndirectList<T>::completeList() const
{ {

View File

@ -166,6 +166,9 @@ public:
//- Number of packed elements //- Number of packed elements
inline label size() const; inline label size() const;
//- Return true if the list is empty (i.e., if size() == 0).
inline bool empty() const;
//- Get value at index I //- Get value at index I
inline unsigned int get(const label i) const; inline unsigned int get(const label i) const;

View File

@ -117,6 +117,13 @@ inline Foam::label Foam::PackedList<nBits>::size() const
} }
template<int nBits>
inline bool Foam::PackedList<nBits>::empty() const
{
return (size_ == 0);
}
// Get value at i // Get value at i
template<int nBits> template<int nBits>
inline unsigned int Foam::PackedList<nBits>::get(const label i) const inline unsigned int Foam::PackedList<nBits>::get(const label i) const

View File

@ -158,6 +158,9 @@ public:
//- Return the number of elements in the PtrList //- Return the number of elements in the PtrList
inline label size() const; inline label size() const;
//- Return true if the PtrList is empty (i.e., if size() == 0).
inline bool empty() const;
// Edit // Edit

View File

@ -38,6 +38,13 @@ inline Foam::label Foam::PtrList<T>::size() const
} }
template<class T>
inline bool Foam::PtrList<T>::empty() const
{
return ptrs_.empty();
}
template<class T> template<class T>
inline bool Foam::PtrList<T>::set(const label i) const inline bool Foam::PtrList<T>::set(const label i) const
{ {

View File

@ -52,7 +52,7 @@ Foam::IOobjectList::IOobjectList
{ {
newInstance = db.time().findInstancePath(instant(instance)); newInstance = db.time().findInstancePath(instant(instance));
if (!newInstance.size()) if (newInstance.empty())
{ {
return; return;
} }
@ -181,7 +181,7 @@ Foam::wordList Foam::IOobjectList::names() const
{ {
wordList objectNames(size()); wordList objectNames(size());
label count=0; label count = 0;
for for
( (
HashPtrTable<IOobject>::const_iterator iter = begin(); HashPtrTable<IOobject>::const_iterator iter = begin();
@ -200,7 +200,7 @@ Foam::wordList Foam::IOobjectList::names(const word& ClassName) const
{ {
wordList objectNames(size()); wordList objectNames(size());
label count=0; label count = 0;
for for
( (
HashPtrTable<IOobject>::const_iterator iter = begin(); HashPtrTable<IOobject>::const_iterator iter = begin();

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