From 7544164d53956d11a225f3b4613893de8ae7f95a Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 5 Mar 2009 12:06:57 +0100 Subject: [PATCH] regIOobject, Hasher, IOobject tweak - regIOobject: don't re-register an unregister object on rename/assignment - Hasher: split-off HasherInt with uint32_t specializations - IOobject: writeBanner/writeDivider return Stream for easier chaining. ... also dropped some namespace bracketing while I was at it. --- applications/test/Hashing/testHashing.C | 3 +- applications/test/regex/regexTest.C | 3 +- applications/test/wordRe/wordReTest.C | 3 +- src/OpenFOAM/db/Callback/Callback.C | 19 ++-- src/OpenFOAM/db/IOobject/IOobject.C | 5 +- src/OpenFOAM/db/IOobject/IOobject.H | 4 +- src/OpenFOAM/db/IOobject/IOobjectI.H | 8 +- .../db/IOobject/IOobjectWriteHeader.C | 7 +- .../db/IOobjects/IOdictionary/IOdictionary.C | 6 +- src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C | 6 +- src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C | 5 +- .../db/IOstreams/Sstreams/chkStream.C | 14 +-- src/OpenFOAM/db/IOstreams/Sstreams/state.C | 14 +-- .../objectRegistry/objectRegistryTemplates.C | 18 ++-- src/OpenFOAM/db/regIOobject/regIOobject.C | 20 ++--- .../db/regIOobject/regIOobjectWrite.C | 14 +-- src/OpenFOAM/global/argList/argList.C | 6 +- .../meshes/ProcessorTopology/commSchedule.C | 9 +- .../meshes/bandCompression/bandCompression.C | 9 +- src/OpenFOAM/meshes/lduMesh/lduMesh.C | 6 +- .../meshes/meshShapes/cell/cellIOList.C | 2 +- .../meshShapes/cellShape/cellShapeEqual.C | 11 +-- .../meshShapes/face/faceAreaInContact.C | 10 +-- .../meshShapes/face/faceContactSphere.C | 12 +-- .../meshes/meshShapes/face/faceIntersection.C | 17 ++-- .../meshes/meshShapes/tetCell/tetCell.C | 10 +-- .../pointBoundaryMesh/pointBoundaryMesh.C | 20 ++--- .../basic/coupled/coupledPointPatch.C | 13 +-- .../pointPatches/pointPatch/pointPatch.C | 5 +- .../polyMesh/globalMeshData/globalMeshData.C | 5 +- .../polyBoundaryMesh/polyBoundaryMesh.C | 6 +- src/OpenFOAM/meshes/polyMesh/polyMesh.C | 6 +- .../basic/coupled/coupledPolyPatch.C | 5 +- .../meshes/primitiveMesh/primitiveMesh.C | 7 +- .../primitiveMesh/primitiveMeshCellCells.C | 16 +--- .../primitiveMeshCellCentresAndVols.C | 17 +--- .../meshes/primitiveMesh/primitiveMeshCells.C | 15 +--- .../primitiveMeshCheck/primitiveMeshCheck.C | 90 +++++++++---------- .../meshes/primitiveMesh/primitiveMeshClear.C | 18 ++-- .../primitiveMesh/primitiveMeshEdgeCells.C | 14 +-- .../primitiveMesh/primitiveMeshEdgeFaces.C | 15 +--- .../primitiveMeshFaceCentresAndAreas.C | 16 +--- .../primitiveMesh/primitiveMeshFindCell.C | 16 +--- .../primitiveMesh/primitiveMeshPointFaces.C | 10 +-- .../primitiveMesh/primitivePatch/patchZones.C | 27 +++--- .../primitiveShapes/tetrahedron/tetrahedron.C | 35 ++++---- .../primitives/hashes/Hasher/Hasher.C | 5 +- .../primitives/hashes/Hasher/Hasher.H | 28 +----- .../primitives/hashes/Hasher/HasherInt.H | 80 +++++++++++++++++ 49 files changed, 274 insertions(+), 436 deletions(-) create mode 100644 src/OpenFOAM/primitives/hashes/Hasher/HasherInt.H diff --git a/applications/test/Hashing/testHashing.C b/applications/test/Hashing/testHashing.C index 248972558c..00af2b962c 100644 --- a/applications/test/Hashing/testHashing.C +++ b/applications/test/Hashing/testHashing.C @@ -54,8 +54,7 @@ int main(int argc, char *argv[]) const word listType(is); Info<< endl; - IOobject::writeDivider(Info); - Info<< listType << endl; + IOobject::writeDivider(Info) << listType << endl; if (listType == "stringList") { diff --git a/applications/test/regex/regexTest.C b/applications/test/regex/regexTest.C index 040d7bb397..c6e492d151 100644 --- a/applications/test/regex/regexTest.C +++ b/applications/test/regex/regexTest.C @@ -43,8 +43,7 @@ int main(int argc, char *argv[]) List > rawList(IFstream("testRegexps")()); Info<< "input list:" << rawList << endl; - IOobject::writeDivider(Info); - Info<< endl; + IOobject::writeDivider(Info) << endl; List groups; diff --git a/applications/test/wordRe/wordReTest.C b/applications/test/wordRe/wordReTest.C index a63b4aec2e..cad3ed688b 100644 --- a/applications/test/wordRe/wordReTest.C +++ b/applications/test/wordRe/wordReTest.C @@ -86,8 +86,7 @@ int main(int argc, char *argv[]) List > rawList(IFstream("testRegexps")()); Info<< "input list:" << rawList << endl; - IOobject::writeDivider(Info); - Info<< endl; + IOobject::writeDivider(Info) << endl; forAll(rawList, elemI) { diff --git a/src/OpenFOAM/db/Callback/Callback.C b/src/OpenFOAM/db/Callback/Callback.C index e937cc1f0c..dc80a76692 100644 --- a/src/OpenFOAM/db/Callback/Callback.C +++ b/src/OpenFOAM/db/Callback/Callback.C @@ -26,15 +26,10 @@ License #include "Callback.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Callback::Callback(CallbackRegistry& cbr) +Foam::Callback::Callback(CallbackRegistry& cbr) : cbr_(cbr) { @@ -43,7 +38,7 @@ Callback::Callback(CallbackRegistry& cbr) template -Callback::Callback(const Callback& cb) +Foam::Callback::Callback(const Callback& cb) : cbr_(cb.cbr_) { @@ -54,7 +49,7 @@ Callback::Callback(const Callback& cb) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template -Callback::~Callback() +Foam::Callback::~Callback() { checkOut(); } @@ -63,7 +58,7 @@ Callback::~Callback() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -bool Callback::checkIn() +bool Foam::Callback::checkIn() { if (!Callback::link::registered()) { @@ -78,7 +73,7 @@ bool Callback::checkIn() template -bool Callback::checkOut() +bool Foam::Callback::checkOut() { if (Callback::link::registered()) { @@ -100,8 +95,4 @@ bool Callback::checkOut() } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/db/IOobject/IOobject.C b/src/OpenFOAM/db/IOobject/IOobject.C index 0a54089b99..0368b02e2e 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.C +++ b/src/OpenFOAM/db/IOobject/IOobject.C @@ -30,10 +30,7 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(IOobject, 0); -} +defineTypeNameAndDebug(Foam::IOobject, 0); // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/IOobject/IOobject.H b/src/OpenFOAM/db/IOobject/IOobject.H index 5559a2295a..d2fc9a6ba1 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.H +++ b/src/OpenFOAM/db/IOobject/IOobject.H @@ -353,11 +353,11 @@ public: //- Write the standard OpenFOAM file/dictionary banner // Optionally without -*- C++ -*- editor hint (eg, for logs) template - static inline void writeBanner(Stream& os, bool noHint=false); + static inline Stream& writeBanner(Stream& os, bool noHint=false); //- Write the standard file section divider template - static inline void writeDivider(Stream& os); + static inline Stream& writeDivider(Stream& os); //- Write header bool writeHeader(Ostream&) const; diff --git a/src/OpenFOAM/db/IOobject/IOobjectI.H b/src/OpenFOAM/db/IOobject/IOobjectI.H index 2407507c86..71af2039f6 100644 --- a/src/OpenFOAM/db/IOobject/IOobjectI.H +++ b/src/OpenFOAM/db/IOobject/IOobjectI.H @@ -29,7 +29,7 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -inline void Foam::IOobject::writeBanner(Stream& os, bool noHint) +inline Stream& Foam::IOobject::writeBanner(Stream& os, bool noHint) { static bool spacesSet(false); static char spaces[40]; @@ -68,14 +68,18 @@ inline void Foam::IOobject::writeBanner(Stream& os, bool noHint) "| \\\\ / A nd | Web: www.OpenFOAM.org |\n" "| \\\\/ M anipulation | |\n" "\\*---------------------------------------------------------------------------*/\n"; + + return os; } template -inline void Foam::IOobject::writeDivider(Stream& os) +inline Stream& Foam::IOobject::writeDivider(Stream& os) { os << "// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\n"; + + return os; } diff --git a/src/OpenFOAM/db/IOobject/IOobjectWriteHeader.C b/src/OpenFOAM/db/IOobject/IOobjectWriteHeader.C index ff62a38096..8c3d8b9485 100644 --- a/src/OpenFOAM/db/IOobject/IOobjectWriteHeader.C +++ b/src/OpenFOAM/db/IOobject/IOobjectWriteHeader.C @@ -43,8 +43,8 @@ bool Foam::IOobject::writeHeader(Ostream& os) const return false; } - writeBanner(os); - os << "FoamFile\n{\n" + writeBanner(os) + << "FoamFile\n{\n" << " version " << os.version() << ";\n" << " format " << os.format() << ";\n" << " class " << type() << ";\n"; @@ -58,8 +58,7 @@ bool Foam::IOobject::writeHeader(Ostream& os) const << " object " << name() << ";\n" << "}" << nl; - writeDivider(os); - os << endl; + writeDivider(os) << endl; return true; } diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C index a8dc22b3ac..53e001b699 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C @@ -35,10 +35,8 @@ Description // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(IOdictionary, 0); -} +defineTypeNameAndDebug(Foam::IOdictionary, 0); + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C index 83951b3871..68fe61ce2c 100644 --- a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C +++ b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C @@ -30,10 +30,8 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(IFstream, 0); -} +defineTypeNameAndDebug(Foam::IFstream, 0); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C index f65f0eb636..27dc86436b 100644 --- a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C +++ b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C @@ -30,10 +30,7 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(OFstream, 0); -} +defineTypeNameAndDebug(Foam::OFstream, 0); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/chkStream.C b/src/OpenFOAM/db/IOstreams/Sstreams/chkStream.C index 710a887d3a..af8476da9c 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/chkStream.C +++ b/src/OpenFOAM/db/IOstreams/Sstreams/chkStream.C @@ -28,17 +28,11 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" - #include "token.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -bool checkStream(istream& is, const string& fnName) +bool Foam::checkStream(istream& is, const string& fnName) { if (!is.good()) { @@ -50,7 +44,7 @@ bool checkStream(istream& is, const string& fnName) } -bool checkStream(ostream& os, const string& fnName) +bool Foam::checkStream(ostream& os, const string& fnName) { if (!os.good()) { @@ -62,8 +56,4 @@ bool checkStream(ostream& os, const string& fnName) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/state.C b/src/OpenFOAM/db/IOstreams/Sstreams/state.C index ed2aba7b05..cff808bf40 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/state.C +++ b/src/OpenFOAM/db/IOstreams/Sstreams/state.C @@ -29,19 +29,13 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" - #include "token.H" #include "int.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Print state of ostream. -void state(ostream& to, const string& s) +void Foam::state(ostream& to, const string& s) { state_value osState = state_value(to.rdstate()); @@ -82,7 +76,7 @@ void state(ostream& to, const string& s) // Print state of istream. -void state(istream& from, const string& s) +void Foam::state(istream& from, const string& s) { state_value isState = state_value(from.rdstate()); @@ -126,8 +120,4 @@ void state(istream& from, const string& s) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C index 5979ca5b9c..646c451317 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C @@ -26,15 +26,12 @@ License #include "objectRegistry.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -wordList objectRegistry::names() const +Foam::wordList +Foam::objectRegistry::names() const { wordList objectNames(size()); @@ -54,7 +51,8 @@ wordList objectRegistry::names() const template -HashTable objectRegistry::lookupClass() const +Foam::HashTable +Foam::objectRegistry::lookupClass() const { HashTable objectsOfClass(size()); @@ -75,7 +73,7 @@ HashTable objectRegistry::lookupClass() const template -bool objectRegistry::foundObject(const word& name) const +bool Foam::objectRegistry::foundObject(const word& name) const { const_iterator iter = find(name); @@ -107,7 +105,7 @@ bool objectRegistry::foundObject(const word& name) const template -const Type& objectRegistry::lookupObject(const word& name) const +const Type& Foam::objectRegistry::lookupObject(const word& name) const { const_iterator iter = find(name); @@ -154,8 +152,4 @@ const Type& objectRegistry::lookupObject(const word& name) const } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/db/regIOobject/regIOobject.C b/src/OpenFOAM/db/regIOobject/regIOobject.C index 6fba693043..1d4d407955 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobject.C +++ b/src/OpenFOAM/db/regIOobject/regIOobject.C @@ -22,9 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - Constructors & destructor for regIOobject. - \*---------------------------------------------------------------------------*/ #include "regIOobject.H" @@ -159,16 +156,16 @@ bool Foam::regIOobject::checkOut() // Rename object and re-register with objectRegistry under new name void Foam::regIOobject::rename(const word& newName) { - // TODO: verify that this works properly with unregistered objects - // I suspect that it incorrectly registers them - // Check out of objectRegistry checkOut(); IOobject::rename(newName); - // Re-register object with objectRegistry - checkIn(); + if (registerObject()) + { + // Re-register object with objectRegistry + checkIn(); + } } @@ -186,8 +183,11 @@ void Foam::regIOobject::operator=(const IOobject& io) IOobject::operator=(io); - // Re-register object with objectRegistry - checkIn(); + if (registerObject()) + { + // Re-register object with objectRegistry + checkIn(); + } } diff --git a/src/OpenFOAM/db/regIOobject/regIOobjectWrite.C b/src/OpenFOAM/db/regIOobject/regIOobjectWrite.C index 6eef1b8aff..dc3dcf1478 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobjectWrite.C +++ b/src/OpenFOAM/db/regIOobject/regIOobjectWrite.C @@ -34,12 +34,7 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -bool regIOobject::writeObject +bool Foam::regIOobject::writeObject ( IOstream::streamFormat fmt, IOstream::versionNumber ver, @@ -131,7 +126,7 @@ bool regIOobject::writeObject } -bool regIOobject::write() const +bool Foam::regIOobject::write() const { return writeObject ( @@ -141,9 +136,4 @@ bool regIOobject::write() const ); } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 47d9ce4830..4a45b56f45 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -285,9 +285,9 @@ Foam::argList::argList // Print the banner once only for parallel runs if (Pstream::master() && bannerEnabled) { - IOobject::writeBanner(Info, true); - Info<< "Build : " << Foam::FOAMbuild << nl - << "Exec : " << argListString.c_str() << nl + IOobject::writeBanner(Info, true) + << "Build : " << Foam::FOAMbuild << nl + << "Exec : " << argListString.c_str() << nl << "Date : " << dateString.c_str() << nl << "Time : " << timeString.c_str() << nl << "Host : " << hostName() << nl diff --git a/src/OpenFOAM/meshes/ProcessorTopology/commSchedule.C b/src/OpenFOAM/meshes/ProcessorTopology/commSchedule.C index 42cf2e34c9..0fd9bf0a5d 100644 --- a/src/OpenFOAM/meshes/ProcessorTopology/commSchedule.C +++ b/src/OpenFOAM/meshes/ProcessorTopology/commSchedule.C @@ -32,14 +32,9 @@ License #include "OStringStream.H" #include "Pstream.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - -defineTypeNameAndDebug(commSchedule, 0); - -} +defineTypeNameAndDebug(Foam::commSchedule, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/bandCompression/bandCompression.C b/src/OpenFOAM/meshes/bandCompression/bandCompression.C index bebfcb64fb..81ac2032eb 100644 --- a/src/OpenFOAM/meshes/bandCompression/bandCompression.C +++ b/src/OpenFOAM/meshes/bandCompression/bandCompression.C @@ -35,11 +35,8 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - // Constructor from components -labelList bandCompression(const labelListList& cellCellAddressing) +Foam::labelList Foam::bandCompression(const labelListList& cellCellAddressing) { labelList newOrder(cellCellAddressing.size()); @@ -106,8 +103,4 @@ labelList bandCompression(const labelListList& cellCellAddressing) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/lduMesh/lduMesh.C b/src/OpenFOAM/meshes/lduMesh/lduMesh.C index 135b74c6ab..e04397686b 100644 --- a/src/OpenFOAM/meshes/lduMesh/lduMesh.C +++ b/src/OpenFOAM/meshes/lduMesh/lduMesh.C @@ -29,10 +29,8 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(lduMesh, 0); -} +defineTypeNameAndDebug(Foam::lduMesh, 0); + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/meshShapes/cell/cellIOList.C b/src/OpenFOAM/meshes/meshShapes/cell/cellIOList.C index b56a79cf4b..ab18b49661 100644 --- a/src/OpenFOAM/meshes/meshShapes/cell/cellIOList.C +++ b/src/OpenFOAM/meshes/meshShapes/cell/cellIOList.C @@ -36,7 +36,7 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTemplateTypeNameAndDebugWithName(cellIOList, "cellList", 0); + defineTemplateTypeNameAndDebugWithName(cellIOList, "cellList", 0); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeEqual.C b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeEqual.C index f4e03cc5ae..30756f3408 100644 --- a/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeEqual.C +++ b/src/OpenFOAM/meshes/meshShapes/cellShape/cellShapeEqual.C @@ -31,12 +31,7 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -bool operator==(const cellShape& a, const cellShape& b) +bool Foam::operator==(const cellShape& a, const cellShape& b) { // Basic rule: we assume that the sequence of labels in each list // will be circular in the same order (but not necessarily in the @@ -180,8 +175,4 @@ bool operator==(const cellShape& a, const cellShape& b) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceAreaInContact.C b/src/OpenFOAM/meshes/meshShapes/face/faceAreaInContact.C index f534447d63..dea584a5f3 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/faceAreaInContact.C +++ b/src/OpenFOAM/meshes/meshShapes/face/faceAreaInContact.C @@ -27,17 +27,13 @@ License #include "face.H" #include "scalarField.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // Calculate area in contact given displacement of vertices relative to // the face plane. Positive displacement is above the face (no contact); // negative is in contact -scalar face::areaInContact +Foam::scalar Foam::face::areaInContact ( const pointField& meshPoints, const scalarField& v @@ -162,8 +158,4 @@ scalar face::areaInContact } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceContactSphere.C b/src/OpenFOAM/meshes/meshShapes/face/faceContactSphere.C index 8355352c22..35b67e2578 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/faceContactSphere.C +++ b/src/OpenFOAM/meshes/meshShapes/face/faceContactSphere.C @@ -24,17 +24,14 @@ License Description Return location of contact sphere on the face - + \*---------------------------------------------------------------------------*/ #include "face.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -scalar face::contactSphereDiameter +Foam::scalar Foam::face::contactSphereDiameter ( const point& p, const vector& n, @@ -44,15 +41,12 @@ scalar face::contactSphereDiameter scalar magN = Foam::mag(n); vector n1 = n/(magN + SMALL); - vector n2 = normal(meshPoints); + n2 /= Foam::mag(n2) + SMALL; return 2*((centre(meshPoints) - p) & n2)/((n1 & n2) - 1.0); } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C b/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C index 55ca87baf2..b514af7749 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C +++ b/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C @@ -34,9 +34,6 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - // Return potential intersection with face with a ray starting // at p, direction n (does not need to be normalized) // Does face-center decomposition and returns triangle intersection @@ -46,7 +43,7 @@ namespace Foam // face plane and the ray and the distance is the distance between the // intersection point and the nearest point on the face -pointHit face::ray +Foam::pointHit Foam::face::ray ( const point& p, const vector& n, @@ -76,7 +73,7 @@ pointHit face::ray nextPoint = meshPoints[f[fcIndex(pI)]]; // Note: for best accuracy, centre point always comes last - // + // pointHit curHit = triPointRef ( meshPoints[f[pI]], @@ -133,7 +130,7 @@ pointHit face::ray } -pointHit face::intersection +Foam::pointHit Foam::face::intersection ( const point& p, const vector& q, @@ -179,7 +176,7 @@ pointHit face::intersection } -pointHit face::nearestPoint +Foam::pointHit Foam::face::nearestPoint ( const point& p, const pointField& meshPoints @@ -200,7 +197,7 @@ pointHit face::nearestPoint nextPoint = meshPoints[f[fcIndex(pI)]]; // Note: for best accuracy, centre point always comes last - // + // triPointRef tri ( meshPoints[f[pI]], @@ -232,8 +229,4 @@ pointHit face::nearestPoint } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/meshShapes/tetCell/tetCell.C b/src/OpenFOAM/meshes/meshShapes/tetCell/tetCell.C index 6f20e4aef9..cc7cf978bd 100644 --- a/src/OpenFOAM/meshes/meshShapes/tetCell/tetCell.C +++ b/src/OpenFOAM/meshes/meshShapes/tetCell/tetCell.C @@ -30,14 +30,10 @@ Description #include "cellShape.H" #include "cellModeller.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -cellShape tetCell::tetCellShape() const +Foam::cellShape Foam::tetCell::tetCellShape() const { static const cellModel* tetModelPtr_ = NULL; @@ -52,8 +48,4 @@ cellShape tetCell::tetCellShape() const } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C index 05b0af286d..11be3c3b86 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C +++ b/src/OpenFOAM/meshes/pointMesh/pointBoundaryMesh/pointBoundaryMesh.C @@ -29,14 +29,9 @@ License #include "facePointPatch.H" #include "globalPointPatch.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -pointBoundaryMesh::pointBoundaryMesh +Foam::pointBoundaryMesh::pointBoundaryMesh ( const pointMesh& m, const polyBoundaryMesh& basicBdry @@ -61,7 +56,7 @@ pointBoundaryMesh::pointBoundaryMesh // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void pointBoundaryMesh::calcGeometry() +void Foam::pointBoundaryMesh::calcGeometry() { forAll(*this, patchi) { @@ -75,7 +70,8 @@ void pointBoundaryMesh::calcGeometry() } -const globalPointPatch& pointBoundaryMesh::globalPatch() const +const Foam::globalPointPatch& +Foam::pointBoundaryMesh::globalPatch() const { const pointPatchList& patches = *this; @@ -99,7 +95,7 @@ const globalPointPatch& pointBoundaryMesh::globalPatch() const } -void pointBoundaryMesh::movePoints(const pointField& p) +void Foam::pointBoundaryMesh::movePoints(const pointField& p) { pointPatchList& patches = *this; @@ -115,7 +111,7 @@ void pointBoundaryMesh::movePoints(const pointField& p) } -void pointBoundaryMesh::updateMesh() +void Foam::pointBoundaryMesh::updateMesh() { pointPatchList& patches = *this; @@ -131,8 +127,4 @@ void pointBoundaryMesh::updateMesh() } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.C index dba72e8121..4310183c4a 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.C @@ -29,27 +29,20 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(coupledPointPatch, 0); +defineTypeNameAndDebug(Foam::coupledPointPatch, 0); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -coupledPointPatch::coupledPointPatch(const pointBoundaryMesh& bm) +Foam::coupledPointPatch::coupledPointPatch(const pointBoundaryMesh& bm) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -coupledPointPatch::~coupledPointPatch() +Foam::coupledPointPatch::~coupledPointPatch() {} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.C index 3dcdb80b08..ca9cbf95f8 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.C @@ -28,9 +28,6 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(pointPatch, 0); -} +defineTypeNameAndDebug(Foam::pointPatch, 0); // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index 121b2a643e..e53330b6a4 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -40,10 +40,7 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(globalMeshData, 0); -} +defineTypeNameAndDebug(Foam::globalMeshData, 0); // Geometric matching tolerance. Factor of mesh bounding box. const Foam::scalar Foam::globalMeshData::matchTol_ = 1E-8; diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index ca11a21ec9..0d8b6b97e8 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -32,10 +32,8 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(polyBoundaryMesh, 0); -} +defineTypeNameAndDebug(Foam::polyBoundaryMesh, 0); + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index e0b4c0536c..1947c12647 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -39,10 +39,8 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(polyMesh, 0); -} +defineTypeNameAndDebug(Foam::polyMesh, 0); + Foam::word Foam::polyMesh::defaultRegion = "region0"; Foam::word Foam::polyMesh::meshSubDir = "polyMesh"; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C index aeb783d909..f471fe1b6e 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C @@ -31,10 +31,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(coupledPolyPatch, 0); -} +defineTypeNameAndDebug(Foam::coupledPolyPatch, 0); Foam::scalar Foam::coupledPolyPatch::matchTol = 1E-3; diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C index 28d03a710c..079a5b6c61 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C @@ -30,10 +30,9 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - defineTypeNameAndDebug(primitiveMesh, 0); -} + +defineTypeNameAndDebug(Foam::primitiveMesh, 0); + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCells.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCells.C index 6beb5fe4bd..191ee7f5e8 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCells.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCells.C @@ -26,14 +26,10 @@ License #include "primitiveMesh.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void primitiveMesh::calcCellCells() const +void Foam::primitiveMesh::calcCellCells() const { // Loop through faceCells and mark up neighbours @@ -102,7 +98,7 @@ void primitiveMesh::calcCellCells() const // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const labelListList& primitiveMesh::cellCells() const +const Foam::labelListList& Foam::primitiveMesh::cellCells() const { if (!ccPtr_) { @@ -113,7 +109,7 @@ const labelListList& primitiveMesh::cellCells() const } -const labelList& primitiveMesh::cellCells +const Foam::labelList& Foam::primitiveMesh::cellCells ( const label cellI, DynamicList