From 576d9388f02908b7bf7c89d95f899375b65bb988 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Fri, 27 Feb 2009 12:40:37 +0100
Subject: [PATCH] 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
---
 .../HashTables/HashTable/HashTable.H          |   3 +-
 .../StaticHashTable/StaticHashTable.H         |   3 +-
 .../LinkedLists/accessTypes/LList/LList.H     |   1 +
 .../LinkedLists/accessTypes/UILList/UILList.H |   1 +
 .../linkTypes/DLListBase/DLListBase.H         |   1 +
 .../linkTypes/SLListBase/SLListBase.H         |   1 +
 .../containers/Lists/FixedList/FixedList.C    |  18 +--
 .../containers/Lists/FixedList/FixedList.H    |  14 +-
 .../containers/Lists/FixedList/FixedListI.H   | 122 +++++++++---------
 .../containers/Lists/FixedList/FixedListIO.C  |  14 +-
 src/OpenFOAM/containers/Lists/List/List.C     |   2 +-
 src/OpenFOAM/containers/Lists/List/List.H     |   4 +-
 src/OpenFOAM/containers/Lists/UList/UList.H   |   3 +-
 .../db/IOstreams/IOstreams/IOstream.H         |   1 +
 .../db/IOstreams/Sstreams/readHexLabel.H      |   2 +-
 src/OpenFOAM/db/IOstreams/token/token.H       |   1 +
 .../db/dlLibraryTable/dlLibraryTable.H        |   2 +-
 src/OpenFOAM/db/error/messageStream.H         |   2 +-
 src/OpenFOAM/fields/Fields/Field/SubField.H   |   5 +-
 .../fields/Fields/labelField/labelField.H     |   2 +-
 .../pointConstraint/pointConstraint.H         |   3 +-
 src/OpenFOAM/matrices/Matrix/Matrix.H         |   5 +-
 .../meshShapes/cellMatcher/cellMatcher.H      |   1 -
 src/OpenFOAM/meshes/meshShapes/edge/edge.H    |   2 +-
 .../meshes/meshShapes/triFace/triFace.H       |   2 +-
 .../primitiveMesh/primitivePatch/walkPatch.H  |   1 -
 .../primitives/DiagTensor/DiagTensor.H        |   8 +-
 src/OpenFOAM/primitives/Scalar/doubleFloat.H  |   2 +-
 .../primitives/contiguous/contiguous.H        |   6 +-
 .../primitives/diagTensor/diagTensor.H        |   2 +-
 src/OpenFOAM/primitives/hashes/Hash/Hash.H    |   7 +-
 src/OpenFOAM/primitives/label/label.C         |  11 +-
 .../primitives/strings/string/string.H        |   4 +-
 .../primitives/strings/string/stringI.H       |  11 +-
 src/OpenFOAM/primitives/uint/uint.H           |   2 +-
 src/OpenFOAM/primitives/vector/vector.H       |   2 +-
 .../fvMeshDistribute/fvMeshDistribute.H       |  11 +-
 .../general/findRefCell/findRefCell.H         |   6 +-
 src/meshTools/indexedOctree/labelBits.H       |   5 +-
 39 files changed, 159 insertions(+), 134 deletions(-)

diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
index 64812044daf..696ab410752 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
@@ -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"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H
index e0a01746f9d..3c3264e42a8 100644
--- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H
+++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.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"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H
index 44e9878c720..9c8a22945ac 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H
@@ -38,6 +38,7 @@ SourceFiles
 #define LList_H
 
 #include "label.H"
+#include "uLabel.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.H b/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.H
index 448add5df34..feefd60c7c8 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.H
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.H
@@ -38,6 +38,7 @@ SourceFiles
 #define UILList_H
 
 #include "label.H"
+#include "uLabel.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H
index ba3423c8e2c..848b797b2ea 100644
--- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H
+++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H
@@ -38,6 +38,7 @@ SourceFiles
 
 #include "bool.H"
 #include "label.H"
+#include "uLabel.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H
index 0c67d7a56e6..b5c957a5370 100644
--- a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H
+++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H
@@ -38,6 +38,7 @@ SourceFiles
 
 #include "bool.H"
 #include "label.H"
+#include "uLabel.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.C b/src/OpenFOAM/containers/Lists/FixedList/FixedList.C
index eec73d41437..735d897bb4d 100644
--- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.C
+++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.C
@@ -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);
diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
index 2cb2cfcea38..34bc05749f1 100644
--- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
+++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
@@ -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
diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H
index 66a6257be82..8523ba76720 100644
--- a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H
+++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H
@@ -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]);
     }
diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C
index 49caad2a0ad..aab7376e059 100644
--- a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C
+++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C
@@ -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
diff --git a/src/OpenFOAM/containers/Lists/List/List.C b/src/OpenFOAM/containers/Lists/List/List.C
index 137f17e8eae..542f9451847 100644
--- a/src/OpenFOAM/containers/Lists/List/List.C
+++ b/src/OpenFOAM/containers/Lists/List/List.C
@@ -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)
diff --git a/src/OpenFOAM/containers/Lists/List/List.H b/src/OpenFOAM/containers/Lists/List/List.H
index 983b2be0081..0c08eed8fef 100644
--- a/src/OpenFOAM/containers/Lists/List/List.H
+++ b/src/OpenFOAM/containers/Lists/List/List.H
@@ -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>
diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H
index 80bf066e19c..6370f8e749f 100644
--- a/src/OpenFOAM/containers/Lists/UList/UList.H
+++ b/src/OpenFOAM/containers/Lists/UList/UList.H
@@ -43,8 +43,9 @@ SourceFiles
 #ifndef UList_H
 #define UList_H
 
-#include "label.H"
 #include "bool.H"
+#include "label.H"
+#include "uLabel.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/IOstream.H b/src/OpenFOAM/db/IOstreams/IOstreams/IOstream.H
index 56f94a688be..f2846f47f57 100644
--- a/src/OpenFOAM/db/IOstreams/IOstreams/IOstream.H
+++ b/src/OpenFOAM/db/IOstreams/IOstreams/IOstream.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"
diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/readHexLabel.H b/src/OpenFOAM/db/IOstreams/Sstreams/readHexLabel.H
index 63f395b2a26..fffccc45259 100644
--- a/src/OpenFOAM/db/IOstreams/Sstreams/readHexLabel.H
+++ b/src/OpenFOAM/db/IOstreams/Sstreams/readHexLabel.H
@@ -36,8 +36,8 @@ SourceFiles
 #ifndef readHexLabel_H
 #define readHexLabel_H
 
-#include "ISstream.H"
 #include "label.H"
+#include "ISstream.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/db/IOstreams/token/token.H b/src/OpenFOAM/db/IOstreams/token/token.H
index cf51ad8a091..2defc09d73b 100644
--- a/src/OpenFOAM/db/IOstreams/token/token.H
+++ b/src/OpenFOAM/db/IOstreams/token/token.H
@@ -39,6 +39,7 @@ SourceFiles
 #define token_H
 
 #include "label.H"
+#include "uLabel.H"
 #include "scalar.H"
 #include "word.H"
 #include "InfoProxy.H"
diff --git a/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.H b/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.H
index 086a2c76553..01d574f8e8f 100644
--- a/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.H
+++ b/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.H
@@ -36,9 +36,9 @@ SourceFiles
 #ifndef dlLibraryTable_H
 #define dlLibraryTable_H
 
-#include "HashTable.H"
 #include "label.H"
 #include "Hash.H"
+#include "HashTable.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/db/error/messageStream.H b/src/OpenFOAM/db/error/messageStream.H
index b4978911a76..20b04363276 100644
--- a/src/OpenFOAM/db/error/messageStream.H
+++ b/src/OpenFOAM/db/error/messageStream.H
@@ -47,8 +47,8 @@ SourceFiles
 #ifndef messageStream_H
 #define messageStream_H
 
-#include "string.H"
 #include "label.H"
+#include "string.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/fields/Fields/Field/SubField.H b/src/OpenFOAM/fields/Fields/Field/SubField.H
index f1eecd23cfa..a9930d177d4 100644
--- a/src/OpenFOAM/fields/Fields/Field/SubField.H
+++ b/src/OpenFOAM/fields/Fields/Field/SubField.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
 \*---------------------------------------------------------------------------*/
diff --git a/src/OpenFOAM/fields/Fields/labelField/labelField.H b/src/OpenFOAM/fields/Fields/labelField/labelField.H
index c479588387d..0431f5c1da2 100644
--- a/src/OpenFOAM/fields/Fields/labelField/labelField.H
+++ b/src/OpenFOAM/fields/Fields/labelField/labelField.H
@@ -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"
diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H
index d8407de9f2e..c2796f4600b 100644
--- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.H
+++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointConstraint/pointConstraint.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"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.H b/src/OpenFOAM/matrices/Matrix/Matrix.H
index b96e886c4bc..fd623fdb206 100644
--- a/src/OpenFOAM/matrices/Matrix/Matrix.H
+++ b/src/OpenFOAM/matrices/Matrix/Matrix.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"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H b/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H
index dc11cad05d0..b2f02e37beb 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H
@@ -78,7 +78,6 @@ SourceFiles
 #ifndef cellMatcher_H
 #define cellMatcher_H
 
-#include "label.H"
 #include "labelList.H"
 #include "faceList.H"
 #include "boolList.H"
diff --git a/src/OpenFOAM/meshes/meshShapes/edge/edge.H b/src/OpenFOAM/meshes/meshShapes/edge/edge.H
index c726ad941c2..dffb3db0224 100644
--- a/src/OpenFOAM/meshes/meshShapes/edge/edge.H
+++ b/src/OpenFOAM/meshes/meshShapes/edge/edge.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]);
 }
diff --git a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H
index c962a4fc5d4..c299cfa2b70 100644
--- a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H
+++ b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H
@@ -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]);
 }
diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/walkPatch.H b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/walkPatch.H
index 67927c217ac..efa5c883bad 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/walkPatch.H
+++ b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/walkPatch.H
@@ -36,7 +36,6 @@ SourceFiles
 #ifndef walkPatch_H
 #define walkPatch_H
 
-#include "label.H"
 #include "labelList.H"
 #include "primitivePatch.H"
 
diff --git a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H
index 035551a240f..b356353c7ae 100644
--- a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H
+++ b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.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
diff --git a/src/OpenFOAM/primitives/Scalar/doubleFloat.H b/src/OpenFOAM/primitives/Scalar/doubleFloat.H
index c68aa725f92..cec1d83377d 100644
--- a/src/OpenFOAM/primitives/Scalar/doubleFloat.H
+++ b/src/OpenFOAM/primitives/Scalar/doubleFloat.H
@@ -27,8 +27,8 @@ License
 #ifndef doubleFloat_H
 #define doubleFloat_H
 
-#include "products.H"
 #include "label.H"
+#include "products.H"
 
 #include <cmath>
 
diff --git a/src/OpenFOAM/primitives/contiguous/contiguous.H b/src/OpenFOAM/primitives/contiguous/contiguous.H
index 3c272839a0d..ee38d8eb104 100644
--- a/src/OpenFOAM/primitives/contiguous/contiguous.H
+++ b/src/OpenFOAM/primitives/contiguous/contiguous.H
@@ -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;
 
 
diff --git a/src/OpenFOAM/primitives/diagTensor/diagTensor.H b/src/OpenFOAM/primitives/diagTensor/diagTensor.H
index 0a23ab1bf6e..99d8cf4986e 100644
--- a/src/OpenFOAM/primitives/diagTensor/diagTensor.H
+++ b/src/OpenFOAM/primitives/diagTensor/diagTensor.H
@@ -26,7 +26,7 @@ Typedef
     Foam::diagTensor
 
 Description
-    3D diagTensor obtained from generic Vector
+    A scalar version of the templated DiagTensor
 
 SourceFiles
     diagTensor.C
diff --git a/src/OpenFOAM/primitives/hashes/Hash/Hash.H b/src/OpenFOAM/primitives/hashes/Hash/Hash.H
index 7675d44bbbd..2a7f2a80865 100644
--- a/src/OpenFOAM/primitives/hashes/Hash/Hash.H
+++ b/src/OpenFOAM/primitives/hashes/Hash/Hash.H
@@ -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);
     }
diff --git a/src/OpenFOAM/primitives/label/label.C b/src/OpenFOAM/primitives/label/label.C
index 38217bd6b2e..999bafdf515 100644
--- a/src/OpenFOAM/primitives/label/label.C
+++ b/src/OpenFOAM/primitives/label/label.C
@@ -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"
diff --git a/src/OpenFOAM/primitives/strings/string/string.H b/src/OpenFOAM/primitives/strings/string/string.H
index 86bbb2a1f5f..3c9cf7aaba4 100644
--- a/src/OpenFOAM/primitives/strings/string/string.H
+++ b/src/OpenFOAM/primitives/strings/string/string.H
@@ -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;
     };
 
 
diff --git a/src/OpenFOAM/primitives/strings/string/stringI.H b/src/OpenFOAM/primitives/strings/string/stringI.H
index dc8c0e8fa06..907ae0e6db5 100644
--- a/src/OpenFOAM/primitives/strings/string/stringI.H
+++ b/src/OpenFOAM/primitives/strings/string/stringI.H
@@ -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;
 }
 
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/uint/uint.H b/src/OpenFOAM/primitives/uint/uint.H
index 5233c56e538..e411e1be3be 100644
--- a/src/OpenFOAM/primitives/uint/uint.H
+++ b/src/OpenFOAM/primitives/uint/uint.H
@@ -26,7 +26,7 @@ Primitive
     uint
 
 Description
-    System uinteger
+    System unsigned integer
 
 SourceFiles
     uintIO.C
diff --git a/src/OpenFOAM/primitives/vector/vector.H b/src/OpenFOAM/primitives/vector/vector.H
index 5c736eb9ae4..2bfac28c4b2 100644
--- a/src/OpenFOAM/primitives/vector/vector.H
+++ b/src/OpenFOAM/primitives/vector/vector.H
@@ -26,7 +26,7 @@ Typedef
     Foam::vector
 
 Description
-    vector obtained from generic Vector
+    A scalar version of the templated Vector
 
 SourceFiles
     vector.C
diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H
index 40db9f8b170..3fd03afe8d0 100644
--- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H
+++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H
@@ -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
diff --git a/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.H b/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.H
index d39c55d4bff..9f09a9efeaa 100644
--- a/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.H
+++ b/src/finiteVolume/cfdTools/general/findRefCell/findRefCell.H
@@ -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
 );
diff --git a/src/meshTools/indexedOctree/labelBits.H b/src/meshTools/indexedOctree/labelBits.H
index 60756a4fc37..28847b6baa3 100644
--- a/src/meshTools/indexedOctree/labelBits.H
+++ b/src/meshTools/indexedOctree/labelBits.H
@@ -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_;
-- 
GitLab