Code clean-up

This commit is contained in:
andy
2010-01-15 15:57:44 +00:00
parent e2eab734f8
commit cdb8880cb3
42 changed files with 506 additions and 487 deletions

View File

@ -109,7 +109,6 @@ struct HashTableCore
{
return iteratorEnd();
}
};
@ -139,6 +138,7 @@ class HashTable
//- Construct from key, next pointer and object
inline hashedEntry(const Key&, hashedEntry* next, const T&);
private:
//- Disallow default bitwise copy construct
hashedEntry(const hashedEntry&);
@ -209,8 +209,7 @@ public:
HashTable(const Xfer<HashTable<T, Key, Hash> >&);
// Destructor
//- Destructor
~HashTable();
@ -247,6 +246,7 @@ public:
//- Print information
Ostream& printInfo(Ostream&) const;
// Edit
//- Insert a new hashedEntry
@ -356,9 +356,8 @@ public:
//- Current hash index
label hashIndex_;
protected:
// Protected Member Functions
protected:
// Constructors
@ -380,6 +379,8 @@ public:
);
// Protected Member Functions
//- Increment to the next position
inline void increment();
@ -392,6 +393,7 @@ public:
//- Return const access to referenced object
inline const T& cobject() const;
public:
// Member operators
@ -434,6 +436,7 @@ public:
const label hashIndex
);
public:
// Constructors
@ -444,13 +447,12 @@ public:
//- Construct end iterator
inline iterator(const iteratorEnd& unused);
// Member operators
//- Conversion to a const_iterator
inline operator const_iterator() const;
// Access
//- Return referenced hash value
inline T& operator*();
inline T& operator()();
@ -492,6 +494,7 @@ public:
const label hashIndex
);
public:
// Constructors
@ -502,9 +505,8 @@ public:
//- Construct end iterator
inline const_iterator(const iteratorEnd& unused);
// Member operators
// Access
// Member operators
//- Return referenced hash value
inline const T& operator*() const;
@ -536,7 +538,6 @@ public:
Ostream&,
const HashTable<T, Key, Hash>&
);
};

View File

@ -97,7 +97,6 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
{}
template<class T, class Key, class Hash>
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
(
@ -452,7 +451,6 @@ void Foam::StaticHashTable<T, Key, Hash>::clearStorage()
}
template<class T, class Key, class Hash>
void Foam::StaticHashTable<T, Key, Hash>::transfer
(

View File

@ -72,10 +72,6 @@ template<class T, class Key, class Hash> Ostream& operator<<
);
/*---------------------------------------------------------------------------*\
Class StaticHashTableName Declaration
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
Class StaticHashTableCore Declaration
\*---------------------------------------------------------------------------*/
@ -100,7 +96,6 @@ struct StaticHashTableCore
iteratorEnd()
{}
};
};
@ -135,6 +130,7 @@ class StaticHashTable
//- Assign a new hashed entry to a possibly already existing key
bool set(const Key&, const T& newElmt, bool protect);
public:
@ -185,8 +181,8 @@ public:
//- Construct by transferring the parameter contents
StaticHashTable(const Xfer<StaticHashTable<T, Key, Hash> >&);
// Destructor
//- Destructor
~StaticHashTable();
@ -275,6 +271,7 @@ public:
//- The opposite of the equality operation.
bool operator!=(const StaticHashTable<T, Key, Hash>&) const;
// STL type definitions
//- Type of values the StaticHashTable contains.
@ -317,6 +314,7 @@ public:
//- Index of current element at hashIndex
label elemIndex_;
public:
// Constructors

View File

@ -417,6 +417,4 @@ Foam::StaticHashTable<T, Key, Hash>::end() const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -84,7 +84,6 @@ class DynamicList
//- The capacity (allocated size) of the underlying list.
label capacity_;
// Private Member Functions
public:
@ -93,6 +92,7 @@ public:
//- Declare friendship with the List class
friend class List<T>;
// Constructors
//- Construct null
@ -178,6 +178,7 @@ public:
//- Transfer contents to the Xfer container as a plain List
inline Xfer<List<T> > xfer();
// Member Operators
//- Append an element at the end of the list
@ -207,6 +208,7 @@ public:
//- Assignment from UList
inline void operator=(const UList<T>&);
// IOstream operators
// Write DynamicList to Ostream.

View File

@ -66,6 +66,7 @@ public:
//- Construct given the complete list and by transferring addressing
inline IndirectList(const UList<T>&, const Xfer<List<label> >&);
// Member Functions
// Access
@ -94,6 +95,7 @@ public:
//- Return the list addressing
inline const List<label>& addressing() const;
// Edit
//- Reset addressing

View File

@ -87,6 +87,7 @@ protected:
// Use with care.
inline void size(const label);
public:
// Static Member Functions
@ -147,8 +148,7 @@ public:
inline autoPtr<List<T> > clone() const;
// Destructor
//- Destructor
~List();

View File

@ -132,6 +132,7 @@ class PackedList
//- Calculate the list length when packed
inline static label packedLength(const label);
public:
// Public data
@ -150,12 +151,14 @@ public:
//- Masking for all bits below the offset
inline static unsigned int maskLower(unsigned offset);
// Forward declaration of iterators
class iteratorBase;
class iterator;
class const_iterator;
// Constructors
//- Null constructor
@ -179,6 +182,7 @@ public:
//- Clone
inline autoPtr< PackedList<nBits> > clone() const;
// Member Functions
// Access
@ -292,11 +296,13 @@ public:
//- Assignment operator. Takes linear time.
void operator=(const UList<label>&);
// Ostream operator
// // Write PackedList to Ostream.
// friend Ostream& operator<< <nBits> (Ostream&, const PackedList<nBits>&);
// Iterators and helpers
//- The iterator base for PackedList
@ -317,6 +323,7 @@ public:
//- Element index
label index_;
// Protected Member Functions
//- Get value as unsigned, no range-checking
@ -325,6 +332,7 @@ public:
//- Set value, returning true if changed, no range-checking
inline bool set(unsigned int);
// Constructors
//- Construct null
@ -333,6 +341,7 @@ public:
//- Construct from base list and position index
inline iteratorBase(const PackedList*, const label);
public:
// Member Operators
@ -370,6 +379,7 @@ public:
//- Disallow assignment from const_iterator - violates const-ness!
void operator=(const const_iterator&);
public:
// Constructors
@ -385,6 +395,7 @@ public:
//- Construct from base list and position index
inline iterator(const PackedList*, const label);
// Member Operators
//- Compare positions (not values)
@ -445,6 +456,7 @@ public:
//- Construct from iterator
inline const_iterator(const iterator&);
// Member operators
//- Compare positions (not values)
@ -466,7 +478,6 @@ public:
inline const_iterator& operator--();
inline const_iterator operator--(int);
};

View File

@ -334,7 +334,6 @@ inline bool Foam::PackedList<nBits>::iterator::operator!=
}
template<unsigned nBits>
inline bool Foam::PackedList<nBits>::const_iterator::operator==
(
@ -355,7 +354,6 @@ inline bool Foam::PackedList<nBits>::const_iterator::operator!=
}
template<unsigned nBits>
inline typename Foam::PackedList<nBits>::iterator&
Foam::PackedList<nBits>::iterator::operator=(const iteratorBase& iter)
@ -712,16 +710,14 @@ inline void Foam::PackedList<nBits>::shrink()
}
template<unsigned nBits>
inline Foam::List<unsigned int>&
Foam::PackedList<nBits>::storage()
inline Foam::List<unsigned int>& Foam::PackedList<nBits>::storage()
{
return static_cast<StorageList&>(*this);
}
template<unsigned nBits>
inline const Foam::List<unsigned int>&
Foam::PackedList<nBits>::storage() const
inline const Foam::List<unsigned int>& Foam::PackedList<nBits>::storage() const
{
return static_cast<const StorageList&>(*this);
}
@ -738,8 +734,7 @@ inline void Foam::PackedList<nBits>::transfer(PackedList<nBits>& lst)
template<unsigned nBits>
inline Foam::Xfer< Foam::PackedList<nBits> >
Foam::PackedList<nBits>::xfer()
inline Foam::Xfer<Foam::PackedList<nBits> > Foam::PackedList<nBits>::xfer()
{
return xferMove(*this);
}

View File

@ -146,8 +146,7 @@ public:
PtrList(Istream&);
// Destructor
//- Destructor
~PtrList();

View File

@ -170,30 +170,35 @@ inline Foam::PtrList<T>::iterator::iterator(T** ptr)
ptr_(ptr)
{}
template<class T>
inline bool Foam::PtrList<T>::iterator::operator==(const iterator& iter) const
{
return ptr_ == iter.ptr_;
}
template<class T>
inline bool Foam::PtrList<T>::iterator::operator!=(const iterator& iter) const
{
return ptr_ != iter.ptr_;
}
template<class T>
inline T& Foam::PtrList<T>::iterator::operator*()
{
return **ptr_;
}
template<class T>
inline T& Foam::PtrList<T>::iterator::operator()()
{
return operator*();
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator++()
@ -202,6 +207,7 @@ Foam::PtrList<T>::iterator::operator++()
return *this;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator++(int)
@ -211,6 +217,7 @@ Foam::PtrList<T>::iterator::operator++(int)
return tmp;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator--()
@ -219,6 +226,7 @@ Foam::PtrList<T>::iterator::operator--()
return *this;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator--(int)
@ -228,6 +236,7 @@ Foam::PtrList<T>::iterator::operator--(int)
return tmp;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator+=(label n)
@ -236,6 +245,7 @@ Foam::PtrList<T>::iterator::operator+=(label n)
return *this;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::operator+(const typename PtrList<T>::iterator& iter, label n)
@ -244,6 +254,7 @@ Foam::operator+(const typename PtrList<T>::iterator& iter, label n)
return tmp += n;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::operator+(label n, const typename PtrList<T>::iterator& iter)
@ -252,6 +263,7 @@ Foam::operator+(label n, const typename PtrList<T>::iterator& iter)
return tmp += n;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::iterator::operator-=(label n)
@ -260,6 +272,7 @@ Foam::PtrList<T>::iterator::operator-=(label n)
return *this;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::operator-(const typename PtrList<T>::iterator& iter, label n)
@ -268,6 +281,7 @@ Foam::operator-(const typename PtrList<T>::iterator& iter, label n)
return tmp -= n;
}
template<class T>
inline Foam::label Foam::operator-
(
@ -278,46 +292,51 @@ inline Foam::label Foam::operator-
return (iter1.ptr_ - iter2.ptr_)/sizeof(T*);
}
template<class T>
inline T& Foam::PtrList<T>::iterator::operator[](label n)
{
return *(*this + n);
}
template<class T>
inline bool Foam::PtrList<T>::iterator::operator<(const iterator& iter) const
{
return ptr_ < iter.ptr_;
}
template<class T>
inline bool Foam::PtrList<T>::iterator::operator>(const iterator& iter) const
{
return ptr_ > iter.ptr_;
}
template<class T>
inline bool Foam::PtrList<T>::iterator::operator<=(const iterator& iter) const
{
return ptr_ <= iter.ptr_;
}
template<class T>
inline bool Foam::PtrList<T>::iterator::operator>=(const iterator& iter) const
{
return ptr_ >= iter.ptr_;
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::begin()
inline typename Foam::PtrList<T>::iterator Foam::PtrList<T>::begin()
{
return ptrs_.begin();
}
template<class T>
inline typename Foam::PtrList<T>::iterator
Foam::PtrList<T>::end()
inline typename Foam::PtrList<T>::iterator Foam::PtrList<T>::end()
{
return ptrs_.end();
}

View File

@ -45,7 +45,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of friend functions and operators
// Forward declaration of classes
class IFstream;
class Time;
@ -61,10 +61,13 @@ class edgeFormatsCore
{
protected:
// Protected Member Functions
//- Read non-comment line
static string getLineNoComment(IFstream&);
public:
// Static Data
//- The file extension corresponding to 'native' edge format

View File

@ -29,7 +29,6 @@ License
#include "IFstream.H"
#include "clock.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fileFormats::EMESHedgeFormat::EMESHedgeFormat
@ -119,8 +118,7 @@ bool Foam::fileFormats::EMESHedgeFormat::read
}
Foam::Ostream&
Foam::fileFormats::EMESHedgeFormat::write
Foam::Ostream& Foam::fileFormats::EMESHedgeFormat::write
(
Ostream& os,
const pointField& pointLst,

View File

@ -79,6 +79,7 @@ protected:
const edgeList&
);
public:
// Constructors

View File

@ -160,7 +160,6 @@ bool Foam::fileFormats::STARCDedgeFormat::readPoints
}
void Foam::fileFormats::STARCDedgeFormat::writePoints
(
Ostream& os,
@ -177,8 +176,7 @@ void Foam::fileFormats::STARCDedgeFormat::writePoints
forAll(pointLst, ptI)
{
os
<< ptI + 1 << " "
os << ptI + 1 << " "
<< pointLst[ptI].x() << " "
<< pointLst[ptI].y() << " "
<< pointLst[ptI].z() << nl;

View File

@ -105,6 +105,7 @@ protected:
const label nEdges
);
public:
// Constructors

View File

@ -60,8 +60,7 @@ void Foam::fileFormats::VTKedgeFormat::writeEdges
const UList<edge>& edgeLst
)
{
os << "LINES " << edgeLst.size() << ' '
<< 3*edgeLst.size() << nl;
os << "LINES " << edgeLst.size() << ' ' << 3*edgeLst.size() << nl;
forAll(edgeLst, edgeI)
{
@ -72,8 +71,6 @@ void Foam::fileFormats::VTKedgeFormat::writeEdges
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fileFormats::VTKedgeFormat::VTKedgeFormat()
@ -104,4 +101,5 @@ void Foam::fileFormats::VTKedgeFormat::write
writeEdges(os, eMesh.edges());
}
// ************************************************************************* //

View File

@ -76,6 +76,7 @@ protected:
//- Write edges
static void writeEdges(Ostream&, const UList<edge>&);
public:
// Constructors

View File

@ -38,11 +38,13 @@ namespace Foam
defineMemberFunctionSelectionTable(edgeMesh,write,fileExtension);
}
Foam::wordHashSet Foam::edgeMesh::readTypes()
{
return wordHashSet(*fileExtensionConstructorTablePtr_);
}
Foam::wordHashSet Foam::edgeMesh::writeTypes()
{
return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
@ -66,6 +68,7 @@ bool Foam::edgeMesh::canReadType
);
}
bool Foam::edgeMesh::canWriteType
(
const word& ext,
@ -215,7 +218,6 @@ void Foam::edgeMesh::reset
// connectivity likely changed
pointEdgesPtr_.clear();
}
}
@ -227,8 +229,7 @@ void Foam::edgeMesh::transfer(edgeMesh& mesh)
}
Foam::Xfer< Foam::edgeMesh >
Foam::edgeMesh::xfer()
Foam::Xfer<Foam::edgeMesh> Foam::edgeMesh::xfer()
{
return xferMove(*this);
}

View File

@ -101,6 +101,7 @@ public:
//- Runtime type information
TypeName("edgeMesh");
// Static
//- Can we read this file format?
@ -115,6 +116,7 @@ public:
static wordHashSet readTypes();
static wordHashSet writeTypes();
// Constructors
//- Construct null
@ -142,6 +144,7 @@ public:
//- Construct from Istream
edgeMesh(Istream&);
// Declare run-time constructor selection table
declareRunTimeSelectionTable
@ -155,6 +158,7 @@ public:
(name)
);
// Selectors
//- Select constructed from filename (explicit extension)
@ -248,8 +252,6 @@ public:
void writeStats(Ostream&) const;
// Write
//- Generic write routine. Chooses writer based on extension.
virtual void write(const fileName& name) const
{

View File

@ -28,7 +28,6 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::autoPtr< Foam::edgeMesh >
Foam::edgeMesh::New(const fileName& name, const word& ext)
{
@ -62,4 +61,5 @@ Foam::edgeMesh::New(const fileName& name)
return New(name, ext);
}
// ************************************************************************* //

View File

@ -426,9 +426,6 @@ Foam::MeshedSurface<Face>::~MeshedSurface()
{}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Face>
@ -1038,8 +1035,7 @@ Foam::MeshedSurface<Face> Foam::MeshedSurface<Face>::subsetMesh
template<class Face>
Foam::MeshedSurface<Face>
Foam::MeshedSurface<Face>::subsetMesh
Foam::MeshedSurface<Face> Foam::MeshedSurface<Face>::subsetMesh
(
const labelHashSet& include
) const
@ -1109,8 +1105,7 @@ void Foam::MeshedSurface<Face>::transfer
template<class Face>
Foam::Xfer< Foam::MeshedSurface<Face> >
Foam::MeshedSurface<Face>::xfer()
Foam::Xfer<Foam::MeshedSurface<Face> > Foam::MeshedSurface<Face>::xfer()
{
return xferMove(*this);
}
@ -1159,6 +1154,7 @@ void Foam::MeshedSurface<Face>::write
MeshedSurfaceProxy<Face>(*this).write(t, surfName);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Face>
@ -1173,8 +1169,7 @@ void Foam::MeshedSurface<Face>::operator=(const MeshedSurface& surf)
template<class Face>
Foam::MeshedSurface<Face>::operator
Foam::MeshedSurfaceProxy<Face>() const
Foam::MeshedSurface<Face>::operator Foam::MeshedSurfaceProxy<Face>() const
{
return MeshedSurfaceProxy<Face>
(
@ -1184,9 +1179,6 @@ Foam::MeshedSurfaceProxy<Face>() const
);
}
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -90,9 +90,10 @@ class MeshedSurface
template<class Face2> friend class UnsortedMeshedSurface;
friend class surfMesh;
private:
//- Private typedefs for convenience
// Private typedefs for convenience
typedef PrimitivePatch
<
@ -106,6 +107,7 @@ private:
typedef UnsortedMeshedSurface<Face> FriendType;
typedef MeshedSurfaceProxy<Face> ProxyType;
// Private Member Data
//- Zone information
@ -113,8 +115,6 @@ private:
List<surfZone> zones_;
// Private member functions
protected:
// Protected Member functions
@ -154,11 +154,13 @@ protected:
//- Set new zones from faceMap
virtual void remapFaces(const UList<label>& faceMap);
public:
//- Runtime type information
ClassName("MeshedSurface");
// Static
//- Face storage only handles triangulated faces
@ -176,6 +178,7 @@ public:
static wordHashSet readTypes();
static wordHashSet writeTypes();
// Constructors
//- Construct null
@ -230,6 +233,7 @@ public:
//- Construct from database
MeshedSurface(const Time&, const word& surfName="");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
@ -243,6 +247,7 @@ public:
(name)
);
// Selectors
//- Select constructed from filename (explicit extension)
@ -255,6 +260,7 @@ public:
//- Select constructed from filename (implicit extension)
static autoPtr<MeshedSurface> New(const fileName&);
// Destructor
virtual ~MeshedSurface();
@ -296,8 +302,8 @@ public:
}
//- Const access to the surface zones.
// If zones are defined, they must be contiguous and cover the entire
// surface.
// If zones are defined, they must be contiguous and cover the
// entire surface
const List<surfZone>& surfZones() const
{
return zones_;
@ -405,6 +411,7 @@ public:
//- Transfer contents to the Xfer container
Xfer<MeshedSurface<Face> > xfer();
// Read
//- Read from file. Chooses reader based on explicit extension
@ -434,7 +441,6 @@ public:
//- Conversion operator to MeshedSurfaceProxy
operator MeshedSurfaceProxy<Face>() const;
};
@ -447,6 +453,7 @@ inline bool MeshedSurface<triFace>::isTri()
return true;
}
//- Specialization for holding triangulated information
template<>
inline label MeshedSurface<triFace>::triangulate()
@ -454,6 +461,7 @@ inline label MeshedSurface<triFace>::triangulate()
return 0;
}
//- Specialization for holding triangulated information
template<>
inline label MeshedSurface<triFace>::triangulate(List<label>& faceMap)
@ -466,6 +474,7 @@ inline label MeshedSurface<triFace>::triangulate(List<label>& faceMap)
return 0;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -26,7 +26,6 @@ License
#include "MeshedSurfaceIOAllocator.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
@ -74,8 +73,6 @@ Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::MeshedSurfaceIOAllocator::clear()

View File

@ -49,7 +49,6 @@ namespace Foam
Class MeshedSurfaceIOAllocator Declaration
\*---------------------------------------------------------------------------*/
//- A helper class for storing points, faces and zones
class MeshedSurfaceIOAllocator
{
// Private data
@ -107,8 +106,6 @@ public:
const Xfer<surfZoneList>& zones
);
// Destructor
// Member Functions

View File

@ -85,7 +85,7 @@ class UnsortedMeshedSurface
private:
//- Private typedefs for convenience
// Private typedefs for convenience
typedef MeshedSurface<Face> ParentType;
typedef MeshedSurface<Face> FriendType;
@ -226,8 +226,7 @@ public:
static autoPtr<UnsortedMeshedSurface> New(const fileName&);
// Destructor
//- Destructor
virtual ~UnsortedMeshedSurface();

View File

@ -287,8 +287,7 @@ void Foam::surfMesh::transfer
}
Foam::Xfer< Foam::MeshedSurface<Foam::face> >
Foam::surfMesh::xfer()
Foam::Xfer<Foam::MeshedSurface<Foam::face> > Foam::surfMesh::xfer()
{
Xfer<MeshedSurface<face> > xf;