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.
This commit is contained in:
Mark Olesen
2009-03-05 12:06:57 +01:00
parent 0cfce1a7ab
commit 7544164d53
49 changed files with 274 additions and 436 deletions

View File

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

View File

@ -43,8 +43,7 @@ int main(int argc, char *argv[])
List<Tuple2<string, string> > rawList(IFstream("testRegexps")());
Info<< "input list:" << rawList << endl;
IOobject::writeDivider(Info);
Info<< endl;
IOobject::writeDivider(Info) << endl;
List<string> groups;

View File

@ -86,8 +86,7 @@ int main(int argc, char *argv[])
List<Tuple2<wordRe, string> > rawList(IFstream("testRegexps")());
Info<< "input list:" << rawList << endl;
IOobject::writeDivider(Info);
Info<< endl;
IOobject::writeDivider(Info) << endl;
forAll(rawList, elemI)
{

View File

@ -26,15 +26,10 @@ License
#include "Callback.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CallbackType>
Callback<CallbackType>::Callback(CallbackRegistry<CallbackType>& cbr)
Foam::Callback<CallbackType>::Callback(CallbackRegistry<CallbackType>& cbr)
:
cbr_(cbr)
{
@ -43,7 +38,7 @@ Callback<CallbackType>::Callback(CallbackRegistry<CallbackType>& cbr)
template<class CallbackType>
Callback<CallbackType>::Callback(const Callback<CallbackType>& cb)
Foam::Callback<CallbackType>::Callback(const Callback<CallbackType>& cb)
:
cbr_(cb.cbr_)
{
@ -54,7 +49,7 @@ Callback<CallbackType>::Callback(const Callback<CallbackType>& cb)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CallbackType>
Callback<CallbackType>::~Callback()
Foam::Callback<CallbackType>::~Callback()
{
checkOut();
}
@ -63,7 +58,7 @@ Callback<CallbackType>::~Callback()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CallbackType>
bool Callback<CallbackType>::checkIn()
bool Foam::Callback<CallbackType>::checkIn()
{
if (!Callback<CallbackType>::link::registered())
{
@ -78,7 +73,7 @@ bool Callback<CallbackType>::checkIn()
template<class CallbackType>
bool Callback<CallbackType>::checkOut()
bool Foam::Callback<CallbackType>::checkOut()
{
if (Callback<CallbackType>::link::registered())
{
@ -100,8 +95,4 @@ bool Callback<CallbackType>::checkOut()
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -30,10 +30,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(IOobject, 0);
}
defineTypeNameAndDebug(Foam::IOobject, 0);
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //

View File

@ -353,11 +353,11 @@ public:
//- Write the standard OpenFOAM file/dictionary banner
// Optionally without -*- C++ -*- editor hint (eg, for logs)
template<class Stream>
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<class Stream>
static inline void writeDivider(Stream& os);
static inline Stream& writeDivider(Stream& os);
//- Write header
bool writeHeader(Ostream&) const;

View File

@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Stream>
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<class Stream>
inline void Foam::IOobject::writeDivider(Stream& os)
inline Stream& Foam::IOobject::writeDivider(Stream& os)
{
os <<
"// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //\n";
return os;
}

View File

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

View File

@ -35,10 +35,8 @@ Description
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(IOdictionary, 0);
}
defineTypeNameAndDebug(Foam::IOdictionary, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -30,10 +30,8 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(IFstream, 0);
}
defineTypeNameAndDebug(Foam::IFstream, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -30,10 +30,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(OFstream, 0);
}
defineTypeNameAndDebug(Foam::OFstream, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

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

View File

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

View File

@ -26,15 +26,12 @@ License
#include "objectRegistry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
wordList objectRegistry::names() const
Foam::wordList
Foam::objectRegistry::names() const
{
wordList objectNames(size());
@ -54,7 +51,8 @@ wordList objectRegistry::names() const
template<class Type>
HashTable<const Type*> objectRegistry::lookupClass() const
Foam::HashTable<const Type*>
Foam::objectRegistry::lookupClass() const
{
HashTable<const Type*> objectsOfClass(size());
@ -75,7 +73,7 @@ HashTable<const Type*> objectRegistry::lookupClass() const
template<class Type>
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<class Type>
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
// ************************************************************************* //

View File

@ -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);
if (registerObject())
{
// Re-register object with objectRegistry
checkIn();
}
}
@ -186,8 +183,11 @@ void Foam::regIOobject::operator=(const IOobject& io)
IOobject::operator=(io);
if (registerObject())
{
// Re-register object with objectRegistry
checkIn();
}
}

View File

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

View File

@ -285,8 +285,8 @@ Foam::argList::argList
// Print the banner once only for parallel runs
if (Pstream::master() && bannerEnabled)
{
IOobject::writeBanner(Info, true);
Info<< "Build : " << Foam::FOAMbuild << nl
IOobject::writeBanner(Info, true)
<< "Build : " << Foam::FOAMbuild << nl
<< "Exec : " << argListString.c_str() << nl
<< "Date : " << dateString.c_str() << nl
<< "Time : " << timeString.c_str() << nl

View File

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

View File

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

View File

@ -29,10 +29,8 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(lduMesh, 0);
}
defineTypeNameAndDebug(Foam::lduMesh, 0);
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -36,7 +36,7 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTemplateTypeNameAndDebugWithName(cellIOList, "cellList", 0);
defineTemplateTypeNameAndDebugWithName(cellIOList, "cellList", 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

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

View File

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

View File

@ -31,10 +31,7 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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
// ************************************************************************* //

View File

@ -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,
@ -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
@ -232,8 +229,4 @@ pointHit face::nearestPoint
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

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

View File

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

View File

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

View File

@ -28,9 +28,6 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(pointPatch, 0);
}
defineTypeNameAndDebug(Foam::pointPatch, 0);
// ************************************************************************* //

View File

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

View File

@ -32,10 +32,8 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(polyBoundaryMesh, 0);
}
defineTypeNameAndDebug(Foam::polyBoundaryMesh, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

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

View File

@ -31,10 +31,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(coupledPolyPatch, 0);
}
defineTypeNameAndDebug(Foam::coupledPolyPatch, 0);
Foam::scalar Foam::coupledPolyPatch::matchTol = 1E-3;

View File

@ -30,10 +30,9 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(primitiveMesh, 0);
}
defineTypeNameAndDebug(Foam::primitiveMesh, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -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<label>& storage
@ -153,14 +149,10 @@ const labelList& primitiveMesh::cellCells
}
const labelList& primitiveMesh::cellCells(const label cellI) const
const Foam::labelList& Foam::primitiveMesh::cellCells(const label cellI) const
{
return cellCells(cellI, labels_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -30,14 +30,9 @@ Description
#include "primitiveMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void primitiveMesh::calcCellCentresAndVols() const
void Foam::primitiveMesh::calcCellCentresAndVols() const
{
if (debug)
{
@ -75,7 +70,7 @@ void primitiveMesh::calcCellCentresAndVols() const
}
void primitiveMesh::makeCellCentresAndVols
void Foam::primitiveMesh::makeCellCentresAndVols
(
const vectorField& fCtrs,
const vectorField& fAreas,
@ -152,7 +147,7 @@ void primitiveMesh::makeCellCentresAndVols
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const vectorField& primitiveMesh::cellCentres() const
const Foam::vectorField& Foam::primitiveMesh::cellCentres() const
{
if (!cellCentresPtr_)
{
@ -163,7 +158,7 @@ const vectorField& primitiveMesh::cellCentres() const
}
const scalarField& primitiveMesh::cellVolumes() const
const Foam::scalarField& Foam::primitiveMesh::cellVolumes() const
{
if (!cellVolumesPtr_)
{
@ -174,8 +169,4 @@ const scalarField& primitiveMesh::cellVolumes() const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,14 +26,9 @@ License
#include "primitiveMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void primitiveMesh::calcCells
void Foam::primitiveMesh::calcCells
(
cellList& cellFaceAddr,
const unallocLabelList& own,
@ -102,7 +97,7 @@ void primitiveMesh::calcCells
}
void primitiveMesh::calcCells() const
void Foam::primitiveMesh::calcCells() const
{
// Loop through faceCells and mark up neighbours
@ -139,7 +134,7 @@ void primitiveMesh::calcCells() const
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const cellList& primitiveMesh::cells() const
const Foam::cellList& Foam::primitiveMesh::cells() const
{
if (!cfPtr_)
{
@ -150,8 +145,4 @@ const cellList& primitiveMesh::cells() const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -30,22 +30,18 @@ License
#include "mathematicalConstants.H"
#include "SortableList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
scalar primitiveMesh::closedThreshold_ = 1.0e-6;
scalar primitiveMesh::aspectThreshold_ = 1000;
scalar primitiveMesh::nonOrthThreshold_ = 70; // deg
scalar primitiveMesh::skewThreshold_ = 4;
Foam::scalar Foam::primitiveMesh::closedThreshold_ = 1.0e-6;
Foam::scalar Foam::primitiveMesh::aspectThreshold_ = 1000;
Foam::scalar Foam::primitiveMesh::nonOrthThreshold_ = 70; // deg
Foam::scalar Foam::primitiveMesh::skewThreshold_ = 4;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool primitiveMesh::checkClosedBoundary(const bool report) const
bool Foam::primitiveMesh::checkClosedBoundary(const bool report) const
{
if (debug)
{
@ -97,7 +93,7 @@ bool primitiveMesh::checkClosedBoundary(const bool report) const
}
bool primitiveMesh::checkClosedCells
bool Foam::primitiveMesh::checkClosedCells
(
const bool report,
labelHashSet* setPtr,
@ -266,7 +262,7 @@ bool primitiveMesh::checkClosedCells
}
bool primitiveMesh::checkFaceAreas
bool Foam::primitiveMesh::checkFaceAreas
(
const bool report,
labelHashSet* setPtr
@ -325,7 +321,7 @@ bool primitiveMesh::checkFaceAreas
}
bool primitiveMesh::checkCellVolumes
bool Foam::primitiveMesh::checkCellVolumes
(
const bool report,
labelHashSet* setPtr
@ -392,7 +388,7 @@ bool primitiveMesh::checkCellVolumes
}
bool primitiveMesh::checkFaceOrthogonality
bool Foam::primitiveMesh::checkFaceOrthogonality
(
const bool report,
labelHashSet* setPtr
@ -512,7 +508,7 @@ bool primitiveMesh::checkFaceOrthogonality
}
bool primitiveMesh::checkFacePyramids
bool Foam::primitiveMesh::checkFacePyramids
(
const bool report,
const scalar minPyrVol,
@ -596,7 +592,7 @@ bool primitiveMesh::checkFacePyramids
}
bool primitiveMesh::checkFaceSkewness
bool Foam::primitiveMesh::checkFaceSkewness
(
const bool report,
labelHashSet* setPtr
@ -740,7 +736,7 @@ bool primitiveMesh::checkFaceSkewness
}
bool primitiveMesh::checkPoints
bool Foam::primitiveMesh::checkPoints
(
const bool report,
labelHashSet* setPtr
@ -818,7 +814,7 @@ bool primitiveMesh::checkPoints
// E.g. maxDeg = 10 allows for angles < 190 (or 10 degrees concavity)
// (if truly concave and points not visible from face centre the face-pyramid
// check in checkMesh will fail)
bool primitiveMesh::checkFaceAngles
bool Foam::primitiveMesh::checkFaceAngles
(
const bool report,
const scalar maxDeg,
@ -946,7 +942,7 @@ bool primitiveMesh::checkFaceAngles
// Check warpage of faces. Is calculated as the difference between areas of
// individual triangles and the overall area of the face (which ifself is
// is the average of the areas of the individual triangles).
bool primitiveMesh::checkFaceFlatness
bool Foam::primitiveMesh::checkFaceFlatness
(
const bool report,
const scalar warnFlatness,
@ -1076,7 +1072,7 @@ bool primitiveMesh::checkFaceFlatness
// - are only in a singe non-empty direction.
// Empty direction info is passed in as a vector of labels (synchronised)
// which are 1 if the direction is non-empty, 0 if it is.
bool primitiveMesh::checkEdgeAlignment
bool Foam::primitiveMesh::checkEdgeAlignment
(
const bool report,
const Vector<label>& directions,
@ -1211,7 +1207,7 @@ bool primitiveMesh::checkEdgeAlignment
}
bool primitiveMesh::checkUpperTriangular
bool Foam::primitiveMesh::checkUpperTriangular
(
const bool report,
labelHashSet* setPtr
@ -1376,7 +1372,7 @@ bool primitiveMesh::checkUpperTriangular
}
bool primitiveMesh::checkCellsZipUp
bool Foam::primitiveMesh::checkCellsZipUp
(
const bool report,
labelHashSet* setPtr
@ -1477,7 +1473,7 @@ bool primitiveMesh::checkCellsZipUp
// Vertices of face within point range and unique.
bool primitiveMesh::checkFaceVertices
bool Foam::primitiveMesh::checkFaceVertices
(
const bool report,
labelHashSet* setPtr
@ -1553,7 +1549,7 @@ bool primitiveMesh::checkFaceVertices
// Check if all points on face are shared between faces.
bool primitiveMesh::checkDuplicateFaces
bool Foam::primitiveMesh::checkDuplicateFaces
(
const label faceI,
const Map<label>& nCommonPoints,
@ -1595,7 +1591,7 @@ bool primitiveMesh::checkDuplicateFaces
// Check that shared points are in consecutive order.
bool primitiveMesh::checkCommonOrder
bool Foam::primitiveMesh::checkCommonOrder
(
const label faceI,
const Map<label>& nCommonPoints,
@ -1758,7 +1754,7 @@ bool primitiveMesh::checkCommonOrder
// Checks common vertices between faces. If more than 2 they should be
// consecutive on both faces.
bool primitiveMesh::checkFaceFaces
bool Foam::primitiveMesh::checkFaceFaces
(
const bool report,
labelHashSet* setPtr
@ -1868,7 +1864,7 @@ bool primitiveMesh::checkFaceFaces
// Checks cells with 1 or less internal faces. Give numerical problems.
bool primitiveMesh::checkCellDeterminant
bool Foam::primitiveMesh::checkCellDeterminant
(
const bool report, // report,
labelHashSet* setPtr // setPtr
@ -1990,7 +1986,7 @@ bool primitiveMesh::checkCellDeterminant
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool primitiveMesh::checkTopology(const bool report) const
bool Foam::primitiveMesh::checkTopology(const bool report) const
{
label noFailedChecks = 0;
@ -2023,7 +2019,7 @@ bool primitiveMesh::checkTopology(const bool report) const
}
bool primitiveMesh::checkGeometry(const bool report) const
bool Foam::primitiveMesh::checkGeometry(const bool report) const
{
label noFailedChecks = 0;
@ -2056,7 +2052,7 @@ bool primitiveMesh::checkGeometry(const bool report) const
}
bool primitiveMesh::checkMesh(const bool report) const
bool Foam::primitiveMesh::checkMesh(const bool report) const
{
if (debug)
{
@ -2088,44 +2084,40 @@ bool primitiveMesh::checkMesh(const bool report) const
}
scalar primitiveMesh::setClosedThreshold(const scalar ct)
Foam::scalar Foam::primitiveMesh::setClosedThreshold(const scalar val)
{
scalar oldClosedThreshold = closedThreshold_;
closedThreshold_ = ct;
scalar prev = closedThreshold_;
closedThreshold_ = val;
return oldClosedThreshold;
return prev;
}
scalar primitiveMesh::setAspectThreshold(const scalar at)
Foam::scalar Foam::primitiveMesh::setAspectThreshold(const scalar val)
{
scalar oldAspectThreshold = aspectThreshold_;
aspectThreshold_ = at;
scalar prev = aspectThreshold_;
aspectThreshold_ = val;
return oldAspectThreshold;
return prev;
}
scalar primitiveMesh::setNonOrthThreshold(const scalar nt)
Foam::scalar Foam::primitiveMesh::setNonOrthThreshold(const scalar val)
{
scalar oldNonOrthThreshold = nonOrthThreshold_;
nonOrthThreshold_ = nt;
scalar prev = nonOrthThreshold_;
nonOrthThreshold_ = val;
return oldNonOrthThreshold;
return prev;
}
scalar primitiveMesh::setSkewThreshold(const scalar st)
Foam::scalar Foam::primitiveMesh::setSkewThreshold(const scalar val)
{
scalar oldSkewThreshold = skewThreshold_;
skewThreshold_ = st;
scalar prev = skewThreshold_;
skewThreshold_ = val;
return oldSkewThreshold;
return prev;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,14 +27,10 @@ License
#include "primitiveMesh.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void primitiveMesh::printAllocated() const
void Foam::primitiveMesh::printAllocated() const
{
Pout<< "primitiveMesh allocated :" << endl;
@ -128,7 +124,7 @@ void primitiveMesh::printAllocated() const
}
void primitiveMesh::clearGeom()
void Foam::primitiveMesh::clearGeom()
{
if (debug)
{
@ -144,7 +140,7 @@ void primitiveMesh::clearGeom()
}
void primitiveMesh::clearAddressing()
void Foam::primitiveMesh::clearAddressing()
{
if (debug)
{
@ -173,15 +169,11 @@ void primitiveMesh::clearAddressing()
}
void primitiveMesh::clearOut()
void Foam::primitiveMesh::clearOut()
{
clearGeom();
clearAddressing();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,14 +27,10 @@ License
#include "primitiveMesh.H"
#include "ListOps.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const labelListList& primitiveMesh::edgeCells() const
const Foam::labelListList& Foam::primitiveMesh::edgeCells() const
{
if (!ecPtr_)
{
@ -59,7 +55,7 @@ const labelListList& primitiveMesh::edgeCells() const
}
const labelList& primitiveMesh::edgeCells
const Foam::labelList& Foam::primitiveMesh::edgeCells
(
const label edgeI,
DynamicList<label>& storage
@ -129,14 +125,10 @@ const labelList& primitiveMesh::edgeCells
}
const labelList& primitiveMesh::edgeCells(const label edgeI) const
const Foam::labelList& Foam::primitiveMesh::edgeCells(const label edgeI) const
{
return edgeCells(edgeI, labels_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,14 +27,9 @@ License
#include "primitiveMesh.H"
#include "ListOps.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const labelListList& primitiveMesh::edgeFaces() const
const Foam::labelListList& Foam::primitiveMesh::edgeFaces() const
{
if (!efPtr_)
{
@ -60,7 +55,7 @@ const labelListList& primitiveMesh::edgeFaces() const
}
const labelList& primitiveMesh::edgeFaces
const Foam::labelList& Foam::primitiveMesh::edgeFaces
(
const label edgeI,
DynamicList<label>& storage
@ -106,14 +101,10 @@ const labelList& primitiveMesh::edgeFaces
}
const labelList& primitiveMesh::edgeFaces(const label edgeI) const
const Foam::labelList& Foam::primitiveMesh::edgeFaces(const label edgeI) const
{
return edgeFaces(edgeI, labels_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -33,14 +33,10 @@ Description
#include "primitiveMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void primitiveMesh::calcFaceCentresAndAreas() const
void Foam::primitiveMesh::calcFaceCentresAndAreas() const
{
if (debug)
{
@ -75,7 +71,7 @@ void primitiveMesh::calcFaceCentresAndAreas() const
}
void primitiveMesh::makeFaceCentresAndAreas
void Foam::primitiveMesh::makeFaceCentresAndAreas
(
const pointField& p,
vectorField& fCtrs,
@ -132,7 +128,7 @@ void primitiveMesh::makeFaceCentresAndAreas
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const vectorField& primitiveMesh::faceCentres() const
const Foam::vectorField& Foam::primitiveMesh::faceCentres() const
{
if (!faceCentresPtr_)
{
@ -143,7 +139,7 @@ const vectorField& primitiveMesh::faceCentres() const
}
const vectorField& primitiveMesh::faceAreas() const
const Foam::vectorField& Foam::primitiveMesh::faceAreas() const
{
if (!faceAreasPtr_)
{
@ -154,8 +150,4 @@ const vectorField& primitiveMesh::faceAreas() const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,15 +27,11 @@ License
#include "primitiveMesh.H"
#include "cell.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Is the point in the cell bounding box
bool primitiveMesh::pointInCellBB(const point& p, label celli) const
bool Foam::primitiveMesh::pointInCellBB(const point& p, label celli) const
{
const pointField& points = this->points();
const faceList& f = faces();
@ -67,7 +63,7 @@ bool primitiveMesh::pointInCellBB(const point& p, label celli) const
// Is the point in the cell
bool primitiveMesh::pointInCell(const point& p, label celli) const
bool Foam::primitiveMesh::pointInCell(const point& p, label celli) const
{
const labelList& f = cells()[celli];
const labelList& owner = this->faceOwner();
@ -93,7 +89,7 @@ bool primitiveMesh::pointInCell(const point& p, label celli) const
// Find the cell with the nearest cell centre
label primitiveMesh::findNearestCell(const point& location) const
Foam::label Foam::primitiveMesh::findNearestCell(const point& location) const
{
const vectorField& centres = cellCentres();
@ -116,7 +112,7 @@ label primitiveMesh::findNearestCell(const point& location) const
// Find cell enclosing this location
label primitiveMesh::findCell(const point& location) const
Foam::label Foam::primitiveMesh::findCell(const point& location) const
{
if (nCells() == 0)
{
@ -160,8 +156,4 @@ label primitiveMesh::findCell(const point& location) const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,14 +27,10 @@ License
#include "primitiveMesh.H"
#include "ListOps.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const labelListList& primitiveMesh::pointFaces() const
const Foam::labelListList& Foam::primitiveMesh::pointFaces() const
{
if (!pfPtr_)
{
@ -52,8 +48,4 @@ const labelListList& primitiveMesh::pointFaces() const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -28,22 +28,17 @@ Description
#include "patchZones.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(patchZones, 0);
defineTypeNameAndDebug(Foam::patchZones, 0);
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
// Gets labels of changed faces and propagates them to the edges. Returns
// labels of edges changed.
labelList patchZones::faceToEdge
Foam::labelList Foam::patchZones::faceToEdge
(
const labelList& changedFaces,
labelList& edgeRegion
@ -78,7 +73,7 @@ labelList patchZones::faceToEdge
// Reverse of faceToEdge: gets edges and returns faces
labelList patchZones::edgeToFace(const labelList& changedEdges)
Foam::labelList Foam::patchZones::edgeToFace(const labelList& changedEdges)
{
labelList changedFaces(pp_.size(), -1);
label changedI = 0;
@ -109,7 +104,7 @@ labelList patchZones::edgeToFace(const labelList& changedEdges)
// Finds area, starting at faceI, delimited by borderEdge
void patchZones::markZone(label faceI)
void Foam::patchZones::markZone(label faceI)
{
// List of faces whose faceZone has been set.
labelList changedFaces(1, faceI);
@ -155,7 +150,11 @@ void patchZones::markZone(label faceI)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::patchZones::patchZones(const primitivePatch& pp, const boolList& borderEdge)
Foam::patchZones::patchZones
(
const primitivePatch& pp,
const boolList& borderEdge
)
:
labelList(pp.size(), -1),
pp_(pp),
@ -178,7 +177,7 @@ Foam::patchZones::patchZones(const primitivePatch& pp, const boolList& borderEdg
label faceI = 0;
while(true)
while (true)
{
// Find first non-visited face
for (; faceI < pp_.size(); faceI++)
@ -204,8 +203,4 @@ Foam::patchZones::patchZones(const primitivePatch& pp, const boolList& borderEdg
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -31,10 +31,6 @@ Description
#include "triPointRef.H"
#include "scalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -45,7 +41,7 @@ namespace Foam
// - triangle circumcentre
// - edge mids
template<class Point, class PointRef>
pointHit tetrahedron<Point, PointRef>::containmentSphere
Foam::pointHit Foam::tetrahedron<Point, PointRef>::containmentSphere
(
const scalar tol
) const
@ -250,7 +246,10 @@ pointHit tetrahedron<Point, PointRef>::containmentSphere
template<class Point, class PointRef>
void tetrahedron<Point, PointRef>::gradNiSquared(scalarField& buffer) const
void Foam::tetrahedron<Point, PointRef>::gradNiSquared
(
scalarField& buffer
) const
{
// Change of sign between face area vector and gradient
// does not matter because of square
@ -268,11 +267,13 @@ void tetrahedron<Point, PointRef>::gradNiSquared(scalarField& buffer) const
template<class Point, class PointRef>
void tetrahedron<Point, PointRef>::gradNiDotGradNj(scalarField& buffer) const
void Foam::tetrahedron<Point, PointRef>::gradNiDotGradNj
(
scalarField& buffer
) const
{
// Warning. Ordering of edges needs to be the same for a tetrahedron
// class, a tetrahedron cell shape model and a tetCell
//
// Warning: Added a mag to produce positive coefficients even if
// the tetrahedron is twisted inside out. This is pretty
@ -296,7 +297,10 @@ void tetrahedron<Point, PointRef>::gradNiDotGradNj(scalarField& buffer) const
template<class Point, class PointRef>
void tetrahedron<Point, PointRef>::gradNiGradNi(tensorField& buffer) const
void Foam::tetrahedron<Point, PointRef>::gradNiGradNi
(
tensorField& buffer
) const
{
// Change of sign between face area vector and gradient
// does not matter because of square
@ -311,11 +315,13 @@ void tetrahedron<Point, PointRef>::gradNiGradNi(tensorField& buffer) const
template<class Point, class PointRef>
void tetrahedron<Point, PointRef>::gradNiGradNj(tensorField& buffer) const
void Foam::tetrahedron<Point, PointRef>::gradNiGradNj
(
tensorField& buffer
) const
{
// Warning. Ordering of edges needs to be the same for a tetrahedron
// class, a tetrahedron cell shape model and a tetCell
//
// Double change of sign between face area vector and gradient
@ -333,8 +339,5 @@ void tetrahedron<Point, PointRef>::gradNiGradNj(tensorField& buffer) const
buffer[5] = (1.0/9.0)*(sd * sc)/magVol;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,6 +27,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "Hasher.H"
#include "HasherInt.H"
#if defined (__GLIBC__)
# include <endian.h>
@ -469,7 +470,7 @@ static unsigned jenkins_hashbig
#endif
// * * * * * * * * * * * * * * * * Functions * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
unsigned Foam::Hasher
@ -513,7 +514,7 @@ unsigned Foam::Hasher
// bytes. hashlittle() is more complicated than hashword() only because
// hashlittle() has to dance around fitting the key bytes into registers.
// ----------------------------------------------------------------------------
unsigned Foam::HasherSingle
unsigned Foam::HasherInt
(
const uint32_t *k,
size_t length,

View File

@ -22,8 +22,8 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::Hashing
InNamespace
Foam
Description
Misc. hashing functions, mostly from Bob Jenkins.
@ -35,6 +35,7 @@ Description
SeeAlso
http://burtleburtle.net/bob/c/lookup3.c
and HasherInt.H for a specialized version
SourceFiles
Hasher.C
@ -44,9 +45,7 @@ SourceFiles
#ifndef Hasher_H
#define Hasher_H
#include <climits>
#include <cstddef>
#include <stdint.h> // C++0x uses <cstdint>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -61,27 +60,6 @@ namespace Foam
// @param[in] seed - the previous hash, or an arbitrary value
unsigned Hasher(const void* data, size_t len, unsigned seed = 0);
//- An optimized version of Hasher
// @param[in] data - an array of uint32_t values
// @param[in] len - the number of values (not bytes)
// @param[in] seed - the previous hash, or an arbitrary value
unsigned HasherSingle(const uint32_t*, size_t length, unsigned seed = 0);
//- An optimized version of Hasher, returning dual hash values
// @param[in] data - an array of uint32_t values
// @param[in] len - the number of values (not bytes)
// @param[in] hash1 - the previous hash, or an arbitrary value
// on output, the primary hash value
// @param[in] hash1 - the previous hash, or an arbitrary value
// on output, the secondary hash value
unsigned HasherDual
(
const uint32_t*,
size_t len,
unsigned& hash1,
unsigned& hash2
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -0,0 +1,80 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
InNamespace
Foam
Description
Optimized hashing functions.
SeeAlso
Hasher.H
\*---------------------------------------------------------------------------*/
#ifndef HasherInt_H
#define HasherInt_H
#include "Hasher.H"
#include <cstddef>
#include <stdint.h> // C++0x uses <cstdint>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- An optimized version of Hasher
// @param[in] data - an array of uint32_t values
// @param[in] len - the number of values (not bytes)
// @param[in] seed - the previous hash, or an arbitrary value
unsigned HasherInt(const uint32_t*, size_t length, unsigned seed = 0);
//- An optimized version of Hasher, returning dual hash values
// @param[in] data - an array of uint32_t values
// @param[in] len - the number of values (not bytes)
// @param[in] hash1 - the previous hash, or an arbitrary value
// on output, the primary hash value
// @param[in] hash1 - the previous hash, or an arbitrary value
// on output, the secondary hash value
unsigned HasherDual
(
const uint32_t*,
size_t len,
unsigned& hash1,
unsigned& hash2
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //