mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Preliminary work on hashing
- Hash returns unsigned - FixedList templated on unsigned int - include uLabel.H in UList, HashTable etc. so the output function is know throughout
This commit is contained in:
@ -39,9 +39,10 @@ SourceFiles
|
||||
#define HashTable_H
|
||||
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
#include "word.H"
|
||||
#include "className.H"
|
||||
#include "Xfer.H"
|
||||
#include "className.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -45,9 +45,10 @@ SourceFiles
|
||||
#define StaticHashTable_H
|
||||
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
#include "word.H"
|
||||
#include "className.H"
|
||||
#include "Xfer.H"
|
||||
#include "className.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
#define LList_H
|
||||
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
#define UILList_H
|
||||
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
|
||||
#include "bool.H"
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
|
||||
#include "bool.H"
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * STL Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
void Foam::FixedList<T, Size>::swap(FixedList<T, Size>& a)
|
||||
{
|
||||
List_ACCESS(T, (*this), vp);
|
||||
@ -47,7 +47,7 @@ void Foam::FixedList<T, Size>::swap(FixedList<T, Size>& a)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
bool Foam::FixedList<T, Size>::operator==(const FixedList<T, Size>& a) const
|
||||
{
|
||||
bool equal = true;
|
||||
@ -63,20 +63,20 @@ bool Foam::FixedList<T, Size>::operator==(const FixedList<T, Size>& a) const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
bool Foam::FixedList<T, Size>::operator!=(const FixedList<T, Size>& a) const
|
||||
{
|
||||
return !operator==(a);
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
bool Foam::FixedList<T, Size>::operator<(const FixedList<T, Size>& a) const
|
||||
{
|
||||
for
|
||||
(
|
||||
const_iterator vi = begin(), ai = a.begin();
|
||||
vi < end() && ai < a.end();
|
||||
const_iterator vi = cbegin(), ai = a.cbegin();
|
||||
vi < cend() && ai < a.cend();
|
||||
vi++, ai++
|
||||
)
|
||||
{
|
||||
@ -101,21 +101,21 @@ bool Foam::FixedList<T, Size>::operator<(const FixedList<T, Size>& a) const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
bool Foam::FixedList<T, Size>::operator>(const FixedList<T, Size>& a) const
|
||||
{
|
||||
return a.operator<(*this);
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
bool Foam::FixedList<T, Size>::operator<=(const FixedList<T, Size>& a) const
|
||||
{
|
||||
return !operator>(a);
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
bool Foam::FixedList<T, Size>::operator>=(const FixedList<T, Size>& a) const
|
||||
{
|
||||
return !operator<(a);
|
||||
|
||||
@ -38,7 +38,9 @@ SourceFiles
|
||||
#ifndef FixedList_H
|
||||
#define FixedList_H
|
||||
|
||||
#include "bool.H"
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
#include "Hash.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
@ -49,12 +51,12 @@ namespace Foam
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<class T, label Size> class FixedList;
|
||||
template<class T, unsigned Size> class FixedList;
|
||||
|
||||
template<class T, label Size>
|
||||
template<class T, unsigned Size>
|
||||
Istream& operator>>(Istream&, FixedList<T, Size>&);
|
||||
|
||||
template<class T, label Size>
|
||||
template<class T, unsigned Size>
|
||||
Ostream& operator<<(Ostream&, const FixedList<T, Size>&);
|
||||
|
||||
template<class T> class UList;
|
||||
@ -65,7 +67,7 @@ template<class T> class SLList;
|
||||
Class FixedList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class T, label Size>
|
||||
template<class T, unsigned Size>
|
||||
class FixedList
|
||||
{
|
||||
// Private data
|
||||
@ -78,14 +80,14 @@ public:
|
||||
|
||||
//- Hashing function class
|
||||
// Rotating hash from http://burtleburtle.net/bob/hash/doobs.html
|
||||
template<class HashT=Hash<T> >
|
||||
template< class HashT=Hash<T> >
|
||||
class Hash
|
||||
{
|
||||
public:
|
||||
Hash()
|
||||
{}
|
||||
|
||||
label operator()(const FixedList<T, Size>&) const;
|
||||
inline unsigned operator()(const FixedList<T, Size>&) const;
|
||||
};
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
@ -29,44 +29,44 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline Foam::FixedList<T, Size>::FixedList()
|
||||
{}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline Foam::FixedList<T, Size>::FixedList(const T v[Size])
|
||||
{
|
||||
for (register label i=0; i<Size; i++)
|
||||
for (register unsigned i=0; i<Size; i++)
|
||||
{
|
||||
v_[i] = v[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline Foam::FixedList<T, Size>::FixedList(const T& t)
|
||||
{
|
||||
for (register label i=0; i<Size; i++)
|
||||
for (register unsigned i=0; i<Size; i++)
|
||||
{
|
||||
v_[i] = t;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline Foam::FixedList<T, Size>::FixedList(const UList<T>& lst)
|
||||
{
|
||||
checkSize(lst.size());
|
||||
|
||||
for (register label i=0; i<Size; i++)
|
||||
for (register unsigned i=0; i<Size; i++)
|
||||
{
|
||||
v_[i] = lst[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline Foam::FixedList<T, Size>::FixedList(const SLList<T>& lst)
|
||||
{
|
||||
checkSize(lst.size());
|
||||
@ -84,41 +84,41 @@ inline Foam::FixedList<T, Size>::FixedList(const SLList<T>& lst)
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline Foam::FixedList<T, Size>::FixedList(const FixedList<T, Size>& lst)
|
||||
{
|
||||
for (register label i=0; i<Size; i++)
|
||||
for (register unsigned i=0; i<Size; i++)
|
||||
{
|
||||
v_[i] = lst[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
inline Foam::autoPtr<Foam::FixedList<T, Size> >
|
||||
template<class T, unsigned Size>
|
||||
inline Foam::autoPtr< Foam::FixedList<T, Size> >
|
||||
Foam::FixedList<T, Size>::clone() const
|
||||
{
|
||||
return autoPtr<FixedList<T, Size> >(new FixedList<T, Size>(*this));
|
||||
return autoPtr< FixedList<T, Size> >(new FixedList<T, Size>(*this));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline const Foam::FixedList<T, Size>& Foam::FixedList<T, Size>::null()
|
||||
{
|
||||
return *reinterpret_cast< FixedList<T, Size>* >(0);
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline Foam::label Foam::FixedList<T, Size>::fcIndex(const label i) const
|
||||
{
|
||||
return (i == Size-1 ? 0 : i+1);
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline Foam::label Foam::FixedList<T, Size>::rcIndex(const label i) const
|
||||
{
|
||||
return (i ? i-1 : Size-1);
|
||||
@ -126,51 +126,51 @@ inline Foam::label Foam::FixedList<T, Size>::rcIndex(const label i) const
|
||||
|
||||
|
||||
// Check start is within valid range (0 ... size-1).
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline void Foam::FixedList<T, Size>::checkStart(const label start) const
|
||||
{
|
||||
if (start<0 || (start && start>=Size))
|
||||
if (start < 0 || (start && unsigned(start) >= Size))
|
||||
{
|
||||
FatalErrorIn("FixedList<T, Size>::checkStart(const label)")
|
||||
<< "start " << start << " out of range 0 ... " << max(Size-1, 0)
|
||||
<< "start " << start << " out of range 0 ... " << (Size-1)
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check size is within valid range (0 ... size).
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline void Foam::FixedList<T, Size>::checkSize(const label size) const
|
||||
{
|
||||
if (size<0 || size>Size)
|
||||
if (size < 0 || unsigned(size) > Size)
|
||||
{
|
||||
FatalErrorIn("FixedList<T, Size>::checkSize(const label)")
|
||||
<< "size " << size << " out of range 0 ... " << Size
|
||||
<< "size " << size << " out of range 0 ... " << (Size)
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check index i is within valid range (0 ... size-1).
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline void Foam::FixedList<T, Size>::checkIndex(const label i) const
|
||||
{
|
||||
if (!Size)
|
||||
{
|
||||
FatalErrorIn("FixedList<T, Size>::checkIndex(const label)")
|
||||
<< "attempt to access element from zero sized list"
|
||||
<< "attempt to access element from zero-sized list"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
else if (i<0 || i>=Size)
|
||||
else if (i < 0 || i >= Size)
|
||||
{
|
||||
FatalErrorIn("FixedList<T, Size>::checkIndex(const label)")
|
||||
<< "index " << i << " out of range 0 ... " << Size-1
|
||||
<< "index " << i << " out of range 0 ... " << (Size-1)
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline void Foam::FixedList<T, Size>::resize(const label s)
|
||||
{
|
||||
# ifdef FULLDEBUG
|
||||
@ -178,7 +178,7 @@ inline void Foam::FixedList<T, Size>::resize(const label s)
|
||||
# endif
|
||||
}
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline void Foam::FixedList<T, Size>::setSize(const label s)
|
||||
{
|
||||
# ifdef FULLDEBUG
|
||||
@ -186,17 +186,17 @@ inline void Foam::FixedList<T, Size>::setSize(const label s)
|
||||
# endif
|
||||
}
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline void Foam::FixedList<T, Size>::transfer(const FixedList<T, Size>& lst)
|
||||
{
|
||||
for (register label i=0; i<Size; i++)
|
||||
for (register unsigned i=0; i<Size; i++)
|
||||
{
|
||||
v_[i] = lst[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline const T*
|
||||
Foam::FixedList<T, Size>::cdata() const
|
||||
{
|
||||
@ -204,7 +204,7 @@ Foam::FixedList<T, Size>::cdata() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline T*
|
||||
Foam::FixedList<T, Size>::data()
|
||||
{
|
||||
@ -215,7 +215,7 @@ Foam::FixedList<T, Size>::data()
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
// element access
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline T& Foam::FixedList<T, Size>::operator[](const label i)
|
||||
{
|
||||
# ifdef FULLDEBUG
|
||||
@ -226,7 +226,7 @@ inline T& Foam::FixedList<T, Size>::operator[](const label i)
|
||||
|
||||
|
||||
// const element access
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline const T& Foam::FixedList<T, Size>::operator[](const label i) const
|
||||
{
|
||||
# ifdef FULLDEBUG
|
||||
@ -236,27 +236,27 @@ inline const T& Foam::FixedList<T, Size>::operator[](const label i) const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline void Foam::FixedList<T, Size>::operator=(const T lst[Size])
|
||||
{
|
||||
for (register label i=0; i<Size; i++)
|
||||
for (register unsigned i=0; i<Size; i++)
|
||||
{
|
||||
v_[i] = lst[i];
|
||||
}
|
||||
}
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline void Foam::FixedList<T, Size>::operator=(const UList<T>& lst)
|
||||
{
|
||||
checkSize(lst.size());
|
||||
|
||||
for (register label i=0; i<Size; i++)
|
||||
for (register unsigned i=0; i<Size; i++)
|
||||
{
|
||||
v_[i] = lst[i];
|
||||
}
|
||||
}
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline void Foam::FixedList<T, Size>::operator=(const SLList<T>& lst)
|
||||
{
|
||||
checkSize(lst.size());
|
||||
@ -273,10 +273,10 @@ inline void Foam::FixedList<T, Size>::operator=(const SLList<T>& lst)
|
||||
}
|
||||
}
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline void Foam::FixedList<T, Size>::operator=(const T& t)
|
||||
{
|
||||
for (register label i=0; i<Size; i++)
|
||||
for (register unsigned i=0; i<Size; i++)
|
||||
{
|
||||
v_[i] = t;
|
||||
}
|
||||
@ -285,7 +285,7 @@ inline void Foam::FixedList<T, Size>::operator=(const T& t)
|
||||
|
||||
// * * * * * * * * * * * * * * STL Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::iterator
|
||||
Foam::FixedList<T, Size>::begin()
|
||||
{
|
||||
@ -293,7 +293,7 @@ Foam::FixedList<T, Size>::begin()
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::begin() const
|
||||
{
|
||||
@ -301,7 +301,7 @@ Foam::FixedList<T, Size>::begin() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::cbegin() const
|
||||
{
|
||||
@ -309,7 +309,7 @@ Foam::FixedList<T, Size>::cbegin() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::iterator
|
||||
Foam::FixedList<T, Size>::end()
|
||||
{
|
||||
@ -317,7 +317,7 @@ Foam::FixedList<T, Size>::end()
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::end() const
|
||||
{
|
||||
@ -325,7 +325,7 @@ Foam::FixedList<T, Size>::end() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::cend() const
|
||||
{
|
||||
@ -333,7 +333,7 @@ Foam::FixedList<T, Size>::cend() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::iterator
|
||||
Foam::FixedList<T, Size>::rbegin()
|
||||
{
|
||||
@ -341,7 +341,7 @@ Foam::FixedList<T, Size>::rbegin()
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::rbegin() const
|
||||
{
|
||||
@ -349,7 +349,7 @@ Foam::FixedList<T, Size>::rbegin() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::crbegin() const
|
||||
{
|
||||
@ -357,7 +357,7 @@ Foam::FixedList<T, Size>::crbegin() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::iterator
|
||||
Foam::FixedList<T, Size>::rend()
|
||||
{
|
||||
@ -365,7 +365,7 @@ Foam::FixedList<T, Size>::rend()
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::rend() const
|
||||
{
|
||||
@ -373,7 +373,7 @@ Foam::FixedList<T, Size>::rend() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::crend() const
|
||||
{
|
||||
@ -381,21 +381,21 @@ Foam::FixedList<T, Size>::crend() const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline Foam::label Foam::FixedList<T, Size>::size() const
|
||||
{
|
||||
return Size;
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline Foam::label Foam::FixedList<T, Size>::max_size() const
|
||||
{
|
||||
return Size;
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
inline bool Foam::FixedList<T, Size>::empty() const
|
||||
{
|
||||
return false;
|
||||
@ -405,18 +405,18 @@ inline bool Foam::FixedList<T, Size>::empty() const
|
||||
#ifndef __CINT__
|
||||
|
||||
// Rotating Hash
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
template<class HashT>
|
||||
inline Foam::label Foam::FixedList<T, Size>::Hash<HashT>::operator()
|
||||
inline unsigned Foam::FixedList<T, Size>::Hash<HashT>::operator()
|
||||
(
|
||||
const FixedList<T, Size>& lst
|
||||
) const
|
||||
{
|
||||
static const label farbit(8*sizeof(label)-4);
|
||||
static const unsigned farbit(8*sizeof(label)-4);
|
||||
|
||||
label val = Size;
|
||||
unsigned val = Size;
|
||||
|
||||
for (register int i=0; i<Size; i++)
|
||||
for (register unsigned i=0; i<Size; i++)
|
||||
{
|
||||
val = (val << 4) ^ (val >> farbit) ^ HashT()(lst[i]);
|
||||
}
|
||||
|
||||
@ -32,14 +32,14 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
Foam::FixedList<T, Size>::FixedList(Istream& is)
|
||||
{
|
||||
operator>>(is, *this);
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
Foam::Istream& Foam::operator>>(Foam::Istream& is, FixedList<T, Size>& L)
|
||||
{
|
||||
is.fatalCheck("operator>>(Istream&, FixedList<T, Size>&)");
|
||||
@ -86,7 +86,7 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, FixedList<T, Size>& L)
|
||||
|
||||
if (listDelimiter == token::BEGIN_LIST)
|
||||
{
|
||||
for (register label i=0; i<Size; i++)
|
||||
for (register unsigned i=0; i<Size; i++)
|
||||
{
|
||||
is >> L[i];
|
||||
|
||||
@ -108,7 +108,7 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, FixedList<T, Size>& L)
|
||||
"reading the single entry"
|
||||
);
|
||||
|
||||
for (register label i=0; i<Size; i++)
|
||||
for (register unsigned i=0; i<Size; i++)
|
||||
{
|
||||
L[i] = element;
|
||||
}
|
||||
@ -134,7 +134,7 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, FixedList<T, Size>& L)
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
void Foam::FixedList<T, Size>::writeEntry(Ostream& os) const
|
||||
{
|
||||
if
|
||||
@ -153,7 +153,7 @@ void Foam::FixedList<T, Size>::writeEntry(Ostream& os) const
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
void Foam::FixedList<T, Size>::writeEntry
|
||||
(
|
||||
const word& keyword,
|
||||
@ -166,7 +166,7 @@ void Foam::FixedList<T, Size>::writeEntry
|
||||
}
|
||||
|
||||
|
||||
template<class T, Foam::label Size>
|
||||
template<class T, unsigned Size>
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const FixedList<T, Size>& L)
|
||||
{
|
||||
// Write list contents depending on data format
|
||||
|
||||
@ -205,7 +205,7 @@ Foam::List<T>::List(InputIterator first, InputIterator last)
|
||||
|
||||
// Construct as copy of FixedList<T, Size>
|
||||
template<class T>
|
||||
template<Foam::label Size>
|
||||
template<unsigned Size>
|
||||
Foam::List<T>::List(const FixedList<T, Size>& lst)
|
||||
:
|
||||
UList<T>(NULL, Size)
|
||||
|
||||
@ -59,7 +59,7 @@ template<class T> class List;
|
||||
|
||||
template<class T> Istream& operator>>(Istream&, List<T>&);
|
||||
|
||||
template<class T, label Size> class FixedList;
|
||||
template<class T, unsigned Size> class FixedList;
|
||||
template<class T> class PtrList;
|
||||
template<class T> class SLList;
|
||||
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
|
||||
@ -117,7 +117,7 @@ public:
|
||||
List(InputIterator first, InputIterator last);
|
||||
|
||||
//- Construct as copy of FixedList<T, Size>
|
||||
template<label Size>
|
||||
template<unsigned Size>
|
||||
List(const FixedList<T, Size>&);
|
||||
|
||||
//- Construct as copy of PtrList<T>
|
||||
|
||||
@ -43,8 +43,9 @@ SourceFiles
|
||||
#ifndef UList_H
|
||||
#define UList_H
|
||||
|
||||
#include "label.H"
|
||||
#include "bool.H"
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -46,6 +46,7 @@ SourceFiles
|
||||
#include "char.H"
|
||||
#include "bool.H"
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
#include "scalar.H"
|
||||
#include "fileName.H"
|
||||
#include "InfoProxy.H"
|
||||
|
||||
@ -36,8 +36,8 @@ SourceFiles
|
||||
#ifndef readHexLabel_H
|
||||
#define readHexLabel_H
|
||||
|
||||
#include "ISstream.H"
|
||||
#include "label.H"
|
||||
#include "ISstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ SourceFiles
|
||||
#define token_H
|
||||
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
#include "scalar.H"
|
||||
#include "word.H"
|
||||
#include "InfoProxy.H"
|
||||
|
||||
@ -36,9 +36,9 @@ SourceFiles
|
||||
#ifndef dlLibraryTable_H
|
||||
#define dlLibraryTable_H
|
||||
|
||||
#include "HashTable.H"
|
||||
#include "label.H"
|
||||
#include "Hash.H"
|
||||
#include "HashTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -47,8 +47,8 @@ SourceFiles
|
||||
#ifndef messageStream_H
|
||||
#define messageStream_H
|
||||
|
||||
#include "string.H"
|
||||
#include "label.H"
|
||||
#include "string.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -40,7 +40,6 @@ SourceFiles
|
||||
#ifndef SubField_H
|
||||
#define SubField_H
|
||||
|
||||
#include "Field.H"
|
||||
#include "SubList.H"
|
||||
#include "Field.H"
|
||||
|
||||
@ -49,6 +48,10 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
//- Pre-declare SubField and related Field type
|
||||
template<class Type> class Field;
|
||||
template<class Type> class SubField;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class SubField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -36,8 +36,8 @@ SourceFiles
|
||||
#ifndef labelField_H
|
||||
#define labelField_H
|
||||
|
||||
#include "Field.H"
|
||||
#include "label.H"
|
||||
#include "Field.H"
|
||||
|
||||
#define TEMPLATE
|
||||
#include "FieldFunctionsM.H"
|
||||
|
||||
@ -41,10 +41,11 @@ SourceFiles
|
||||
#ifndef pointConstraint_H
|
||||
#define pointConstraint_H
|
||||
|
||||
#include "Tuple2.H"
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
#include "vector.H"
|
||||
#include "tensor.H"
|
||||
#include "Tuple2.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -39,9 +39,10 @@ SourceFiles
|
||||
#ifndef Matrix_H
|
||||
#define Matrix_H
|
||||
|
||||
#include "List.H"
|
||||
#include "label.H"
|
||||
#include "bool.H"
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
#include "List.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -78,7 +78,6 @@ SourceFiles
|
||||
#ifndef cellMatcher_H
|
||||
#define cellMatcher_H
|
||||
|
||||
#include "label.H"
|
||||
#include "labelList.H"
|
||||
#include "faceList.H"
|
||||
#include "boolList.H"
|
||||
|
||||
@ -136,7 +136,7 @@ public:
|
||||
//- Hash specialization for hashing edges
|
||||
// Simple commutative hash.
|
||||
template<>
|
||||
inline label Hash<edge>::operator()(const edge& e) const
|
||||
inline unsigned Hash<edge>::operator()(const edge& e) const
|
||||
{
|
||||
return (e[0]*e[1] + e[0]+e[1]);
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ public:
|
||||
//- Hash specialization for hashing triFace
|
||||
// Simple commutative hash.
|
||||
template<>
|
||||
inline label Hash<triFace>::operator()(const triFace& t) const
|
||||
inline unsigned Hash<triFace>::operator()(const triFace& t) const
|
||||
{
|
||||
return (t[0]*t[1]*t[2] + t[0]+t[1]+t[2]);
|
||||
}
|
||||
|
||||
@ -36,7 +36,6 @@ SourceFiles
|
||||
#ifndef walkPatch_H
|
||||
#define walkPatch_H
|
||||
|
||||
#include "label.H"
|
||||
#include "labelList.H"
|
||||
#include "primitivePatch.H"
|
||||
|
||||
|
||||
@ -26,9 +26,11 @@ Class
|
||||
Foam::DiagTensor
|
||||
|
||||
Description
|
||||
Templated 3D DiagTensor derived from VectorSpace adding construction from
|
||||
3 components, element access using xx(), yy() and zz() member functions and
|
||||
the inner-product (dot-product) and outer-product operators.
|
||||
Templated 3D DiagTensor derived from VectorSpace.
|
||||
|
||||
Adding construction from 3 components, element access using xx(), yy()
|
||||
and zz() member functions and the inner-product (dot-product) and
|
||||
outer-product operators.
|
||||
|
||||
SourceFiles
|
||||
DiagTensorI.H
|
||||
|
||||
@ -27,8 +27,8 @@ License
|
||||
#ifndef doubleFloat_H
|
||||
#define doubleFloat_H
|
||||
|
||||
#include "products.H"
|
||||
#include "label.H"
|
||||
#include "products.H"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
@ -29,15 +29,13 @@ Description
|
||||
Template function to specify if the data of a type are contiguous.
|
||||
|
||||
The default function specifies that data are not contiguous.
|
||||
This is specialised for the types (e.g. primitives) with contiguous data.
|
||||
This is specialised for the types (eg, primitives) with contiguous data.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef contiguous_H
|
||||
#define contiguous_H
|
||||
|
||||
#include "label.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -46,7 +44,7 @@ namespace Foam
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
template<class T, label Size> class FixedList;
|
||||
template<class T, unsigned Size> class FixedList;
|
||||
template<class T> class Pair;
|
||||
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ Typedef
|
||||
Foam::diagTensor
|
||||
|
||||
Description
|
||||
3D diagTensor obtained from generic Vector
|
||||
A scalar version of the templated DiagTensor
|
||||
|
||||
SourceFiles
|
||||
diagTensor.C
|
||||
|
||||
@ -35,6 +35,7 @@ Description
|
||||
#define Hash_H
|
||||
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
#include "pTraits.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -55,9 +56,9 @@ public:
|
||||
Hash()
|
||||
{}
|
||||
|
||||
label operator()(const PrimitiveType& p) const
|
||||
unsigned operator()(const PrimitiveType& p) const
|
||||
{
|
||||
return label(p);
|
||||
return unsigned(p);
|
||||
}
|
||||
|
||||
};
|
||||
@ -75,7 +76,7 @@ public:
|
||||
Hash()
|
||||
{}
|
||||
|
||||
long operator()(const void* const& p) const
|
||||
unsigned operator()(const void* const& p) const
|
||||
{
|
||||
return long(p);
|
||||
}
|
||||
|
||||
@ -59,6 +59,15 @@ label pow(label a, label b)
|
||||
ans *= a;
|
||||
}
|
||||
|
||||
# ifdef FULLDEBUG
|
||||
if (b < 0)
|
||||
{
|
||||
FatalErrorIn("pow(label a, label b)")
|
||||
<< "negative value for b is not supported"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
# endif
|
||||
|
||||
return ans;
|
||||
}
|
||||
|
||||
@ -73,7 +82,7 @@ label factorial(label n)
|
||||
};
|
||||
|
||||
# ifdef FULLDEBUG
|
||||
if (n>12 && n<0)
|
||||
if (n > 12 && n < 0)
|
||||
{
|
||||
FatalErrorIn("factorial(label n)")
|
||||
<< "n value out of range"
|
||||
|
||||
@ -85,14 +85,14 @@ public:
|
||||
static const string null;
|
||||
|
||||
|
||||
//- Hashing function class
|
||||
//- Hashing function class, shared by all the derived classes
|
||||
class hash
|
||||
{
|
||||
public:
|
||||
hash()
|
||||
{}
|
||||
|
||||
inline size_type operator()(const string&) const;
|
||||
inline unsigned operator()(const string&) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -196,20 +196,21 @@ inline Foam::string Foam::string::operator()(const size_type n) const
|
||||
}
|
||||
|
||||
|
||||
inline Foam::string::size_type Foam::string::hash::operator()
|
||||
inline unsigned Foam::string::hash::operator()
|
||||
(
|
||||
const string& key
|
||||
) const
|
||||
{
|
||||
register size_type val = 0;
|
||||
const size_type len = key.length();
|
||||
const char *data = key.data();
|
||||
|
||||
for (string::const_iterator iter=key.begin(); iter!=key.end(); ++iter)
|
||||
register unsigned val = 0;
|
||||
for (register size_type i=0; i < len; ++data, ++i)
|
||||
{
|
||||
val = (val << 1) ^ *iter;
|
||||
val = (val << 1) ^ *data;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,7 +26,7 @@ Primitive
|
||||
uint
|
||||
|
||||
Description
|
||||
System uinteger
|
||||
System unsigned integer
|
||||
|
||||
SourceFiles
|
||||
uintIO.C
|
||||
|
||||
@ -26,7 +26,7 @@ Typedef
|
||||
Foam::vector
|
||||
|
||||
Description
|
||||
vector obtained from generic Vector
|
||||
A scalar version of the templated Vector
|
||||
|
||||
SourceFiles
|
||||
vector.C
|
||||
|
||||
@ -106,8 +106,8 @@ class fvMeshDistribute
|
||||
}
|
||||
};
|
||||
|
||||
// Hash labelPair. Note non-commutative since p[0] is face, p[1] is
|
||||
// processor.
|
||||
//- Hash labelPair.
|
||||
// Note non-commutative since p[0] is face, p[1] is processor.
|
||||
class labelPairHash
|
||||
{
|
||||
public:
|
||||
@ -115,12 +115,11 @@ class fvMeshDistribute
|
||||
labelPairHash()
|
||||
{}
|
||||
|
||||
label operator()(const labelPair& p, const uLabel tableSize) const
|
||||
unsigned operator()(const labelPair& p) const
|
||||
{
|
||||
uLabel p0 = static_cast<uLabel>(p[0]);
|
||||
uLabel p1 = static_cast<uLabel>(p[1]);
|
||||
uLabel key = p0*p0+p0+p1;
|
||||
return key % tableSize;
|
||||
return (p0*p0 + p0+p1);
|
||||
}
|
||||
};
|
||||
|
||||
@ -287,7 +286,7 @@ class fvMeshDistribute
|
||||
void addProcPatches
|
||||
(
|
||||
const labelList&, // processor that neighbour is on
|
||||
labelList& procPatchID
|
||||
labelList& procPatchID
|
||||
);
|
||||
|
||||
//- Get boundary faces to be repatched. Is -1 or new patchID
|
||||
|
||||
@ -49,9 +49,9 @@ namespace Foam
|
||||
// but which is not on a cyclic, symmetry or processor patch.
|
||||
void setRefCell
|
||||
(
|
||||
const volScalarField& field,
|
||||
const dictionary& dict,
|
||||
label& refCelli,
|
||||
const volScalarField&,
|
||||
const dictionary&,
|
||||
label& refCellI,
|
||||
scalar& refValue,
|
||||
bool forceReference = false
|
||||
);
|
||||
|
||||
@ -26,7 +26,7 @@ Class
|
||||
Foam::labelBits
|
||||
|
||||
Description
|
||||
A 29bits label and 3bits packed into single label
|
||||
A 29bits label and 3bits direction packed into single label
|
||||
|
||||
SourceFiles
|
||||
|
||||
@ -36,6 +36,7 @@ SourceFiles
|
||||
#define labelBits_H
|
||||
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
#include "direction.H"
|
||||
#include "error.H"
|
||||
|
||||
@ -134,7 +135,7 @@ public:
|
||||
{
|
||||
return is >> lb.data_;
|
||||
}
|
||||
|
||||
|
||||
friend inline Ostream& operator<<(Ostream& os, const labelBits& lb)
|
||||
{
|
||||
return os << lb.data_;
|
||||
|
||||
Reference in New Issue
Block a user