diff --git a/.gitignore b/.gitignore
index 4a7188cdfbaaa032b0025983cdc81649a20f8aa5..96c3093b718b9a8ee6d711583018ae836555158a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,6 +49,9 @@ doc/[Dd]oxygen/man
 *.tar.gz
 *.tgz
 
+# ignore the persistent .build tag in the main directory
+/.build
+
 # ignore .timeStamp in the main directory
 /.timeStamp
 
diff --git a/applications/solvers/incompressible/pisoFoam/pisoFoam.C b/applications/solvers/incompressible/pisoFoam/pisoFoam.C
index 1c8a534db274a5c29ad19dd2077f0967422ae5bf..b2722a466cc671af2986fe846c6d730a4d305d49 100644
--- a/applications/solvers/incompressible/pisoFoam/pisoFoam.C
+++ b/applications/solvers/incompressible/pisoFoam/pisoFoam.C
@@ -70,6 +70,8 @@ int main(int argc, char *argv[])
               + turbulence->divDevReff(U)
             );
 
+            UEqn.relax();
+
             if (momentumPredictor)
             {
                 solve(UEqn == -fvc::grad(p));
diff --git a/applications/solvers/multiphase/cavitatingFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/pEqn.H
index c9382dfc0fb95f3cb59f2d510cad407c4757d8c8..c22aa76479a0d503d22bc60af591a82a7733d850 100644
--- a/applications/solvers/multiphase/cavitatingFoam/pEqn.H
+++ b/applications/solvers/multiphase/cavitatingFoam/pEqn.H
@@ -1,7 +1,7 @@
 {
     if (nOuterCorr == 1)
     {
-        p = 
+        p =
         (
             rho
           - (1.0 - gamma)*rhol0
@@ -37,7 +37,14 @@
           - fvm::laplacian(rUAf, p)
         );
 
-        pEqn.solve();
+        if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
+        {
+            pEqn.solve(mesh.solver(p.name() + "Final"));
+        }
+        else
+        {
+            pEqn.solve(mesh.solver(p.name()));
+        }
 
         if (nonOrth == nNonOrthCorr)
         {
diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/UEqn.H b/applications/solvers/multiphase/compressibleInterDyMFoam/UEqn.H
index 90033f9826fa037c0d626e2b7f9e4aa5b2fa0ba3..1576f6ba787b037d97c84368836912f0c7d129dd 100644
--- a/applications/solvers/multiphase/compressibleInterDyMFoam/UEqn.H
+++ b/applications/solvers/multiphase/compressibleInterDyMFoam/UEqn.H
@@ -1,13 +1,16 @@
-    surfaceScalarField muf =
+    surfaceScalarField muEff
+    (
+        "muEff",
         twoPhaseProperties.muf()
-      + fvc::interpolate(rho*turbulence->nut());
+      + fvc::interpolate(rho*turbulence->nut())
+    );
 
     fvVectorMatrix UEqn
     (
         fvm::ddt(rho, U)
       + fvm::div(rhoPhi, U)
-      - fvm::laplacian(muf, U)
-      - (fvc::grad(U) & fvc::grad(muf))
+      - fvm::laplacian(muEff, U)
+      - (fvc::grad(U) & fvc::grad(muEff))
     //- fvc::div(muf*(mesh.Sf() & fvc::interpolate(fvc::grad(U)().T())))
     );
 
diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqnsSubCycle.H
index e161a3cbe6b2ea9eb48eeca600982f0a4cc3492f..32a7163130ebe623fec24babb865c2a4f8bb9322 100644
--- a/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqnsSubCycle.H
+++ b/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqnsSubCycle.H
@@ -12,7 +12,9 @@
     surfaceScalarField phic = mag(phi/mesh.magSf());
     phic = min(interface.cAlpha()*phic, max(phic));
 
+    fvc::makeAbsolute(phi, U);
     volScalarField divU = fvc::div(phi);
+    fvc::makeRelative(phi, U);
 
     if (nAlphaSubCycles > 1)
     {
diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterDyMFoam/pEqn.H
index b0f3378408fb76da41887cee0724a55e77afea11..7e4b37061fdede3fccc625875cc38c447657a198 100644
--- a/applications/solvers/multiphase/compressibleInterDyMFoam/pEqn.H
+++ b/applications/solvers/multiphase/compressibleInterDyMFoam/pEqn.H
@@ -30,7 +30,7 @@
           - ghf*fvc::snGrad(rho)
         )*rUAf*mesh.magSf();
 
-    for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
+    for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
     {
         fvScalarMatrix pdEqnIncomp
         (
@@ -38,15 +38,36 @@
           - fvm::laplacian(rUAf, pd)
         );
 
-        solve
+        if
         (
+            oCorr == nOuterCorr-1
+            && corr == nCorr-1
+            && nonOrth == nNonOrthCorr
+        )
+        {
+            solve
             (
-                max(alpha1, scalar(0))*(psi1/rho1)
-              + max(alpha2, scalar(0))*(psi2/rho2)
-            )
-           *pdEqnComp()
-          + pdEqnIncomp
-        );
+                (
+                    max(alpha1, scalar(0))*(psi1/rho1)
+                  + max(alpha2, scalar(0))*(psi2/rho2)
+                )
+               *pdEqnComp()
+              + pdEqnIncomp,
+                mesh.solver(pd.name() + "Final")
+            );
+        }
+        else
+        {
+            solve
+            (
+                (
+                    max(alpha1, scalar(0))*(psi1/rho1)
+                  + max(alpha2, scalar(0))*(psi2/rho2)
+                )
+               *pdEqnComp()
+              + pdEqnIncomp
+            );
+        }
 
         if (nonOrth == nNonOrthCorr)
         {
@@ -62,7 +83,8 @@
 
     p = max
         (
-            (pd + gh*(alpha1*rho10 + alpha2*rho20))/(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
+            (pd + gh*(alpha1*rho10 + alpha2*rho20))
+           /(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
             pMin
         );
 
diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H
index f020863077b7b9678a76af75d3249fe860280098..c59137c7b87a9be3c799e03567dc8209341798f5 100644
--- a/applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H
+++ b/applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H
@@ -1,15 +1,18 @@
-    surfaceScalarField muf =
+    surfaceScalarField muEff
+    (
+        "muEff",
         twoPhaseProperties->muf()
-      + fvc::interpolate(rho*turbulence->nut());
+      + fvc::interpolate(rho*turbulence->nut())
+    );
 
     fvVectorMatrix UEqn
     (
         fvm::ddt(rho, U)
       + fvm::div(rhoPhi, U)
       - fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
-      - fvm::laplacian(muf, U)
-      - (fvc::grad(U) & fvc::grad(muf))
-    //- fvc::div(muf*(fvc::interpolate(dev2(fvc::grad(U))) & mesh.Sf()))
+      - fvm::laplacian(muEff, U)
+      - (fvc::grad(U) & fvc::grad(muEff))
+    //- fvc::div(muEff*(fvc::interpolate(dev2(fvc::grad(U))) & mesh.Sf()))
     );
 
     UEqn.relax();
diff --git a/applications/test/DLList/DLListTest.C b/applications/test/DLList/DLListTest.C
index 12913ce8666f661fdd693bc76e1775c090e7a59b..2929efc1ce8d2940aed11d007c9d7b474bef437b 100644
--- a/applications/test/DLList/DLListTest.C
+++ b/applications/test/DLList/DLListTest.C
@@ -23,7 +23,7 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Application
-    
+
 Description
 
 \*---------------------------------------------------------------------------*/
@@ -48,7 +48,6 @@ int main(int argc, char *argv[])
     }
 
     myList.append(100.3);
-
     myList.append(500.3);
 
     Info<< nl << "And again using STL iterator: " << nl << endl;
@@ -120,7 +119,18 @@ int main(int argc, char *argv[])
         Info<< "element:" << *iter << endl;
     }
 
-    Info<< nl << "Bye." << endl;
+
+    Info<< nl << "Testing transfer: " << nl << endl;
+    Info<< "original: " << myList << endl;
+
+    DLList<scalar> newList;
+    newList.transfer(myList);
+
+    Info<< nl << "source: " << myList << nl
+        << nl << "target: " << newList << endl;
+
+
+    Info<< nl << "Done." << endl;
     return 0;
 }
 
diff --git a/applications/test/Dictionary/DictionaryTest.C b/applications/test/Dictionary/DictionaryTest.C
index ade39072642b83f14e516106797c059676e0ff4f..9bbd32d4fdd2868e60850703ab05320fc9e0268b 100644
--- a/applications/test/Dictionary/DictionaryTest.C
+++ b/applications/test/Dictionary/DictionaryTest.C
@@ -23,15 +23,18 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Application
-    
+
 Description
 
 \*---------------------------------------------------------------------------*/
 
 #include "OSspecific.H"
 
+#include "scalar.H"
+
 #include "IOstreams.H"
 #include "Dictionary.H"
+#include "PtrDictionary.H"
 
 using namespace Foam;
 
@@ -63,6 +66,36 @@ public:
 };
 
 
+class Scalar
+{
+    scalar data_;
+
+public:
+
+    Scalar()
+    :
+        data_(0)
+    {}
+
+    Scalar(scalar val)
+    :
+        data_(val)
+    {}
+
+    ~Scalar()
+    {
+        Info <<"delete Scalar: " << data_ << endl;
+    }
+
+    friend Ostream& operator<<(Ostream& os, const Scalar& val)
+    {
+        os << val.data_;
+        return os;
+    }
+};
+
+
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 //  Main program:
 
@@ -92,12 +125,11 @@ int main(int argc, char *argv[])
         Info<< "element : " << *iter;
     }
 
-    Info<< dict.toc() << endl;
+    Info<< "keys: " << dict.toc() << endl;
 
     delete dictPtr;
 
-    dictPtr = new Dictionary<ent>;
-    Dictionary<ent>& dict2 = *dictPtr;
+    Dictionary<ent> dict2;
 
     for (int i = 0; i<10; i++)
     {
@@ -106,9 +138,79 @@ int main(int argc, char *argv[])
         dict2.swapUp(ePtr);
     }
 
-    Info<< dict2 << endl;
+    Info<< "dict:\n" << dict2 << endl;
+
+    Info<< nl << "Testing transfer: " << nl << endl;
+    Info<< "original: " << dict2 << endl;
+
+    Dictionary<ent> newDict;
+    newDict.transfer(dict2);
+
+    Info<< nl << "source: " << dict2 << nl
+        << "keys: " << dict2.toc() << nl
+        << "target: " << newDict << nl
+        << "keys: " << newDict.toc() << endl;
+
+
+    PtrDictionary<Scalar> scalarDict;
+    for (int i = 0; i<10; i++)
+    {
+        word key("ent" + name(i));
+        scalarDict.insert(key, new Scalar(1.3*i));
+    }
+
+    Info<< nl << "scalarDict1: " << endl;
+    for
+    (
+        PtrDictionary<Scalar>::const_iterator iter = scalarDict.begin();
+        iter != scalarDict.end();
+        ++iter
+    )
+    {
+        Info<< " = " << iter() << endl;
+    }
+    
+    PtrDictionary<Scalar> scalarDict2;
+    for (int i = 8; i<15; i++)
+    {
+        word key("ent" + name(i));
+        scalarDict2.insert(key, new Scalar(1.3*i));
+    }
+    Info<< nl << "scalarDict2: " << endl;
+    for
+    (
+        PtrDictionary<Scalar>::const_iterator iter = scalarDict2.begin();
+        iter != scalarDict2.end();
+        ++iter
+    )
+    {
+        Info<< "elem = " << *iter << endl;
+    }
+    
+    scalarDict.transfer(scalarDict2);
+
+    
+    Scalar* p = scalarDict.lookupPtr("ent8");
+    
+    // This does not (yet) work
+    // Scalar* q = scalarDict.remove("ent10");
+
+    if (p)
+    {
+        Info << "found: " << *p << endl;
+    }
+    else
+    {
+        Info << "no p: " << endl;
+    }
+
+    scalarDict.clear();
+
+    // Info<< " = " << *iter << endl;
+
+
 
-    Info<< nl << "Bye." << endl;
+    Info<< nl << "Done." << endl;
     return 0;
 }
 
diff --git a/applications/test/ISLList/ISLListTest.C b/applications/test/ISLList/ISLListTest.C
index 60590d1eafc26468d19167b0e4792ca271381a3c..f33f811c1a4bfa3b705ddacbfef0d734d0771326 100644
--- a/applications/test/ISLList/ISLListTest.C
+++ b/applications/test/ISLList/ISLListTest.C
@@ -23,7 +23,7 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Application
-    
+
 Description
 
 \*---------------------------------------------------------------------------*/
@@ -52,6 +52,13 @@ public:
     :
         data_(s)
     {}
+
+    friend Ostream& operator<<(Ostream& os, const Scalar& s)
+    {
+        os << s.data_;
+        return os;
+    }
+
 };
 
 
@@ -68,10 +75,8 @@ int main(int argc, char *argv[])
     }
 
     myList.append(new Scalar(100.3));
-
     myList.append(new Scalar(500.3));
 
-
     Info<< nl << "And again using STL iterator: " << nl << endl;
 
     for
@@ -99,6 +104,15 @@ int main(int argc, char *argv[])
     }
 
 
+    Info<< nl << "Testing transfer: " << nl << endl;
+    Info<< "original: " << myList << endl;
+
+    ISLList<Scalar> newList;
+    newList.transfer(myList);
+
+    Info<< nl << "source: " << myList << nl
+        << nl << "target: " << newList << endl;
+
     Info<< nl << "Bye." << endl;
     return 0;
 }
diff --git a/applications/test/PtrList/Make/files b/applications/test/PtrList/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..4bfd49bde04e8d290f2aa7041966dfc8b3dc6c04
--- /dev/null
+++ b/applications/test/PtrList/Make/files
@@ -0,0 +1,3 @@
+PtrListTest.C
+
+EXE = $(FOAM_USER_APPBIN)/PtrListTest
diff --git a/applications/test/hmm/Make/options b/applications/test/PtrList/Make/options
similarity index 100%
rename from applications/test/hmm/Make/options
rename to applications/test/PtrList/Make/options
diff --git a/applications/test/PtrList/PtrListTest.C b/applications/test/PtrList/PtrListTest.C
new file mode 100644
index 0000000000000000000000000000000000000000..8de64a9d3cdfb6a7f2250a7059caacd0c40350f6
--- /dev/null
+++ b/applications/test/PtrList/PtrListTest.C
@@ -0,0 +1,112 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Application
+
+Description
+
+\*---------------------------------------------------------------------------*/
+
+#include "OSspecific.H"
+
+#include "scalar.H"
+#include "IOstreams.H"
+#include "PtrList.H"
+
+using namespace Foam;
+
+class Scalar
+{
+    scalar data_;
+
+public:
+
+    Scalar()
+    :
+        data_(0)
+    {}
+
+    Scalar(scalar val)
+    :
+        data_(val)
+    {}
+
+    ~Scalar()
+    {
+        Info <<"delete Scalar: " << data_ << endl;
+    }
+
+    friend Ostream& operator<<(Ostream& os, const Scalar& val)
+    {
+        os << val.data_;
+        return os;
+    }
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+//  Main program:
+
+int main(int argc, char *argv[])
+{
+    PtrList<Scalar> list1(10);
+    PtrList<Scalar> list2(15);
+
+    forAll(list1, i)
+    {
+        list1.set(i, new Scalar(1.3*i));
+    }
+
+    forAll(list2, i)
+    {
+        list2.set(i, new Scalar(10 + 1.3*i));
+    }
+
+
+    Info<<"list1: " << list1 << endl;
+    Info<<"list2: " << list2 << endl;
+
+    Info<<"indirectly delete some items via set(.., 0) :" << endl;
+    for (label i = 0; i < 3; i++)
+    {
+        list1.set(i, 0);
+    }
+
+    Info<<"transfer list2 -> list1:" << endl;
+    list1.transfer(list2);
+
+    Info<<"list1: " << list1 << endl;
+    Info<<"list2: " << list2 << endl;
+
+    Info<<"indirectly delete some items via setSize :" << endl;
+    list1.setSize(4);
+
+    Info<<"list1: " << list1 << endl;
+
+    Info<< nl << "Done." << endl;
+    return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/SLList/SLListTest.C b/applications/test/SLList/SLListTest.C
index 3bd9af2b6723a72d8be0f25c1ac76427ecda5977..f55f7b4edf58f533e5f1c242b08bfbbb79beef73 100644
--- a/applications/test/SLList/SLListTest.C
+++ b/applications/test/SLList/SLListTest.C
@@ -23,7 +23,7 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Application
-    
+
 Description
 
 \*---------------------------------------------------------------------------*/
@@ -48,10 +48,8 @@ int main(int argc, char *argv[])
     }
 
     myList.append(100.3);
-
     myList.append(500.3);
 
-
     Info<< nl << "And again using STL iterator: " << nl << endl;
 
     for
@@ -99,7 +97,27 @@ int main(int argc, char *argv[])
         Info<< "element:" << *iter2 << endl;
     }
 
-    Info<< nl << "Bye." << endl;
+
+
+    for (int i = 0; i<10; i++)
+    {
+        myList.append(1.3*i);
+    }
+
+    myList.append(100.3);
+    myList.append(500.3);
+
+    Info<< nl << "Testing transfer: " << nl << endl;
+    Info<< "original: " << myList << endl;
+
+    SLList<scalar> newList;
+    newList.transfer(myList);
+
+    Info<< nl << "source: " << myList << nl
+        << nl << "target: " << newList << endl;
+
+
+    Info<< nl << "Done." << endl;
     return 0;
 }
 
diff --git a/applications/test/UDictionary/UDictionaryTest.C b/applications/test/UDictionary/UDictionaryTest.C
index 5caea16dad9e959c73d5c7911b938a300df9f8ec..247fc98cbb6b0d20e0c8111881d21606631fad2a 100644
--- a/applications/test/UDictionary/UDictionaryTest.C
+++ b/applications/test/UDictionary/UDictionaryTest.C
@@ -23,7 +23,7 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Application
-    
+
 Description
 
 \*---------------------------------------------------------------------------*/
@@ -113,7 +113,20 @@ int main(int argc, char *argv[])
 
     Info<< dict2 << endl;
 
-    Info<< nl << "Bye." << endl;
+
+    Info<< nl << "Testing transfer: " << nl << endl;
+    Info<< "original: " << dict2 << endl;
+
+    UDictionary<ent> newDict;
+    newDict.transfer(dict2);
+
+    Info<< nl << "source: " << dict2 << nl
+        << "keys: " << dict2.toc() << nl
+        << "target: " << newDict << nl
+        << "keys: " << newDict.toc() << endl;
+
+    Info<< nl << "Done." << endl;
+
     return 0;
 }
 
diff --git a/applications/test/dictionary/dictionaryTest.C b/applications/test/dictionary/dictionaryTest.C
index d8580bdf5429c851e9907b387cfaa4e18080af79..558ec7fec68d34878e0b4b7a09574aa02acd5f5f 100644
--- a/applications/test/dictionary/dictionaryTest.C
+++ b/applications/test/dictionary/dictionaryTest.C
@@ -41,34 +41,44 @@ using namespace Foam;
 
 int main(int argc, char *argv[])
 {
-    Info<< dictionary(IFstream("testDict")()) << endl;
+    {
+        dictionary dict(IFstream("testDict")());
+        Info<< "dict: " << dict << nl
+            << "toc: " << dict.toc() << nl
+            << "keys: " << dict.keys() << nl
+            << "patterns: " << dict.keys(true) << endl;
+    }
+
 
     IOobject::writeDivider(Info);
 
     {
         dictionary dict(IFstream("testDictRegex")());
+        dict.add(keyType("fooba[rz]", true), "anything");
 
-        Info<< "dict:" << dict << endl;
+        Info<< "dict:" << dict << nl
+            << "toc: " << dict.toc() << nl
+            << "keys: " << dict.keys() << nl
+            << "patterns: " << dict.keys(true) << endl;
 
-        // Wildcard find.
-        Info<< "Wildcard find \"abc\" in top directory : "
+        Info<< "Pattern find \"abc\" in top directory : "
             << dict.lookup("abc") << endl;
-        Info<< "Wildcard find \"abc\" in sub directory : "
+        Info<< "Pattern find \"abc\" in sub directory : "
             << dict.subDict("someDict").lookup("abc")
             << endl;
-        Info<< "Recursive wildcard find \"def\" in sub directory : "
+        Info<< "Recursive pattern find \"def\" in sub directory : "
             << dict.subDict("someDict").lookup("def", true)
             << endl;
-        Info<< "Recursive wildcard find \"foo\" in sub directory : "
+        Info<< "Recursive pattern find \"foo\" in sub directory : "
             << dict.subDict("someDict").lookup("foo", true)
             << endl;
-        Info<< "Recursive wildcard find \"fooz\" in sub directory : "
+        Info<< "Recursive pattern find \"fooz\" in sub directory : "
             << dict.subDict("someDict").lookup("fooz", true)
             << endl;
-        Info<< "Recursive wildcard find \"bar\" in sub directory : "
+        Info<< "Recursive pattern find \"bar\" in sub directory : "
             << dict.subDict("someDict").lookup("bar", true)
             << endl;
-        Info<< "Recursive wildcard find \"xxx\" in sub directory : "
+        Info<< "Recursive pattern find \"xxx\" in sub directory : "
             << dict.subDict("someDict").lookup("xxx", true)
             << endl;
     }
diff --git a/applications/test/dictionary/testDictRegex b/applications/test/dictionary/testDictRegex
index d4252cd3bee069ada8a5ec37a7e8d694670786ec..01d4274ba8dad8147a4b62e254317b0ae1cd7f38 100644
--- a/applications/test/dictionary/testDictRegex
+++ b/applications/test/dictionary/testDictRegex
@@ -18,8 +18,10 @@ FoamFile
 ".*"        parentValue1;
 "[n-z].*"   parentValue2;
 "f.*"       parentValue3;
+keyX        parentValue4;
+keyY        parentValue5;
 
-someDict
+"(.*)Dict"
 {
     foo         subdictValue0;
     bar         $f.*;         // should this really match 'foo'?
@@ -28,7 +30,7 @@ someDict
     "a.*c"      subdictValue3;
     "ab.*"      subdictValue2;
     "a.*"       subdictValue1;
-    abcd        subdictValue4;
+    abcd        \1;
 }
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/applications/test/fileName/fileNameTest.C b/applications/test/fileName/fileNameTest.C
index 99642333c6117d786b85832ed8d403fe62f6e992..c3a36f49e1a35156c14185287a5285bc40dc6c08 100644
--- a/applications/test/fileName/fileNameTest.C
+++ b/applications/test/fileName/fileNameTest.C
@@ -32,6 +32,7 @@ Description
 
 #include "fileName.H"
 #include "IOstreams.H"
+#include "OSspecific.H"
 
 using namespace Foam;
 
@@ -57,7 +58,16 @@ int main()
     Info<< "pathName.components() = " << pathName.components() << endl;
     Info<< "pathName.component(2) = " << pathName.component(2) << endl;
 
-    Info<< "end" << endl;
+
+    // test findEtcFile
+    Info<< "\n\nfindEtcFile tests:" << nl
+        << " controlDict => " << findEtcFile("controlDict") << nl
+        << " badName => " << findEtcFile("badName") << endl;
+    Info<< "This should emit a fatal error:" << endl;
+    Info<< " badName(die) => " << findEtcFile("badName", true) << nl
+        << endl;
+
+    Info<< "\nEnd" << endl;
 
     return 0;
 }
diff --git a/applications/test/getRoots/Make/files b/applications/test/getRoots/Make/files
deleted file mode 100644
index 01385a77312922d0dc59e319abc7c8e38d8f25cf..0000000000000000000000000000000000000000
--- a/applications/test/getRoots/Make/files
+++ /dev/null
@@ -1,2 +0,0 @@
-getRoots.C
-EXE = $(FOAM_USER_APPBIN)/getRoots
diff --git a/applications/test/getRoots/Make/options b/applications/test/getRoots/Make/options
deleted file mode 100644
index 4e772fdf9d7bc94221d127458f9d2ca32850fe69..0000000000000000000000000000000000000000
--- a/applications/test/getRoots/Make/options
+++ /dev/null
@@ -1,2 +0,0 @@
-/* EXE_INC = -I$(LIB_SRC)/finiteVolume/lnInclude */
-/* EXE_LIBS = -lfiniteVolume */
diff --git a/applications/test/getRoots/getRoots.C b/applications/test/getRoots/getRoots.C
deleted file mode 100644
index 2cc985b1697d890aa135679c7b856f3e3d1a0a92..0000000000000000000000000000000000000000
--- a/applications/test/getRoots/getRoots.C
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "dictionary.H"
-#include "fileNameList.H"
-#include "IFstream.H"
-#include "OSspecific.H"
-
-using namespace Foam;
-
-int main()
-{
-    Info << "\nReading Roots" << endl;
-
-    IFstream rootsFile(home()/".foam/apps/openDX/roots");
-    fileNameList rootsList(dictionary(rootsFile).lookup("roots"));
-
-    char** rootsStrings = new char*[rootsList.size() + 1];
-    rootsStrings[rootsList.size()] = 0;
-
-    if (rootsList.size())
-    {
-        for (int i=0; i<rootsList.size(); i++)
-        {
-            rootsStrings[i] = new char[rootsList[i].size() + 1];
-            strcpy(rootsStrings[i], rootsList[i].c_str());
-
-            Info<< rootsStrings[i] << endl;
-        }
-    }
-
-    return 0;
-}
diff --git a/applications/test/hmm/Make/files b/applications/test/hmm/Make/files
deleted file mode 100644
index 759804fcfa6cf2737cd9599f8aeba508687cf353..0000000000000000000000000000000000000000
--- a/applications/test/hmm/Make/files
+++ /dev/null
@@ -1,4 +0,0 @@
-calcEntry/calcEntry.C
-dictionaryTest.C
-
-EXE = $(FOAM_USER_APPBIN)/dictionaryTest
diff --git a/applications/test/hmm/testDict b/applications/test/hmm/testDict
deleted file mode 100644
index 70f6885e7ef345028a910a08c2691d2e7d6a6a82..0000000000000000000000000000000000000000
--- a/applications/test/hmm/testDict
+++ /dev/null
@@ -1,55 +0,0 @@
-FoamFile
-{
-    version         2.0;
-    format          ascii;
-
-    root            "";
-    case            "";
-    instance        "";
-    local           "";
-
-    class           dictionary;
-    object          testDict;
-}
-
-
-dimensions      [ 0 2 -2 0 0 0 0 ];
-internalField   uniform 1;
-
-active
-{
-    type            turbulentIntensityKineticEnergyInlet;
-    intensity       0.1;
-    value           $internalField;
-}
-
-
-inactive
-{
-    type            zeroGradient;
-}
-
-
-boundaryField
-{
-    Default_Boundary_Region
-    {
-        type            zeroGradient;
-    }
-
-    inlet_1  { $active }
-    inlet_2  { $inactive }
-    inlet_3  { $inactive }
-
-    #include "testDictInc"
-
-    outlet
-    {
-        type            inletOutlet;
-        inletValue      $internalField;
-        value           #include "value";
-        x               5;
-        y               6;
-        another         #calc{x $x; y $y;};
-    }
-}
diff --git a/applications/test/hmm/testDictInc b/applications/test/hmm/testDictInc
deleted file mode 100644
index a0814c18339e71c5c438eea2985d2f149e25dc63..0000000000000000000000000000000000000000
--- a/applications/test/hmm/testDictInc
+++ /dev/null
@@ -1,6 +0,0 @@
-    inlet_4
-    {
-        type            inletOutlet;
-        inletValue      $internalField;
-        value           $internalField;
-    }
diff --git a/applications/test/hmm/value b/applications/test/hmm/value
deleted file mode 100644
index 196f9d3d0a639b5120ba76846b0612094b137245..0000000000000000000000000000000000000000
--- a/applications/test/hmm/value
+++ /dev/null
@@ -1 +0,0 @@
-uniform 2
diff --git a/applications/test/regex/Make/options b/applications/test/regex/Make/options
index 0eb7b642835fcec4c4b72727cdc17c7e7825fe70..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644
--- a/applications/test/regex/Make/options
+++ b/applications/test/regex/Make/options
@@ -1,3 +0,0 @@
-EXE_LIBS = \
-    $(FOAM_LIBBIN)/libOSspecific.o
-
diff --git a/applications/test/regex/regexTest.C b/applications/test/regex/regexTest.C
index 51c07b9ceecea77332a64730bd12807689bff171..0463891dc1ef24d4914fa0bb285b03ef4ff200a1 100644
--- a/applications/test/regex/regexTest.C
+++ b/applications/test/regex/regexTest.C
@@ -76,6 +76,36 @@ int main(int argc, char *argv[])
         Info << endl;
     }
 
+    Info<<"test regExp(const char*) ..." << endl;
+    string me("Mark");
+
+    if (regExp("[Mm]ar[ck]").match(me))
+    {
+        Info<< "matched: " << me << endl;
+    }
+    else
+    {
+        Info<< "no match" << endl;
+    }
+
+    if (regExp("").match(me))
+    {
+        Info<< "matched: " << me << endl;
+    }
+    else
+    {
+        Info<< "no match" << endl;
+    }
+
+    if (regExp(NULL).match(me))
+    {
+        Info<< "matched: " << me << endl;
+    }
+    else
+    {
+        Info<< "no match" << endl;
+    }
+
     Info<< endl;
 
     return 0;
diff --git a/applications/test/router/Gather/Gather.C b/applications/test/router/Gather/Gather.C
index 968f45b9361a9cb0d449e93217d2aff0a6468e7b..1f2bc56c44a8cb4e7c8a24e92f151cb1076fa637 100644
--- a/applications/test/router/Gather/Gather.C
+++ b/applications/test/router/Gather/Gather.C
@@ -59,23 +59,24 @@ Gather<T0>::Gather(const T0& localData, const bool redistribute)
             // Receive data
             for
             (
-                int slave=Pstream::firstSlave(), procIndex = 1;
-                slave<=Pstream::lastSlave();
+                int slave = Pstream::firstSlave(), procIndex = 1;
+                slave <= Pstream::lastSlave();
                 slave++, procIndex++
             )
             {
-                IPstream fromSlave(slave);
+                IPstream fromSlave(Pstream::scheduled, slave);
                 fromSlave >> this->operator[](procIndex);
             }
+
             // Send data
             for
             (
-                int slave=Pstream::firstSlave(), procIndex = 1;
-                slave<=Pstream::lastSlave();
+                int slave = Pstream::firstSlave(), procIndex = 1;
+                slave <= Pstream::lastSlave();
                 slave++, procIndex++
             )
             {
-                OPstream toSlave(slave);
+                OPstream toSlave(Pstream::scheduled, slave);
 
                 if (redistribute)
                 {
@@ -92,12 +93,13 @@ Gather<T0>::Gather(const T0& localData, const bool redistribute)
         {
             // Slave: send my local data to master
             {
-                OPstream toMaster(Pstream::masterNo());
+                OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
                 toMaster << localData;
             }
+
             // Receive data from master
             {
-                IPstream fromMaster(Pstream::masterNo());
+                IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
                 if (redistribute)
                 {
                     fromMaster >> *this;
diff --git a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C
index f290e7fa42d0e609a3730f9e85db9589108b9c93..f9337bad0e863d08691b255ef86d5dbba05689db 100644
--- a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C
+++ b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C
@@ -289,9 +289,7 @@ int main(int argc, char *argv[])
                 << patchNames[patchI] << "\t\t"
                 << allPatchFaces[patchI].size() << endl;
 
-            allPatchFaces[patchI].shrink();
             patchFaces[patchI].transfer(allPatchFaces[patchI]);
-            allPatchFaces[patchI].clear();
         }
 
         Info<< endl;
diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
index e99bca0af1db9e80bc4bc06afb5d5cbd2e3b054e..cf9d5e82379e15897b4ecd6985875462c6bd7cef 100644
--- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
+++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
@@ -461,7 +461,7 @@ int main(int argc, char *argv[])
             }
         }
 
-   
+
         // Trim
         boundaryFaces.setSize(faceI);
         boundaryPatch.setSize(faceI);
@@ -515,7 +515,7 @@ int main(int argc, char *argv[])
             Info<< "    " << patchNames[patchI] << " : "
                 << allPatchFaces[patchI].size() << endl;
 
-            patchFaces[patchI].transfer(allPatchFaces[patchI].shrink());
+            patchFaces[patchI].transfer(allPatchFaces[patchI]);
         }
 
         Info<< endl;
@@ -548,7 +548,6 @@ int main(int argc, char *argv[])
 
     meshPtr().write();
 
-
     Info<< "End\n" << endl;
 
     return 0;
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/CMakeLists.txt
index 01d4f5a9fe0031eb8b03760bcb3cb294de083c82..17be614da4d2e9db4390f247b195c4f92f351bd9 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/CMakeLists.txt
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/CMakeLists.txt
@@ -7,6 +7,8 @@
 # the pqReader.xml file contains xml defining readers with their
 # file extensions and descriptions.
 
+cmake_minimum_required(VERSION 2.4)
+
 FIND_PACKAGE(ParaView REQUIRED)
 INCLUDE(${PARAVIEW_USE_FILE})
 
diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C b/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C
index d7db62e441c93b1fbb3bca9fb550f01cba246b2a..898f3572e0af5c62992d296e45599359b36edd94 100644
--- a/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C
+++ b/applications/utilities/postProcessing/graphics/fieldview9Reader/readerDatabase.C
@@ -74,10 +74,7 @@ void Foam::readerDatabase::getPolyHedra()
         }
     }
 
-    polys.shrink();
-
     Info<< "Found " << polys.size() << " polyhedral cells " << endl;
-
     polys_.transfer(polys);
 }
 
diff --git a/applications/utilities/postProcessing/sampling/sample/sample.C b/applications/utilities/postProcessing/sampling/sample/sample.C
index f2b27de8ead3eb94729c5c54366f64253b134537..306c8d7aed227ab1235ef6f53d046a6eee1d0ae6 100644
--- a/applications/utilities/postProcessing/sampling/sample/sample.C
+++ b/applications/utilities/postProcessing/sampling/sample/sample.C
@@ -101,8 +101,23 @@ int main(int argc, char *argv[])
     instantList timeDirs = timeSelector::select0(runTime, args);
 #   include "createMesh.H"
 
-    IOsampledSets sSets(mesh, "sampleDict", IOobject::MUST_READ, true);
-    IOsampledSurfaces sSurfs(mesh, "sampleDict", IOobject::MUST_READ, true);
+    IOsampledSets sSets
+    (
+        sampledSets::typeName,
+        mesh,
+        "sampleDict",
+        IOobject::MUST_READ,
+        true
+    );
+
+    IOsampledSurfaces sSurfs
+    (
+        sampledSurfaces::typeName,
+        mesh,
+        "sampleDict",
+        IOobject::MUST_READ,
+        true
+    );
 
     forAll(timeDirs, timeI)
     {
diff --git a/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C b/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C
index 3d494b6cc0315b35633d3ea3a447a67426e0a8b7..be274ec4ce8da98eb3a6af1cfca2678c8a189864 100644
--- a/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C
+++ b/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C
@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
 
     Info<< nl << "Reading Burcat data dictionary" << endl;
 
-    fileName BurcatCpDataFileName(dotFoam("thermoData/BurcatCpData"));
+    fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
 
     // Construct control dictionary
     IFstream BurcatCpDataFile(BurcatCpDataFileName);
diff --git a/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C b/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C
index 56767eecb3e95504d3c0c327bfc817ebf86572ec..444570046ae0d41578a5b0026aa20ac1ebaf7bca 100644
--- a/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C
+++ b/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C
@@ -79,7 +79,7 @@ int main(int argc, char *argv[])
 
     Info<< nl << "Reading Burcat data dictionary" << endl;
 
-    fileName BurcatCpDataFileName(dotFoam("thermoData/BurcatCpData"));
+    fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
 
     // Construct control dictionary
     IFstream BurcatCpDataFile(BurcatCpDataFileName);
diff --git a/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C b/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C
index c3ee5e81fda16b78c7d7b00d3133e8634415e906..392c2e062fd7e474e8ca64d33e0feb01acc7f3f6 100644
--- a/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C
+++ b/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
 
     Info<< nl << "Reading Burcat data dictionary" << endl;
 
-    fileName BurcatCpDataFileName(dotFoam("thermoData/BurcatCpData"));
+    fileName BurcatCpDataFileName(findEtcFile("thermoData/BurcatCpData"));
 
     // Construct control dictionary
     IFstream BurcatCpDataFile(BurcatCpDataFileName);
diff --git a/bin/buildParaView3.3-cvs-python b/bin/buildParaView3.3-cvs-python
deleted file mode 120000
index db5ce4641b139ff974bcef01ee90a13c71a117d6..0000000000000000000000000000000000000000
--- a/bin/buildParaView3.3-cvs-python
+++ /dev/null
@@ -1 +0,0 @@
-buildParaView3.3-cvs
\ No newline at end of file
diff --git a/bin/buildParaView3.5-cvs b/bin/buildParaView3.5-cvs
new file mode 100755
index 0000000000000000000000000000000000000000..707287a981873b253e26911f116fb0639fc70d53
--- /dev/null
+++ b/bin/buildParaView3.5-cvs
@@ -0,0 +1,192 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# =========                 |
+# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+#  \\    /   O peration     |
+#   \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+#    \\/     M anipulation  |
+#------------------------------------------------------------------------------
+# License
+#     This file is part of OpenFOAM.
+#
+#     OpenFOAM is free software; you can redistribute it and/or modify it
+#     under the terms of the GNU General Public License as published by the
+#     Free Software Foundation; either version 2 of the License, or (at your
+#     option) any later version.
+#
+#     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+#     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+#     for more details.
+#
+#     You should have received a copy of the GNU General Public License
+#     along with OpenFOAM; if not, write to the Free Software Foundation,
+#     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Script
+#     buildParaView3.5-cvs
+#
+# Description
+#     Build and install ParaView
+#     - run from folder above ParaView source folder or place the
+#       ParaView source under $WM_THIRD_PARTY_DIR
+#
+#------------------------------------------------------------------------------
+. $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions
+
+PARAVIEW_SRC=paraview-3.5-cvs
+PARAVIEW_MAJOR_VERSION=3.5
+
+# User options:
+# ~~~~~~~~~~~~~
+
+# MPI support:
+WITH_MPI=OFF
+MPI_MAX_PROCS=32
+
+# Python support:
+# note: script will try to determine the appropriate python library.
+#       If it fails, specify the path using the PYTHON_LIBRARY variable
+WITH_PYTHON=OFF
+PYTHON_LIBRARY=""
+# PYTHON_LIBRARY="/usr/lib64/libpython2.5.so.1.0"
+
+# MESA graphics support:
+WITH_MESA=OFF
+
+#
+# No further editing below this line
+#------------------------------------------------------------------------------
+Script=${0##*/}
+
+usage() {
+    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
+    cat<<USAGE
+
+usage: ${0##*/} [OPTION]
+options:
+  -fast      for repeated builds (-make -install) *use with caution*
+  -mpi       with mpi (if not already enabled)
+  -python    with python (if not already enabled)
+  -mesa      with mesa (if not already enabled)
+  -verbose   verbose output in Makefiles
+  -help
+
+For finer control, the build stages can be also selected individually
+(mutually exclusive)
+  -config
+  -make
+  -makedoc
+  -install
+  [-envpath]    alter absolute paths in CMake files to use env variables
+
+Build and install $PARAVIEW_SRC
+  - run from folder above the ParaView source folder or place the
+    ParaView source under \$WM_THIRD_PARTY_DIR
+
+USAGE
+   exit 1
+}
+
+# add options based on script name:
+case "$Script" in *-mpi*)    WITH_MPI=ON;; esac
+case "$Script" in *-python*) WITH_PYTHON=ON;; esac
+case "$Script" in *-mesa*)   WITH_MESA=ON;; esac
+
+runCONFIG=true
+runMAKE=true
+runMAKEDOC=true
+runINSTALL=true
+runENVPATH=false
+
+# parse options
+while [ "$#" -gt 0 ]
+do
+    case "$1" in
+    -h | -help)
+        usage
+        ;;
+    -config)             # stage 1: config only
+        runCONFIG=true
+        runMAKE=false
+        runMAKEDOC=false
+        runINSTALL=false
+        shift
+        ;;
+    -make)               # stage 2: make only
+        runCONFIG=false
+        runMAKE=true
+        runMAKEDOC=false
+        runINSTALL=false
+        shift
+        ;;
+    -makedoc)            # stage 3: generate html documentation
+        runCONFIG=false
+        runMAKE=false
+        runMAKEDOC=true
+        runINSTALL=false
+        shift
+        ;;
+    -install)            # stage 4: install only
+        runCONFIG=false
+        runMAKE=false
+        runMAKEDOC=false
+        runINSTALL=true
+        shift
+        ;;
+    -envpath)            # optional: change cmake files to use env variables
+        runCONFIG=false
+        runMAKE=false
+        runMAKEDOC=false
+        runINSTALL=false
+        runENVPATH=true
+        shift
+        ;;
+    -fast)               # shortcut for rebuild
+        runCONFIG=false
+        runMAKE=true
+        runMAKEDOC=false
+        runINSTALL=true
+        shift
+        ;;
+    -mpi)
+        WITH_MPI=ON
+        shift
+        ;;
+    -python)
+        WITH_PYTHON=ON
+        shift
+        ;;
+    -mesa)
+        WITH_MESA=ON
+        shift
+        ;;
+    -verbose)
+        VERBOSE=ON
+        shift
+        ;;
+    *)
+        usage "unknown option/argument: '$*'"
+        ;;
+    esac
+done
+
+# Set configure options
+#~~~~~~~~~~~~~~~~~~~~~~
+addVerbosity        # verbose makefiles
+addMpiSupport       # set MPI-specific options
+addPythonSupport    # set Python-specific options
+addMesaSupport      # set MESA-specific options
+
+getPaths            # discover where things are or should be put
+
+# Build and install
+# ~~~~~~~~~~~~~~~~~
+[ $runCONFIG  = true ] && configParaView
+[ $runMAKE    = true ] && makeParaView
+[ $runMAKEDOC = true ] && makeDocs
+[ $runINSTALL = true ] && installParaView
+[ $runENVPATH = true ] && fixCMakeFiles
+
+echo "done"
+#------------------------------------------------------------------------------
diff --git a/bin/buildParaView3.5-cvs-python b/bin/buildParaView3.5-cvs-python
new file mode 120000
index 0000000000000000000000000000000000000000..d3ed3924a892abffc145149dd53de0b9819d6272
--- /dev/null
+++ b/bin/buildParaView3.5-cvs-python
@@ -0,0 +1 @@
+buildParaView3.5-cvs
\ No newline at end of file
diff --git a/bin/foamUpdateCaseFileHeader b/bin/foamUpdateCaseFileHeader
index f4340fc53c7957cb2a60a9806b44b24dac7da713..311cb21e8238471db0205051c3acc083fbfeb0d3 100755
--- a/bin/foamUpdateCaseFileHeader
+++ b/bin/foamUpdateCaseFileHeader
@@ -45,8 +45,8 @@ options:
   -h      help
 
   Updates the header of application files and removes consecutive blank lines.
-  By default, writes current version in the header.
-  An alternative version can be specified with -v option.
+  By default, writes current OpenFOAM version in the header.
+  An alternative version can be specified with the -v option.
 
 USAGE
     exit 1
@@ -59,8 +59,8 @@ printHeader() {
 | =========                 |                                                 |
 | \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
 |  \\\\    /   O peration     | Version:  ${foamVersion}  |
-|   \\\\  /    A nd           | Web:      http://www.OpenFOAM.org               |
-|    \\\\/     M anipulation  |                                                 |
+|   \\\\  /    A nd           |                                                 |
+|    \\\\/     M anipulation  |                                www.OpenFOAM.org |
 \\*---------------------------------------------------------------------------*/
 FoamFile
 {
@@ -84,13 +84,13 @@ FoamFileAttribute() {
 #
 # OPTIONS
 #
-OPTS=`getopt hv: $*`
+opts=$(getopt hv: $*)
 if [ $? -ne 0 ]
 then
     echo "Aborting due to invalid option"
     usage
 fi
-eval set -- '$OPTS'
+eval set -- '$opts'
 while [ "$1" != "--" ]
 do
     case $1 in
@@ -110,11 +110,13 @@ shift
 
 
 # constant width for version
-foamVersion=`printf %-36s $foamVersion`
+foamVersion=$(printf %-36s $foamVersion)
 
 #
 # MAIN
 #
+unset NOTE
+
 for caseFile
 do
     if grep FoamFile $caseFile >/dev/null 2>&1
@@ -122,16 +124,17 @@ do
         echo "Updating case file: $caseFile"
         sed -n '/FoamFile/,/}/p' $caseFile > FoamFile.tmp
 
-        CLASS=`FoamFileAttribute class FoamFile.tmp`
-        OBJECT=`FoamFileAttribute object FoamFile.tmp`
-        FORMAT=`FoamFileAttribute format FoamFile.tmp`
+        FORMAT=$(FoamFileAttribute format FoamFile.tmp)
+        CLASS=$(FoamFileAttribute  class  FoamFile.tmp)
+        OBJECT=$(FoamFileAttribute object FoamFile.tmp)
+        # extract NOTE?
 
         printHeader $FORMAT $CLASS $OBJECT $NOTE > FoamFile.tmp
         sed '1,/}/d' $caseFile | sed '/./,/^$/!d' >> FoamFile.tmp
 
         # use cat to avoid removing/replace soft-links
         [ -s FoamFile.tmp ] && cat FoamFile.tmp >| $caseFile
-        rm FoamFile.tmp
+        rm -f FoamFile.tmp 2>/dev/null
     else
         echo " Invalid case file: $caseFile" 1>&2
     fi
diff --git a/bin/tools/buildParaView3.2.1 b/bin/tools/buildParaView3.2.1
deleted file mode 100755
index 904682581df68d664661819d29b88fe4a24bfc7d..0000000000000000000000000000000000000000
--- a/bin/tools/buildParaView3.2.1
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/sh
-#------------------------------------------------------------------------------
-# =========                 |
-# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-#  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
-#    \\/     M anipulation  |
-#------------------------------------------------------------------------------
-# License
-#     This file is part of OpenFOAM.
-#
-#     OpenFOAM is free software; you can redistribute it and/or modify it
-#     under the terms of the GNU General Public License as published by the
-#     Free Software Foundation; either version 2 of the License, or (at your
-#     option) any later version.
-#
-#     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-#     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-#     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-#     for more details.
-#
-#     You should have received a copy of the GNU General Public License
-#     along with OpenFOAM; if not, write to the Free Software Foundation,
-#     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# Script
-#     buildParaView3.2.1
-#
-# Description
-#     Build and install ParaView
-#     - run from folder above ParaView source folder or place the
-#       ParaView source under $WM_PROJECT_INST_DIR
-#
-#------------------------------------------------------------------------------
-. $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions
-
-PARAVIEW_SRC="ParaView3.2.1"
-PARAVIEW_MAJOR_VERSION="3.2"
-
-# User options:
-# ~~~~~~~~~~~~~
-
-WITH_MPI=ON
-MPI_MAX_PROCS=32
-WITH_PYTHON=ON
-PYTHON_LIBRARY=""
-WITH__MESA=OFF
-
-#
-# No further editing below this line
-#------------------------------------------------------------------------------
-
-# shortcut for repeated builds - use with caution
-if [ "$1" = "-fast" ]
-then
-   CMAKE_SKIP=YES
-elif [ "$#" -gt 0 ]
-then
-   echo "$0: only supports a -fast option"
-   exit 1
-fi
-
-# Set configure options
-#~~~~~~~~~~~~~~~~~~~~~~
-addVerbosity        # set cmake verbosity
-addMpiSupport       # set MPI-specific options
-addPythonSupport    # set Python-specific options
-addMesaSupport      # set MESA-specific options
-
-buildParaView
-installParaView
-
-echo "done"
-
-#------------------------------------------------------------------------------
diff --git a/bin/buildParaView3.3-cvs b/bin/tools/buildParaView3.4
similarity index 54%
rename from bin/buildParaView3.3-cvs
rename to bin/tools/buildParaView3.4
index 1f95596f3c56c6e1d9cf87b3b28efce845109719..87b993d539c9f5f95cf7d53c076a9f9f0b789154 100755
--- a/bin/buildParaView3.3-cvs
+++ b/bin/tools/buildParaView3.4
@@ -34,8 +34,8 @@
 #------------------------------------------------------------------------------
 . $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions
 
-PARAVIEW_SRC="ParaView3.3-cvs"
-PARAVIEW_MAJOR_VERSION="3.3"
+PARAVIEW_SRC=paraview-3.4
+PARAVIEW_MAJOR_VERSION=3.4
 
 # User options:
 # ~~~~~~~~~~~~~
@@ -45,7 +45,7 @@ WITH_MPI=OFF
 MPI_MAX_PROCS=32
 
 # Python support:
-# note: script will try to determine python library.
+# note: script will try to determine the appropriate python library.
 #       If it fails, specify the path using the PYTHON_LIBRARY variable
 WITH_PYTHON=OFF
 PYTHON_LIBRARY=""
@@ -60,18 +60,26 @@ WITH_MESA=OFF
 Script=${0##*/}
 
 usage() {
-   while [ "$#" -ge 1 ]; do echo "$1"; shift; done
-   cat<<USAGE
+    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
+    cat<<USAGE
 
 usage: ${0##*/} [OPTION]
 options:
-  -fast      skip cmake for repeated builds - use with caution
+  -fast      for repeated builds (-make -install) *use with caution*
   -mpi       with mpi (if not already enabled)
   -python    with python (if not already enabled)
   -mesa      with mesa (if not already enabled)
-  -verbose   verbose cmake output
+  -verbose   verbose output in Makefiles
   -help
 
+For finer control, the build stages can be also selected individually
+(mutually exclusive)
+  -config
+  -make
+  -makedoc
+  -install
+  [-envpath]    alter absolute paths in CMake files to use env variables
+
 Build and install $PARAVIEW_SRC
   - run from folder above the ParaView source folder or place the
     ParaView source under \$WM_THIRD_PARTY_DIR
@@ -80,57 +88,105 @@ USAGE
    exit 1
 }
 
-# options based on the script name:
-case "$Script" in *-fast*)   CMAKE_SKIP=ON;; esac
+# add options based on script name:
 case "$Script" in *-mpi*)    WITH_MPI=ON;; esac
 case "$Script" in *-python*) WITH_PYTHON=ON;; esac
 case "$Script" in *-mesa*)   WITH_MESA=ON;; esac
 
+runCONFIG=true
+runMAKE=true
+runMAKEDOC=true
+runINSTALL=true
+runENVPATH=false
+
 # parse options
 while [ "$#" -gt 0 ]
 do
-   case "$1" in
-   -h | -help)
-      usage
-      ;;
-   -fast)
-      CMAKE_SKIP=YES
-      shift
-      ;;
-   -mpi)
-      WITH_MPI=ON
-      shift
-      ;;
-   -python)
-      WITH_PYTHON=ON
-      shift
-      ;;
-   -mesa)
-      WITH_MESA=ON
-      shift
-      ;;
-   -verbose)
-      VERBOSE=ON
-      shift
-      ;;
-   *)
-      usage "unknown option/argument: '$*'"
-      ;;
-   esac
+    case "$1" in
+    -h | -help)
+        usage
+        ;;
+    -config)             # stage 1: config only
+        runCONFIG=true
+        runMAKE=false
+        runMAKEDOC=false
+        runINSTALL=false
+        shift
+        ;;
+    -make)               # stage 2: make only
+        runCONFIG=false
+        runMAKE=true
+        runMAKEDOC=false
+        runINSTALL=false
+        shift
+        ;;
+    -makedoc)            # stage 3: generate html documentation
+        runCONFIG=false
+        runMAKE=false
+        runMAKEDOC=true
+        runINSTALL=false
+        shift
+        ;;
+    -install)            # stage 4: install only
+        runCONFIG=false
+        runMAKE=false
+        runMAKEDOC=false
+        runINSTALL=true
+        shift
+        ;;
+    -envpath)            # optional: change cmake files to use env variables
+        runCONFIG=false
+        runMAKE=false
+        runMAKEDOC=false
+        runINSTALL=false
+        runENVPATH=true
+        shift
+        ;;
+    -fast)               # shortcut for rebuild
+        runCONFIG=false
+        runMAKE=true
+        runMAKEDOC=false
+        runINSTALL=true
+        shift
+        ;;
+    -mpi)
+        WITH_MPI=ON
+        shift
+        ;;
+    -python)
+        WITH_PYTHON=ON
+        shift
+        ;;
+    -mesa)
+        WITH_MESA=ON
+        shift
+        ;;
+    -verbose)
+        VERBOSE=ON
+        shift
+        ;;
+    *)
+        usage "unknown option/argument: '$*'"
+        ;;
+    esac
 done
 
 # Set configure options
 #~~~~~~~~~~~~~~~~~~~~~~
-addVerbosity        # set CMake verbosity
+addVerbosity        # verbose makefiles
 addMpiSupport       # set MPI-specific options
 addPythonSupport    # set Python-specific options
 addMesaSupport      # set MESA-specific options
 
+getPaths            # discover where things are or should be put
+
 # Build and install
 # ~~~~~~~~~~~~~~~~~
-buildParaView
-installParaView
+[ $runCONFIG  = true ] && configParaView
+[ $runMAKE    = true ] && makeParaView
+[ $runENVPATH = true ] && fixCMakeFiles
+[ $runMAKEDOC = true ] && makeDocs
+[ $runINSTALL = true ] && installParaView
 
 echo "done"
-
 #------------------------------------------------------------------------------
diff --git a/bin/tools/buildParaViewFunctions b/bin/tools/buildParaViewFunctions
index ef5a25923a0ab4d605cd2d4ab40a1720b23e0580..e3662ac19f62a001c97766a6b7436325c1baa4e8 100644
--- a/bin/tools/buildParaViewFunctions
+++ b/bin/tools/buildParaViewFunctions
@@ -31,299 +31,366 @@
 #------------------------------------------------------------------------------
 
 # ParaView_INST_DIR  : location of the original sources
-# ParaView_DIR       : location of the compiled output
+# ParaView_DIR       : location of the build (for the ParaViewConfig.cmake)
+#                      and the installed program
 
+
+#
+# set CMake cache variables
+#
 addCMakeVariable()
 {
-   while [ -n "$1" ]
-   do
-      CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1"
-      shift
-   done
+    while [ -n "$1" ]
+    do
+        CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1"
+        shift
+    done
 }
 
 
+#
+# verbose makefiles
+#
 addVerbosity()
 {
-   [ "$VERBOSE" = ON ] && addCMakeVariable  CMAKE_VERBOSE_MAKEFILE=TRUE
+    [ "$VERBOSE" = ON ] && addCMakeVariable  CMAKE_VERBOSE_MAKEFILE=TRUE
 }
 
 
+#
+# define options for mpi support
+#
 addMpiSupport()
 {
-   [ "$WITH_MPI" = ON ] || return
-   OBJ_ADD="$OBJ_ADD-mpi"
-
-   addCMakeVariable  PARAVIEW_USE_MPI=ON
-   addCMakeVariable  VTK_USE_MPI=ON
-   addCMakeVariable  MPI_INCLUDE_PATH=$MPI_ARCH_PATH/include
-   addCMakeVariable  MPI_LIBRARY=$MPI_ARCH_PATH/lib/libmpi.so
-   addCMakeVariable  VTK_MPIRUN_EXE=$MPI_ARCH_PATH/bin/mpirun
-   addCMakeVariable  VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS
+    [ "$WITH_MPI" = ON ] || return
+    OBJ_ADD="$OBJ_ADD-mpi"
+
+    addCMakeVariable  PARAVIEW_USE_MPI=ON VTK_USE_MPI=ON
+    addCMakeVariable  MPI_INCLUDE_PATH=$MPI_ARCH_PATH/include
+    addCMakeVariable  MPI_LIBRARY=$MPI_ARCH_PATH/lib/libmpi.so
+    addCMakeVariable  VTK_MPIRUN_EXE=$MPI_ARCH_PATH/bin/mpirun
+    addCMakeVariable  VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS
 }
 
 
+#
+# define options for python support
+#
 addPythonSupport()
 {
-   [ "$WITH_PYTHON" = ON ] || return
-   OBJ_ADD="$OBJ_ADD-py"
-
-   if pythonBin=$(which python 2>/dev/null)
-   then
-      if [ -n "$PYTHON_LIBRARY" ]
-      then
-         # check $PYTHON_LIBRARY if it has been set
-         if [ ! -e "$PYTHON_LIBRARY" ]
-         then
-            echo "*** Error: libpython not found at location specified " \
-                 "by PYTHON_LIBRARY=$PYTHON_LIBRARY"
-         fi
-      else
-         # Try to get $PYTHON_LIBRARY from dynamically linked binary
-         PYTHON_LIBRARY=$(ldd $pythonBin | \
-            sed -ne '/libpython/s/.* => \(.*\) (.*/\1/p')
-
-         if [ ! -e "$PYTHON_LIBRARY" ]
-         then
-            echo "*** Error: Unable to determine path to python library."
-         fi
-      fi
-
-      [ -e "$PYTHON_LIBRARY" ] || {
-         echo "    Please set the variable PYTHON_LIBRARY to the full"
-         echo "    path to (and including) libpython, or deactivate"
-         echo "    python support by setting WITH_PYTHON=OFF"
-         exit 1
-      }
-
-      pythonMajor=$(echo $PYTHON_LIBRARY | sed 's/.*libpython\(.*\)\.so.*/\1/')
-      pythonInclude=/usr/include/python$pythonMajor
-
-      [ -e "$PYTHON_LIBRARY" ] || {
-         echo "    Please set the variable PYTHON_LIBRARY to the full"
-         echo "    path to (and including) libpython, or deactivate"
-         echo "    python support by setting WITH_PYTHON=OFF"
-         exit 1
-      }
-
-      # note - we could also allow for a PYTHON_INCLUDE variable ...
-      [ -e "$pythonInclude" ] || {
-         echo "    No python include headers found"
-         echo "    Please install python headers or deactivate "
-         echo "    python support by setting WITH_PYTHON=OFF"
-         exit 1
-      }
-
-      addCMakeVariable  PARAVIEW_ENABLE_PYTHON=ON
-      addCMakeVariable  PYTHON_INCLUDE_PATH=$pythonInclude
-      addCMakeVariable  PYTHON_LIBRARY=$PYTHON_LIBRARY
-
-      echo "----"
-      echo "Python information:"
-      echo "    executable     : $pythonBin"
-      echo "    version        : $pythonMajor"
-      echo "    include path   : $pythonInclude"
-      echo "    library        : $PYTHON_LIBRARY"
-
-      unset pythonBin pythonInclude pythonMajor
-   else
-      echo "*** Error: python not installed"
-      echo "***        Deactivate python support by setting WITH_PYTHON=OFF"
-      exit 1
-   fi
+    [ "$WITH_PYTHON" = ON ] || return
+    OBJ_ADD="$OBJ_ADD-py"
+
+    if pythonBin=$(which python 2>/dev/null)
+    then
+        if [ -n "$PYTHON_LIBRARY" ]
+        then
+            # check $PYTHON_LIBRARY if it has been set
+            if [ ! -e "$PYTHON_LIBRARY" ]
+            then
+                echo "*** Error: libpython not found at location specified " \
+                     "by PYTHON_LIBRARY=$PYTHON_LIBRARY"
+            fi
+        else
+            # Try to get $PYTHON_LIBRARY from dynamically linked binary
+            PYTHON_LIBRARY=$(ldd $pythonBin | \
+                sed -ne '/libpython/s/.* => \(.*\) (.*/\1/p')
+
+           if [ ! -e "$PYTHON_LIBRARY" ]
+           then
+               echo "*** Error: Unable to determine path to python library."
+           fi
+        fi
+
+        [ -e "$PYTHON_LIBRARY" ] || {
+            echo "    Please set the variable PYTHON_LIBRARY to the full"
+            echo "    path to (and including) libpython, or deactivate"
+            echo "    python support by setting WITH_PYTHON=OFF"
+            exit 1
+        }
+
+        pythonMajor=$(echo $PYTHON_LIBRARY | sed 's/.*libpython\(.*\)\.so.*/\1/')
+        pythonInclude=/usr/include/python$pythonMajor
+
+        [ -e "$PYTHON_LIBRARY" ] || {
+            echo "    Please set the variable PYTHON_LIBRARY to the full"
+            echo "    path to (and including) libpython, or deactivate"
+            echo "    python support by setting WITH_PYTHON=OFF"
+            exit 1
+        }
+
+        # note - we could also allow for a PYTHON_INCLUDE variable ...
+        [ -e "$pythonInclude" ] || {
+            echo "    No python include headers found"
+            echo "    Please install python headers or deactivate "
+            echo "    python support by setting WITH_PYTHON=OFF"
+            exit 1
+        }
+
+        addCMakeVariable  PARAVIEW_ENABLE_PYTHON=ON
+        addCMakeVariable  PYTHON_INCLUDE_PATH=$pythonInclude
+        addCMakeVariable  PYTHON_LIBRARY=$PYTHON_LIBRARY
+
+        echo "----"
+        echo "Python information:"
+        echo "    executable     : $pythonBin"
+        echo "    version        : $pythonMajor"
+        echo "    include path   : $pythonInclude"
+        echo "    library        : $PYTHON_LIBRARY"
+
+        unset pythonBin pythonInclude pythonMajor
+    else
+        echo "*** Error: python not installed"
+        echo "***        Deactivate python support by setting WITH_PYTHON=OFF"
+        exit 1
+    fi
 }
 
 
+#
+# define options for mesa support
+#
 addMesaSupport()
 {
-   [ "$WITH_MESA" = ON ] || return
+    [ "$WITH_MESA" = ON ] || return
 
-   MESA_INCLUDE_DIR=/usr/include/GL
-   MESA_LIBRARY=/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so
+    MESA_INCLUDE_DIR=/usr/include/GL
+    MESA_LIBRARY=/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so
 
-   if [ -d "$MESA_INCLUDE_DIR" -a -f "$MESA_LIBRARY" ]
-   then
-      OBJ_ADD="$OBJ_ADD-mesa"
+    if [ -d "$MESA_INCLUDE_DIR" -a -f "$MESA_LIBRARY" ]
+    then
+        OBJ_ADD="$OBJ_ADD-mesa"
 
-      addCMakeVariable  VTK_OPENGL_HAS_OSMESA=ON
-      addCMakeVariable  OSMESA_INCLUDE_DIR=$MESA_INCLUDE_DIR
-      addCMakeVariable  OSMESA_LIBRARY=$MESA_LIBRARY
+        addCMakeVariable  VTK_OPENGL_HAS_OSMESA=ON
+        addCMakeVariable  OSMESA_INCLUDE_DIR=$MESA_INCLUDE_DIR
+        addCMakeVariable  OSMESA_LIBRARY=$MESA_LIBRARY
 
-   else
-      echo "*** Error: no MESA information found"
-      exit 1
-   fi
+    else
+       echo "*** Error: no MESA information found"
+       exit 1
+    fi
 }
 
 
-buildParaView()
+#
+# discover where things are or should be put
+#
+getPaths()
 {
-   # set paraview environment
-   for i in $PWD $WM_THIRD_PARTY_DIR
-   do
-      ParaView_INST_DIR=$i/$PARAVIEW_SRC
-      [ -d $ParaView_INST_DIR ] && break
-   done
-
-   if [ ! -d "$ParaView_INST_DIR" ]
-   then
-      # last chance: maybe already in the paraview directory
-      [ "${PWD##*/}" = $PARAVIEW_SRC ] && ParaView_INST_DIR=$PWD
-
-      [ -d "$ParaView_INST_DIR" ] || {
-         echo "did not find $PARAVIEW_SRC in these directories:"
-         echo "  PWD=$PWD"
-         echo "  WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR"
-         echo "abort build"
-         exit 1
-      }
-   fi
-
-
-   # ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER$OBJ_ADD
-   ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
-
-   # shortcut for repeated builds - use with caution
-   if [ "$CMAKE_SKIP" = YES ]
-   then
-
-      # change to build/install folder
-      cd $ParaView_DIR || exit 1
-
-   else
-
-      # remove any existing build folder and recreate
-      rm -rf $ParaView_DIR
-      mkdir -p $ParaView_DIR
-      cd $ParaView_DIR
-
-      echo "----"
-      echo "Building $PARAVIEW_SRC"
-      echo "    MPI support    : $WITH_MPI"
-      echo "    Python support : $WITH_PYTHON"
-      echo "    MESA support   : $WITH_MESA"
-      echo "    Source         : $ParaView_INST_DIR"
-      echo "    Target         : $ParaView_DIR"
-      echo "----"
-
-      # make paraview
-      cmake \
-         -DCMAKE_INSTALL_PREFIX=$PARAVIEW_APP_DIR \
-         $CMAKE_VARIABLES \
-         $ParaView_INST_DIR
-   fi
-
-   # change to build folder
-   echo "    Starting make"
-
-   if [ -r /proc/cpuinfo ]
-   then
-      WM_NCOMPPROCS=$(egrep "^processor" /proc/cpuinfo | wc -l)
-
-      if [ $WM_NCOMPPROCS -gt 8 ]
-      then
-         WM_NCOMPPROCS=8
-      fi
-
-      make -j $WM_NCOMPPROCS
-   else
-      make
-   fi
+    # set paraview environment
+    for i in $PWD $WM_THIRD_PARTY_DIR
+    do
+        ParaView_INST_DIR=$i/$PARAVIEW_SRC
+        [ -d $ParaView_INST_DIR ] && break
+    done
+
+    if [ ! -d "$ParaView_INST_DIR" ]
+    then
+        # last chance: maybe already in the paraview directory
+        [ "${PWD##*/}" = $PARAVIEW_SRC ] && ParaView_INST_DIR=$PWD
+
+        [ -d "$ParaView_INST_DIR" ] || {
+            echo "did not find $PARAVIEW_SRC in these directories:"
+            echo "  PWD=$PWD"
+            echo "  WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR"
+            echo "abort build"
+            exit 1
+        }
+    fi
+
+    # ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER$OBJ_ADD
+    ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
+    echo "ParaView_DIR=$ParaView_DIR"
 }
 
 
-# adjust hard-links
+#
+# configure via cmake, but don't actually build anything
+#
+configParaView()
+{
+    # remove any existing build folder and recreate
+    if [ -d $ParaView_DIR ]
+    then
+        echo "removing old build/install directory"
+        rm -rf $ParaView_DIR
+    fi
+    mkdir -p $ParaView_DIR
+
+    cd $ParaView_DIR
+
+    echo "----"
+    echo "Configuring $PARAVIEW_SRC"
+    echo "    MPI support    : $WITH_MPI"
+    echo "    Python support : $WITH_PYTHON"
+    echo "    MESA support   : $WITH_MESA"
+    echo "    Source         : $ParaView_INST_DIR"
+    echo "    Target         : $ParaView_DIR"
+    echo "----"
+    echo
+    echo cmake \
+        -DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
+        $CMAKE_VARIABLES \
+        ../..
+    echo
+    echo "----"
+    echo
+
+    # run cmake to create Makefiles
+    cmake \
+        -DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
+        $CMAKE_VARIABLES \
+        ../..
+
+}
+
+
+#
+# invoke make
+# also link bin/ to lib/paraview-* for development without installation
+#
+makeParaView()
+{
+    cd $ParaView_DIR || exit 1  # change to build folder
+    echo "    Starting make"
+
+    if [ -r /proc/cpuinfo ]
+    then
+        WM_NCOMPPROCS=$(egrep "^processor" /proc/cpuinfo | wc -l)
+        [ $WM_NCOMPPROCS -le 8 ] || WM_NCOMPPROCS=8
+
+        time make -j $WM_NCOMPPROCS
+    else
+        time make
+    fi
+    echo "    Done make"
+
+    echo "    For quicker development, linking lib/paraview-$PARAVIEW_MAJOR_VERSION/ -> bin/"
+    rm -rf lib/paraview-$PARAVIEW_MAJOR_VERSION
+    mkdir lib 2>/dev/null
+    ( cd lib && ln -s ../bin paraview-$PARAVIEW_MAJOR_VERSION )
+}
+
+
+#
+# adjust hard-links (internal function)
 # Note: use loop with grep to avoid touching too many files
-fixCMakeHardLinks()
+#
+fixHardLinks()
+{
+    envName=$1
+    string=$2
+    shift 2
+
+    echo "-- Replacing path hard links for \$$envName"
+
+    for fileSpec
+    do
+        echo -n "   $fileSpec: "
+        for i in $(find . -type f -iname "$fileSpec")
+        do
+            if grep -q "$string" $i
+            then
+                echo -n "#"
+                sed -i "s,$string,\$ENV{$envName},g" $i
+            fi
+        done
+        echo
+    done
+}
+
+
+#
+# replace absolute paths with environment variables
+# This triggers a partial (or even a full) rebuild, but might let us
+# find our files later if we relocate the build
+#
+fixCMakeFiles()
 {
-   fileSpec=$1
-   string=$2
-   envName=$3
-
-   echo -n "    for \$$envName "
-   for i in $(find . -type f -iname "$fileSpec")
-   do
-      if grep -q "$string" $i
-      then
-         echo -n "#"
-         sed -i "s,$string,\$ENV{$envName},g" $i
-      fi
-   done
-   echo
+    cd $ParaView_DIR || exit 1  # change to build folder
+
+    # Replace path with env variable: ParaView_DIR
+    fixHardLinks ParaView_DIR "$ParaView_DIR" '*.cmake'
+
+    # Replace path with env variable: ParaView_INST_DIR
+    fixHardLinks ParaView_INST_DIR "$ParaView_INST_DIR" '*.cmake'
+
+    # Replace path with env variable: MPI_ARCH_PATH
+    if [ "$WITH_MPI" = ON ]
+    then
+        fixHardLinks MPI_ARCH_PATH "$MPI_ARCH_PATH" '*.cmake'
+    fi
+
+    # Replace path with env variable: CMAKE_HOME
+    if [ -r "$CMAKE_HOME" ]
+    then
+        fixHardLinks CMAKE_HOME "$CMAKE_HOME" '*cmake*'
+    fi
+
+    # Replace path with env variable: WM_COMPILER_DIR
+    # (include cmake.check_cache)
+    # This triggers a complete rebuild (with cmake-2.6.2), but is likely
+    # needed when redistributing files
+    fixHardLinks WM_COMPILER_DIR "$WM_COMPILER_DIR" '*cmake*'
 }
 
 
+#
+# make html documentation (mostly just for the readers/writers)
+#
+makeDocs()
+{
+    cd $ParaView_DIR || exit 1  # change to build folder
+    echo "    Creating html documentation"
+
+    make HTMLDocumentation
+}
+
+
+#
+# actually install the program
+#
 installParaView()
 {
-   if [ ! -e "$ParaView_DIR/bin/paraview" ]
-   then
-      echo "    Cannot install - no paraview binary found"
-      return
-   fi
-   echo "    Build complete"
-
-   cd $ParaView_DIR
-
-   echo "    Replacing path hard links"
-
-   # Replace local ParaView_INST_DIR path with ParaView_INST_DIR
-   # environment variable
-   fixCMakeHardLinks '*.cmake' "$ParaView_INST_DIR" ParaView_INST_DIR
-
-   # Replace local MPI_ARCH_PATH path with MPI_ARCH_PATH
-   # environment variable
-   if [ "$WITH_MPI" = ON ]
-   then
-      fixCMakeHardLinks '*.cmake' "$MPI_ARCH_PATH" MPI_ARCH_PATH
-   fi
-
-   # Replace local CMAKE_HOME path with CMAKE_HOME
-   # environment variable
-   if [ -r "$CMAKE_HOME" ]
-   then
-      fixCMakeHardLinks '*cmake*' "$CMAKE_HOME" CMAKE_HOME
-   fi
-
-   # Replace local WM_COMPILER_DIR path with WM_COMPILER_DIR
-   # environment variable
-   fixCMakeHardLinks '*cmake*' "$WM_COMPILER_DIR" WM_COMPILER_DIR
-
-   # create a softlink to the $ParaView_DIR/bin folder
-   # - workaround for chosen install location
-   echo "    Creating lib/paraview-$PARAVIEW_MAJOR_VERSION soft link to 'bin'"
-   rm -rf lib/paraview-$PARAVIEW_MAJOR_VERSION
-   [ -d lib ] || mkdir lib
-   ( cd lib && ln -s ../bin paraview-$PARAVIEW_MAJOR_VERSION )
-
-   # info on symlinks to screen
-   echo ""
-   echo "    ---"
-   echo "    Installation complete"
-   echo "    Set environment variables:"
-   echo "    - ParaView_INST_DIR to $ParaView_INST_DIR"
-   echo "    - ParaView_DIR to $ParaView_DIR"
-   echo "    - PV_PLUGIN_PATH to $FOAM_LIBBIN"
-   echo "    Add $ParaView_DIR/bin to PATH"
-   # echo "   Add $ParaView_INST_DIR/lib to LD_LIBRARY_PATH"
-   echo "    ---"
+    cd $ParaView_DIR || exit 1  # change to build folder
+    echo "    Installing ParaView to $ParaView_DIR"
+
+    echo "disabled 'make install' for now, just use links"
+
+    # about.txt may be missing
+    paraviewLibDir="$ParaView_DIR/lib/paraview-$PARAVIEW_MAJOR_VERSION"
+    if [ -d "$paraviewLibDir" -a ! -e "$paraviewLibDir/about.txt" ]
+    then
+        echo "paraview-$PARAVIEW_MAJOR_VERSION installed - $(date)" > $paraviewLibDir/about.txt
+    fi
+
+cat<< INFO
+    ---
+    Installation complete
+    Set environment variables:
+
+        export ParaView_INST_DIR=$ParaView_INST_DIR
+        export ParaView_DIR=$ParaView_DIR
+        export PV_PLUGIN_PATH=$FOAM_LIBBIN
+        export PATH=\$ParaView_DIR/bin:\$PATH
+    ---
+INFO
 }
 
 
 # clear all the variables used before using any of the functions
-
 unset VERBOSE
-unset WITH_MPI
-unset WITH_MESA
-unset WITH_PYTHON
-unset PYTHON_LIBRARY
+unset WITH_MPI WITH_MESA
+unset WITH_PYTHON PYTHON_LIBRARY
 unset CMAKE_VARIABLES
-unset CMAKE_SKIP
 unset OBJ_ADD
 
 # start with these general settings
 addCMakeVariable  VTK_USE_TK=FALSE
-addCMakeVariable  BUILD_SHARED_LIBS:BOOL=ON
-addCMakeVariable  VTK_USE_RPATH:BOOL=OFF
+addCMakeVariable  BUILD_SHARED_LIBS:BOOL=ON VTK_USE_RPATH:BOOL=OFF
 addCMakeVariable  CMAKE_BUILD_TYPE:STRING=Release
 
+# include development files in "make install"
+addCMakeVariable  PARAVIEW_INSTALL_DEVELOPMENT:BOOL=ON
+
 # ----------------------------------------------------------------- end-of-file
diff --git a/etc/apps/paraview3/bashrc b/etc/apps/paraview3/bashrc
index 8ff878105138c45aa083e88fd34dedd9a741384e..cfa2f113376bddbb38f35bc43722575f7f2c4f62 100644
--- a/etc/apps/paraview3/bashrc
+++ b/etc/apps/paraview3/bashrc
@@ -26,38 +26,49 @@
 #     paraview3/bashrc
 #
 # Description
-#     Setup file for ParaView3.
+#     Setup file for paraview-3.x
 #     Sourced from OpenFOAM-?.?/etc/bashrc
 #
+# Note
+#     The env. variable 'ParaView_DIR' is required for building plugins
 #------------------------------------------------------------------------------
 
-export CMAKE_HOME=$WM_THIRD_PARTY_DIR/cmake-2.4.6/platforms/$WM_ARCH
+# determine the cmake to be used
+unset CMAKE_HOME
+for cmake in cmake-2.6.2 cmake-2.4.6
+do
+    cmake=$WM_THIRD_PARTY_DIR/$cmake/platforms/$WM_ARCH
+    if [ -r $cmake ]
+    then
+        export CMAKE_HOME=$cmake
+        export PATH=$CMAKE_HOME/bin:$PATH
+        break
+    fi
+done
 
-if [ -r $CMAKE_HOME ]
-then
-    export PATH=$CMAKE_HOME/bin:$PATH
-else
-    unset CMAKE_HOME
-fi
+paraviewMajor=paraview-3.5
+export ParaView_VERSION=3.5-cvs
 
-export ParaView_VERSION="3.3-cvs"
-
-export ParaView_INST_DIR=$WM_THIRD_PARTY_DIR/ParaView$ParaView_VERSION
+export ParaView_INST_DIR=$WM_THIRD_PARTY_DIR/paraview-$ParaView_VERSION
 export ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
 
-if [ "$PYTHONPATH" ]
+# add in python libraries if required
+paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
+if [ -r $paraviewPython ]
 then
-    export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
-else
-    export PYTHONPATH=$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
+    if [ "$PYTHONPATH" ]
+    then
+        export PYTHONPATH=$PYTHONPATH:$paraviewPython:$ParaView_DIR/lib/$paraviewMajor
+    else
+        export PYTHONPATH=$paraviewPython:$ParaView_DIR/lib/$paraviewMajor
+    fi
 fi
 
-
 if [ -r $ParaView_DIR ]
 then
     export PATH=$ParaView_DIR/bin:$PATH
-    export LD_LIBRARY_PATH=$ParaView_DIR/bin:$LD_LIBRARY_PATH
     export PV_PLUGIN_PATH=$FOAM_LIBBIN
 fi
 
+unset cmake paraviewMajor paraviewPython
 # -----------------------------------------------------------------------------
diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc
index 636b10eb75d0b806d0844653c26d6e8c37c6498d..875d0d1655f5a8c1bcfcb4312609953710aa8a0a 100644
--- a/etc/apps/paraview3/cshrc
+++ b/etc/apps/paraview3/cshrc
@@ -26,34 +26,44 @@
 #     paraview3/cshrc
 #
 # Description
-#     Startup File for Paraview3
+#     Startup File for paraview-3.x
 #     Sourced from OpenFOAM-?.?/etc/cshrc
 #
+# Note
+#     The env. variable 'ParaView_DIR' is required for building plugins
 #------------------------------------------------------------------------------
 
-setenv CMAKE_HOME $WM_THIRD_PARTY_DIR/cmake-2.4.6/platforms/$WM_ARCH
+# determine the cmake to be used
+unsetenv CMAKE_HOME
+foreach cmake ( cmake-2.6.2 cmake-2.4.6 )
+    set cmake=$WM_THIRD_PARTY_DIR/$cmake/platforms/$WM_ARCH
+    if ( -r $cmake ) then
+        setenv CMAKE_HOME $cmake
+        set path=($CMAKE_HOME/bin $path)
+        break
+    endif
+end
 
-if ( -r $CMAKE_HOME ) then
-    set path=($CMAKE_HOME/bin $path)
-else
-    unsetenv CMAKE_HOME
-endif
-
-setenv ParaView_VERSION 3.3-cvs
+set paraviewMajor=paraview-3.5
+setenv ParaView_VERSION 3.5-cvs
 
-setenv ParaView_INST_DIR $WM_THIRD_PARTY_DIR/ParaView$ParaView_VERSION
+setenv ParaView_INST_DIR $WM_THIRD_PARTY_DIR/paraview-$ParaView_VERSION
 setenv ParaView_DIR $ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
 
-if ($?PYTHONPATH) then
-    setenv PYTHONPATH ${PYTHONPATH}:$ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
-else
-    setenv PYTHONPATH $ParaView_DIR/Utilities/VTKPythonWrapping:$ParaView_DIR/lib/paraview-3.3
+# add in python libraries if required
+set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping
+if ( -r $paraviewPython ) then
+    if ($?PYTHONPATH) then
+        setenv PYTHONPATH ${PYTHONPATH}:$paraviewPython:$ParaView_DIR/lib/${paraviewMajor}
+    else
+        setenv PYTHONPATH $paraviewPython:$ParaView_DIR/lib/${paraviewMajor}
+    endif
 endif
 
 if ( -r $ParaView_INST_DIR ) then
     set path=($ParaView_DIR/bin $path)
-    setenv LD_LIBRARY_PATH $ParaView_DIR/bin:$LD_LIBRARY_PATH
     setenv PV_PLUGIN_PATH $FOAM_LIBBIN
 endif
 
+unset cmake paraviewMajor paraviewPython
 # -----------------------------------------------------------------------------
diff --git a/etc/bashrc b/etc/bashrc
index ec96457be247718cd103bef4fe42eac681bcb145..35044f5b019600d90f81a57c7f03496f7a071e25 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -91,7 +91,7 @@ export WM_COMPILER_LIB_ARCH=
 # WM_JAVAC_OPTION = Opt | Debug
 : ${WM_JAVAC_OPTION:=Opt}; export WM_JAVAC_OPTION
 
-# WM_MPLIB = | OPENMPI| LAM | MPICH | MPICH-GM | HPMPI | GAMMA | MPI
+# WM_MPLIB = | OPENMPI | LAM | MPICH | MPICH-GM | HPMPI | GAMMA | MPI
 : ${WM_MPLIB:=OPENMPI}; export WM_MPLIB
 
 
diff --git a/src/Allwmake b/src/Allwmake
index f6e7907e32721347fec0d57a42d1210ae88c93c2..e0324141cd6b7ceb5ef9591e21b294a032e9dfc0 100755
--- a/src/Allwmake
+++ b/src/Allwmake
@@ -2,11 +2,8 @@
 cd ${0%/*} || exit 1    # run from this directory
 set -x
 
-# update version string if under Git
-git describe 2> /dev/null | \
-(read project_string \
-   && sed -e 's/WM_PROJECT_VERSION/\"'"${project_string}"'"/' \
-   OpenFOAM/global/global_raw.C >OpenFOAM/global/global.C)
+# update Foam::FOAMversion string if required
+wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null
 
 wmakeLnInclude -f OpenFOAM
 wmakeLnInclude -f OSspecific/$WM_OS
diff --git a/src/OSspecific/Unix/Unix.C b/src/OSspecific/Unix/Unix.C
index 8f4ddafdb827b6b63e7524764478a2fd0c93ff7e..271d4a442b57ead63fdb449c16efedb505c5c34d 100644
--- a/src/OSspecific/Unix/Unix.C
+++ b/src/OSspecific/Unix/Unix.C
@@ -211,7 +211,7 @@ bool Foam::chDir(const fileName& dir)
 }
 
 
-Foam::fileName Foam::dotFoam(const fileName& name)
+Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
 {
     // Search user files:
     // ~~~~~~~~~~~~~~~~~~
@@ -268,6 +268,15 @@ Foam::fileName Foam::dotFoam(const fileName& name)
     }
 
     // Not found
+    // abort if the file is mandatory, otherwise return null
+    if (mandatory)
+    {
+        cerr<< "--> FOAM FATAL ERROR in Foam::findEtcFile() :"
+               " could not find mandatory file\n    '"
+            << name.c_str() << "'\n\n" << std::endl;
+        ::exit(1);
+    }
+
     return fileName::null;
 }
 
diff --git a/src/OSspecific/Unix/regExp.C b/src/OSspecific/Unix/regExp.C
index 62c69512b712f65639008e14bac85a3b2c8d8b96..e3ad4a11af4cb6e7b1e5cf553fcfe62a3255e923 100644
--- a/src/OSspecific/Unix/regExp.C
+++ b/src/OSspecific/Unix/regExp.C
@@ -37,15 +37,20 @@ License
 void Foam::regExp::compile(const char* pat) const
 {
     clear();
-    preg_ = new regex_t;
 
-    if (regcomp(preg_, pat, REG_EXTENDED) != 0)
+    // avoid NULL and zero-length patterns
+    if (pat && *pat)
     {
-        FatalErrorIn
-        (
-            "regExp::compile(const char*)"
-        )   << "Failed to compile regular expression '" << pat << "'"
-            << exit(FatalError);
+        preg_ = new regex_t;
+
+        if (regcomp(preg_, pat, REG_EXTENDED) != 0)
+        {
+            FatalErrorIn
+            (
+                "regExp::compile(const char*)"
+            )   << "Failed to compile regular expression '" << pat << "'"
+                << exit(FatalError);
+        }
     }
 }
 
@@ -60,6 +65,7 @@ void Foam::regExp::clear() const
     }
 }
 
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 Foam::regExp::regExp()
@@ -83,6 +89,7 @@ Foam::regExp::regExp(const char* pat)
     compile(pat);
 }
 
+
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 Foam::regExp::~regExp()
@@ -90,6 +97,7 @@ Foam::regExp::~regExp()
     clear();
 }
 
+
 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
 
 int Foam::regExp::ngroups() const
@@ -110,6 +118,7 @@ bool Foam::regExp::match
         regmatch_t pmatch[1];
 
         // match and also verify that the entire string was matched
+        // pmatch[0] is the entire match
         if
         (
             regexec(preg_, str.c_str(), nmatch, pmatch, 0) == 0
@@ -141,6 +150,8 @@ bool Foam::regExp::match
         regmatch_t pmatch[nmatch];
 
         // match and also verify that the entire string was matched
+        // pmatch[0] is the entire match
+        // pmatch[1..] are the (...) sub-groups
         if
         (
             regexec(preg_, str.c_str(), nmatch, pmatch, 0) == 0
@@ -179,8 +190,8 @@ bool Foam::regExp::match
     return false;
 }
 
-// * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * * //
 
+// * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * * //
 
 void Foam::regExp::operator=(const string& pat)
 {
@@ -193,4 +204,5 @@ void Foam::regExp::operator=(const char* pat)
     compile(pat);
 }
 
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files
index a9708a3c30773a099382a2d87d624b088bb40406..9162050cc0a60e7d85f254bf9348a8b8078d9a1c 100644
--- a/src/OpenFOAM/Make/files
+++ b/src/OpenFOAM/Make/files
@@ -1,5 +1,4 @@
-global/global.C
-
+global/global.Cver
 global/dimensionedConstants/dimensionedConstants.C
 global/argList/argList.C
 global/clock/clock.C
@@ -290,7 +289,6 @@ $(tetCell)/tetCell.C
 
 cellModeller = $(meshShapes)/cellModeller
 $(cellModeller)/cellModeller.C
-$(cellModeller)/cellModellerIO.C
 
 cellModel = $(meshShapes)/cellModel
 $(cellModel)/cellModel.C
diff --git a/src/OpenFOAM/containers/Dictionaries/Dictionary/Dictionary.C b/src/OpenFOAM/containers/Dictionaries/Dictionary/Dictionary.C
index 33d7fd3723255e24f6aa7207db3e678b309fdc93..b6e52f46860ae265acae8ce0eef7040fd5b8a394 100644
--- a/src/OpenFOAM/containers/Dictionaries/Dictionary/Dictionary.C
+++ b/src/OpenFOAM/containers/Dictionaries/Dictionary/Dictionary.C
@@ -28,22 +28,15 @@ Description
 
 #include "Dictionary.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Null constructor
 template<class T>
-Dictionary<T>::Dictionary()
+Foam::Dictionary<T>::Dictionary()
 {}
 
 
-// Copy constructor
 template<class T>
-Dictionary<T>::Dictionary(const Dictionary& dict)
+Foam::Dictionary<T>::Dictionary(const Dictionary& dict)
 :
     DictionaryBase<IDLList<T>, T>(dict)
 {}
@@ -52,10 +45,10 @@ Dictionary<T>::Dictionary(const Dictionary& dict)
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class T>
-bool Dictionary<T>::erase(const word& Keyword)
+bool Foam::Dictionary<T>::erase(const word& keyword)
 {
     T* tPtr;
-    if ((tPtr = this->remove(Keyword)))
+    if (tPtr = this->remove(keyword))
     {
         delete tPtr;
         return true;
@@ -69,6 +62,4 @@ bool Dictionary<T>::erase(const word& Keyword)
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/Dictionaries/Dictionary/Dictionary.H b/src/OpenFOAM/containers/Dictionaries/Dictionary/Dictionary.H
index 3b985482e7bdbec929388d8d4dd62c9efbb10094..90af1383f4a485307b002ee9fcd71c32e4ea9eeb 100644
--- a/src/OpenFOAM/containers/Dictionaries/Dictionary/Dictionary.H
+++ b/src/OpenFOAM/containers/Dictionaries/Dictionary/Dictionary.H
@@ -27,8 +27,10 @@ Class
 
 Description
     Gerneral purpose template dictionary class which manages the storage
-    associated with it.  It is derived from DictionaryBase instantiated on
-    a memory managed form of intrusive doubly-linked list of \<T\>.
+    associated with it.
+
+    It is derived from DictionaryBase instantiated on a memory managed form
+    of intrusive doubly-linked list of \<T\>.
 
 SourceFiles
     Dictionary.C
@@ -47,7 +49,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class Dictionary Declaration
+                         Class Dictionary Declaration
 \*---------------------------------------------------------------------------*/
 
 template<class T>
@@ -69,11 +71,9 @@ public:
 
     // Member functions
 
-        // Editing
-
-            //- Remove an entry specified by keyword from the dictionary
-            //  and delete it
-            bool erase(const word& keyword);
+        //- Remove an entry specified by keyword and delete the pointer.
+        //  Returns true if the keyword was found
+        bool erase(const word& keyword);
 };
 
 
diff --git a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C
index 4349973c3ce236f4077046a70a95ee50639534dc..95112712081129e65f9331a7592fcb89ab9429ad 100644
--- a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C
+++ b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.C
@@ -26,15 +26,10 @@ License
 
 #include "DictionaryBase.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 template<class IDLListType, class T>
-void DictionaryBase<IDLListType, T>::addEntries()
+void Foam::DictionaryBase<IDLListType, T>::addEntries()
 {
     for
     (
@@ -51,12 +46,15 @@ void DictionaryBase<IDLListType, T>::addEntries()
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class IDLListType, class T>
-DictionaryBase<IDLListType, T>::DictionaryBase()
+Foam::DictionaryBase<IDLListType, T>::DictionaryBase()
 {}
 
 
 template<class IDLListType, class T>
-DictionaryBase<IDLListType, T>::DictionaryBase(const DictionaryBase& dict)
+Foam::DictionaryBase<IDLListType, T>::DictionaryBase
+(
+    const DictionaryBase& dict
+)
 :
     IDLListType(dict)
 {
@@ -66,17 +64,20 @@ DictionaryBase<IDLListType, T>::DictionaryBase(const DictionaryBase& dict)
 
 template<class IDLListType, class T>
 template<class INew>
-DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is, const INew& inewt)
+Foam::DictionaryBase<IDLListType, T>::DictionaryBase
+(
+    Istream& is,
+    const INew& iNew
+)
 :
-    IDLListType(is, inewt)
+    IDLListType(is, iNew)
 {
     addEntries();
 }
 
 
-// Istream constructor
 template<class IDLListType, class T>
-DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is)
+Foam::DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is)
 :
     IDLListType(is)
 {
@@ -88,25 +89,60 @@ DictionaryBase<IDLListType, T>::DictionaryBase(Istream& is)
 
 // Find and return T
 template<class IDLListType, class T>
-bool DictionaryBase<IDLListType, T>::found(const word& keyword) const
+bool Foam::DictionaryBase<IDLListType, T>::found(const word& keyword) const
 {
     return hashedTs_.found(keyword);
 }
 
 
-// Find and return T*
+// Find and return T*, return NULL if not found
 template<class IDLListType, class T>
-const T* DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
+const T* Foam::DictionaryBase<IDLListType, T>::lookupPtr
+(
+    const word& keyword
+) const
+{
+    typename HashTable<T*>::const_iterator iter = hashedTs_.find(keyword);
+
+    if (iter != hashedTs_.end())
+    {
+        return *iter;
+    }
+    else
+    {
+        return NULL;
+    }
+}
+
+
+// Find and return T*, return NULL if not found
+template<class IDLListType, class T>
+T* Foam::DictionaryBase<IDLListType, T>::lookupPtr(const word& keyword)
+{
+    typename HashTable<T*>::iterator iter = hashedTs_.find(keyword);
+
+    if (iter != hashedTs_.end())
+    {
+        return *iter;
+    }
+    else
+    {
+        return NULL;
+    }
+}
+
+
+// Find and return T*, FatalError if keyword not found
+template<class IDLListType, class T>
+const T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
 {
     typename HashTable<T*>::const_iterator iter = hashedTs_.find(keyword);
 
     if (iter == hashedTs_.end())
     {
-        // If keyword not found print error message ...
         FatalErrorIn
         (
-            "DictionaryBase<IDLListType, T>::"
-            "lookup(const word& keyword) const"
+            "DictionaryBase<IDLListType, T>::lookup(const word&) const"
         )   << keyword << " is undefined"
             << exit(FatalError);
     }
@@ -115,18 +151,17 @@ const T* DictionaryBase<IDLListType, T>::lookup(const word& keyword) const
 }
 
 
-// Find and return T*
+// Find and return T*, FatalError if keyword not found
 template<class IDLListType, class T>
-T* DictionaryBase<IDLListType, T>::lookup(const word& keyword)
+T* Foam::DictionaryBase<IDLListType, T>::lookup(const word& keyword)
 {
     typename HashTable<T*>::iterator iter = hashedTs_.find(keyword);
 
     if (iter == hashedTs_.end())
     {
-        // If keyword not found print error message ...
         FatalErrorIn
         (
-            "DictionaryBase<IDLListType, T>::lookup(const word& keyword)"
+            "DictionaryBase<IDLListType, T>::lookup(const word&)"
         )   << keyword << " is undefined"
             << exit(FatalError);
     }
@@ -137,7 +172,7 @@ T* DictionaryBase<IDLListType, T>::lookup(const word& keyword)
 
 // Return the table of contents
 template<class IDLListType, class T>
-wordList DictionaryBase<IDLListType, T>::toc() const
+Foam::wordList Foam::DictionaryBase<IDLListType, T>::toc() const
 {
     wordList keywords(this->size());
 
@@ -158,26 +193,28 @@ wordList DictionaryBase<IDLListType, T>::toc() const
 
 // Add at head of dictionary
 template<class IDLListType, class T>
-void DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
+void Foam::DictionaryBase<IDLListType, T>::insert(const word& keyword, T* tPtr)
 {
-    IDLListType::insert(tPtr);
+    // NOTE: we should probably check that HashTable::insert actually worked
     hashedTs_.insert(keyword, tPtr);
+    IDLListType::insert(tPtr);
 }
 
 
 // Add at tail of dictionary
 template<class IDLListType, class T>
-void DictionaryBase<IDLListType, T>::append(const word& keyword, T* tPtr)
+void Foam::DictionaryBase<IDLListType, T>::append(const word& keyword, T* tPtr)
 {
-    IDLListType::append(tPtr);
+    // NOTE: we should probably check that HashTable::insert actually worked
     hashedTs_.insert(keyword, tPtr);
+    IDLListType::append(tPtr);
 }
 
 
 template<class IDLListType, class T>
-T* DictionaryBase<IDLListType, T>::remove(const word& Keyword)
+T* Foam::DictionaryBase<IDLListType, T>::remove(const word& keyword)
 {
-    typename HashTable<T*>::iterator iter = hashedTs_.find(Keyword);
+    typename HashTable<T*>::iterator iter = hashedTs_.find(keyword);
 
     if (iter != hashedTs_.end())
     {
@@ -192,19 +229,29 @@ T* DictionaryBase<IDLListType, T>::remove(const word& Keyword)
 }
 
 
-//- Clear the dictionary
 template<class IDLListType, class T>
-void DictionaryBase<IDLListType, T>::clear()
+void Foam::DictionaryBase<IDLListType, T>::clear()
 {
     IDLListType::clear();
     hashedTs_.clear();
 }
 
 
+template<class IDLListType, class T>
+void Foam::DictionaryBase<IDLListType, T>::transfer
+(
+    DictionaryBase<IDLListType, T>& dict
+)
+{
+    IDLListType::transfer(dict);
+    hashedTs_.transfer(dict.hashedTs_);
+}
+
+
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
 template<class IDLListType, class T>
-void DictionaryBase<IDLListType, T>::operator=
+void Foam::DictionaryBase<IDLListType, T>::operator=
 (
     const DictionaryBase<IDLListType, T>& dict
 )
@@ -218,25 +265,11 @@ void DictionaryBase<IDLListType, T>::operator=
     }
 
     IDLListType::operator=(dict);
-
     this->hashedTs_.clear();
-
-    for
-    (
-        typename IDLListType::iterator iter = this->begin();
-        iter != this->end();
-        ++iter
-    )
-    {
-        this->hashedTs_.insert((*iter).keyword(), &(*iter));
-    }
+    this->addEntries();
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #include "DictionaryBaseIO.C"
diff --git a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H
index 8288cdf5cfbf5f28feddfe19c73bcb3e249a2b34..f14785bcd555ae5a8737623024e6d15de146d82f 100644
--- a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H
+++ b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBase.H
@@ -29,12 +29,12 @@ Description
     Base dictionary class templated on both the form of doubly-linked list
     it uses as well as the type it holds.
 
-    The double templating allows for the instantiation of forms with and
+    The double templating allows for the instantiation of forms with or
     without storage management.
 
 Note
     The IDLListType parameter should itself be a template but this confused
-    gcc 2.95.2 so it has to be instantiated for T when an intantiation of
+    gcc 2.95.2 so it has to be instantiated for T when an instantiation of
     DictionaryBase is requested
 
 See Also
@@ -67,7 +67,7 @@ Ostream& operator<<(Ostream&, const DictionaryBase<IDLListType, T>&);
 
 
 /*---------------------------------------------------------------------------*\
-                           Class DictionaryBase Declaration
+                      Class DictionaryBase Declaration
 \*---------------------------------------------------------------------------*/
 
 template<class IDLListType, class T>
@@ -77,7 +77,7 @@ class DictionaryBase
 {
     // Private data
 
-        //- HashTable of the enries held on the DL-list for quick lookup
+        //- HashTable of the entries held on the IDLListType for quick lookup
         HashTable<T*> hashedTs_;
 
 
@@ -99,10 +99,10 @@ public:
 
         //- Construct from Istream using given Istream constructor class
         template<class INew>
-        DictionaryBase(Istream& is, const INew& inewt);
+        DictionaryBase(Istream&, const INew&);
 
-        //- Construct from Istream
-        DictionaryBase(Istream& is);
+        //- Construct from Istream using default Istream constructor class
+        DictionaryBase(Istream&);
 
 
     // Member functions
@@ -110,7 +110,13 @@ public:
         // Search and lookup
 
             //- Search DictionaryBase for given keyword
-            bool found(const word& keyword) const;
+            bool found(const word&) const;
+
+            //- Find and return an entry if present, otherwise return NULL
+            const T* lookupPtr(const word&) const;
+
+            //- Find and return an entry if present, otherwise return NULL
+            T* lookupPtr(const word&);
 
             //- Find and return entry
             const T* lookup(const word&) const;
@@ -125,17 +131,21 @@ public:
         // Editing
 
             //- Add at head of dictionary
-            void insert(const word& keyword, T*);
+            void insert(const word&, T*);
 
             //- Add at tail of dictionary
-            void append(const word& keyword, T*);
+            void append(const word&, T*);
 
-            //- Remove and return entry specified by keyword
-            T* remove(const word& keyword);
+            //- Remove and return entry specified by keyword.
+            //  Return NULL if the keyword was not found.
+            T* remove(const word&);
 
             //- Clear the dictionary
             void clear();
 
+            //- Transfer the contents of the argument into this DictionaryBase
+            //  and annull the argument.
+            void transfer(DictionaryBase<IDLListType, T>&);
 
     // Member operators
 
diff --git a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBaseIO.C b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBaseIO.C
index 15854c515bf653dcb8a09ee0377dd59585be5673..6af2b1622dcc46f760622704bcfffba39c995b40 100644
--- a/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBaseIO.C
+++ b/src/OpenFOAM/containers/Dictionaries/DictionaryBase/DictionaryBaseIO.C
@@ -30,15 +30,13 @@ Description
 #include "DictionaryBase.H"
 #include "IOstreams.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * * //
 
 template<class IDLListType, class T>
-Ostream& operator<<(Ostream& os, const DictionaryBase<IDLListType, T>& dict)
+Foam::Ostream& Foam::operator<<
+(
+    Ostream& os,
+    const DictionaryBase<IDLListType, T>& dict)
 {
     for
     (
@@ -53,7 +51,7 @@ Ostream& operator<<(Ostream& os, const DictionaryBase<IDLListType, T>& dict)
         if (!os.good())
         {
             Info
-                << "operator<<(Ostream& os, const DictionaryBase&) : "
+                << "operator<<(Ostream&, const DictionaryBase&) : "
                 << "Can't write entry for DictionaryBase"
                 << endl;
 
@@ -67,6 +65,4 @@ Ostream& operator<<(Ostream& os, const DictionaryBase<IDLListType, T>& dict)
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.C b/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.C
index b2b7861eb4f00e3f4bee21689a5f36fc2df18465..4b0a48ac900002db096e6f544e8aa9b742306a97 100644
--- a/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.C
+++ b/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.C
@@ -26,20 +26,15 @@ License
 
 #include "PtrDictionary.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class T>
-PtrDictionary<T>::PtrDictionary()
+Foam::PtrDictionary<T>::PtrDictionary()
 {}
 
 
 template<class T>
-PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
+Foam::PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
 :
     DictionaryBase<DLPtrList<T>, T>(dict)
 {}
@@ -47,14 +42,14 @@ PtrDictionary<T>::PtrDictionary(const PtrDictionary& dict)
 
 template<class T>
 template<class INew>
-PtrDictionary<T>::PtrDictionary(Istream& is, const INew& iNew)
+Foam::PtrDictionary<T>::PtrDictionary(Istream& is, const INew& iNew)
 :
     DictionaryBase<DLPtrList<T>, T>(is, iNew)
 {}
 
 
 template<class T>
-PtrDictionary<T>::PtrDictionary(Istream& is)
+Foam::PtrDictionary<T>::PtrDictionary(Istream& is)
 :
     DictionaryBase<DLPtrList<T>, T>(is)
 {}
@@ -62,6 +57,4 @@ PtrDictionary<T>::PtrDictionary(Istream& is)
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.H b/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.H
index 3396236515c1a1ec08ef83318e32532703e9b5e8..9c7da2f4de329a18c8aa06c98041d169a32eb521 100644
--- a/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.H
+++ b/src/OpenFOAM/containers/Dictionaries/PtrDictionary/PtrDictionary.H
@@ -27,8 +27,10 @@ Class
 
 Description
     Template dictionary class which does not manages the storage
-    associated with it.  It is derived from DictionaryBase instantiated on
-    a non-memory managed form of intrusive doubly-linked list of T.
+    associated with it.
+
+    It is derived from DictionaryBase instantiated on a non-memory managed
+    form of intrusive doubly-linked list of T.
 
 SourceFiles
     PtrDictionary.C
@@ -47,7 +49,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class PtrDictionary Declaration
+                        Class PtrDictionary Declaration
 \*---------------------------------------------------------------------------*/
 
 template<class T>
diff --git a/src/OpenFOAM/containers/Dictionaries/UDictionary/UDictionary.C b/src/OpenFOAM/containers/Dictionaries/UDictionary/UDictionary.C
index 9712b747351431b59989a0ba9d88a97239fbd773..8f29af262bc361ddef8e5ebc9b25e6887e0c1460 100644
--- a/src/OpenFOAM/containers/Dictionaries/UDictionary/UDictionary.C
+++ b/src/OpenFOAM/containers/Dictionaries/UDictionary/UDictionary.C
@@ -26,22 +26,15 @@ License
 
 #include "UDictionary.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Null constructor
 template<class T>
-UDictionary<T>::UDictionary()
+Foam::UDictionary<T>::UDictionary()
 {}
 
 
-// Copy constructor
 template<class T>
-UDictionary<T>::UDictionary(const UDictionary& dict)
+Foam::UDictionary<T>::UDictionary(const UDictionary& dict)
 :
     DictionaryBase<UIDLList<T>, T>(dict)
 {}
@@ -49,6 +42,4 @@ UDictionary<T>::UDictionary(const UDictionary& dict)
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/Dictionaries/UDictionary/UDictionary.H b/src/OpenFOAM/containers/Dictionaries/UDictionary/UDictionary.H
index fb30237d40d91768a8b9ba850bfe51e35ddd98ac..5cc4d301f4e3f2aab7d1558d337111b6ce9077a4 100644
--- a/src/OpenFOAM/containers/Dictionaries/UDictionary/UDictionary.H
+++ b/src/OpenFOAM/containers/Dictionaries/UDictionary/UDictionary.H
@@ -49,7 +49,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class UDictionary Declaration
+                         Class UDictionary Declaration
 \*---------------------------------------------------------------------------*/
 
 template<class T>
diff --git a/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.C b/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.C
index 3a4686fbf6aa659ad4c5e9d8046099de1e7a4ffd..6aa7da72abd4c50cbcca4ca9c2d37cf796f0c6a3 100644
--- a/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.C
+++ b/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.C
@@ -26,22 +26,15 @@ License
 
 #include "UPtrDictionary.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Null constructor
 template<class T>
-UPtrDictionary<T>::UPtrDictionary()
+Foam::UPtrDictionary<T>::UPtrDictionary()
 {}
 
 
-// Copy constructor
 template<class T>
-UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
+Foam::UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
 :
     DictionaryBase<DLList<T*>, T>(dict)
 {}
@@ -49,6 +42,4 @@ UPtrDictionary<T>::UPtrDictionary(const UPtrDictionary& dict)
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.H b/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.H
index 2caac9efac685a5e5e88658f73edbc897a6e1980..99aee0ac562ce84c04c8ef25b823cca530d9e3b7 100644
--- a/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.H
+++ b/src/OpenFOAM/containers/Dictionaries/UPtrDictionary/UPtrDictionary.H
@@ -27,8 +27,10 @@ Class
 
 Description
     Template dictionary class which does not manages the storage
-    associated with it.  It is derived from DictionaryBase instantiated on
-    a non-memory managed form of intrusive doubly-linked list of \<T\>.
+    associated with it.
+
+    It is derived from DictionaryBase instantiated on a non-memory managed
+    form of intrusive doubly-linked list of \<T\>.
 
 SourceFiles
     UPtrDictionary.C
@@ -47,7 +49,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class UPtrDictionary Declaration
+                       Class UPtrDictionary Declaration
 \*---------------------------------------------------------------------------*/
 
 template<class T>
diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
index d9d74fd1ad4fbcb79040a38183b1e1b357c03c62..37c595222e5c1f6a2aca308cdb356f538b7a0092 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
@@ -456,6 +456,14 @@ void HashTable<T, Key, Hash>::clear()
 }
 
 
+template<class T, class Key, class Hash>
+void HashTable<T, Key, Hash>::clearStorage()
+{
+    clear();
+    resize(0);
+}
+
+
 template<class T, class Key, class Hash>
 void HashTable<T, Key, Hash>::transfer(HashTable<T, Key, Hash>& ht)
 {
diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
index 701d8456156572dd54f878b5dc7748636505a7be..798dad6367882f2bee2e94d12e2ac74b395b7508 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
@@ -54,6 +54,7 @@ template<class T>
 class List;
 
 template<class T, class Key, class Hash> class HashTable;
+template<class T, class Key, class Hash> class HashPtrTable;
 
 template<class T, class Key, class Hash> Istream& operator>>
 (
@@ -102,7 +103,7 @@ class HashTable
                 //- Construct given key, next pointer and object
                 inline hashedEntry
                 (
-                    const Key& key,
+                    const Key&,
                     hashedEntry* next,
                     const T& newEntry
                 );
@@ -127,7 +128,7 @@ class HashTable
     // Private Member Functions
 
         //- Assign a new hashedEntry to a possibly already existing key
-        bool set(const Key& key, const T& newElmt, bool protect);
+        bool set(const Key&, const T& newElmt, bool protect);
 
 public:
 
@@ -173,15 +174,15 @@ public:
             inline label size() const;
 
             //- Return true if hashedEntry is found in table
-            bool found(const Key& key) const;
+            bool found(const Key&) const;
 
             //- Find and return an iterator set at the hashedEntry
             //  If not found iterator = end()
-            iterator find(const Key& key);
+            iterator find(const Key&);
 
             //- Find and return an const_iterator set at the hashedEntry
             //  If not found iterator = end()
-            const_iterator find(const Key& key) const;
+            const_iterator find(const Key&) const;
 
             //- Return the table of contents
             List<Key> toc() const;
@@ -190,16 +191,16 @@ public:
         // Edit
 
             //- Insert a new hashedEntry
-            inline bool insert(const Key& key, const T& newElmt);
+            inline bool insert(const Key&, const T& newElmt);
 
             //- Assign a new hashedEntry, overwriting existing entries
-            inline bool set(const Key& key, const T& newElmt);
+            inline bool set(const Key&, const T& newElmt);
 
             //- Erase an hashedEntry specified by given iterator
-            bool erase(const iterator& it);
+            bool erase(const iterator&);
 
             //- Erase an hashedEntry specified by given key if in table
-            bool erase(const Key& key);
+            bool erase(const Key&);
 
             //- Resize the hash table for efficiency
             void resize(const label newSize);
@@ -207,6 +208,10 @@ public:
             //- Clear all entries from table
             void clear();
 
+            //- Clear the table entries and the table itself.
+            //  Equivalent to clear() followed by resize(0)
+            void clearStorage();
+
             //- Transfer the contents of the argument table into this table
             //  and annull the argument table.
             void transfer(HashTable<T, Key, Hash>&);
@@ -215,14 +220,14 @@ public:
     // Member Operators
 
         //- Find and return an hashedEntry
-        inline T& operator[](const Key& key);
+        inline T& operator[](const Key&);
 
         //- Find and return an hashedEntry
-        inline const T& operator[](const Key& key) const;
+        inline const T& operator[](const Key&) const;
 
         //- Find and return an hashedEntry and
         //  if it is not present create it null.
-        inline T& operator()(const Key& key);
+        inline T& operator()(const Key&);
 
         //- Assignment
         void operator=(const HashTable<T, Key, Hash>&);
@@ -290,13 +295,13 @@ public:
 
             // Member operators
 
-                inline void operator=(const iterator& iter);
+                inline void operator=(const iterator&);
 
-                inline bool operator==(const iterator& iter) const;
-                inline bool operator!=(const iterator& iter) const;
+                inline bool operator==(const iterator&) const;
+                inline bool operator!=(const iterator&) const;
 
-                inline bool operator==(const const_iterator& iter) const;
-                inline bool operator!=(const const_iterator& iter) const;
+                inline bool operator==(const const_iterator&) const;
+                inline bool operator!=(const const_iterator&) const;
 
                 inline T& operator*();
                 inline T& operator()();
@@ -352,13 +357,13 @@ public:
 
             // Member operators
 
-                inline void operator=(const const_iterator& iter);
+                inline void operator=(const const_iterator&);
 
-                inline bool operator==(const const_iterator& iter) const;
-                inline bool operator!=(const const_iterator& iter) const;
+                inline bool operator==(const const_iterator&) const;
+                inline bool operator!=(const const_iterator&) const;
 
-                inline bool operator==(const iterator& iter) const;
-                inline bool operator!=(const iterator& iter) const;
+                inline bool operator==(const iterator&) const;
+                inline bool operator!=(const iterator&) const;
 
                 inline const T& operator*();
                 inline const T& operator()();
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.C
index 670a3116a4221db6204764f42870bff1078c9f29..565cac9493810d3b7cfead47a795897161318677 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.C
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.C
@@ -26,22 +26,17 @@ License
 
 #include "ILList.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-ILList<LListBase, T>::ILList(const ILList<LListBase, T>& slpl)
+Foam::ILList<LListBase, T>::ILList(const ILList<LListBase, T>& lst)
 :
     UILList<LListBase, T>()
 {
     for
     (
-        typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
-        iter != slpl.end();
+        typename UILList<LListBase, T>::const_iterator iter = lst.begin();
+        iter != lst.end();
         ++iter
     )
     {
@@ -53,9 +48,9 @@ ILList<LListBase, T>::ILList(const ILList<LListBase, T>& slpl)
 #ifndef __INTEL_COMPILER
 template<class LListBase, class T>
 template<class CloneArg>
-ILList<LListBase, T>::ILList
+Foam::ILList<LListBase, T>::ILList
 (
-    const ILList<LListBase, T>& slpl,
+    const ILList<LListBase, T>& lst,
     const CloneArg& cloneArg
 )
 :
@@ -63,8 +58,8 @@ ILList<LListBase, T>::ILList
 {
     for
     (
-        typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
-        iter != slpl.end();
+        typename UILList<LListBase, T>::const_iterator iter = lst.begin();
+        iter != lst.end();
         ++iter
     )
     {
@@ -77,7 +72,7 @@ ILList<LListBase, T>::ILList
 // * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-ILList<LListBase, T>::~ILList()
+Foam::ILList<LListBase, T>::~ILList()
 {
     this->clear();
 }
@@ -85,9 +80,8 @@ ILList<LListBase, T>::~ILList()
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-//- Return and remove head
 template<class LListBase, class T>
-bool ILList<LListBase, T>::eraseHead()
+bool Foam::ILList<LListBase, T>::eraseHead()
 {
     T* tPtr;
     if ((tPtr = this->removeHead()))
@@ -101,9 +95,8 @@ bool ILList<LListBase, T>::eraseHead()
     }
 }
 
-//- Return and remove element
 template<class LListBase, class T>
-bool ILList<LListBase, T>::erase(T* p)
+bool Foam::ILList<LListBase, T>::erase(T* p)
 {
     T* tPtr;
     if ((tPtr = remove(p)))
@@ -119,7 +112,7 @@ bool ILList<LListBase, T>::erase(T* p)
 
 
 template<class LListBase, class T>
-void ILList<LListBase, T>::clear()
+void Foam::ILList<LListBase, T>::clear()
 {
     label oldSize = this->size();
     for (label i=0; i<oldSize; i++)
@@ -131,17 +124,25 @@ void ILList<LListBase, T>::clear()
 }
 
 
+template<class LListBase, class T>
+void Foam::ILList<LListBase, T>::transfer(ILList<LListBase, T>& lst)
+{
+    clear();
+    LListBase::transfer(lst);
+}
+
+
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-void ILList<LListBase, T>::operator=(const ILList<LListBase, T>& slpl)
+void Foam::ILList<LListBase, T>::operator=(const ILList<LListBase, T>& lst)
 {
     this->clear();
 
     for
     (
-        typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
-        iter != slpl.end();
+        typename UILList<LListBase, T>::const_iterator iter = lst.begin();
+        iter != lst.end();
         ++iter
     )
     {
@@ -149,11 +150,6 @@ void ILList<LListBase, T>::operator=(const ILList<LListBase, T>& slpl)
     }
 }
 
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
 
 #include "ILListIO.C"
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.H b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.H
index 074a54a259125065fbb724bf20fd320949e554bd..401a8b60388100bb60273a2afe0490c8f22b0eb1 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.H
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILList.H
@@ -71,7 +71,7 @@ class ILList
 
         //- Read from Istream using given Istream constructor class
         template<class INew>
-        void read(Istream&, const INew& inewt);
+        void read(Istream&, const INew&);
 
 
 public:
@@ -96,7 +96,7 @@ public:
 
         //- Copy constructor with additional argument for clone
         template<class CloneArg>
-        ILList(const ILList<LListBase, T>& slpl, const CloneArg& cloneArg)
+        ILList(const ILList<LListBase, T>& lst, const CloneArg& cloneArg)
         #ifdef __INTEL_COMPILER
         :
             UILList<LListBase, T>()
@@ -104,8 +104,8 @@ public:
             for
             (
                 typename UILList<LListBase, T>::const_iterator iter =
-                    slpl.begin();
-                iter != slpl.end();
+                    lst.begin();
+                iter != lst.end();
                 ++iter
             )
             {
@@ -118,7 +118,7 @@ public:
 
         //- Construct from Istream using given Istream constructor class
         template<class INew>
-        ILList(Istream&, const INew& inewt);
+        ILList(Istream&, const INew&);
 
 
     // Destructor
@@ -139,6 +139,10 @@ public:
             //- Clear the contents of the list
             void clear();
 
+            //- Transfer the contents of the argument into this List
+            //  and annull the argument list.
+            void transfer(ILList<LListBase, T>&);
+
 
     // Member operators
 
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILListIO.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILListIO.C
index 8d2ac68c27e4396053e3c5dcc91c5463943db606..a467da11dc87779ba93f3e38df6ddb14e37b8fd0 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILListIO.C
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILListIO.C
@@ -30,24 +30,19 @@ Description
 #include "Istream.H"
 #include "INew.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
 template<class INew>
-void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
+void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
 {
-    is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
+    is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
 
     token firstToken(is);
 
     is.fatalCheck
     (
-        "operator>>(Istream& is, ILList<LListBase, T>& L) : reading first token"
+        "operator>>(Istream&, ILList<LListBase, T>&) : reading first token"
     );
 
     if (firstToken.isLabel())
@@ -63,26 +58,26 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
             {
                 for (label i=0; i<s; i++)
                 {
-                    append(inewt(is).ptr());
-                
+                    append(iNew(is).ptr());
+
                     is.fatalCheck
                     (
-                        "operator>>(Istream& is, ILList<LListBase, T>& L) : "
+                        "operator>>(Istream&, ILList<LListBase, T>&) : "
                         "reading entry"
                     );
                 }
             }
             else
             {
-                T* tPtr = inewt(is).ptr();
+                T* tPtr = iNew(is).ptr();
                 append(tPtr);
 
                 is.fatalCheck
                 (
-                    "operator>>(Istream& is, ILList<LListBase, T>& L) : "
+                    "operator>>(Istream&, ILList<LListBase, T>&) : "
                     "reading entry"
                 );
-                
+
                 for (label i=1; i<s; i++)
                 {
                     append(new T(*tPtr));
@@ -99,14 +94,14 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
         {
             FatalIOErrorIn
             (
-                "operator>>(Istream& is, ILList<LListBase, T>& L)",
+                "operator>>(Istream&, ILList<LListBase, T>&)",
                 is
             )   << "incorrect first token, '(', found " << firstToken.info()
                 << exit(FatalIOError);
         }
 
         token lastToken(is);
-        is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
+        is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
 
         while
         (
@@ -117,36 +112,34 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
         )
         {
             is.putBack(lastToken);
-            append(inewt(is).ptr());
+            append(iNew(is).ptr());
 
             is >> lastToken;
-            is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
+            is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
         }
     }
     else
     {
-        FatalIOErrorIn("operator>>(Istream& is, ILList<LListBase, T>& L)", is)
+        FatalIOErrorIn("operator>>(Istream&, ILList<LListBase, T>&)", is)
             << "incorrect first token, expected <int> or '(', found "
             << firstToken.info()
             << exit(FatalIOError);
     }
 
-    is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
+    is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
 }
 
 
-//- Construct from Istream using given Istream constructor class
 template<class LListBase, class T>
 template<class INew>
-ILList<LListBase, T>::ILList(Istream& is, const INew& inewt)
+Foam::ILList<LListBase, T>::ILList(Istream& is, const INew& iNew)
 {
-    read(is, inewt);
+    read(is, iNew);
 }
 
 
-// Construct from Istream
 template<class LListBase, class T>
-ILList<LListBase, T>::ILList(Istream& is)
+Foam::ILList<LListBase, T>::ILList(Istream& is)
 {
     read(is, INew<T>());
 }
@@ -155,7 +148,7 @@ ILList<LListBase, T>::ILList(Istream& is)
 // * * * * * * * * * * * * * * * Istream Operator  * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-Istream& operator>>(Istream& is, ILList<LListBase, T>& L)
+Foam::Istream& Foam::operator>>(Istream& is, ILList<LListBase, T>& L)
 {
     L.clear();
     L.read(is, INew<T>());
@@ -166,6 +159,4 @@ Istream& operator>>(Istream& is, ILList<LListBase, T>& L)
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.C
index 94512eeabda6a65145daf02cd712783d13cf5ef1..1c93142b416245af36a84dfb12d6880ef3b0b111 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.C
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.C
@@ -27,22 +27,16 @@ Description
 \*---------------------------------------------------------------------------*/
 
 #include "error.H"
-
 #include "LList.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-LList<LListBase, T>::LList(const LList<LListBase, T>& slpl)
+Foam::LList<LListBase, T>::LList(const LList<LListBase, T>& lst)
 :
     LListBase()
 {
-    for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
+    for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
     {
         append(iter());
     }
@@ -50,7 +44,7 @@ LList<LListBase, T>::LList(const LList<LListBase, T>& slpl)
 
 
 template<class LListBase, class T>
-LList<LListBase, T>::~LList()
+Foam::LList<LListBase, T>::~LList()
 {
     this->clear();
 }
@@ -59,7 +53,7 @@ LList<LListBase, T>::~LList()
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-void LList<LListBase, T>::clear()
+void Foam::LList<LListBase, T>::clear()
 {
     label oldSize = this->size();
     for (label i=0; i<oldSize; i++)
@@ -71,24 +65,28 @@ void LList<LListBase, T>::clear()
 }
 
 
+template<class LListBase, class T>
+void Foam::LList<LListBase, T>::transfer(LList<LListBase, T>& lst)
+{
+    clear();
+    LListBase::transfer(lst);
+}
+
+
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-void LList<LListBase, T>::operator=(const LList<LListBase, T>& slpl)
+void Foam::LList<LListBase, T>::operator=(const LList<LListBase, T>& lst)
 {
     this->clear();
 
-    for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
+    for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
     {
         append(iter());
     }
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
 
 #include "LListIO.C"
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H
index a9bc0bccae46bfdef4d1523beacf08fffc4e4dfd..4c422f7ccb2ae01f59add91906f1f33bd49d2ccf 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LList.H
@@ -67,7 +67,7 @@ Ostream& operator<<
 
 
 /*---------------------------------------------------------------------------*\
-                           Class LList Declaration
+                            Class LList Declaration
 \*---------------------------------------------------------------------------*/
 
 template<class LListBase, class T>
@@ -200,6 +200,9 @@ public:
             //- Delete contents of list
             void clear();
 
+            //- Transfer the contents of the argument into this List
+            //  and annull the argument list.
+            void transfer(LList<LListBase, T>&);
 
     // Member operators
 
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LListIO.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LListIO.C
index 32dbaf3f17fa1aa09dea5fd8eb8b8bc38ed0cff9..316585078186b627688b2b0d330ab4d7ba9078fb 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LListIO.C
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LListIO.C
@@ -30,16 +30,10 @@ Description
 #include "Istream.H"
 #include "Ostream.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from Istream
 template<class LListBase, class T>
-LList<LListBase, T>::LList(Istream& is)
+Foam::LList<LListBase, T>::LList(Istream& is)
 {
     operator>>(is, *this);
 }
@@ -48,18 +42,18 @@ LList<LListBase, T>::LList(Istream& is)
 // * * * * * * * * * * * * * * * Istream Operator  * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-Istream& operator>>(Istream& is, LList<LListBase, T>& L)
+Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
 {
     // Anull list
     L.clear();
 
-    is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
+    is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
 
     token firstToken(is);
 
     is.fatalCheck
     (
-        " operator>>(Istream& is, LList<LListBase, T>& L) : reading first token"
+        " operator>>(Istream&, LList<LListBase, T>&) : reading first token"
     );
 
     if (firstToken.isLabel())
@@ -101,14 +95,14 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
         {
             FatalIOErrorIn
             (
-                " operator>>(Istream& is, LList<LListBase, T>& L)",
+                " operator>>(Istream&, LList<LListBase, T>&)",
                 is
             )   << "incorrect first token, '(', found " << firstToken.info()
                 << exit(FatalIOError);
         }
 
         token lastToken(is);
-        is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
+        is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
 
         while
         (
@@ -124,19 +118,19 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
             L.append(element);
 
             is >> lastToken;
-            is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
+            is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
         }
     }
     else
     {
-        FatalIOErrorIn(" operator>>(Istream& is, LList<LListBase, T>& L)", is)
+        FatalIOErrorIn(" operator>>(Istream&, LList<LListBase, T>&)", is)
             << "incorrect first token, expected <int> or '(', found "
             << firstToken.info()
             << exit(FatalIOError);
     }
 
     // Check state of IOstream
-    is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
+    is.fatalCheck(" operator>>(Istream&, LList<LListBase,>&)");
 
     return is;
 }
@@ -145,19 +139,19 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
 // * * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-Ostream& operator<<(Ostream& os, const LList<LListBase, T>& ll)
+Foam::Ostream& Foam::operator<<(Ostream& os, const LList<LListBase, T>& lst)
 {
-    // Write size of LList
-    os << nl << ll.size();
+    // Write size
+    os << nl << lst.size();
 
     // Write beginning of contents
     os << nl << token::BEGIN_LIST << nl;
 
-    // Write LList contents
+    // Write contents
     for
     (
-        typename LList<LListBase, T>::const_iterator iter = ll.begin();
-        iter != ll.end();
+        typename LList<LListBase, T>::const_iterator iter = lst.begin();
+        iter != lst.end();
         ++iter
     )
     {
@@ -168,14 +162,10 @@ Ostream& operator<<(Ostream& os, const LList<LListBase, T>& ll)
     os << token::END_LIST;
 
     // Check state of IOstream
-    os.check("Ostream& operator<<(Ostream&, const LList&)");
+    os.check("Ostream& operator<<(Ostream&, const LList<LListBase, T>&)");
 
     return os;
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.C
index bf29f1d45050eeef9fdd5437c1ed7a87643110dd..935e68292c080d89d4203548ec0d17c479d50c8b 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.C
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.C
@@ -26,19 +26,14 @@ License
 
 #include "LPtrList.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& slpl)
+Foam::LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& lst)
 :
     LList<LListBase, T*>()
 {
-    for(const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
+    for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
     {
         append(iter().clone().ptr());
     }
@@ -48,7 +43,7 @@ LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& slpl)
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-LPtrList<LListBase, T>::~LPtrList()
+Foam::LPtrList<LListBase, T>::~LPtrList()
 {
     clear();
 }
@@ -56,9 +51,8 @@ LPtrList<LListBase, T>::~LPtrList()
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-//- Return and remove head
 template<class LListBase, class T>
-bool LPtrList<LListBase, T>::eraseHead()
+bool Foam::LPtrList<LListBase, T>::eraseHead()
 {
     T* tPtr;
     if ((tPtr = this->removeHead()))
@@ -74,7 +68,7 @@ bool LPtrList<LListBase, T>::eraseHead()
 
 
 template<class LListBase, class T>
-void LPtrList<LListBase, T>::clear()
+void Foam::LPtrList<LListBase, T>::clear()
 {
     label oldSize = this->size();
     for (label i=0; i<oldSize; i++)
@@ -86,24 +80,28 @@ void LPtrList<LListBase, T>::clear()
 }
 
 
+template<class LListBase, class T>
+void Foam::LPtrList<LListBase, T>::transfer(LPtrList<LListBase, T>& lst)
+{
+    clear();
+    LList<LListBase, T*>::transfer(lst);
+}
+
+
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-void LPtrList<LListBase, T>::operator=(const LPtrList<LListBase, T>& slpl)
+void Foam::LPtrList<LListBase, T>::operator=(const LPtrList<LListBase, T>& lst)
 {
     clear();
 
-    for(const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
+    for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
     {
         append(iter().clone().ptr());
     }
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
 
 #include "LPtrListIO.C"
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.H b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.H
index 601d26f87617ee3943e658d7be6e928d0972eaa1..fdb59ea27cd1cc553e5121ca8b543e07e588876d 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.H
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrList.H
@@ -149,12 +149,16 @@ public:
 
         // Edit
 
-            //- Remove the head element specified from the list and delete it
+            //- Remove the head element from the list and delete the pointer
             bool eraseHead();
 
-            //- Remove the specified element from the list and delete it
+            //- Clear the contents of the list
             void clear();
 
+            //- Transfer the contents of the argument into this List
+            //  and annull the argument list.
+            void transfer(LPtrList<LListBase, T>&);
+
 
     // Member operators
 
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrListIO.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrListIO.C
index e5bd9c907ddad88c51c550a237e83d1223dcabdc..c7bb16c4e2a87b5191e0a47791c66a7b3a447cb0 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrListIO.C
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrListIO.C
@@ -29,16 +29,11 @@ License
 #include "Ostream.H"
 #include "INew.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
 
 template<class LListBase, class T>
 template<class INew>
-void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
+void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
 {
     is.fatalCheck
     (
@@ -66,8 +61,8 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
             {
                 for (label i=0; i<s; i++)
                 {
-                    append(inewt(is).ptr());
-                
+                    append(iNew(is).ptr());
+
                     is.fatalCheck
                     (
                         "LPtrList<LListBase, T>::read(Istream&, const INew&) : "
@@ -77,7 +72,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
             }
             else
             {
-                T* tPtr = inewt(is).ptr();
+                T* tPtr = iNew(is).ptr();
                 append(tPtr);
 
                 is.fatalCheck
@@ -85,7 +80,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
                     "LPtrList<LListBase, T>::read(Istream&, const INew&) : "
                     "reading entry"
                 );
-                
+
                 for (label i=1; i<s; i++)
                 {
                     append(tPtr->clone().ptr());
@@ -120,7 +115,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
         )
         {
             is.putBack(lastToken);
-            append(inewt(is).ptr());
+            append(iNew(is).ptr());
 
             is >> lastToken;
             is.fatalCheck
@@ -148,14 +143,14 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
 
 template<class LListBase, class T>
 template<class INew>
-LPtrList<LListBase, T>::LPtrList(Istream& is, const INew& inewt)
+Foam::LPtrList<LListBase, T>::LPtrList(Istream& is, const INew& iNew)
 {
-    read(is, inewt);
+    read(is, iNew);
 }
 
 
 template<class LListBase, class T>
-LPtrList<LListBase, T>::LPtrList(Istream& is)
+Foam::LPtrList<LListBase, T>::LPtrList(Istream& is)
 {
     read(is, INew<T>());
 }
@@ -164,11 +159,10 @@ LPtrList<LListBase, T>::LPtrList(Istream& is)
 // * * * * * * * * * * * * * * * Istream Operator  * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-Istream& operator>>(Istream& is, LPtrList<LListBase, T>& L)
+Foam::Istream& Foam::operator>>(Istream& is, LPtrList<LListBase, T>& L)
 {
-    // Anull list
     L.clear();
-
+    L.read(is, INew<T>());
 
     return is;
 }
@@ -177,19 +171,19 @@ Istream& operator>>(Istream& is, LPtrList<LListBase, T>& L)
 // * * * * * * * * * * * * * * * Ostream Operators * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-Ostream& operator<<(Ostream& os, const LPtrList<LListBase, T>& slpl)
+Foam::Ostream& Foam::operator<<(Ostream& os, const LPtrList<LListBase, T>& lst)
 {
-    // Write size of LPtrList
-    os << nl << slpl.size();
+    // Write size
+    os << nl << lst.size();
 
     // Write beginning of contents
     os << nl << token::BEGIN_LIST << nl;
 
-    // Write LPtrList contents
+    // Write contents
     for
     (
-        typename LPtrList<LListBase, T>::const_iterator iter = slpl.begin();
-        iter != slpl.end();
+        typename LPtrList<LListBase, T>::const_iterator iter = lst.begin();
+        iter != lst.end();
         ++iter
     )
     {
@@ -200,14 +194,9 @@ Ostream& operator<<(Ostream& os, const LPtrList<LListBase, T>& slpl)
     os << token::END_LIST;
 
     // Check state of IOstream
-    os.check("Ostream& operator<<(Ostream&, const LPtrList&)");
+    os.check("Ostream& operator<<(Ostream&, const LPtrList<LListBase, T>&)");
 
     return os;
 }
 
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.C
index ab6392094ab17d866cdeecf920dcc162b9f69ecb..1c10434c9ac21e4fec97ea44dcbdd92f9f4665cb 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.C
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.C
@@ -28,17 +28,12 @@ Description
 
 #include "UILList.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-UILList<LListBase, T>::UILList(const UILList<LListBase, T>& slpl)
+Foam::UILList<LListBase, T>::UILList(const UILList<LListBase, T>& lst)
 {
-    for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
+    for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
     {
         append(&iter());
     }
@@ -48,22 +43,24 @@ UILList<LListBase, T>::UILList(const UILList<LListBase, T>& slpl)
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-void UILList<LListBase, T>::operator=(const UILList<LListBase, T>& slpl)
+void Foam::UILList<LListBase, T>::operator=(const UILList<LListBase, T>& rhs)
 {
     LListBase::clear();
 
-    for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
+    for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
     {
         append(&iter());
     }
 }
 
 
-// Comparison for equality
 template<class LListBase, class T>
-bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
+bool Foam::UILList<LListBase, T>::operator==
+(
+    const UILList<LListBase, T>& rhs
+) const
 {
-    if (this->size() != slpl.size())
+    if (this->size() != rhs.size())
     {
         return false;
     }
@@ -71,7 +68,7 @@ bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
     bool equal = true;
 
     const_iterator iter1 = this->begin();
-    const_iterator iter2 = slpl.begin();
+    const_iterator iter2 = rhs.begin();
 
     for (; iter1 != this->end(); ++iter1, ++iter2)
     {
@@ -84,16 +81,15 @@ bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
 
 // Comparison for inequality
 template<class LListBase, class T>
-bool UILList<LListBase, T>::operator!=(const UILList<LListBase, T>& slpl) const
+bool Foam::UILList<LListBase, T>::operator!=
+(
+    const UILList<LListBase, T>& rhs
+) const
 {
-    return !operator==(slpl);
+    return !operator==(rhs);
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
 
 #include "UILListIO.C"
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.H b/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.H
index d10c1c3949d2003cbb6ea43d47260431cf9cdc1d..cab57ed3268a2b559da7bce189b9e696a4fc4b3e 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.H
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILList.H
@@ -245,7 +245,7 @@ public:
 
                 const T& operator*()
                 {
-                    return 
+                    return
                         static_cast<const T&>
                         (LListBase_const_iterator::operator*());
                 }
@@ -266,7 +266,7 @@ public:
     // STL member operators
 
         //- Equality operation on ULists of the same type.
-        //  Returns true when the ULists are elementwise equal
+        //  Returns true when the ULists are element-wise equal
         //  (using UList::value_type::operator==).  Takes linear time.
         bool operator==(const UILList<LListBase, T>&) const;
 
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILListIO.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILListIO.C
index 62459551c642a80c68eefa0c500f74533f847b55..d3ce739772a8bfab6570815f89f20a10ed1bae55 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILListIO.C
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILListIO.C
@@ -30,27 +30,22 @@ Description
 #include "Ostream.H"
 #include "token.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * //
 
 template<class LListBase, class T>
-Ostream& operator<<(Ostream& os, const UILList<LListBase, T>& ill)
+Foam::Ostream& Foam::operator<<(Ostream& os, const UILList<LListBase, T>& lst)
 {
-    // Write size of UILList
-    os << nl << ill.size();
+    // Write size
+    os << nl << lst.size();
 
     // Write beginning of contents
     os << nl << token::BEGIN_LIST << nl;
 
-    // Write UILList contents
+    // Write contents
     for
     (
-        typename UILList<LListBase, T>::const_iterator iter = ill.begin();
-        iter != ill.end();
+        typename UILList<LListBase, T>::const_iterator iter = lst.begin();
+        iter != lst.end();
         ++iter
     )
     {
@@ -61,14 +56,9 @@ Ostream& operator<<(Ostream& os, const UILList<LListBase, T>& ill)
     os << token::END_LIST;
 
     // Check state of IOstream
-    os.check("Ostream& operator<<(Ostream&, const UILList&)");
+    os.check("Ostream& operator<<(Ostream&, const UILList<LListBase, T>&)");
 
     return os;
 }
 
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C
index ba25e663b3bcc2974270a7d29a84e329e2819d3d..b3e21c42258df2e463ec246f110c6a336b7f78ac 100644
--- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C
+++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C
@@ -32,17 +32,12 @@ License
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-DLListBase::iterator DLListBase::endIter
+Foam::DLListBase::iterator Foam::DLListBase::endIter
 (
     const_cast<DLListBase&>(static_cast<const DLListBase&>(DLListBase()))
 );
 
-DLListBase::const_iterator DLListBase::endConstIter
+Foam::DLListBase::const_iterator Foam::DLListBase::endConstIter
 (
     static_cast<const DLListBase&>(DLListBase()),
     reinterpret_cast<const link*>(NULL)
@@ -51,7 +46,7 @@ DLListBase::const_iterator DLListBase::endConstIter
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-void DLListBase::insert(DLListBase::link* a)
+void Foam::DLListBase::insert(DLListBase::link* a)
 {
     nElmts_++;
 
@@ -71,7 +66,7 @@ void DLListBase::insert(DLListBase::link* a)
 }
 
 
-void DLListBase::append(DLListBase::link* a)
+void Foam::DLListBase::append(DLListBase::link* a)
 {
     nElmts_++;
 
@@ -91,7 +86,7 @@ void DLListBase::append(DLListBase::link* a)
 }
 
 
-bool DLListBase::swapUp(DLListBase::link* a)
+bool Foam::DLListBase::swapUp(DLListBase::link* a)
 {
     if (first_ != a)
     {
@@ -132,7 +127,7 @@ bool DLListBase::swapUp(DLListBase::link* a)
 }
 
 
-bool DLListBase::swapDown(DLListBase::link* a)
+bool Foam::DLListBase::swapDown(DLListBase::link* a)
 {
     if (last_ != a)
     {
@@ -173,7 +168,7 @@ bool DLListBase::swapDown(DLListBase::link* a)
 }
 
 
-DLListBase::link* DLListBase::removeHead()
+Foam::DLListBase::link* Foam::DLListBase::removeHead()
 {
     nElmts_--;
 
@@ -197,7 +192,7 @@ DLListBase::link* DLListBase::removeHead()
 }
 
 
-DLListBase::link* DLListBase::remove(DLListBase::link* l)
+Foam::DLListBase::link* Foam::DLListBase::remove(DLListBase::link* l)
 {
     nElmts_--;
 
@@ -229,7 +224,7 @@ DLListBase::link* DLListBase::remove(DLListBase::link* l)
 }
 
 
-DLListBase::link* DLListBase::replace
+Foam::DLListBase::link* Foam::DLListBase::replace
 (
     DLListBase::link* oldLink,
     DLListBase::link* newLink
@@ -266,8 +261,4 @@ DLListBase::link* DLListBase::replace
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H
index 8fd2c55bc19592d8f3caf2876efccc29b5aa5e16..33df2b87c711a76b3e6517a7e106947490f735ef 100644
--- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H
+++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H
@@ -167,6 +167,9 @@ public:
             //- Clear the list
             inline void clear();
 
+            //- Transfer the contents of the argument into this List
+            //  and annull the argument list.
+            inline void transfer(DLListBase&);
 
     // STL iterator
 
diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H
index eb9c00d3f8c5da40d0cfd3616476973e1ba0c2d8..a9414fa3876c6adaacabaf664043694bac9f357d 100644
--- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H
+++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H
@@ -26,21 +26,16 @@ License
 
 #include "error.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * * //
 
-inline DLListBase::link::link()
+inline Foam::DLListBase::link::link()
 :
     prev_(0),
     next_(0)
 {}
 
 
-inline DLListBase::DLListBase()
+inline Foam::DLListBase::DLListBase()
 :
     first_(0),
     last_(0),
@@ -48,7 +43,7 @@ inline DLListBase::DLListBase()
 {}
 
 
-inline DLListBase::DLListBase(link* a)
+inline Foam::DLListBase::DLListBase(link* a)
 :
     first_(a),
     last_(a),
@@ -61,32 +56,33 @@ inline DLListBase::DLListBase(link* a)
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-inline DLListBase::~DLListBase()
+inline Foam::DLListBase::~DLListBase()
 {}
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-inline bool DLListBase::link::registered() const
+inline bool Foam::DLListBase::link::registered() const
 {
     return prev_ != 0 && next_ != 0;
 }
 
 
-inline void DLListBase::link::deregister()
+inline void Foam::DLListBase::link::deregister()
 {
     prev_ = 0;
     next_ = 0;
 }
 
 
-inline label DLListBase::size() const
+inline Foam::label Foam::DLListBase::size() const
 {
     return nElmts_;
 }
 
 
-inline DLListBase::link* DLListBase::first()
+inline Foam::DLListBase::link*
+Foam::DLListBase::first()
 {
     if (!nElmts_)
     {
@@ -98,7 +94,8 @@ inline DLListBase::link* DLListBase::first()
 }
 
 
-inline const DLListBase::link* DLListBase::first() const
+inline const Foam::DLListBase::link*
+Foam::DLListBase::first() const
 {
     if (!nElmts_)
     {
@@ -110,7 +107,8 @@ inline const DLListBase::link* DLListBase::first() const
 }
 
 
-inline DLListBase::link* DLListBase::last()
+inline Foam::DLListBase::link*
+Foam::DLListBase::last()
 {
     if (!nElmts_)
     {
@@ -122,7 +120,8 @@ inline DLListBase::link* DLListBase::last()
 }
 
 
-inline const DLListBase::link* DLListBase::last() const
+inline const Foam::DLListBase::link*
+Foam::DLListBase::last() const
 {
     if (!nElmts_)
     {
@@ -134,21 +133,36 @@ inline const DLListBase::link* DLListBase::last() const
 }
 
 
-inline void DLListBase::clear()
+inline void Foam::DLListBase::clear()
 {
-    nElmts_ = 0;
     first_ = 0;
-    last_ = 0;
+    last_  = 0;
+    nElmts_ = 0;
 }
 
 
-inline DLListBase::link* DLListBase::remove(DLListBase::iterator& it)
+inline void Foam::DLListBase::transfer(DLListBase& lst)
+{
+    first_  = lst.first_;
+    last_   = lst.last_;
+    nElmts_ = lst.nElmts_;
+
+    lst.clear();
+}
+
+
+inline Foam::DLListBase::link*
+Foam::DLListBase::remove
+(
+    DLListBase::iterator& it
+)
 {
     return remove(it.curElmt_);
 }
 
 
-inline DLListBase::link* DLListBase::replace
+inline Foam::DLListBase::link*
+Foam::DLListBase::replace
 (
     DLListBase::iterator& oldIter,
     DLListBase::link* newLink
@@ -160,7 +174,7 @@ inline DLListBase::link* DLListBase::replace
 
 // * * * * * * * * * * * * * * * STL iterator  * * * * * * * * * * * * * * * //
 
-inline DLListBase::iterator::iterator(DLListBase& s, link* elmt)
+inline Foam::DLListBase::iterator::iterator(DLListBase& s, link* elmt)
 :
     curList_(s),
     curElmt_(elmt),
@@ -168,7 +182,7 @@ inline DLListBase::iterator::iterator(DLListBase& s, link* elmt)
 {}
 
 
-inline DLListBase::iterator::iterator(DLListBase& s)
+inline Foam::DLListBase::iterator::iterator(DLListBase& s)
 :
     curList_(s),
     curElmt_(NULL),
@@ -176,32 +190,34 @@ inline DLListBase::iterator::iterator(DLListBase& s)
 {}
 
 
-inline void DLListBase::iterator::operator=(const iterator& iter)
+inline void Foam::DLListBase::iterator::operator=(const iterator& iter)
 {
     curElmt_ = iter.curElmt_;
     curLink_ = iter.curLink_;
 }
 
 
-inline bool DLListBase::iterator::operator==(const iterator& iter) const
+inline bool Foam::DLListBase::iterator::operator==(const iterator& iter) const
 {
     return curElmt_ == iter.curElmt_;
 }
 
 
-inline bool DLListBase::iterator::operator!=(const iterator& iter) const
+inline bool Foam::DLListBase::iterator::operator!=(const iterator& iter) const
 {
     return curElmt_ != iter.curElmt_;
 }
 
 
-inline DLListBase::link& DLListBase::iterator::operator*()
+inline Foam::DLListBase::link&
+Foam::DLListBase::iterator::operator*()
 {
     return *curElmt_;
 }
 
 
-inline DLListBase::iterator& DLListBase::iterator::operator++()
+inline Foam::DLListBase::iterator&
+Foam::DLListBase::iterator::operator++()
 {
     // Check if the curElmt_ is the last element (if it points to itself)
     // or if the list is empty because the last element may have been removed
@@ -219,7 +235,8 @@ inline DLListBase::iterator& DLListBase::iterator::operator++()
 }
 
 
-inline DLListBase::iterator DLListBase::iterator::operator++(int)
+inline Foam::DLListBase::iterator
+Foam::DLListBase::iterator::operator++(int)
 {
     iterator tmp = *this;
     ++*this;
@@ -227,7 +244,8 @@ inline DLListBase::iterator DLListBase::iterator::operator++(int)
 }
 
 
-inline DLListBase::iterator DLListBase::begin()
+inline Foam::DLListBase::iterator
+Foam::DLListBase::begin()
 {
     if (size())
     {
@@ -240,7 +258,7 @@ inline DLListBase::iterator DLListBase::begin()
 }
 
 
-inline const DLListBase::iterator& DLListBase::end()
+inline const Foam::DLListBase::iterator& Foam::DLListBase::end()
 {
     return endIter;
 }
@@ -248,7 +266,7 @@ inline const DLListBase::iterator& DLListBase::end()
 
 // * * * * * * * * * * * * * * STL const_iterator  * * * * * * * * * * * * * //
 
-inline DLListBase::const_iterator::const_iterator
+inline Foam::DLListBase::const_iterator::const_iterator
 (
     const DLListBase& s,
     const link* elmt
@@ -259,20 +277,23 @@ inline DLListBase::const_iterator::const_iterator
 {}
 
 
-inline DLListBase::const_iterator::const_iterator(const iterator& iter)
+inline Foam::DLListBase::const_iterator::const_iterator(const iterator& iter)
 :
     curList_(iter.curList_),
     curElmt_(iter.curElmt_)
 {}
 
 
-inline void DLListBase::const_iterator::operator=(const const_iterator& iter)
+inline void Foam::DLListBase::const_iterator::operator=
+(
+    const const_iterator& iter
+)
 {
     curElmt_ = iter.curElmt_;
 }
 
 
-inline bool DLListBase::const_iterator::operator==
+inline bool Foam::DLListBase::const_iterator::operator==
 (
     const const_iterator& iter
 ) const
@@ -281,7 +302,7 @@ inline bool DLListBase::const_iterator::operator==
 }
 
 
-inline bool DLListBase::const_iterator::operator!=
+inline bool Foam::DLListBase::const_iterator::operator!=
 (
     const const_iterator& iter
 ) const
@@ -290,13 +311,15 @@ inline bool DLListBase::const_iterator::operator!=
 }
 
 
-inline const DLListBase::link& DLListBase::const_iterator::operator*()
+inline const Foam::DLListBase::link&
+Foam::DLListBase::const_iterator::operator*()
 {
     return *curElmt_;
 }
 
 
-inline DLListBase::const_iterator& DLListBase::const_iterator::operator++()
+inline Foam::DLListBase::const_iterator&
+Foam::DLListBase::const_iterator::operator++()
 {
     if (curElmt_ == curList_.last_)
     {
@@ -311,7 +334,8 @@ inline DLListBase::const_iterator& DLListBase::const_iterator::operator++()
 }
 
 
-inline DLListBase::const_iterator DLListBase::const_iterator::operator++(int)
+inline Foam::DLListBase::const_iterator
+Foam::DLListBase::const_iterator::operator++(int)
 {
     const_iterator tmp = *this;
     ++*this;
@@ -319,7 +343,8 @@ inline DLListBase::const_iterator DLListBase::const_iterator::operator++(int)
 }
 
 
-inline DLListBase::const_iterator DLListBase::begin() const
+inline Foam::DLListBase::const_iterator
+Foam::DLListBase::begin() const
 {
     if (size())
     {
@@ -332,14 +357,11 @@ inline DLListBase::const_iterator DLListBase::begin() const
 }
 
 
-inline const DLListBase::const_iterator& DLListBase::end() const
+inline const Foam::DLListBase::const_iterator&
+Foam::DLListBase::end() const
 {
     return endConstIter;
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.C b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.C
index 0098ff685faeed240a195d1edd0517d6b92d916d..44e50a3666277007a7f69e45b877a9262ec5024f 100644
--- a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.C
+++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.C
@@ -25,22 +25,16 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "error.H"
-
 #include "SLListBase.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-SLListBase::iterator SLListBase::endIter
+Foam::SLListBase::iterator Foam::SLListBase::endIter
 (
     const_cast<SLListBase&>(static_cast<const SLListBase&>(SLListBase()))
 );
 
-SLListBase::const_iterator SLListBase::endConstIter
+Foam::SLListBase::const_iterator Foam::SLListBase::endConstIter
 (
     static_cast<const SLListBase&>(SLListBase()),
     reinterpret_cast<const link*>(NULL)
@@ -49,7 +43,7 @@ SLListBase::const_iterator SLListBase::endConstIter
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-void SLListBase::insert(SLListBase::link* a)
+void Foam::SLListBase::insert(SLListBase::link* a)
 {
     nElmts_++;
 
@@ -66,7 +60,7 @@ void SLListBase::insert(SLListBase::link* a)
 }
 
 
-void SLListBase::append(SLListBase::link* a)
+void Foam::SLListBase::append(SLListBase::link* a)
 {
     nElmts_++;
 
@@ -82,7 +76,7 @@ void SLListBase::append(SLListBase::link* a)
 }
 
 
-SLListBase::link* SLListBase::removeHead()
+Foam::SLListBase::link* Foam::SLListBase::removeHead()
 {
     nElmts_--;
 
@@ -108,7 +102,7 @@ SLListBase::link* SLListBase::removeHead()
 }
 
 
-SLListBase::link* SLListBase::remove(SLListBase::link* it)
+Foam::SLListBase::link* Foam::SLListBase::remove(SLListBase::link* it)
 {
     SLListBase::iterator iter = begin();
     SLListBase::link *prev = &(*iter);
@@ -143,8 +137,4 @@ SLListBase::link* SLListBase::remove(SLListBase::link* it)
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H
index cfd8afe4a902a72b65fb72ac96bcd1c958982423..f802e6914297e6110498d54c04a64682fc2ba261 100644
--- a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H
+++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H
@@ -152,6 +152,9 @@ public:
             //- Clear the list
             inline void clear();
 
+            //- Transfer the contents of the argument into this List
+            //  and annull the argument list.
+            inline void transfer(SLListBase&);
 
     // STL iterator
 
diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBaseI.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBaseI.H
index 3a1125924bc52cf9da74d8c11eba13bb8274bf3f..594fc6f098f151e8fde2397ae65cbc613e9cdc49 100644
--- a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBaseI.H
+++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBaseI.H
@@ -29,33 +29,28 @@ Description
 
 #include "error.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * * //
 
-inline SLListBase::link::link()
+inline Foam::SLListBase::link::link()
 :
     next_(0)
 {}
 
 
-inline SLListBase::link::link(link* p)
+inline Foam::SLListBase::link::link(link* p)
 :
     next_(p)
 {}
 
 
-inline SLListBase::SLListBase()
+inline Foam::SLListBase::SLListBase()
 :
     last_(0),
     nElmts_(0)
 {}
 
 
-inline SLListBase::SLListBase(link* a)
+inline Foam::SLListBase::SLListBase(link* a)
 :
     last_(a->next_ = a),
     nElmts_(1)
@@ -64,19 +59,20 @@ inline SLListBase::SLListBase(link* a)
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-inline SLListBase::~SLListBase()
+inline Foam::SLListBase::~SLListBase()
 {}
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-inline label SLListBase::size() const
+inline Foam::label Foam::SLListBase::size() const
 {
     return nElmts_;
 }
 
 
-inline SLListBase::link* SLListBase::first()
+inline Foam::SLListBase::link*
+Foam::SLListBase::first()
 {
     if (!nElmts_)
     {
@@ -88,7 +84,8 @@ inline SLListBase::link* SLListBase::first()
 }
 
 
-inline const SLListBase::link* SLListBase::first() const
+inline const Foam::SLListBase::link*
+Foam::SLListBase::first() const
 {
     if (!nElmts_)
     {
@@ -100,7 +97,8 @@ inline const SLListBase::link* SLListBase::first() const
 }
 
 
-inline SLListBase::link* SLListBase::last()
+inline Foam::SLListBase::link*
+Foam::SLListBase::last()
 {
     if (!nElmts_)
     {
@@ -112,7 +110,8 @@ inline SLListBase::link* SLListBase::last()
 }
 
 
-inline const SLListBase::link* SLListBase::last() const
+inline const Foam::SLListBase::link*
+Foam::SLListBase::last() const
 {
     if (!nElmts_)
     {
@@ -124,14 +123,26 @@ inline const SLListBase::link* SLListBase::last() const
 }
 
 
-inline void SLListBase::clear()
+inline void Foam::SLListBase::clear()
 {
-    nElmts_ = 0;
     last_ = 0;
+    nElmts_ = 0;
 }
 
 
-inline SLListBase::link* SLListBase::remove(SLListBase::iterator& it)
+inline void Foam::SLListBase::transfer(SLListBase& lst)
+{
+    last_   = lst.last_;
+    nElmts_ = lst.nElmts_;
+
+    lst.clear();
+}
+
+
+inline Foam::SLListBase::link* Foam::SLListBase::remove
+(
+    SLListBase::iterator& it
+)
 {
     return remove(it.curElmt_);
 }
@@ -139,7 +150,7 @@ inline SLListBase::link* SLListBase::remove(SLListBase::iterator& it)
 
 // * * * * * * * * * * * * * * * STL iterator  * * * * * * * * * * * * * * * //
 
-inline SLListBase::iterator::iterator(SLListBase& s, link* elmt)
+inline Foam::SLListBase::iterator::iterator(SLListBase& s, link* elmt)
 :
     curList_(s),
     curElmt_(elmt),
@@ -147,7 +158,7 @@ inline SLListBase::iterator::iterator(SLListBase& s, link* elmt)
 {}
 
 
-inline SLListBase::iterator::iterator(SLListBase& s)
+inline Foam::SLListBase::iterator::iterator(SLListBase& s)
 :
     curList_(s),
     curElmt_(NULL),
@@ -155,32 +166,32 @@ inline SLListBase::iterator::iterator(SLListBase& s)
 {}
 
 
-inline void SLListBase::iterator::operator=(const iterator& iter)
+inline void Foam::SLListBase::iterator::operator=(const iterator& iter)
 {
     curElmt_ = iter.curElmt_;
     curLink_ = iter.curLink_;
 }
 
 
-inline bool SLListBase::iterator::operator==(const iterator& iter) const
+inline bool Foam::SLListBase::iterator::operator==(const iterator& iter) const
 {
     return curElmt_ == iter.curElmt_;
 }
 
 
-inline bool SLListBase::iterator::operator!=(const iterator& iter) const
+inline bool Foam::SLListBase::iterator::operator!=(const iterator& iter) const
 {
     return curElmt_ != iter.curElmt_;
 }
 
 
-inline SLListBase::link& SLListBase::iterator::operator*()
+inline Foam::SLListBase::link& Foam::SLListBase::iterator::operator*()
 {
     return *curElmt_;
 }
 
 
-inline SLListBase::iterator& SLListBase::iterator::operator++()
+inline Foam::SLListBase::iterator& Foam::SLListBase::iterator::operator++()
 {
     if (curElmt_ == curList_.last_ || curList_.last_ == 0)
     {
@@ -196,7 +207,8 @@ inline SLListBase::iterator& SLListBase::iterator::operator++()
 }
 
 
-inline SLListBase::iterator SLListBase::iterator::operator++(int)
+inline Foam::SLListBase::iterator
+Foam::SLListBase::iterator::operator++(int)
 {
     iterator tmp = *this;
     ++*this;
@@ -204,7 +216,8 @@ inline SLListBase::iterator SLListBase::iterator::operator++(int)
 }
 
 
-inline SLListBase::iterator SLListBase::begin()
+inline Foam::SLListBase::iterator
+Foam::SLListBase::begin()
 {
     if (size())
     {
@@ -217,7 +230,8 @@ inline SLListBase::iterator SLListBase::begin()
 }
 
 
-inline const SLListBase::iterator& SLListBase::end()
+inline const Foam::SLListBase::iterator&
+Foam::SLListBase::end()
 {
     return endIter;
 }
@@ -225,7 +239,7 @@ inline const SLListBase::iterator& SLListBase::end()
 
 // * * * * * * * * * * * * * * STL const_iterator  * * * * * * * * * * * * * //
 
-inline SLListBase::const_iterator::const_iterator
+inline Foam::SLListBase::const_iterator::const_iterator
 (
     const SLListBase& s,
     const link* elmt
@@ -236,20 +250,23 @@ inline SLListBase::const_iterator::const_iterator
 {}
 
 
-inline SLListBase::const_iterator::const_iterator(const iterator& iter)
+inline Foam::SLListBase::const_iterator::const_iterator(const iterator& iter)
 :
     curList_(iter.curList_),
     curElmt_(iter.curElmt_)
 {}
 
 
-inline void SLListBase::const_iterator::operator=(const const_iterator& iter)
+inline void Foam::SLListBase::const_iterator::operator=
+(
+    const const_iterator& iter
+)
 {
     curElmt_ = iter.curElmt_;
 }
 
 
-inline bool SLListBase::const_iterator::operator==
+inline bool Foam::SLListBase::const_iterator::operator==
 (
     const const_iterator& iter
 ) const
@@ -258,7 +275,7 @@ inline bool SLListBase::const_iterator::operator==
 }
 
 
-inline bool SLListBase::const_iterator::operator!=
+inline bool Foam::SLListBase::const_iterator::operator!=
 (
     const const_iterator& iter
 ) const
@@ -267,13 +284,15 @@ inline bool SLListBase::const_iterator::operator!=
 }
 
 
-inline const SLListBase::link& SLListBase::const_iterator::operator*()
+inline const Foam::SLListBase::link&
+Foam::SLListBase::const_iterator::operator*()
 {
     return *curElmt_;
 }
 
 
-inline SLListBase::const_iterator& SLListBase::const_iterator::operator++()
+inline Foam::SLListBase::const_iterator&
+Foam::SLListBase::const_iterator::operator++()
 {
     if (curElmt_ == curList_.last_)
     {
@@ -288,7 +307,8 @@ inline SLListBase::const_iterator& SLListBase::const_iterator::operator++()
 }
 
 
-inline SLListBase::const_iterator SLListBase::const_iterator::operator++(int)
+inline Foam::SLListBase::const_iterator
+Foam::SLListBase::const_iterator::operator++(int)
 {
     const_iterator tmp = *this;
     ++*this;
@@ -296,7 +316,8 @@ inline SLListBase::const_iterator SLListBase::const_iterator::operator++(int)
 }
 
 
-inline SLListBase::const_iterator SLListBase::begin() const
+inline Foam::SLListBase::const_iterator
+Foam::SLListBase::begin() const
 {
     if (size())
     {
@@ -309,14 +330,11 @@ inline SLListBase::const_iterator SLListBase::begin() const
 }
 
 
-inline const SLListBase::const_iterator& SLListBase::end() const
+inline const Foam::SLListBase::const_iterator&
+Foam::SLListBase::end() const
 {
     return endConstIter;
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/LinkedLists/user/DLList/DLList.H b/src/OpenFOAM/containers/LinkedLists/user/DLList.H
similarity index 100%
rename from src/OpenFOAM/containers/LinkedLists/user/DLList/DLList.H
rename to src/OpenFOAM/containers/LinkedLists/user/DLList.H
diff --git a/src/OpenFOAM/containers/LinkedLists/user/DLPtrList/DLPtrList.H b/src/OpenFOAM/containers/LinkedLists/user/DLPtrList.H
similarity index 100%
rename from src/OpenFOAM/containers/LinkedLists/user/DLPtrList/DLPtrList.H
rename to src/OpenFOAM/containers/LinkedLists/user/DLPtrList.H
diff --git a/src/OpenFOAM/containers/LinkedLists/user/FIFOStack/FIFOStack.H b/src/OpenFOAM/containers/LinkedLists/user/FIFOStack.H
similarity index 100%
rename from src/OpenFOAM/containers/LinkedLists/user/FIFOStack/FIFOStack.H
rename to src/OpenFOAM/containers/LinkedLists/user/FIFOStack.H
diff --git a/src/OpenFOAM/containers/LinkedLists/user/IDLList/IDLList.H b/src/OpenFOAM/containers/LinkedLists/user/IDLList.H
similarity index 100%
rename from src/OpenFOAM/containers/LinkedLists/user/IDLList/IDLList.H
rename to src/OpenFOAM/containers/LinkedLists/user/IDLList.H
diff --git a/src/OpenFOAM/containers/LinkedLists/user/ISLList/ISLList.H b/src/OpenFOAM/containers/LinkedLists/user/ISLList.H
similarity index 100%
rename from src/OpenFOAM/containers/LinkedLists/user/ISLList/ISLList.H
rename to src/OpenFOAM/containers/LinkedLists/user/ISLList.H
diff --git a/src/OpenFOAM/containers/LinkedLists/user/LIFOStack/LIFOStack.H b/src/OpenFOAM/containers/LinkedLists/user/LIFOStack.H
similarity index 100%
rename from src/OpenFOAM/containers/LinkedLists/user/LIFOStack/LIFOStack.H
rename to src/OpenFOAM/containers/LinkedLists/user/LIFOStack.H
diff --git a/src/OpenFOAM/containers/LinkedLists/user/SLList/SLList.H b/src/OpenFOAM/containers/LinkedLists/user/SLList.H
similarity index 100%
rename from src/OpenFOAM/containers/LinkedLists/user/SLList/SLList.H
rename to src/OpenFOAM/containers/LinkedLists/user/SLList.H
diff --git a/src/OpenFOAM/containers/LinkedLists/user/SLPtrList/SLPtrList.H b/src/OpenFOAM/containers/LinkedLists/user/SLPtrList.H
similarity index 100%
rename from src/OpenFOAM/containers/LinkedLists/user/SLPtrList/SLPtrList.H
rename to src/OpenFOAM/containers/LinkedLists/user/SLPtrList.H
diff --git a/src/OpenFOAM/containers/LinkedLists/user/UIDLList/UIDLList.H b/src/OpenFOAM/containers/LinkedLists/user/UIDLList.H
similarity index 100%
rename from src/OpenFOAM/containers/LinkedLists/user/UIDLList/UIDLList.H
rename to src/OpenFOAM/containers/LinkedLists/user/UIDLList.H
diff --git a/src/OpenFOAM/db/IOobject/IOobjectI.H b/src/OpenFOAM/db/IOobject/IOobjectI.H
index 90b78aabfc5123e65d58906f4461289b42d3674b..20425b8a7db0bf67d646aba77b687f468d49cab5 100644
--- a/src/OpenFOAM/db/IOobject/IOobjectI.H
+++ b/src/OpenFOAM/db/IOobject/IOobjectI.H
@@ -31,13 +31,22 @@ License
 template<class Stream>
 inline void Foam::IOobject::writeBanner(Stream& os, bool noHint)
 {
-    static bool spacesSet = false;
+    static bool spacesSet(false);
     static char spaces[40];
 
     if (!spacesSet)
     {
         memset(spaces, ' ', 40);
-        spaces[38 - strlen(Foam::FOAMversion)] = '\0';
+
+        size_t len = strlen(Foam::FOAMversion);
+        if (len < 38)
+        {
+            spaces[38 - len] = '\0';
+        }
+        else
+        {
+            spaces[0] = '\0';
+        }
         spacesSet = true;
     }
 
@@ -56,8 +65,8 @@ inline void Foam::IOobject::writeBanner(Stream& os, bool noHint)
         "| =========                 |                                                 |\n"
         "| \\\\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |\n"
         "|  \\\\    /   O peration     | Version:  " << FOAMversion << spaces << "|\n"
-        "|   \\\\  /    A nd           | Web:      http://www.OpenFOAM.org               |\n"
-        "|    \\\\/     M anipulation  |                                                 |\n"
+        "|   \\\\  /    A nd           |                                                 |\n"
+        "|    \\\\/     M anipulation  |                                www.OpenFOAM.org |\n"
         "\\*---------------------------------------------------------------------------*/\n";
 }
 
diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C
index 577494aa1cf435019fb43d7d770e5f511e31e987..98752700a1be835cbea82c1c9a29e6a0985ba7c9 100644
--- a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C
+++ b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.C
@@ -32,22 +32,22 @@ License
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-//- Write keyType
-Foam::Ostream& Foam::Ostream::write(const keyType& s)
+// Write keyType
+Foam::Ostream& Foam::Ostream::write(const keyType& kw)
 {
-    // Write as word?
-    if (s.isWildCard())
+    // Write as word or string
+    if (kw.isPattern())
     {
-        return write(static_cast<const string&>(s));
+        return write(static_cast<const string&>(kw));
     }
     else
     {
-        return write(static_cast<const word&>(s));
+        return write(static_cast<const word&>(kw));
     }
 }
 
 
-//- Decrememt the indent level
+// Decrement the indent level
 void Foam::Ostream::decrIndent()
 {
     if (indentLevel_ == 0)
@@ -62,15 +62,26 @@ void Foam::Ostream::decrIndent()
 }
 
 
-// Write the keyword to the Ostream followed by appropriate indentation
-Foam::Ostream& Foam::Ostream::writeKeyword(const Foam::keyType& keyword)
+// Write the keyword followed by appropriate indentation
+Foam::Ostream& Foam::Ostream::writeKeyword(const keyType& kw)
 {
     indent();
-    write(keyword);
+    write(kw);
 
-    label nSpaces = max(entryIndentation_ - label(keyword.size()), 1);
+    label nSpaces = entryIndentation_ - label(kw.size());
 
-    for (label i=0; i<nSpaces; i++)
+    // pattern is surrounded by quotes
+    if (kw.isPattern())
+    {
+        nSpaces -= 2;
+    }
+
+    if (nSpaces < 1)
+    {
+        nSpaces = 1;
+    }
+
+    while (nSpaces--)
     {
         write(char(token::SPACE));
     }
diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H
index 6dc7df259aef54ecbc44da928f4f99f0f89883f7..32fe3fd7f5db00bda7a83729dfed14fc4b141a4f 100644
--- a/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H
+++ b/src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H
@@ -60,12 +60,11 @@ protected:
         //- Number of spaces per indent level
         static const unsigned short indentSize_ = 4;
 
-        //- Current indent level
-        unsigned short indentLevel_;
-
         //- Indentation of the entry from the start of the keyword
         static const unsigned short entryIndentation_ = 16;
 
+        //- Current indent level
+        unsigned short indentLevel_;
 
 public:
 
@@ -148,9 +147,8 @@ public:
             //- Decrememt the indent level
             void decrIndent();
 
-            //- Write the keyword to the Ostream followed by
-            //  appropriate indentation
-            Ostream& writeKeyword(const keyType& keyword);
+            //- Write the keyword followed by an appropriate indentation
+            Ostream& writeKeyword(const keyType&);
 
 
         // Stream state functions
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/OPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/OPstream.H
index 6041ba202a5caa6773a5a98677d4f11572cf22d2..386781c35bb96d84631e29494e9b7cc93a036abd 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/OPstream.H
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/OPstream.H
@@ -47,7 +47,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class OPstream Declaration
+                          Class OPstream Declaration
 \*---------------------------------------------------------------------------*/
 
 class OPstream
@@ -160,7 +160,7 @@ public:
             void flush()
             {}
 
-            //- Add '\n' and flush stream
+            //- Add newline and flush stream
             void endl()
             {}
 
diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H
index cd3a03ec0cb4531299379539835d86fec7cc74c5..9fd9d988246f185df2d8cfb1b87813062853cc21 100644
--- a/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H
+++ b/src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H
@@ -48,7 +48,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class OSstream Declaration
+                          Class OSstream Declaration
 \*---------------------------------------------------------------------------*/
 
 class OSstream
@@ -162,20 +162,20 @@ public:
             //- Flush stream
             virtual void flush();
 
-            //- Add '\n' and flush stream
+            //- Add newline and flush stream
             virtual void endl();
 
             //- Get width of output field
             virtual int width() const;
 
             //- Set width of output field (and return old width)
-            virtual int width(const int w);
+            virtual int width(const int);
 
             //- Get precision of output field
             virtual int precision() const;
 
             //- Set precision of output field (and return old precision)
-            virtual int precision(const int p);
+            virtual int precision(const int);
 
 
         // Print
diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C
index d54f1bc3d23481c36ba77583a5475e28c3de6716..5d0ee2af6581447c7151a04b4864392d9a8973ce 100644
--- a/src/OpenFOAM/db/dictionary/dictionary.C
+++ b/src/OpenFOAM/db/dictionary/dictionary.C
@@ -38,23 +38,23 @@ const Foam::dictionary Foam::dictionary::null;
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-bool Foam::dictionary::findInWildcards
+bool Foam::dictionary::findInPatterns
 (
-    const bool wildCardMatch,
+    const bool patternMatch,
     const word& Keyword,
     DLList<entry*>::const_iterator& wcLink,
     DLList<autoPtr<regExp> >::const_iterator& reLink
 ) const
 {
-    if (wildCardEntries_.size() > 0)
+    if (patternEntries_.size() > 0)
     {
-        while (wcLink != wildCardEntries_.end())
+        while (wcLink != patternEntries_.end())
         {
-            if (!wildCardMatch && wcLink()->keyword() == Keyword)
-            {
-                return true;
-            }
-            else if (wildCardMatch && reLink()->match(Keyword))
+            if
+            (
+                patternMatch ? reLink()->match(Keyword)
+              : wcLink()->keyword() == Keyword
+            )
             {
                 return true;
             }
@@ -68,23 +68,23 @@ bool Foam::dictionary::findInWildcards
 }
 
 
-bool Foam::dictionary::findInWildcards
+bool Foam::dictionary::findInPatterns
 (
-    const bool wildCardMatch,
+    const bool patternMatch,
     const word& Keyword,
     DLList<entry*>::iterator& wcLink,
     DLList<autoPtr<regExp> >::iterator& reLink
 )
 {
-    if (wildCardEntries_.size() > 0)
+    if (patternEntries_.size() > 0)
     {
-        while (wcLink != wildCardEntries_.end())
+        while (wcLink != patternEntries_.end())
         {
-            if (!wildCardMatch && wcLink()->keyword() == Keyword)
-            {
-                return true;
-            }
-            else if (wildCardMatch && reLink()->match(Keyword))
+            if
+            (
+                patternMatch ? reLink()->match(Keyword)
+              : wcLink()->keyword() == Keyword
+            )
             {
                 return true;
             }
@@ -125,10 +125,10 @@ Foam::dictionary::dictionary
     {
         hashedEntries_.insert(iter().keyword(), &iter());
 
-        if (iter().keyword().isWildCard())
+        if (iter().keyword().isPattern())
         {
-            wildCardEntries_.insert(&iter());
-            wildCardRegexps_.insert
+            patternEntries_.insert(&iter());
+            patternRegexps_.insert
             (
                 autoPtr<regExp>(new regExp(iter().keyword()))
             );
@@ -155,10 +155,10 @@ Foam::dictionary::dictionary
     {
         hashedEntries_.insert(iter().keyword(), &iter());
 
-        if (iter().keyword().isWildCard())
+        if (iter().keyword().isPattern())
         {
-            wildCardEntries_.insert(&iter());
-            wildCardRegexps_.insert
+            patternEntries_.insert(&iter());
+            patternRegexps_.insert
             (
                 autoPtr<regExp>(new regExp(iter().keyword()))
             );
@@ -217,14 +217,14 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
     }
     else
     {
-        if (wildCardEntries_.size() > 0)
+        if (patternEntries_.size() > 0)
         {
-            DLList<entry*>::const_iterator wcLink = wildCardEntries_.begin();
+            DLList<entry*>::const_iterator wcLink = patternEntries_.begin();
             DLList<autoPtr<regExp> >::const_iterator reLink =
-                wildCardRegexps_.begin();
+                patternRegexps_.begin();
 
-            // Find in wildcards using regular expressions only
-            if (findInWildcards(true, keyword, wcLink, reLink))
+            // Find in patterns using regular expressions only
+            if (findInPatterns(true, keyword, wcLink, reLink))
             {
                 return true;
             }
@@ -246,22 +246,22 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr
 (
     const word& keyword,
     bool recursive,
-    bool wildCardMatch
+    bool patternMatch
 ) const
 {
     HashTable<entry*>::const_iterator iter = hashedEntries_.find(keyword);
 
     if (iter == hashedEntries_.end())
     {
-        if (wildCardMatch && wildCardEntries_.size() > 0)
+        if (patternMatch && patternEntries_.size() > 0)
         {
             DLList<entry*>::const_iterator wcLink =
-                wildCardEntries_.begin();
+                patternEntries_.begin();
             DLList<autoPtr<regExp> >::const_iterator reLink =
-                wildCardRegexps_.begin();
+                patternRegexps_.begin();
 
-            // Find in wildcards using regular expressions only
-            if (findInWildcards(wildCardMatch, keyword, wcLink, reLink))
+            // Find in patterns using regular expressions only
+            if (findInPatterns(patternMatch, keyword, wcLink, reLink))
             {
                 return wcLink();
             }
@@ -269,7 +269,7 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr
 
         if (recursive && &parent_ != &dictionary::null)
         {
-            return parent_.lookupEntryPtr(keyword, recursive, wildCardMatch);
+            return parent_.lookupEntryPtr(keyword, recursive, patternMatch);
         }
         else
         {
@@ -285,21 +285,22 @@ Foam::entry* Foam::dictionary::lookupEntryPtr
 (
     const word& keyword,
     bool recursive,
-    bool wildCardMatch
+    bool patternMatch
 )
 {
     HashTable<entry*>::iterator iter = hashedEntries_.find(keyword);
 
     if (iter == hashedEntries_.end())
     {
-        if (wildCardMatch && wildCardEntries_.size() > 0)
+        if (patternMatch && patternEntries_.size() > 0)
         {
             DLList<entry*>::iterator wcLink =
-                wildCardEntries_.begin();
+                patternEntries_.begin();
             DLList<autoPtr<regExp> >::iterator reLink =
-                wildCardRegexps_.begin();
-            // Find in wildcards using regular expressions only
-            if (findInWildcards(wildCardMatch, keyword, wcLink, reLink))
+                patternRegexps_.begin();
+
+            // Find in patterns using regular expressions only
+            if (findInPatterns(patternMatch, keyword, wcLink, reLink))
             {
                 return wcLink();
             }
@@ -311,7 +312,7 @@ Foam::entry* Foam::dictionary::lookupEntryPtr
             (
                 keyword,
                 recursive,
-                wildCardMatch
+                patternMatch
             );
         }
         else
@@ -328,10 +329,10 @@ const Foam::entry& Foam::dictionary::lookupEntry
 (
     const word& keyword,
     bool recursive,
-    bool wildCardMatch
+    bool patternMatch
 ) const
 {
-    const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch);
+    const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
 
     if (entryPtr == NULL)
     {
@@ -352,16 +353,16 @@ Foam::ITstream& Foam::dictionary::lookup
 (
     const word& keyword,
     bool recursive,
-    bool wildCardMatch
+    bool patternMatch
 ) const
 {
-    return lookupEntry(keyword, recursive, wildCardMatch).stream();
+    return lookupEntry(keyword, recursive, patternMatch).stream();
 }
 
 
 bool Foam::dictionary::isDict(const word& keyword) const
 {
-    // Find non-recursive with wildcards
+    // Find non-recursive with patterns
     const entry* entryPtr = lookupEntryPtr(keyword, false, true);
 
     if (entryPtr)
@@ -430,7 +431,26 @@ Foam::wordList Foam::dictionary::toc() const
 {
     wordList keys(size());
 
-    label i = 0;
+    label nKeys = 0;
+    for
+    (
+        IDLList<entry>::const_iterator iter = begin();
+        iter != end();
+        ++iter
+    )
+    {
+        keys[nKeys++] = iter().keyword();
+    }
+
+    return keys;
+}
+
+
+Foam::List<Foam::keyType> Foam::dictionary::keys(bool patterns) const
+{
+    List<keyType> keys(size());
+
+    label nKeys = 0;
     for
     (
         IDLList<entry>::const_iterator iter = begin();
@@ -438,8 +458,12 @@ Foam::wordList Foam::dictionary::toc() const
         ++iter
     )
     {
-        keys[i++] = iter().keyword();
+        if (iter().keyword().isPattern() ? patterns : !patterns)
+        {
+            keys[nKeys++] = iter().keyword();
+        }
     }
+    keys.setSize(nKeys);
 
     return keys;
 }
@@ -473,10 +497,10 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
             {
                 entryPtr->name() = name_ + "::" + entryPtr->keyword();
 
-                if (entryPtr->keyword().isWildCard())
+                if (entryPtr->keyword().isPattern())
                 {
-                    wildCardEntries_.insert(entryPtr);
-                    wildCardRegexps_.insert
+                    patternEntries_.insert(entryPtr);
+                    patternRegexps_.insert
                     (
                         autoPtr<regExp>(new regExp(entryPtr->keyword()))
                     );
@@ -502,10 +526,10 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
         entryPtr->name() = name_ + "::" + entryPtr->keyword();
         IDLList<entry>::append(entryPtr);
 
-        if (entryPtr->keyword().isWildCard())
+        if (entryPtr->keyword().isPattern())
         {
-            wildCardEntries_.insert(entryPtr);
-            wildCardRegexps_.insert
+            patternEntries_.insert(entryPtr);
+            patternRegexps_.insert
             (
                 autoPtr<regExp>(new regExp(entryPtr->keyword()))
             );
@@ -597,16 +621,15 @@ bool Foam::dictionary::remove(const word& Keyword)
 
     if (iter != hashedEntries_.end())
     {
-        // Delete from wildcards first
-        DLList<entry*>::iterator wcLink =
-            wildCardEntries_.begin();
-        DLList<autoPtr<regExp> >::iterator reLink = wildCardRegexps_.begin();
+        // Delete from patterns first
+        DLList<entry*>::iterator wcLink = patternEntries_.begin();
+        DLList<autoPtr<regExp> >::iterator reLink = patternRegexps_.begin();
 
-        // Find in wildcards using exact match only
-        if (findInWildcards(false, Keyword, wcLink, reLink))
+        // Find in pattern using exact match only
+        if (findInPatterns(false, Keyword, wcLink, reLink))
         {
-            wildCardEntries_.remove(wcLink);
-            wildCardRegexps_.remove(reLink);
+            patternEntries_.remove(wcLink);
+            patternRegexps_.remove(reLink);
         }
 
         IDLList<entry>::remove(iter());
@@ -643,14 +666,14 @@ bool Foam::dictionary::changeKeyword
         return false;
     }
 
-    if (iter()->keyword().isWildCard())
+    if (iter()->keyword().isPattern())
     {
         FatalErrorIn
         (
             "dictionary::changeKeyword(const word&, const word&, bool)"
         )   << "Old keyword "<< oldKeyword
-            << " is a wildcard."
-            << "Wildcard replacement not yet implemented."
+            << " is a pattern."
+            << "Pattern replacement not yet implemented."
             << exit(FatalError);
     }
 
@@ -662,19 +685,19 @@ bool Foam::dictionary::changeKeyword
     {
         if (forceOverwrite)
         {
-            if (iter2()->keyword().isWildCard())
+            if (iter2()->keyword().isPattern())
             {
-                // Delete from wildcards first
+                // Delete from patterns first
                 DLList<entry*>::iterator wcLink =
-                    wildCardEntries_.begin();
+                    patternEntries_.begin();
                 DLList<autoPtr<regExp> >::iterator reLink =
-                    wildCardRegexps_.begin();
+                    patternRegexps_.begin();
 
-                // Find in wildcards using exact match only
-                if (findInWildcards(false, iter2()->keyword(), wcLink, reLink))
+                // Find in patterns using exact match only
+                if (findInPatterns(false, iter2()->keyword(), wcLink, reLink))
                 {
-                    wildCardEntries_.remove(wcLink);
-                    wildCardRegexps_.remove(reLink);
+                    patternEntries_.remove(wcLink);
+                    patternRegexps_.remove(reLink);
                 }
             }
 
@@ -701,10 +724,10 @@ bool Foam::dictionary::changeKeyword
     hashedEntries_.erase(oldKeyword);
     hashedEntries_.insert(newKeyword, iter());
 
-    if (newKeyword.isWildCard())
+    if (newKeyword.isPattern())
     {
-        wildCardEntries_.insert(iter());
-        wildCardRegexps_.insert
+        patternEntries_.insert(iter());
+        patternRegexps_.insert
         (
             autoPtr<regExp>(new regExp(newKeyword))
         );
@@ -770,8 +793,8 @@ void Foam::dictionary::clear()
 {
     IDLList<entry>::clear();
     hashedEntries_.clear();
-    wildCardEntries_.clear();
-    wildCardRegexps_.clear();
+    patternEntries_.clear();
+    patternRegexps_.clear();
 }
 
 
diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H
index 1d87a08fd64d7505d4628c0cd2740dd6eb12db82..a4020b6f32f6d2c0aa5bddb54eceae944c385c0c 100644
--- a/src/OpenFOAM/db/dictionary/dictionary.H
+++ b/src/OpenFOAM/db/dictionary/dictionary.H
@@ -27,12 +27,12 @@ Class
 
 Description
     A list of keyword definitions, which are a keyword followed by any number
-    of values (e.g. words and numbers). The keywords can represent wildcards
+    of values (e.g. words and numbers). The keywords can represent patterns
     which are matched using Posix regular expressions. The general order for
-    searching is
+    searching is as follows:
     - exact match
-    - wildcard match (in reverse order)
-    - optional recursion into subdictionaries
+    - pattern match (in reverse order)
+    - optional recursion into the enclosing (parent) dictionaries
 
     The dictionary class is the base class for IOdictionary.
     It also serves as a bootstrap dictionary for the objectRegistry data
@@ -92,29 +92,27 @@ class dictionary
         //- Parent dictionary
         const dictionary& parent_;
 
-        //- Wildcard entries
-        DLList<entry*> wildCardEntries_;
+        //- Entries of matching patterns
+        DLList<entry*> patternEntries_;
 
-        //- Wildcard precompiled regular expressions
-        DLList<autoPtr<regExp> > wildCardRegexps_;
+        //- Patterns as precompiled regular expressions
+        DLList<autoPtr<regExp> > patternRegexps_;
 
    // Private Member Functions
 
-        //- Search wildcard table either for exact match or for regular
-        //  expression match.
-        bool findInWildcards
+        //- Search patterns table for exact match or regular expression match
+        bool findInPatterns
         (
-            const bool wildCardMatch,
+            const bool patternMatch,
             const word& Keyword,
             DLList<entry*>::const_iterator& wcLink,
             DLList<autoPtr<regExp> >::const_iterator& reLink
         ) const;
 
-        //- Search wildcard table either for exact match or for regular
-        //  expression match.
-        bool findInWildcards
+        //- Search patterns table for exact match or regular expression match
+        bool findInPatterns
         (
-            const bool wildCardMatch,
+            const bool patternMatch,
             const word& Keyword,
             DLList<entry*>::iterator& wcLink,
             DLList<autoPtr<regExp> >::iterator& reLink
@@ -210,83 +208,88 @@ public:
         // Search and lookup
 
             //- Search dictionary for given keyword
-            //  If recursive search parent dictionaries
+            //  If recursive, search parent dictionaries
             bool found(const word&, bool recursive=false) const;
 
             //- Find and return an entry data stream pointer if present
             //  otherwise return NULL.
-            //  If recursive search parent dictionaries.
-            //  If wildCardMatch use wildcards.
+            //  If recursive, search parent dictionaries.
+            //  If patternMatch, use regular expressions
             const entry* lookupEntryPtr
             (
                 const word&,
                 bool recursive,
-                bool wildCardMatch
+                bool patternMatch
             ) const;
 
             //- Find and return an entry data stream pointer for manipulation
             //  if present otherwise return NULL.
-            //  If recursive search parent dictionaries.
-            //  If wildCardMatch use wildcards.
+            //  If recursive, search parent dictionaries.
+            //  If patternMatch, use regular expressions.
             entry* lookupEntryPtr
             (
                 const word&,
                 bool recursive,
-                bool wildCardMatch
+                bool patternMatch
             );
 
             //- Find and return an entry data stream if present otherwise error.
-            //  If recursive search parent dictionaries.
-            //  If wildCardMatch use wildcards.
+            //  If recursive, search parent dictionaries.
+            //  If patternMatch, use regular expressions.
             const entry& lookupEntry
             (
                 const word&,
                 bool recursive,
-                bool wildCardMatch
+                bool patternMatch
             ) const;
 
             //- Find and return an entry data stream
-            //  If recursive search parent dictionaries
+            //  If recursive, search parent dictionaries.
+            //  If patternMatch, use regular expressions.
             ITstream& lookup
             (
                 const word&,
                 bool recursive=false,
-                bool wildCardMatch=true
+                bool patternMatch=true
             ) const;
 
             //- Find and return a T,
             //  if not found return the given default value
-            //  If recursive search parent dictionaries
+            //  If recursive, search parent dictionaries.
+            //  If patternMatch, use regular expressions.
             template<class T>
             T lookupOrDefault
             (
                 const word&,
                 const T&,
                 bool recursive=false,
-                bool wildCardMatch=true
+                bool patternMatch=true
             ) const;
 
             //- Find and return a T, if not found return the given
             //  default value, and add to dictionary.
-            //  If recursive search parent dictionaries
+            //  If recursive, search parent dictionaries.
+            //  If patternMatch, use regular expressions.
             template<class T>
             T lookupOrAddDefault
             (
                 const word&,
                 const T&,
                 bool recursive=false,
-                bool wildCardMatch=true
+                bool patternMatch=true
             );
 
             //- Find an entry if present, and assign to T
-            //  Returns true if the entry was found
+            //  Returns true if the entry was found.
+            //  If recursive, search parent dictionaries.
+            //  If patternMatch, use regular expressions.
             template<class T>
             bool readIfPresent
             (
                 const word&,
                 T&,
                 bool recursive=false,
-                bool wildCardMatch=true
+                bool patternMatch=true
             ) const;
 
             //- Check if entry is a sub-dictionary
@@ -305,6 +308,9 @@ public:
             //- Return the table of contents
             wordList toc() const;
 
+            //- Return the list of available keys or patterns
+            List<keyType> keys(bool patterns=false) const;
+
         // Editing
 
             //- Add a new entry
@@ -393,7 +399,7 @@ public:
         void operator=(const dictionary&);
 
         //- Include entries from the given dictionary.
-        //  Warn, but do not overwrite existing entries
+        //  Warn, but do not overwrite existing entries.
         void operator+=(const dictionary&);
 
         //- Conditionally include entries from the given dictionary.
@@ -417,13 +423,13 @@ public:
 
 // Global Operators
 
-//- Combine dictionaries starting from the entries in dict1 and then including
-//  those from dict2.
+//- Combine dictionaries.
+//  Starting from the entries in dict1 and then including those from dict2.
 //  Warn, but do not overwrite the entries from dict1.
 dictionary operator+(const dictionary& dict1, const dictionary& dict2);
 
-//- Combine dictionaries starting from the entries in dict1 and then including
-//  those from dict2.
+//- Combine dictionaries.
+//  Starting from the entries in dict1 and then including those from dict2.
 //  Do not overwrite the entries from dict1.
 dictionary operator|(const dictionary& dict1, const dictionary& dict2);
 
diff --git a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H
index 1909f4851ddc4bbdae66a9586965102ef613d7a9..2b86c53d01329de349ee0277248c4092510687a4 100644
--- a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H
+++ b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntry.H
@@ -74,20 +74,20 @@ public:
     // Constructors
 
         //- Construct from the parent dictionary and Istream
-        dictionaryEntry(const dictionary& parentDict, Istream& is);
+        dictionaryEntry(const dictionary& parentDict, Istream&);
 
         //- Construct from the keyword, parent dictionary and a Istream
         dictionaryEntry
         (
-            const keyType& keyword,
+            const keyType&,
             const dictionary& parentDict,
-            Istream& is
+            Istream&
         );
 
         //- Construct from the keyword, parent dictionary and a dictionary
         dictionaryEntry
         (
-            const keyType& keyword,
+            const keyType&,
             const dictionary& parentDict,
             const dictionary& dict
         );
@@ -96,7 +96,7 @@ public:
         dictionaryEntry
         (
             const dictionary& parentDict,
-            const dictionaryEntry& dictEnt
+            const dictionaryEntry&
         );
 
         autoPtr<entry> clone(const dictionary& parentDict) const
@@ -158,10 +158,8 @@ public:
 };
 
 
-#if defined (__GNUC__)
 template<>
-#endif
-Ostream& operator<<(Ostream& os, const InfoProxy<dictionaryEntry>& ip);
+Ostream& operator<<(Ostream&, const InfoProxy<dictionaryEntry>&);
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/db/dictionary/dictionaryTemplates.C b/src/OpenFOAM/db/dictionary/dictionaryTemplates.C
index a47a97681472c2d47d42b035f7504c9171a5ffa7..65883ba535be0bc8bda2fd444635c4e0d927534b 100644
--- a/src/OpenFOAM/db/dictionary/dictionaryTemplates.C
+++ b/src/OpenFOAM/db/dictionary/dictionaryTemplates.C
@@ -35,18 +35,18 @@ T Foam::dictionary::lookupOrDefault
     const word& keyword,
     const T& deflt,
     bool recursive,
-    bool wildCardMatch
+    bool patternMatch
 ) const
 {
-    const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch);
+    const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
 
-    if (entryPtr == NULL)
+    if (entryPtr)
     {
-        return deflt;
+        return pTraits<T>(entryPtr->stream());
     }
     else
     {
-        return pTraits<T>(entryPtr->stream());
+        return deflt;
     }
 }
 
@@ -57,19 +57,19 @@ T Foam::dictionary::lookupOrAddDefault
     const word& keyword,
     const T& deflt,
     bool recursive,
-    bool wildCardMatch
+    bool patternMatch
 )
 {
-    const entry* entryPtr = lookupEntryPtr(keyword, recursive, wildCardMatch);
+    const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
 
-    if (entryPtr == NULL)
+    if (entryPtr)
     {
-        add(new primitiveEntry(keyword, deflt));
-        return deflt;
+        return pTraits<T>(entryPtr->stream());
     }
     else
     {
-        return pTraits<T>(entryPtr->stream());
+        add(new primitiveEntry(keyword, deflt));
+        return deflt;
     }
 }
 
@@ -80,19 +80,19 @@ bool Foam::dictionary::readIfPresent
     const word& k,
     T& val,
     bool recursive,
-    bool wildCardMatch
+    bool patternMatch
 ) const
 {
-    const entry* entryPtr = lookupEntryPtr(k, recursive, wildCardMatch);
+    const entry* entryPtr = lookupEntryPtr(k, recursive, patternMatch);
 
-    if (entryPtr == NULL)
+    if (entryPtr)
     {
-        return false;
+        entryPtr->stream() >> val;
+        return true;
     }
     else
     {
-        entryPtr->stream() >> val;
-        return true;
+        return false;
     }
 }
 
diff --git a/src/OpenFOAM/db/dictionary/entry/entry.H b/src/OpenFOAM/db/dictionary/entry/entry.H
index 5ed8b929b6993d64db10a3ebce69047bdb83c64f..61eafc7c8a91bbd27934083befb5c6ec2a97ac80 100644
--- a/src/OpenFOAM/db/dictionary/entry/entry.H
+++ b/src/OpenFOAM/db/dictionary/entry/entry.H
@@ -92,20 +92,20 @@ public:
 
         //- Construct on freestore as copy with reference to the
         //  dictionary the copy belongs to
-        virtual Foam::autoPtr<entry> clone
+        virtual autoPtr<entry> clone
         (
             const dictionary& parentDict
         ) const = 0;
 
         //- Construct on freestore as copy
         //  Note: the parent directory is set to dictionary::null
-        virtual Foam::autoPtr<entry> clone() const;
+        virtual autoPtr<entry> clone() const;
 
         //- Construct from Istream and insert into dictionary
         static bool New(dictionary& parentDict, Istream& is);
 
         //- Construct on freestore from Istream and return
-        static Foam::autoPtr<entry> New(Istream& is);
+        static autoPtr<entry> New(Istream& is);
 
 
     // Destructor
diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H
index 86d8afd61daad8a3d4a1dce09fabd93fd0f1a75a..1e5858abafcc1b5fc2ec9714cfb81c296c80a172 100644
--- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H
+++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.H
@@ -75,32 +75,32 @@ public:
         void append
         (
             const token& currToken,
-            const dictionary& dict,
-            Istream& is
+            const dictionary&,
+            Istream&
         );
 
         //- Append the given tokens starting at the current tokenIndex
-        void append(const tokenList& varTokens);
+        void append(const tokenList&);
 
         //- Expand the given variable (keyword starts with $)
-        bool expandVariable(const word& keyword, const dictionary& dict);
+        bool expandVariable(const word&, const dictionary&);
 
         //- Expand the given function (keyword starts with #)
         bool expandFunction
         (
-            const word& keyword,
-            const dictionary& dict,
-            Istream& is
+            const word&,
+            const dictionary&,
+            Istream&
         );
 
         //- Read tokens from the given stream
-        bool read(const dictionary& dict, Istream&);
+        bool read(const dictionary&, Istream&);
 
         //- Read the complete entry from the given stream
-        void readEntry(const dictionary& dict, Istream&);
+        void readEntry(const dictionary&, Istream&);
 
         //- Insert the given tokens at token i
-        void insert(const tokenList& varTokens, const label i);
+        void insert(const tokenList&, const label i);
 
 
 public:
@@ -108,13 +108,13 @@ public:
     // Constructors
 
         //- Construct from keyword and a Istream
-        primitiveEntry(const keyType& keyword, Istream&);
+        primitiveEntry(const keyType&, Istream&);
 
-        //- Construct from keyword, parent dictionary and a Istream
-        primitiveEntry(const keyType& keyword, const dictionary&, Istream&);
+        //- Construct from keyword, parent dictionary and Istream
+        primitiveEntry(const keyType&, const dictionary& parentDict, Istream&);
 
         //- Construct from keyword and a ITstream
-        primitiveEntry(const keyType& keyword, const ITstream&);
+        primitiveEntry(const keyType&, const ITstream&);
 
         //- Construct from keyword and a token
         primitiveEntry(const keyType&, const token&);
@@ -182,7 +182,7 @@ public:
 
 
 template<>
-Ostream& operator<<(Ostream& os, const InfoProxy<primitiveEntry>& ip);
+Ostream& operator<<(Ostream&, const InfoProxy<primitiveEntry>&);
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/db/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjectList/functionObjectList.C
index 760cf83a2a51907a7dc1ae7ecc5ae06dbdabc5a1..8bb900edfd083eb66740c56ee0289a57a62f22e6 100644
--- a/src/OpenFOAM/db/functionObjectList/functionObjectList.C
+++ b/src/OpenFOAM/db/functionObjectList/functionObjectList.C
@@ -27,6 +27,26 @@ License
 #include "functionObjectList.H"
 #include "Time.H"
 
+// * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
+
+Foam::functionObject* Foam::functionObjectList::remove(const word& key)
+{
+    functionObject* ptr = 0;
+
+    // Find index of existing functionObject
+    HashTable<label>::iterator fnd = indices_.find(key);
+
+    if (fnd != indices_.end())
+    {
+        // remove the pointer from the old list
+        ptr = functions_.set(fnd(), 0).ptr();
+        indices_.erase(fnd);
+    }
+
+    return ptr;
+}
+
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 Foam::functionObjectList::functionObjectList
@@ -35,24 +55,28 @@ Foam::functionObjectList::functionObjectList
     const bool execution
 )
 :
-    HashPtrTable<functionObject>(),
+    functions_(),
+    indices_(),
     time_(t),
-    foDict_(t.controlDict()),
-    execution_(execution)
+    parentDict_(t.controlDict()),
+    execution_(execution),
+    updated_(false)
 {}
 
 
 Foam::functionObjectList::functionObjectList
 (
     const Time& t,
-    const dictionary& foDict,
+    const dictionary& parentDict,
     const bool execution
 )
 :
-    HashPtrTable<functionObject>(),
+    functions_(),
+    indices_(),
     time_(t),
-    foDict_(foDict),
-    execution_(execution)
+    parentDict_(parentDict),
+    execution_(execution),
+    updated_(false)
 {}
 
 
@@ -66,52 +90,28 @@ Foam::functionObjectList::~functionObjectList()
 
 bool Foam::functionObjectList::start()
 {
-    if (execution_)
-    {
-        bool ok = false;
-
-        if (foDict_.found("functions"))
-        {
-            HashPtrTable<functionObject> functions
-            (
-                foDict_.lookup("functions"),
-                functionObject::iNew(time_)
-            );
-
-            transfer(functions);
-
-            forAllIter(HashPtrTable<functionObject>, *this, iter)
-            {
-                ok = iter()->start() && ok;
-            }
-        }
-
-        return ok;
-    }
-    else
-    {
-        return true;
-    }
+    return read();
 }
 
 
 bool Foam::functionObjectList::execute()
 {
+    bool ok = true;
+
     if (execution_)
     {
-        bool ok = false;
-
-        forAllIter(HashPtrTable<functionObject>, *this, iter)
+        if (!updated_)
         {
-            ok = iter()->execute() && ok;
+            read();
         }
 
-        return ok;
-    }
-    else
-    {
-        return true;
+        forAllIter(PtrList<functionObject>, functions_, iter)
+        {
+            ok = iter().execute() && ok;
+        }
     }
+
+    return ok;
 }
 
 
@@ -129,46 +129,108 @@ void Foam::functionObjectList::off()
 
 bool Foam::functionObjectList::read()
 {
-    bool read = false;
+    bool ok = true;
+    updated_ = execution_;
+
+    // avoid reading/initializing if execution is off
+    if (!execution_)
+    {
+        return ok;
+    }
 
-    if (foDict_.found("functions"))
+    // Update existing and add new functionObjects
+    const entry* entryPtr = parentDict_.lookupEntryPtr("functions",false,false);
+    if (entryPtr)
     {
-        HashPtrTable<dictionary> functionDicts(foDict_.lookup("functions"));
+        PtrList<functionObject> newPtrs;
+        HashTable<label> newIndices;
 
-        // Update existing and add new functionObjects
-        forAllConstIter(HashPtrTable<dictionary>, functionDicts, iter)
-        {
-            if (found(iter.key()))
-            {
-                read = find(iter.key())()->read(*iter()) && read;
-            }
-            else
-            {
-                functionObject* functionObjectPtr =
-                    functionObject::New(iter.key(), time_, *iter()).ptr();
+        label nFunc = 0;
 
-                functionObjectPtr->start();
+        if (entryPtr->isDict())
+        {
+            // a dictionary of functionObjects
+            const dictionary& functionDicts = entryPtr->dict();
+            newPtrs.setSize(functionDicts.size());
 
-                insert(iter.key(), functionObjectPtr);
+            forAllConstIter(dictionary, functionDicts, iter)
+            {
+                // safety:
+                if (!iter().isDict())
+                {
+                    continue;
+                }
+                const word& key = iter().keyword();
+                const dictionary& dict = iter().dict();
+
+                functionObject* objPtr = remove(key);
+                if (objPtr)
+                {
+                    // existing functionObject
+                    ok = objPtr->read(dict) && ok;
+                }
+                else
+                {
+                    // new functionObject
+                    objPtr = functionObject::New(key, time_, dict).ptr();
+                    ok = objPtr->start() && ok;
+                }
+
+                newPtrs.set(nFunc, objPtr);
+                newIndices.insert(key, nFunc);
+                nFunc++;
             }
         }
-
-        // Remove deleted functionObjects
-        forAllIter(HashPtrTable<functionObject>, *this, iter)
+        else
         {
-            if (!functionDicts.found(iter.key()))
+            // a list of functionObjects
+            PtrList<entry> functionDicts(entryPtr->stream());
+            newPtrs.setSize(functionDicts.size());
+
+            forAllIter(PtrList<entry>, functionDicts, iter)
             {
-                erase(iter);
+                // safety:
+                if (!iter().isDict())
+                {
+                    continue;
+                }
+                const word& key = iter().keyword();
+                const dictionary& dict = iter().dict();
+
+                functionObject* objPtr = remove(key);
+                if (objPtr)
+                {
+                    // existing functionObject
+                    ok = objPtr->read(dict) && ok;
+                }
+                else
+                {
+                    // new functionObject
+                    objPtr = functionObject::New(key, time_, dict).ptr();
+                    ok = objPtr->start() && ok;
+                }
+
+                newPtrs.set(nFunc, objPtr);
+                newIndices.insert(key, nFunc);
+                nFunc++;
             }
         }
+
+        // safety:
+        newPtrs.setSize(nFunc);
+
+        // update PtrList of functionObjects
+        // also deletes existing, unused functionObjects
+        functions_.transfer(newPtrs);
+        indices_.transfer(newIndices);
     }
     else
     {
-        clear();
-        read = true;
+        functions_.clear();
+        indices_.clear();
     }
 
-    return read;
+    return ok;
 }
 
 
diff --git a/src/OpenFOAM/db/functionObjectList/functionObjectList.H b/src/OpenFOAM/db/functionObjectList/functionObjectList.H
index 78462b653bef92507b97496d6b552c26cbc89cc4..1b0d51c066f8907504a7bf9ce96aaf14cc99eba6 100644
--- a/src/OpenFOAM/db/functionObjectList/functionObjectList.H
+++ b/src/OpenFOAM/db/functionObjectList/functionObjectList.H
@@ -26,8 +26,8 @@ Class
     Foam::functionObjectList
 
 Description
-    List of function objects with execute function which is called for
-    each object.
+    List of function objects with execute() function that is called for each
+    object.
 
 See Also
     Foam::functionObject and Foam::OutputFilterFunctionObject
@@ -41,7 +41,8 @@ SourceFiles
 #define functionObjectList_H
 
 #include "functionObject.H"
-#include "HashPtrTable.H"
+#include "HashTable.H"
+#include "PtrList.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -49,26 +50,41 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class functionObjectList Declaration
+                     Class functionObjectList Declaration
 \*---------------------------------------------------------------------------*/
 
 class functionObjectList
-:
-    public HashPtrTable<functionObject>
 {
     // Private data
 
+        //- A list of function objects
+        //  Avoid 'is-a' relationship for protection
+        PtrList<functionObject> functions_;
+
+        //- Quick lookup of the index into the PtrList<functionObject>
+        //  Currently only used to manage rereading/deletion
+        HashTable<label>  indices_;
+
         const Time& time_;
 
-        //- Dictionary containing the list of function object specifications
-        const dictionary& foDict_;
+        //- Dictionary containing the "functions" entry
+        //  This entry can either be a list or a dictionary of
+        //  functionObject specifications.
+        const dictionary& parentDict_;
 
         //- Switch for the execution of the functionObjects
         bool execution_;
 
+        //- Tracks if read() was called while execution was turned off
+        bool updated_;
+
 
     // Private Member Functions
 
+        //- Remove and return the function object pointer by name.
+        //  Return NULL if it didn't exist.
+        functionObject* remove(const word&);
+
         //- Disallow default bitwise copy construct
         functionObjectList(const functionObjectList&);
 
@@ -85,17 +101,17 @@ public:
         functionObjectList
         (
             const Time&,
-            const bool execution = true
+            const bool execution=true
         );
 
 
-        //- Construct from Time, functionObject dictionary and the execution
-        //  setting
+        //- Construct from Time, dictionary with "functions" entry
+        //  and the execution setting
         functionObjectList
         (
             const Time&,
-            const dictionary& foDict,
-            const bool execution = true
+            const dictionary& parentDict,
+            const bool execution=true
         );
 
 
@@ -118,7 +134,7 @@ public:
         //- Switch the function objects off
         virtual void off();
 
-        //- Read and set the function objects if their data has changed
+        //- Read and set the function objects if their data have changed
         virtual bool read();
 };
 
diff --git a/src/OpenFOAM/db/scalarRange/scalarRanges.C b/src/OpenFOAM/db/scalarRange/scalarRanges.C
index d2bf1c830256143be0a9a4554481cb5879e3d79c..f0cf5d5a844d72f0e7357f52fc2b979f61f353fd 100644
--- a/src/OpenFOAM/db/scalarRange/scalarRanges.C
+++ b/src/OpenFOAM/db/scalarRange/scalarRanges.C
@@ -51,7 +51,6 @@ Foam::scalarRanges::scalarRanges(Istream& is)
         }
     }
 
-    lst.shrink();
     transfer(lst);
 }
 
diff --git a/src/OpenFOAM/global/debug/debug.C b/src/OpenFOAM/global/debug/debug.C
index 82ec7d7eaf13f226563e0170e44c8e45261b3980..3a3274a1e20fa9b48dea3b78cbdbd1bcb5ae79ef 100644
--- a/src/OpenFOAM/global/debug/debug.C
+++ b/src/OpenFOAM/global/debug/debug.C
@@ -36,19 +36,16 @@ Description
 
 namespace Foam
 {
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
 namespace debug
 {
 
+//! @cond ignoreDocumentation - local scope
 dictionary* controlDictPtr_(NULL);
 dictionary* debugSwitchesPtr_(NULL);
 dictionary* infoSwitchesPtr_(NULL);
 dictionary* optimisationSwitchesPtr_(NULL);
 
-//- Class to ensure controlDictPtr_ is deleted at the end of the run
-//  @cond ignore documentation for this class
+// to ensure controlDictPtr_ is deleted at the end of the run
 class deleteControlDictPtr
 {
 public:
@@ -61,135 +58,110 @@ public:
         if (controlDictPtr_)
         {
             delete controlDictPtr_;
+            controlDictPtr_ = 0;
         }
     }
 };
-//! @endcond
 
 deleteControlDictPtr deleteControlDictPtr_;
+//! @endcond ignoreDocumentation
 
 
-dictionary& switchSet(const char* switchSetName, dictionary* switchSetPtr)
-{
-    if (!switchSetPtr)
-    {
-        if (!controlDict().found(switchSetName))
-        {
-            cerr<< "debug::switchSet(const char*, dictionary*): " << std::endl
-                << "    Cannot find " <<  switchSetName
-            << " in dictionary " << controlDictPtr_->name().c_str()
-            << std::endl << std::endl;
-
-            ::exit(1);
-        }
-
-        switchSetPtr =
-            const_cast<dictionary*>(&(controlDict().subDict(switchSetName)));
-    }
-
-    return *switchSetPtr;
-}
+} // End namespace debug
+} // End namespace Foam
 
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-int debugSwitch
-(
-    dictionary& switchSet,
-    const char* switchName,
-    const int defaultValue
-)
+Foam::dictionary& Foam::debug::controlDict()
 {
-    if (switchSet.found(switchName))
-    {
-        return readInt(switchSet.lookup(switchName));
-    }
-    else
+    if (!controlDictPtr_)
     {
-        switchSet.add(switchName, defaultValue);
-        return defaultValue;
+        controlDictPtr_ = new dictionary
+        (
+            IFstream(findEtcFile("controlDict", true))()
+        );
     }
-}
 
+    return *controlDictPtr_;
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-dictionary& debug::controlDict()
+Foam::dictionary& Foam::debug::switchSet
+(
+    const char* subDictName,
+    dictionary*& subDictPtr
+)
 {
-    if (!controlDictPtr_)
+    if (!subDictPtr)
     {
-        fileName controlDictFileName(dotFoam("controlDict"));
-
-        IFstream dictFile(controlDictFileName);
+        entry* ePtr = controlDict().lookupEntryPtr
+        (
+            subDictName, false, false
+        );
 
-        if (!dictFile.good())
+        if (!ePtr || !ePtr->isDict())
         {
-            cerr<< "debug::controlDict(): "
-                << "Cannot open essential file " << controlDictFileName.c_str()
+            cerr<< "debug::switchSet(const char*, dictionary*&):\n"
+                << "    Cannot find " <<  subDictName << " in dictionary "
+                << controlDict().name().c_str()
                 << std::endl << std::endl;
+
             ::exit(1);
         }
 
-        controlDictPtr_ = new dictionary(dictFile);
+        subDictPtr = &ePtr->dict();
     }
 
-    return *controlDictPtr_;
+    return *subDictPtr;
 }
 
 
-dictionary& debug::debugSwitches()
+Foam::dictionary& Foam::debug::debugSwitches()
 {
     return switchSet("DebugSwitches", debugSwitchesPtr_);
 }
 
 
-int debug::debugSwitch(const char* switchName, const int defaultValue)
+Foam::dictionary& Foam::debug::infoSwitches()
 {
-    return debugSwitch
-    (
-        debugSwitches(),
-        switchName,
-        defaultValue
-    );
+    return switchSet("InfoSwitches", infoSwitchesPtr_);
 }
 
 
-dictionary& debug::infoSwitches()
+Foam::dictionary& Foam::debug::optimisationSwitches()
 {
-    return switchSet("InfoSwitches", infoSwitchesPtr_);
+    return switchSet("OptimisationSwitches", optimisationSwitchesPtr_);
 }
 
 
-int debug::infoSwitch(const char* switchName, const int defaultValue)
+int Foam::debug::debugSwitch(const char* name, const int defaultValue)
 {
-    return debugSwitch
+    return debugSwitches().lookupOrAddDefault
     (
-        infoSwitches(),
-        switchName,
-        defaultValue
+        name, defaultValue, false, false
     );
 }
 
 
-dictionary& debug::optimisationSwitches()
+int Foam::debug::infoSwitch(const char* name, const int defaultValue)
 {
-    return switchSet("OptimisationSwitches", optimisationSwitchesPtr_);
+    return infoSwitches().lookupOrAddDefault
+    (
+        name, defaultValue, false, false
+    );
 }
 
 
-int debug::optimisationSwitch(const char* switchName, const int defaultValue)
+int Foam::debug::optimisationSwitch(const char* name, const int defaultValue)
 {
-    return debugSwitch
+    return optimisationSwitches().lookupOrAddDefault
     (
-        optimisationSwitches(),
-        switchName,
-        defaultValue
+        name, defaultValue, false, false
     );
 }
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace Foam
 
 // ************************************************************************* //
diff --git a/src/OpenFOAM/global/debug/debug.H b/src/OpenFOAM/global/debug/debug.H
index 8787f3397da1ec1851ed87eab3a15606bfde2cfa..9431a4f78b9933dfb03e90a6825a21925ec34804 100644
--- a/src/OpenFOAM/global/debug/debug.H
+++ b/src/OpenFOAM/global/debug/debug.H
@@ -41,44 +41,40 @@ SourceFiles
 namespace Foam
 {
 
+// Forward declaration of classes
 class dictionary;
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace debug
 {
+    //- The central control dictionary.
+    //  Located in ~/.OpenFOAM/VERSION or $WM_PROJECT_DIR/etc
+    //  @sa Foam::findEtcFile()
     dictionary& controlDict();
 
-
-    dictionary& switchSet(const char* switchSetName, dictionary* switchSetPtr);
-
-
+    //- The DebugSwitches sub-dictionary in the central controlDict.
     dictionary& debugSwitches();
 
-    int debugSwitch
-    (
-        const char* switchName,
-        const int defaultValue = 0
-    );
+    //- The InfoSwitches sub-dictionary in the central controlDict.
+    dictionary& infoSwitches();
 
+    //- The OptimisationSwitches sub-dictionary in the central controlDict.
+    dictionary& optimisationSwitches();
 
-    dictionary& infoSwitches();
+    //- Lookup debug switch or add default value.
+    int debugSwitch(const char* name, const int defaultValue=0);
 
-    int infoSwitch
-    (
-        const char* switchName,
-        const int defaultValue = 0
-    );
+    //- Lookup info switch or add default value.
+    int infoSwitch(const char* name, const int defaultValue=0);
 
+    //- Lookup optimisation switch or add default value.
+    int optimisationSwitch(const char* name, const int defaultValue=0);
 
-    dictionary& optimisationSwitches();
+    //- Internal function to lookup a sub-dictionary from controlDict.
+    dictionary& switchSet(const char* subDictName, dictionary*& subDictPtr);
 
-    int optimisationSwitch
-    (
-        const char* switchName,
-        const int defaultValue = 0
-    );
-}
+} // End namespace debug
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/global/global.C b/src/OpenFOAM/global/global.C
deleted file mode 100644
index 38f900ef4efa8ce214a9edbb801843a70f6231d0..0000000000000000000000000000000000000000
--- a/src/OpenFOAM/global/global.C
+++ /dev/null
@@ -1,78 +0,0 @@
-/*-------------------------------*- C++ -*-----------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by the
-    Free Software Foundation; either version 2 of the License, or (at your
-    option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Description
-    Define the globals used in the FOAM library.  It is important that these
-    are constructed in the appropriate order to avoid the use of unconstructed
-    data in the global namespace.
-
-    This file gets preprocessed by the Allwmake script to replace
-    PROJECT_VERSION with the appropriate version number string.
-
-\*---------------------------------------------------------------------------*/
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-#include "foamVersion.H"
-
-const char* const Foam::FOAMversion = "dev_2008-10-29-197-gc1bfee3";
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Setup an error handler for the global new operator
-
-#include "new.C"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Global IO streams
-
-#include "IOstreams.C"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#include "JobInfo.H"
-bool Foam::JobInfo::constructed = false;
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Global error definitions (initialised by construction)
-
-#include "messageStream.C"
-#include "error.C"
-#include "IOerror.C"
-#include "token.C"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Read the debug and info switches
-
-#include "debug.C"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Read and set cell models
-
-#include "globalCellModeller.C"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-// Create the jobInfo file in the $FOAM_JOB_DIR/runningJobs directory
-
-#include "JobInfo.C"
-
-// ************************************************************************* //
diff --git a/src/OpenFOAM/global/global_raw.C b/src/OpenFOAM/global/global.Cver
similarity index 80%
rename from src/OpenFOAM/global/global_raw.C
rename to src/OpenFOAM/global/global.Cver
index 29c67cf3e0b02cde9e0870b1b27df1d8cbb76d93..5f409deeba4be720d30c0713fd5e3b52d90c52fc 100644
--- a/src/OpenFOAM/global/global_raw.C
+++ b/src/OpenFOAM/global/global.Cver
@@ -23,19 +23,24 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Description
-    Define the globals used in the FOAM library.  It is important that these
-    are constructed in the appropriate order to avoid the use of unconstructed
-    data in the global namespace.
+    Define the globals used in the OpenFOAM library.
+    It is important that these are constructed in the appropriate order to
+    avoid the use of unconstructed data in the global namespace.
 
-    This file gets preprocessed by the Allwmake script to replace
-    PROJECT_VERSION with the appropriate version number string.
+    This file has the extension .Cver to trigger a Makefile rule that converts
+    WM_PROJECT_VERSION into the appropriate version string.
 
 \*---------------------------------------------------------------------------*/
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 #include "foamVersion.H"
 
-const char* const Foam::FOAMversion = WM_PROJECT_VERSION;
+const char* const Foam::FOAMversion = "WM_PROJECT_VERSION";
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// Static initializers for string::null, word::null and fileName::null
+
+#include "stringsGlobals.C"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 // Setup an error handler for the global new operator
@@ -50,7 +55,7 @@ const char* const Foam::FOAMversion = WM_PROJECT_VERSION;
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #include "JobInfo.H"
-bool Foam::JobInfo::constructed = false;
+bool Foam::JobInfo::constructed(false);
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 // Global error definitions (initialised by construction)
diff --git a/src/OpenFOAM/include/OSspecific.H b/src/OpenFOAM/include/OSspecific.H
index 9bfb08b0692450efcd19d9cdbeb61b0940b1aa82..169620865ec08bdfac2e208058a67f24e535eabc 100644
--- a/src/OpenFOAM/include/OSspecific.H
+++ b/src/OpenFOAM/include/OSspecific.H
@@ -102,7 +102,8 @@ bool chDir(const fileName& dir);
 //    - $WM_PROJECT_DIR/etc/
 //
 //  @return the full path name or fileName::null if the name cannot be found
-fileName dotFoam(const fileName& name);
+//  Optionally abort if the file cannot be found
+fileName findEtcFile(const fileName& name, bool mandatory=false);
 
 //- Make a directory and return an error if it could not be created
 //  and does not already exist
diff --git a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.C b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.C
index 0fadb614bb2df69591b306503ec79e874bdf5e3b..e545798895a2bca973b9425f3300b3283608438f 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellModel/cellModel.C
@@ -27,14 +27,9 @@ License
 #include "cellModel.H"
 #include "pyramid.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-vector cellModel::centre
+Foam::vector Foam::cellModel::centre
 (
     const labelList& pointLabels,
     const pointField& points
@@ -91,7 +86,7 @@ vector cellModel::centre
 }
 
 
-scalar cellModel::mag
+Foam::scalar Foam::cellModel::mag
 (
     const labelList& pointLabels,
     const pointField& points
@@ -143,9 +138,4 @@ scalar cellModel::mag
     return v;
 }
 
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/OpenFOAM/meshes/meshShapes/cellModeller/cellModeller.C b/src/OpenFOAM/meshes/meshShapes/cellModeller/cellModeller.C
index a2656f838433e68bf5feb520d980327801708b56..7d69b5238c8160f72bb66d98e45d9b12d3024b41 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellModeller/cellModeller.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellModeller/cellModeller.C
@@ -29,12 +29,58 @@ Description
 
 #include "cellModeller.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-namespace Foam
+Foam::cellModeller::cellModeller()
 {
+    if (modelPtrs_.size())
+    {
+        FatalErrorIn("cellModeller::cellModeller(const fileName&)")
+            << "attempt to re-construct cellModeller when it already exists"
+            << exit(FatalError);
+    }
+
+    label maxIndex = 0;
+    forAll(models_, i)
+    {
+        if (models_[i].index() > maxIndex) maxIndex = models_[i].index();
+    }
+
+    modelPtrs_.setSize(maxIndex + 1);
+    modelPtrs_ = NULL;
 
-cellModeller::~cellModeller()
+    // For all the words in the wordlist, set the details of the model
+    // to those specified by the word name and the other parameters
+    // given. This should result in an automatic 'read' of the model
+    // from its File (see cellModel class).
+    forAll(models_, i)
+    {
+        if (modelPtrs_[models_[i].index()])
+        {
+            FatalErrorIn("cellModeller::cellModeller(const fileName&)")
+                << "more than one model share the index "
+                << models_[i].index()
+                << exit(FatalError);
+        }
+
+        modelPtrs_[models_[i].index()] = &models_[i];
+
+        if (modelDictionary_.found(models_[i].name()))
+        {
+            FatalErrorIn("cellModeller::cellModeller(const fileName&)")
+                << "more than one model share the name "
+                << models_[i].name()
+                << exit(FatalError);
+        }
+
+        modelDictionary_.insert(models_[i].name(), &models_[i]);
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::cellModeller::~cellModeller()
 {}
 
 
@@ -43,9 +89,9 @@ cellModeller::~cellModeller()
 // Returns a pointer to a model which matches the string symbol
 // supplied. A null pointer is returned if there is no suitable match.
 
-const cellModel* cellModeller::lookup(const word& symbol)
+const Foam::cellModel* Foam::cellModeller::lookup(const word& name)
 {
-    HashTable<const cellModel*>::iterator iter = modelDictionary_.find(symbol);
+    HashTable<const cellModel*>::iterator iter = modelDictionary_.find(name);
 
     if (iter != modelDictionary_.end())
     {
@@ -57,9 +103,7 @@ const cellModel* cellModeller::lookup(const word& symbol)
     }
 }
 
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace Foam
 
 // ************************************************************************* //
diff --git a/src/OpenFOAM/meshes/meshShapes/cellModeller/cellModeller.H b/src/OpenFOAM/meshes/meshShapes/cellModeller/cellModeller.H
index 4f6f2ee70f679976bd23d599a8fde26f23ea0bb7..11e642d2d4d7df78b519a12ff00ad07efcf3100c 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellModeller/cellModeller.H
+++ b/src/OpenFOAM/meshes/meshShapes/cellModeller/cellModeller.H
@@ -48,7 +48,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class cellModeller Declaration
+                        Class cellModeller Declaration
 \*---------------------------------------------------------------------------*/
 
 class cellModeller
@@ -69,10 +69,9 @@ public:
 
     // Constructors
 
-        //- Construct given file name
+        //- Construct from central "cellModels" file
         cellModeller();
 
-
     // Destructor
 
         ~cellModeller();
@@ -80,12 +79,10 @@ public:
 
     // Member functions
 
-        //- Look up a model given name and return ptr to model if good
-        //  else zero
+        //- Look up a model by name and return a pointer to the model or NULL
         static const cellModel* lookup(const word&);
 
-        //- Look up a model given label and return ptr to model if good
-        //  else zero
+        //- Look up a model by index and return a pointer to the model or NULL
         static const cellModel* lookup(const label i)
         {
             return modelPtrs_[i];
diff --git a/src/OpenFOAM/meshes/meshShapes/cellModeller/cellModellerIO.C b/src/OpenFOAM/meshes/meshShapes/cellModeller/cellModellerIO.C
deleted file mode 100644
index ef3eb17df26f7637d860b1ace079f61aafe5f08c..0000000000000000000000000000000000000000
--- a/src/OpenFOAM/meshes/meshShapes/cellModeller/cellModellerIO.C
+++ /dev/null
@@ -1,91 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by the
-    Free Software Foundation; either version 2 of the License, or (at your
-    option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Description
-    Reads the data portion of a model catalogue File.
-
-\*---------------------------------------------------------------------------*/
-
-#include "cellModeller.H"
-#include "dictionary.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-cellModeller::cellModeller()
-{
-    if (modelPtrs_.size())
-    {
-        FatalErrorIn("cellModeller::cellModeller(const fileName&)")
-            << "attempt to re-construct cellModeller when it already exists"
-            << exit(FatalError);
-    }
-
-    label maxIndex = 0;
-    forAll(models_, i)
-    {
-        if (models_[i].index() > maxIndex) maxIndex = models_[i].index();
-    }
-
-    modelPtrs_.setSize(maxIndex + 1);
-    modelPtrs_ = NULL;
-
-    // For all the words in the wordlist, set the details of the model
-    // to those specified by the word name and the other parameters
-    // given. This should result in an automatic 'read' of the model
-    // from its File (see cellModel class).
-    forAll(models_, i)
-    {
-        if (modelPtrs_[models_[i].index()])
-        {
-            FatalErrorIn("cellModeller::cellModeller(const fileName&)")
-                << "more than one model share the index "
-                << models_[i].index()
-                << exit(FatalError);
-        }
-
-        modelPtrs_[models_[i].index()] = &models_[i];
-
-        if (modelDictionary_.found(models_[i].name()))
-        {
-            FatalErrorIn("cellModeller::cellModeller(const fileName&)")
-                << "more than one model share the name "
-                << models_[i].name()
-                << exit(FatalError);
-        }
-
-        modelDictionary_.insert(models_[i].name(), &models_[i]);
-    }
-}
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// ************************************************************************* //
diff --git a/src/OpenFOAM/meshes/meshShapes/cellModeller/globalCellModeller.C b/src/OpenFOAM/meshes/meshShapes/cellModeller/globalCellModeller.C
index 54e73f855b5fa593094d104ebeb93de9fa485bf7..7f5b6274513c714f46229cb6a606bf7c2f009a33 100644
--- a/src/OpenFOAM/meshes/meshShapes/cellModeller/globalCellModeller.C
+++ b/src/OpenFOAM/meshes/meshShapes/cellModeller/globalCellModeller.C
@@ -23,6 +23,7 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Description
+    cellModeller global initializations
 
 \*---------------------------------------------------------------------------*/
 
@@ -30,24 +31,25 @@ Description
 #include "OSspecific.H"
 #include "IFstream.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * Static data * * * * * * * * * * * * * * * * //
 
+
 // PtrList of models
-PtrList<cellModel> cellModeller::models_
+Foam::PtrList<Foam::cellModel> Foam::cellModeller::models_
 (
-    (IFstream(dotFoam("cellModels"))())
+    IFstream(findEtcFile("cellModels", true))()
 );
 
 // List of model pointers
-List<cellModel*> cellModeller::modelPtrs_;
+Foam::List<Foam::cellModel*> Foam::cellModeller::modelPtrs_;
 
 // HashTable of model pointers
-HashTable<const cellModel*> cellModeller::modelDictionary_;
+Foam::HashTable<const Foam::cellModel*> Foam::cellModeller::modelDictionary_;
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
 
 // Construct a dummy cellModeller which reads the models and fills
 // the above tables
diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C
index 8fdee370a05e9b06c5b7a8b1b67503ee4cb72063..0650dcc87978e069a19474db29a945a208c33e30 100644
--- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C
+++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C
@@ -393,12 +393,11 @@ void Foam::globalMeshData::calcSharedEdges() const
             }
         }
     }
-    dynSharedEdgeLabels.shrink();
+
     sharedEdgeLabelsPtr_ = new labelList();
     labelList& sharedEdgeLabels = *sharedEdgeLabelsPtr_;
     sharedEdgeLabels.transfer(dynSharedEdgeLabels);
 
-    dynSharedEdgeAddr.shrink();
     sharedEdgeAddrPtr_ = new labelList();
     labelList& sharedEdgeAddr = *sharedEdgeAddrPtr_;
     sharedEdgeAddr.transfer(dynSharedEdgeAddr);
diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C
index 6cf680ca70f3ebc4765aca9af3418d4dcc7cef15..93382ec2a43e5b4cd6f1741207ef01c5c9f790c9 100644
--- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C
+++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C
@@ -467,10 +467,8 @@ void Foam::globalPoints::remove(const Map<label>& directNeighbours)
     Map<label> oldMeshToProcPoint(meshToProcPoint_);
     meshToProcPoint_.clear();
 
-    procPoints_.shrink();
     List<procPointList> oldProcPoints;
     oldProcPoints.transfer(procPoints_);
-    procPoints_.clear();
 
     // Go through all equivalences
     for
@@ -535,7 +533,7 @@ void Foam::globalPoints::remove(const Map<label>& directNeighbours)
         {
             // This happens for 'wedge' like cyclics where the two halves
             // come together in the same point so share the same meshPoint.
-            // So this meshPoint will have info of size one only. 
+            // So this meshPoint will have info of size one only.
             if
             (
                 pointInfo[0][0] != Pstream::myProcNo()
@@ -968,7 +966,7 @@ Foam::globalPoints::globalPoints(const polyMesh& mesh)
     //        Pout<< "    pointI:" << meshPointI << ' '
     //            << mesh.points()[meshPointI]
     //            << " connected to proc " << pointInfo[i][0]
-    //            << " point:" << pointInfo[i][1] 
+    //            << " point:" << pointInfo[i][1]
     //        << endl;
     //    }
     //}
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C
index 19418a23114dcf02aa3c7c1e56b29de242a5afc2..a004cfa8e279d85344ea9efd17608f77ceb16c98 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C
@@ -64,7 +64,7 @@ Foam::labelListList Foam::polyMesh::cellShapePointCells
 
     forAll (pc, pointI)
     {
-        pointCellAddr[pointI].transfer(pc[pointI].shrink());
+        pointCellAddr[pointI].transfer(pc[pointI]);
     }
 
     return pointCellAddr;
diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C
index 825af4cb706757fe69614ceeb264cd00208e164d..36ebdc8324e675d9010efe379256ad59b7140d11 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C
+++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchAddressing.C
@@ -298,7 +298,7 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::calcAddressing()
 
     forAll (faceFaces, faceI)
     {
-        faceFaces[faceI].transfer(ff[faceI].shrink());
+        faceFaces[faceI].transfer(ff[faceI]);
     }
 
 
diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchEdgeLoops.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchEdgeLoops.C
index 0f2d45ebf2bc15a902507c834869f1dcbf919010..f9a74e01990ca32d4977a5f1ff1426bde840b0f3 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchEdgeLoops.C
+++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchEdgeLoops.C
@@ -151,8 +151,6 @@ void PrimitivePatch<Face, FaceList, PointField, PointType>::calcEdgeLoops()
         while (currentEdgeI != -1);
 
         // Done all for current loop. Transfer to edgeLoops.
-        loop.shrink();
-
         edgeLoops[loopI].transfer(loop);
 
         loopI++;
diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellEdges.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellEdges.C
index 47d6343f16e42639aa8f5bd9c1f277d73f773e13..d12cf2ca5da134e725ad44ea7c6935f49738a607 100644
--- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellEdges.C
+++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellEdges.C
@@ -108,7 +108,7 @@ void Foam::primitiveMesh::calcCellEdges() const
         // reset the size
         forAll (ce, cellI)
         {
-            cellEdgeAddr[cellI].transfer(ce[cellI].shrink());
+            cellEdgeAddr[cellI].transfer(ce[cellI]);
         }
     }
 }
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.C b/src/OpenFOAM/primitives/strings/fileName/fileName.C
index 5eeadf96335f968368424c71b657d6f6f4e5d724..ac63f914267d361e951b507c6e6d4cc98de90cc4 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileName.C
+++ b/src/OpenFOAM/primitives/strings/fileName/fileName.C
@@ -33,7 +33,6 @@ License
 
 const char* const Foam::fileName::typeName = "fileName";
 int Foam::fileName::debug(debug::debugSwitch(fileName::typeName, 0));
-const Foam::fileName Foam::fileName::null;
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/primitives/strings/keyType/keyType.H b/src/OpenFOAM/primitives/strings/keyType/keyType.H
index 4d4c358d5d172f3cb831884246d9411872d0721c..6525a5404c8e119a0e1b3200378ff3baf07417b5 100644
--- a/src/OpenFOAM/primitives/strings/keyType/keyType.H
+++ b/src/OpenFOAM/primitives/strings/keyType/keyType.H
@@ -28,8 +28,8 @@ Class
 Description
     A class for handling keywords in dictionaries.
 
-    A keyType is the keyword of a dictionary. It differs from word in that
-    it accepts wildcards.
+    A keyType is the keyword of a dictionary.
+    It differs from word in that it accepts patterns (regular expressions).
 
 SourceFiles
     keyType.C
@@ -53,7 +53,7 @@ class Ostream;
 
 
 /*---------------------------------------------------------------------------*\
-                           Class keyType Declaration
+                          Class keyType Declaration
 \*---------------------------------------------------------------------------*/
 
 class keyType
@@ -62,7 +62,8 @@ class keyType
 {
     // Private member data
 
-        bool isWildCard_;
+        //- Is the keyType a pattern (regular expression)
+        bool isPattern_;
 
     // Private Member Functions
 
@@ -78,22 +79,22 @@ public:
         inline keyType();
 
         //- Construct as copy
-        inline keyType(const keyType& s);
+        inline keyType(const keyType&);
 
         //- Construct as copy of word
-        inline keyType(const word& s);
+        inline keyType(const word&);
 
         //- Construct as copy of string. Expect it to be regular expression.
-        inline keyType(const string& s);
+        inline keyType(const string&);
 
         //- Construct as copy of character array
-        inline keyType(const char* s);
+        inline keyType(const char*);
 
         //- Construct as copy of std::string
-        inline keyType(const std::string& s, const bool isWildCard);
+        inline keyType(const std::string&, const bool isPattern);
 
         //- Construct from Istream
-        keyType(Istream& is);
+        keyType(Istream&);
 
 
     // Member functions
@@ -101,29 +102,25 @@ public:
         //- Is this character valid for a keyType
         inline static bool valid(char c);
 
-        //- Is the type a wildcard?
-        inline bool isWildCard() const;
-
+        //- Should be treated as a match rather than a literal string
+        inline bool isPattern() const;
 
     // Member operators
 
         // Assignment
 
-            inline void operator=(const keyType& s);
+            inline void operator=(const keyType&);
+            inline void operator=(const word&);
 
             //- Assign from regular expression.
-            inline void operator=(const string& s);
-
-            inline void operator=(const word& s);
-
+            inline void operator=(const string&);
             inline void operator=(const char*);
 
 
     // IOstream operators
 
-        friend Istream& operator>>(Istream& is, keyType& w);
-
-        friend Ostream& operator<<(Ostream& os, const keyType& w);
+        friend Istream& operator>>(Istream&, keyType&);
+        friend Ostream& operator<<(Ostream&, const keyType&);
 };
 
 
diff --git a/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H b/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H
index f3785ebbffe68b68d0093a79cc55f7e70d2e47c8..d76205d795776d624c94367e01c7db76f8babc77 100644
--- a/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H
+++ b/src/OpenFOAM/primitives/strings/keyType/keyTypeI.H
@@ -30,43 +30,40 @@ License
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-//- Construct null
 inline Foam::keyType::keyType()
 :
     word(),
-    isWildCard_(false)
+    isPattern_(false)
 {}
 
 
-//- Construct as copy
 inline Foam::keyType::keyType(const keyType& s)
 :
     word(s, false),
-    isWildCard_(s.isWildCard())
+    isPattern_(s.isPattern())
 {}
 
 
-//- Construct as copy of word
 inline Foam::keyType::keyType(const word& s)
 :
     word(s, false),
-    isWildCard_(false)
+    isPattern_(false)
 {}
 
 
-//- Construct as copy of string. Expect it to be regular expression
+// Construct as copy of string. Expect it to be regular expression
 inline Foam::keyType::keyType(const string& s)
 :
     word(s, false),
-    isWildCard_(true)
+    isPattern_(true)
 {}
 
 
-//- Construct as copy of character array
+// Construct as copy of character array
 inline Foam::keyType::keyType(const char* s)
 :
     word(s, false),
-    isWildCard_(false)
+    isPattern_(false)
 {}
 
 
@@ -74,11 +71,11 @@ inline Foam::keyType::keyType(const char* s)
 inline Foam::keyType::keyType
 (
     const std::string& s,
-    const bool isWildCard
+    const bool isPattern
 )
 :
     word(s, false),
-    isWildCard_(isWildCard)
+    isPattern_(isPattern)
 {}
 
 
@@ -90,9 +87,9 @@ inline bool Foam::keyType::valid(char c)
 }
 
 
-bool Foam::keyType::isWildCard() const
+bool Foam::keyType::isPattern() const
 {
-    return isWildCard_;
+    return isPattern_;
 }
 
 
@@ -102,14 +99,14 @@ inline void Foam::keyType::operator=(const keyType& s)
 {
     // Bypass checking
     string::operator=(s);
-    isWildCard_ = s.isWildCard();
+    isPattern_ = s.isPattern_;
 }
 
 
 inline void Foam::keyType::operator=(const word& s)
 {
     word::operator=(s);
-    isWildCard_ = false;
+    isPattern_ = false;
 }
 
 
@@ -117,7 +114,7 @@ inline void Foam::keyType::operator=(const string& s)
 {
     // Bypass checking
     string::operator=(s);
-    isWildCard_ = true;
+    isPattern_ = true;
 }
 
 
@@ -125,7 +122,7 @@ inline void Foam::keyType::operator=(const char* s)
 {
     // Bypass checking
     string::operator=(s);
-    isWildCard_ = false;
+    isPattern_ = false;
 }
 
 
diff --git a/src/OpenFOAM/primitives/strings/string/string.C b/src/OpenFOAM/primitives/strings/string/string.C
index b3c218eacd1b2cef3586c4de36d7b4a1045e8f58..268a4fb2dcc5c9e2f57426c14ba1afa7117790ad 100644
--- a/src/OpenFOAM/primitives/strings/string/string.C
+++ b/src/OpenFOAM/primitives/strings/string/string.C
@@ -32,7 +32,6 @@ License
 
 const char* const Foam::string::typeName = "string";
 int Foam::string::debug(debug::debugSwitch(string::typeName, 0));
-const Foam::string Foam::string::null;
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
@@ -202,7 +201,7 @@ Foam::string& Foam::string::expand()
             // otherwise add extra test
             if (user == "OpenFOAM")
             {
-                *this = dotFoam(file);
+                *this = findEtcFile(file);
             }
             else
             {
diff --git a/src/OpenFOAM/primitives/strings/string/string.H b/src/OpenFOAM/primitives/strings/string/string.H
index 82cc904ef48f3fb01d87d8bcdbea4d238c0fb5d6..13e996b5110aa98f2a1f1c0190e202118397ba4e 100644
--- a/src/OpenFOAM/primitives/strings/string/string.H
+++ b/src/OpenFOAM/primitives/strings/string/string.H
@@ -34,7 +34,7 @@ Description
     Used as a base class for word and fileName.
 
 See Also
-    Foam::dotFoam() for information about the site/user OpenFOAM
+    Foam::findEtcFile() for information about the site/user OpenFOAM
     configuration directory
 
 SourceFiles
@@ -176,7 +176,7 @@ public:
             //     - leading "~OpenFOAM" : site/user OpenFOAM configuration directory
             //
             //  @sa
-            //  Foam::dotFoam
+            //  Foam::findEtcFile
             string& expand();
 
             //- Remove repeated characters returning true if string changed
diff --git a/applications/test/hmm/dictionaryTest.C b/src/OpenFOAM/primitives/strings/stringsGlobals.C
similarity index 75%
rename from applications/test/hmm/dictionaryTest.C
rename to src/OpenFOAM/primitives/strings/stringsGlobals.C
index a57a16e552f533f34457e90d9906eff91c3909e6..c81a032ee9b0c1a4f01bc3611ed9f2c55a516cc6 100644
--- a/applications/test/hmm/dictionaryTest.C
+++ b/src/OpenFOAM/primitives/strings/stringsGlobals.C
@@ -22,30 +22,24 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Application
-    
 Description
+    Static initializers for
+        Foam::string::null
+        Foam::word::null
+        Foam::fileName::null.
+    This file is included in global.Cver since these members are required by
+    debug.C.
 
 \*---------------------------------------------------------------------------*/
 
-#include "IOstreams.H"
-#include "IFstream.H"
-#include "dictionary.H"
+#include "string.H"
+#include "word.H"
+#include "fileName.H"
 
-using namespace Foam;
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-//  Main program:
-
-int main(int argc, char *argv[])
-{
-    IFstream dictStream("testDict");
-    dictionary testDict(dictStream);
-
-    Info<< testDict << endl;
-
-    return 0;
-}
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
+const Foam::string Foam::string::null;
+const Foam::word Foam::word::null;
+const Foam::fileName Foam::fileName::null;
 
 // ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/word/word.C b/src/OpenFOAM/primitives/strings/word/word.C
index 6cb36b1af295834a83e70273636502ebaa65ee24..84415533016879598a5ada76ffa6f6b3eca24b59 100644
--- a/src/OpenFOAM/primitives/strings/word/word.C
+++ b/src/OpenFOAM/primitives/strings/word/word.C
@@ -31,6 +31,5 @@ License
 
 const char* const Foam::word::typeName = "word";
 int Foam::word::debug(Foam::debug::debugSwitch(word::typeName, 0));
-const Foam::word Foam::word::null;
 
 // ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/word/word.H b/src/OpenFOAM/primitives/strings/word/word.H
index 6565c28b4f8ede3a084ac9c56fc67513e8ac6052..96d2c73cfb864fc6349e50e2577b29a363f35210 100644
--- a/src/OpenFOAM/primitives/strings/word/word.H
+++ b/src/OpenFOAM/primitives/strings/word/word.H
@@ -87,7 +87,7 @@ public:
         inline word(const word&);
 
         //- Construct as copy of character array
-        inline word(const char*, const bool doStripInvalid = true);
+        inline word(const char*, const bool doStripInvalid=true);
 
         //- Construct as copy with a maximum number of characters
         inline word
@@ -98,10 +98,10 @@ public:
         );
 
         //- Construct as copy of string
-        inline word(const string&, const bool doStripInvalid = true);
+        inline word(const string&, const bool doStripInvalid=true);
 
         //- Construct as copy of std::string
-        inline word(const std::string&, const bool doStripInvalid = true);
+        inline word(const std::string&, const bool doStripInvalid=true);
 
         //- Construct from Istream
         word(Istream&);
diff --git a/src/OpenFOAM/primitives/uint/uintIO.C b/src/OpenFOAM/primitives/uint/uintIO.C
index 26b64224f76f5c9aa6a75b215207d20a17efef74..a40d4b7f5f931bb5cac79f070dc539be89417a03 100644
--- a/src/OpenFOAM/primitives/uint/uintIO.C
+++ b/src/OpenFOAM/primitives/uint/uintIO.C
@@ -44,7 +44,6 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-// Return a string representation of an uint
 word name(const unsigned int i)
 {
     std::ostringstream osBuffer;
@@ -66,7 +65,7 @@ Istream& operator>>(Istream& is, unsigned int& i)
 
     if (t.isLabel())
     {
-        i = uint(t.labelToken());
+        i = unsigned(t.labelToken());
     }
     else
     {
diff --git a/src/Pstream/Allwmake b/src/Pstream/Allwmake
index 25886fbfaca1614b56d2ef07de7f5570aaac3205..f43c2b1a30a3f05be9019deb965bf619c95f203e 100755
--- a/src/Pstream/Allwmake
+++ b/src/Pstream/Allwmake
@@ -5,7 +5,11 @@ set -x
 wmake libso dummy
 
 case "$WM_MPLIB" in
-LAM | OPENMPI | MPI | MPICH | MPICH-GM | HPMPI )
+GAMMA)
+   wmake libso gamma
+   ;;
+
+LAM | *MPI* )
    export WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB
    set +x
    echo
@@ -13,10 +17,6 @@ LAM | OPENMPI | MPI | MPICH | MPICH-GM | HPMPI )
    set -x
    wmake libso mpi
    ;;
-
-GAMMA)
-   wmake libso gamma
-   ;;
 esac
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
index 6d98bdfebc0701197152ed8094d5df595572a4d5..8b3e527d37d2a1aae45681b4d5e9b06fed051f8e 100644
--- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
+++ b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
@@ -546,7 +546,7 @@ void Foam::meshRefinement::calcLocalRegions
             }
         }
     }
-    localCc.shrink();
+
     localPoints.transfer(localCc);
 
     if (localPoints.size() != globalToLocalRegion.size())
diff --git a/src/conversion/polyDualMesh/polyDualMesh.C b/src/conversion/polyDualMesh/polyDualMesh.C
index 9b310d2bf4843589658fc4f61e76fcb7861a2dac..73ca981f98a8f58b85b3c650af77a7a84d8868bf 100644
--- a/src/conversion/polyDualMesh/polyDualMesh.C
+++ b/src/conversion/polyDualMesh/polyDualMesh.C
@@ -412,11 +412,9 @@ void Foam::polyDualMesh::collectPatchInternalFace
         }
     }
 
-    dualFace2.transfer(dualFace.shrink());
-    dualFace.clear();
+    dualFace2.transfer(dualFace);
 
-    featEdgeIndices2.transfer(featEdgeIndices.shrink());
-    featEdgeIndices.clear();
+    featEdgeIndices2.transfer(featEdgeIndices);
 
     if (reverseFace)
     {
@@ -1590,8 +1588,7 @@ void Foam::polyDualMesh::calcFeatures
             allFeaturePoints.append(allBoundary.meshPoints()[pointI]);
         }
     }
-    featurePoints.transfer(allFeaturePoints.shrink());
-    allFeaturePoints.clear();
+    featurePoints.transfer(allFeaturePoints);
 
     if (debug)
     {
@@ -1633,8 +1630,7 @@ void Foam::polyDualMesh::calcFeatures
             allFeatureEdges.append(meshEdges[edgeI]);
         }
     }
-    featureEdges.transfer(allFeatureEdges.shrink());
-    allFeatureEdges.clear();
+    featureEdges.transfer(allFeatureEdges);
 }
 
 
diff --git a/src/decompositionAgglomeration/decompositionMethods/decompositionMethod/decompositionMethod.C b/src/decompositionAgglomeration/decompositionMethods/decompositionMethod/decompositionMethod.C
index 071a63affc0641b003f16673c745696141ce1a75..f2b929c6567ffef4b8e57f489657d8b03785c2ef 100644
--- a/src/decompositionAgglomeration/decompositionMethods/decompositionMethod/decompositionMethod.C
+++ b/src/decompositionAgglomeration/decompositionMethods/decompositionMethod/decompositionMethod.C
@@ -165,8 +165,7 @@ void Foam::decompositionMethod::calcCellCells
     cellCells.setSize(dynCellCells.size());
     forAll(dynCellCells, coarseI)
     {
-        cellCells[coarseI].transfer(dynCellCells[coarseI].shrink());
-        dynCellCells[coarseI].clear();
+        cellCells[coarseI].transfer(dynCellCells[coarseI]);
     }
 }
 
diff --git a/src/decompositionAgglomeration/parMetisDecomp/parMetisDecomp.C b/src/decompositionAgglomeration/parMetisDecomp/parMetisDecomp.C
index 8b3092f08f6ea860ca0133b9acd49009ce7cab3a..0df751b6ded31c1f900f6fe509314f0d8c31545e 100644
--- a/src/decompositionAgglomeration/parMetisDecomp/parMetisDecomp.C
+++ b/src/decompositionAgglomeration/parMetisDecomp/parMetisDecomp.C
@@ -794,8 +794,7 @@ Foam::labelList Foam::parMetisDecomp::decompose
         globalRegionRegions.setSize(dynRegionRegions.size());
         forAll(dynRegionRegions, i)
         {
-            globalRegionRegions[i].transfer(dynRegionRegions[i].shrink());
-            dynRegionRegions[i].clear();
+            globalRegionRegions[i].transfer(dynRegionRegions[i]);
         }
     }
 
@@ -859,7 +858,7 @@ Foam::labelList Foam::parMetisDecomp::decompose
     // Check for user supplied weights and decomp options
     if (decompositionDict_.found("metisCoeffs"))
     {
-        const dictionary& metisCoeffs = 
+        const dictionary& metisCoeffs =
             decompositionDict_.subDict("metisCoeffs");
         word weightsFile;
 
diff --git a/src/dynamicMesh/boundaryMesh/boundaryMesh.C b/src/dynamicMesh/boundaryMesh/boundaryMesh.C
index 76201ff987c91e29e48f6b5710a3fb1c398ad849..817317a62e7483417b8caa231a4dc1565a0564be 100644
--- a/src/dynamicMesh/boundaryMesh/boundaryMesh.C
+++ b/src/dynamicMesh/boundaryMesh/boundaryMesh.C
@@ -1503,17 +1503,13 @@ void Foam::boundaryMesh::setExtraEdges(const label edgeI)
 {
     labelList minDistance(mesh().nEdges(), -1);
 
-   // All edge labels encountered
-
+    // All edge labels encountered
     DynamicList<label> visitedEdges;
 
     // Floodfill from edgeI starting from distance 0. Stop at distance.
     markEdges(8, edgeI, 0, minDistance, visitedEdges);
 
-    visitedEdges.shrink();
-
     // Set edge labels to display
-    //? Allowed to transfer from DynamicList to List
     extraEdges_.transfer(visitedEdges);
 }
 
diff --git a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C
index 39be5d1d2f375aaa7cfcafa5c584edbdffbd1ed3..2a6630333f59b6248c8fb802aef10ad241f99e4b 100644
--- a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C
+++ b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C
@@ -787,9 +787,6 @@ bool Foam::topoCellLooper::cut
             }
             else
             {
-                localLoop.shrink();
-                localLoopWeights.shrink();
-
                 loop.transfer(localLoop);
                 loopWeights.transfer(localLoopWeights);
 
@@ -799,17 +796,16 @@ bool Foam::topoCellLooper::cut
         else
         {
             // Let parent handle poly case.
-            return
-                hexCellLooper::cut
-                (
-                    refDir,
-                    cellI,
-                    vertIsCut,
-                    edgeIsCut,
-                    edgeWeight,
-                    loop,
-                    loopWeights
-                );
+            return hexCellLooper::cut
+            (
+                refDir,
+                cellI,
+                vertIsCut,
+                edgeIsCut,
+                edgeWeight,
+                loop,
+                loopWeights
+            );
         }
     }
 }
diff --git a/src/dynamicMesh/meshCut/meshModifiers/boundaryCutter/boundaryCutter.C b/src/dynamicMesh/meshCut/meshModifiers/boundaryCutter/boundaryCutter.C
index 391b513758e9cdcbfe63db653040af07e92bfda9..34912f8c27cee49cb097f55d9d7db45541a1a02d 100644
--- a/src/dynamicMesh/meshCut/meshModifiers/boundaryCutter/boundaryCutter.C
+++ b/src/dynamicMesh/meshCut/meshModifiers/boundaryCutter/boundaryCutter.C
@@ -131,11 +131,8 @@ Foam::face Foam::boundaryCutter::addEdgeCutsToFace
         }
     }
 
-    newFace.shrink();
-
     face returnFace;
     returnFace.transfer(newFace);
-    newFace.clear();
 
     if (debug)
     {
@@ -361,9 +358,7 @@ bool Foam::boundaryCutter::splitFace
             {
                 // Enough vertices to create a face from.
                 face tmpFace;
-                newFace.shrink();
                 tmpFace.transfer(newFace);
-                newFace.clear();
 
                 // Add face tmpFace
                 addFace(faceI, tmpFace, modifiedFace, meshMod);
@@ -381,9 +376,7 @@ bool Foam::boundaryCutter::splitFace
         {
             // Enough vertices to create a face from.
             face tmpFace;
-            newFace.shrink();
             tmpFace.transfer(newFace);
-            newFace.clear();
 
             // Add face tmpFace
             addFace(faceI, tmpFace, modifiedFace, meshMod);
diff --git a/src/dynamicMesh/meshCut/wallLayerCells/wallLayerCells.C b/src/dynamicMesh/meshCut/wallLayerCells/wallLayerCells.C
index 9632618c8a60b577e6d4ba0b2c22d729550d0c6c..c46266496f5c19a18dc21d6981744faf0039201d 100644
--- a/src/dynamicMesh/meshCut/wallLayerCells/wallLayerCells.C
+++ b/src/dynamicMesh/meshCut/wallLayerCells/wallLayerCells.C
@@ -222,8 +222,6 @@ Foam::wallLayerCells::wallLayerCells
         }
     }
 
-    refineCells.shrink();
-
     // Transfer refineCells storage to this.
     transfer(refineCells);
 }
diff --git a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C
index b7edb38f2bb8af1b0eb0e925b562290f92fdaf16..b59d97f19db59665e481d69bb2228317d9e6294e 100644
--- a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C
+++ b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C
@@ -489,7 +489,6 @@ void Foam::polyMeshAdder::insertVertices
 
     if (workFace.size() != allF.size())
     {
-        workFace.shrink();
         allF.transfer(workFace);
     }
 }
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C
index 8b510a706467c081c0f56f4f90feab541a151181..4a9ebbaf7d3e9d6faed74c7362e7532890bbe5c1 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C
@@ -1079,8 +1079,7 @@ Foam::label Foam::hexRef8::storeMidPointInfo
         }
 
         face newFace;
-        newFace.transfer(newFaceVerts.shrink());
-        newFaceVerts.clear();
+        newFace.transfer(newFaceVerts);
 
         label anchorCell0 = getAnchorCell
         (
@@ -3687,8 +3686,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
                     );
 
                     // Convert dynamiclist to face.
-                    newFace.transfer(faceVerts.shrink());
-                    faceVerts.clear();
+                    newFace.transfer(faceVerts);
 
                     //Pout<< "Split face:" << faceI << " verts:" << f
                     //    << " into quad:" << newFace << endl;
@@ -3811,8 +3809,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
                     }
 
                     face newFace;
-                    newFace.transfer(newFaceVerts.shrink());
-
+                    newFace.transfer(newFaceVerts);
 
                     // The point with the lowest level should be an anchor
                     // point of the neighbouring cells.
@@ -3993,10 +3990,8 @@ Foam::labelListList Foam::hexRef8::setRefinement
         }
     }
 
-    pointLevel_.transfer(newPointLevel.shrink());
-    newPointLevel.clear();
-    cellLevel_.transfer(newCellLevel.shrink());
-    newCellLevel.clear();
+    pointLevel_.transfer(newPointLevel);
+    cellLevel_.transfer(newCellLevel);
 
     // Mark files as changed
     setInstance(mesh_.facesInstance());
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C
index 6ed3f0c14f5fd9cdd6506ede3ef1afbc859c83c6..e22ca0cd69fdcb5d4effe0b4b39cca3a08a4dbc8 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C
@@ -1964,21 +1964,15 @@ void Foam::polyTopoChange::compactAndReorder
 
     // Clear inflation info
     {
-        faceFromPoint_.clear();
-        faceFromPoint_.resize(0);
-        faceFromEdge_.clear();
-        faceFromEdge_.resize(0);
+        faceFromPoint_.clearStorage();
+        faceFromEdge_.clearStorage();
 
-        cellFromPoint_.clear();
-        cellFromPoint_.resize(0);
-        cellFromEdge_.clear();
-        cellFromEdge_.resize(0);
-        cellFromFace_.clear();
-        cellFromFace_.resize(0);
+        cellFromPoint_.clearStorage();
+        cellFromEdge_.clearStorage();
+        cellFromFace_.clearStorage();
     }
 
 
-
     const polyBoundaryMesh& boundary = mesh.boundaryMesh();
 
     // Grab patch mesh point maps
@@ -2092,10 +2086,8 @@ void Foam::polyTopoChange::clear()
     points_.clearStorage();
     pointMap_.clearStorage();
     reversePointMap_.clearStorage();
-    pointZone_.clear();
-    pointZone_.resize(0);
-    retiredPoints_.clear();
-    retiredPoints_.resize(0);
+    pointZone_.clearStorage();
+    retiredPoints_.clearStorage();
 
     faces_.clearStorage();
     region_.clearStorage();
@@ -2103,27 +2095,19 @@ void Foam::polyTopoChange::clear()
     faceNeighbour_.clearStorage();
     faceMap_.clearStorage();
     reverseFaceMap_.clearStorage();
-    faceFromPoint_.clear();
-    faceFromPoint_.resize(0);
-    faceFromEdge_.clear();
-    faceFromEdge_.resize(0);
-    flipFaceFlux_.clear();
-    flipFaceFlux_.resize(0);
-    faceZone_.clear();
-    faceZone_.resize(0);
-    faceZoneFlip_.clear();
-    faceZoneFlip_.resize(0);
+    faceFromPoint_.clearStorage();
+    faceFromEdge_.clearStorage();
+    flipFaceFlux_.clearStorage();
+    faceZone_.clearStorage();
+    faceZoneFlip_.clearStorage();
     nActiveFaces_ = 0;
 
     cellMap_.clearStorage();
     reverseCellMap_.clearStorage();
     cellZone_.clearStorage();
-    cellFromPoint_.clear();
-    cellFromPoint_.resize(0);
-    cellFromEdge_.clear();
-    cellFromEdge_.resize(0);
-    cellFromFace_.clear();
-    cellFromFace_.resize(0);
+    cellFromPoint_.clearStorage();
+    cellFromEdge_.clearStorage();
+    cellFromFace_.clearStorage();
 }
 
 
@@ -2996,8 +2980,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::changeMesh
 
     // Clear out primitives
     {
-        retiredPoints_.clear();
-        retiredPoints_.resize(0);
+        retiredPoints_.clearStorage();
         region_.clearStorage();
     }
 
@@ -3053,15 +3036,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::changeMesh
 
     // Clear zone info
     {
-        pointZone_.clear();
-        pointZone_.resize(0);
-
-        faceZone_.clear();
-        faceZone_.resize(0);
-
-        faceZoneFlip_.clear();
-        faceZoneFlip_.resize(0);
-
+        pointZone_.clearStorage();
+        faceZone_.clearStorage();
+        faceZoneFlip_.clearStorage();
         cellZone_.clearStorage();
     }
 
@@ -3227,8 +3204,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::makeMesh
 
     // Clear out primitives
     {
-        retiredPoints_.clear();
-        retiredPoints_.resize(0);
+        retiredPoints_.clearStorage();
         region_.clearStorage();
     }
 
@@ -3346,15 +3322,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChange::makeMesh
 
     // Clear zone info
     {
-        pointZone_.clear();
-        pointZone_.resize(0);
-
-        faceZone_.clear();
-        faceZone_.resize(0);
-
-        faceZoneFlip_.clear();
-        faceZoneFlip_.resize(0);
-
+        pointZone_.clearStorage();
+        faceZone_.clearStorage();
+        faceZoneFlip_.clearStorage();
         cellZone_.clearStorage();
     }
 
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/removeFaces.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/removeFaces.C
index 32cb3c5b823a0bb07da241ca8a62d4a733fe1ca2..df0197873c759772e56b437b5adb686eab915d4f 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/removeFaces.C
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/removeFaces.C
@@ -365,8 +365,7 @@ void Foam::removeFaces::mergeFaces
     }
 
     face mergedFace;
-    mergedFace.transfer(faceVerts.shrink());
-    faceVerts.clear();
+    mergedFace.transfer(faceVerts);
 
     if (reverseLoop)
     {
@@ -574,7 +573,7 @@ Foam::removeFaces::removeFaces
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 // Removing face connects cells. This function works out a consistent set of
-// cell regions. 
+// cell regions.
 // - returns faces to remove. Can be extended with additional faces
 //   (if owner would become neighbour)
 // - sets cellRegion to -1 or to region number
@@ -693,7 +692,7 @@ Foam::label Foam::removeFaces::compatibleRemoves
 
 
     // Various checks
-    // - master is lowest numbered in any region 
+    // - master is lowest numbered in any region
     // - regions have more than 1 cell
     {
         labelList nCells(regionMaster.size(), 0);
@@ -763,8 +762,7 @@ Foam::label Foam::removeFaces::compatibleRemoves
         }
     }
 
-    newFacesToRemove.transfer(allFacesToRemove.shrink());
-    allFacesToRemove.clear();
+    newFacesToRemove.transfer(allFacesToRemove);
 
     return nUsedRegions;
 }
@@ -1102,7 +1100,7 @@ void Foam::removeFaces::setRefinement
             else if (nFacesPerEdge[edgeI] == 1)
             {
                 // 1: illegal. Tested above.
-            }            
+            }
             else if (nFacesPerEdge[edgeI] == 2)
             {
                 // 2: merge faces.
@@ -1219,7 +1217,7 @@ void Foam::removeFaces::setRefinement
                         << "The other side has region:" << nbrRegion
                         << endl
                         << "(region -1 means face is to be deleted)"
-                        << abort(FatalError);                
+                        << abort(FatalError);
                 }
             }
             else if (toNbrRegion[myRegion] == -1)
@@ -1240,9 +1238,9 @@ void Foam::removeFaces::setRefinement
                         << " with coupled neighbouring regions:"
                         << toNbrRegion[myRegion] << " and "
                         << nbrRegion
-                        << abort(FatalError);                
+                        << abort(FatalError);
                 }
-            }   
+            }
         }
     }
 
@@ -1358,7 +1356,7 @@ void Foam::removeFaces::setRefinement
             pointsToRemove
         )
     );
-    
+
     //
     // Now we know
     // - faceLabels         : faces to remove (sync since no boundary faces)
@@ -1367,7 +1365,7 @@ void Foam::removeFaces::setRefinement
     // - faceRegion         : connected face region of faces to be merged (sync)
     // - affectedFace       : faces with points removed and/or owner/neighbour
     //                        changed (non sync)
-    
+
 
     // Start modifying mesh and keep track of faces changed.
 
diff --git a/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C b/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C
index cce2f1cd4437aba58d989fea2413cd13168f599e..2a36d3b778d9ca5d30cd4d2d40d04548f993ed9a 100644
--- a/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C
+++ b/src/dynamicMesh/slidingInterface/coupleSlidingInterface.C
@@ -372,7 +372,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
     // sliding intergace coupling in order to allow the point
     // projection to be done separately from the actual cutting.
     // Please change consistently with slidingInterfaceProjectPoints.C
-    // 
+    //
     if (debug)
     {
         Pout << "Processing slave edges " << endl;
@@ -543,7 +543,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
             forAll (curFaces, faceI)
             {
 //                 Pout<< "face: " << curFaces[faceI] << " "
-//                     << masterPatch[curFaces[faceI]] 
+//                     << masterPatch[curFaces[faceI]]
 //                     << " local: "
 //                     << masterPatch.localFaces()[curFaces[faceI]]
 //                     << endl;
@@ -566,7 +566,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
             // The edge cutting code is repeated in
             // slidingInterface::modifyMotionPoints.  This is done for
             // efficiency reasons and avoids multiple creation of cutting
-            // planes.  Please update both simultaneously.  
+            // planes.  Please update both simultaneously.
 
             const point& a = projectedSlavePoints[curEdge.start()];
             const point& b = projectedSlavePoints[curEdge.end()];
@@ -623,7 +623,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
                         if (slaveCut.hit())
                         {
                             // Strict checking of slave cut to avoid capturing
-                            // end points.  
+                            // end points.
                             scalar cutOnSlave =
                                 (
                                     (
@@ -747,14 +747,14 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
 
     forAll (pointsIntoMasterEdges, i)
     {
-        pime[i].transfer(pointsIntoMasterEdges[i].shrink());
+        pime[i].transfer(pointsIntoMasterEdges[i]);
     }
 
     labelListList pise(pointsIntoSlaveEdges.size());
 
     forAll (pointsIntoSlaveEdges, i)
     {
-        pise[i].transfer(pointsIntoSlaveEdges[i].shrink());
+        pise[i].transfer(pointsIntoSlaveEdges[i]);
     }
 
     // Prepare the enriched faces
@@ -1398,7 +1398,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
             }
 
             face newFace;
-            newFace.transfer(newFaceLabels.shrink());
+            newFace.transfer(newFaceLabels);
 
 //             Pout << "Modifying master stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
 
@@ -1683,7 +1683,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
             }
 
             face newFace;
-            newFace.transfer(newFaceLabels.shrink());
+            newFace.transfer(newFaceLabels);
 
 //             Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
 
diff --git a/src/dynamicMesh/slidingInterface/decoupleSlidingInterface.C b/src/dynamicMesh/slidingInterface/decoupleSlidingInterface.C
index ce08c9a8bff50ef37a691c783d13d5bffe9c3277..ec620bd69d53f1cd8569c5404dcf9fe7f25d049d 100644
--- a/src/dynamicMesh/slidingInterface/decoupleSlidingInterface.C
+++ b/src/dynamicMesh/slidingInterface/decoupleSlidingInterface.C
@@ -227,7 +227,7 @@ void Foam::slidingInterface::decoupleInterface
             }
 
             face newFace;
-            newFace.transfer(newFaceLabels.shrink());
+            newFace.transfer(newFaceLabels);
 
 //             Pout << "Modifying master stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
 
@@ -350,7 +350,7 @@ void Foam::slidingInterface::decoupleInterface
             }
 
             face newFace;
-            newFace.transfer(newFaceLabels.shrink());
+            newFace.transfer(newFaceLabels);
 
 //             Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
 
diff --git a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchCutFaces.C b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchCutFaces.C
index b056193d72c28fe02103466145ba51fc9dd8dc27..8afb49c049414cc66872f55d18eab032495d2b56 100644
--- a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchCutFaces.C
+++ b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchCutFaces.C
@@ -133,7 +133,7 @@ void Foam::enrichedPatch::calcCutFaces() const
         // The seed edges include all the edges of the original face + all edges
         // of other faces that have been used in the construction of the
         // facet.  Edges from other faces can be considered as
-        // internal to the current face if used only once.  
+        // internal to the current face if used only once.
 
         // Track the edge usage to avoid duplicate faces and reset it to unused
         boolList usedFaceEdges(curLocalFace.size(), false);
@@ -304,12 +304,12 @@ void Foam::enrichedPatch::calcCutFaces() const
 
                     // Append the face
                     face cutFaceGlobal;
-                    cutFaceGlobal.transfer(cutFaceGlobalPoints.shrink());
+                    cutFaceGlobal.transfer(cutFaceGlobalPoints);
 
                     cf.append(cutFaceGlobal);
 
                     face cutFaceLocal;
-                    cutFaceLocal.transfer(cutFaceLocalPoints.shrink());
+                    cutFaceLocal.transfer(cutFaceLocalPoints);
 //                     Pout << "\ncutFaceLocal: " << cutFaceLocal.points(lp) << endl;
                     // Go through all edges of the cut faces.
                     // If the edge corresponds to a starting face edge,
@@ -358,7 +358,7 @@ void Foam::enrichedPatch::calcCutFaces() const
                             edgeSeeds.append(curCutFaceEdge.reverseEdge());
                         }
                     }
-                            
+
 
                     // Find out what the other side is
 
@@ -596,20 +596,19 @@ void Foam::enrichedPatch::calcCutFaces() const
 
     // Re-pack the list into compact storage
     cutFacesPtr_ = new faceList();
-    cutFacesPtr_->transfer(cf.shrink());
+    cutFacesPtr_->transfer(cf);
 
     cutFaceMasterPtr_ = new labelList();
-    cutFaceMasterPtr_->transfer(cfMaster.shrink());
+    cutFaceMasterPtr_->transfer(cfMaster);
 
     cutFaceSlavePtr_ = new labelList();
-    cutFaceSlavePtr_->transfer(cfSlave.shrink());
+    cutFaceSlavePtr_->transfer(cfSlave);
 }
 
 
 void Foam::enrichedPatch::clearCutFaces()
 {
     deleteDemandDrivenData(cutFacesPtr_);
-
     deleteDemandDrivenData(cutFaceMasterPtr_);
     deleteDemandDrivenData(cutFaceSlavePtr_);
 }
diff --git a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchFaces.C b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchFaces.C
index 5d9f6d6ca2e23e28a07b6936e34782f5fdc3a468..7e2ba2ef7cae585c5c9dd072edeb6c11d7dbdb3c 100644
--- a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchFaces.C
+++ b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchFaces.C
@@ -80,7 +80,7 @@ void Foam::enrichedPatch::calcEnrichedFaces
 
     // For correct functioning of the enrichedPatch class, the slave
     // faces need to be inserted first.  See comments in
-    // enrichedPatch.H  
+    // enrichedPatch.H
 
     // Get reference to the point merge map
     const Map<label>& pmm = pointMergeMap();
@@ -233,10 +233,10 @@ void Foam::enrichedPatch::calcEnrichedFaces
                 }
             }
         }
-//         Info << "New slave face " << faceI << ": " << newFace << endl;
+        // Info<< "New slave face " << faceI << ": " << newFace << endl;
 
         // Add the new face to the list
-        enrichedFaces[nEnrichedFaces].transfer(newFace.shrink());
+        enrichedFaces[nEnrichedFaces].transfer(newFace);
         nEnrichedFaces++;
     }
 
@@ -384,10 +384,10 @@ void Foam::enrichedPatch::calcEnrichedFaces
                 }
             }
         }
-//         Info << "New master face: " << newFace << endl;
+        // Info<< "New master face: " << newFace << endl;
 
         // Add the new face to the list
-        enrichedFaces[nEnrichedFaces].transfer(newFace.shrink());
+        enrichedFaces[nEnrichedFaces].transfer(newFace);
         nEnrichedFaces++;
     }
 
diff --git a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchMasterPoints.C b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchMasterPoints.C
index 43dcc0e1807b45e69b1e653071e3f4be354f7ab4..01b623cff9414c73c2e9aefab8febd48c175a045 100644
--- a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchMasterPoints.C
+++ b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchMasterPoints.C
@@ -138,11 +138,11 @@ void Foam::enrichedPatch::calcMasterPointFaces() const
     forAll (mpfToc, mpfTocI)
     {
         labelList l;
-        l.transfer(mpf.find(mpfToc[mpfTocI])().shrink());
+        l.transfer(mpf.find(mpfToc[mpfTocI])());
 
         masterPointFaceAddr.insert(mpfToc[mpfTocI], l);
     }
-//     Pout << "masterPointFaceAddr: " << masterPointFaceAddr << endl;
+    // Pout<< "masterPointFaceAddr: " << masterPointFaceAddr << endl;
 }
 
 
diff --git a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchPointPoints.C b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchPointPoints.C
index 42f580cb9bb3495652cb1e05b9f153a729f7023b..a20336b876802fc7c577ee02f98ad42aec77246d 100644
--- a/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchPointPoints.C
+++ b/src/dynamicMesh/slidingInterface/enrichedPatch/enrichedPatchPointPoints.C
@@ -110,7 +110,7 @@ void Foam::enrichedPatch::calcPointPoints() const
 
     forAll (pp, pointI)
     {
-        ppAddr[pointI].transfer(pp[pointI].shrink());
+        ppAddr[pointI].transfer(pp[pointI]);
     }
 }
 
diff --git a/src/finiteVolume/cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.C b/src/finiteVolume/cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.C
index 3783df0723b9cab9939f4bd43e3f98f3e2448015..f7a1eee8e88cdd618987585860333c2dce0eccbb 100644
--- a/src/finiteVolume/cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.C
+++ b/src/finiteVolume/cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.C
@@ -26,29 +26,55 @@ License
 
 #include "pressureGradientExplicitSource.H"
 #include "volFields.H"
+#include "IFstream.H"
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+void Foam::pressureGradientExplicitSource::writeGradP() const
+{
+    // Only write on output time
+    if (mesh_.time().outputTime())
+    {
+        IOdictionary propsDict
+        (
+            IOobject
+            (
+                sourceName_ + "Properties",
+                mesh_.time().timeName(),
+                "uniform",
+                mesh_,
+                IOobject::NO_READ,
+                IOobject::NO_WRITE
+            )
+        );
+        propsDict.add("gradient", gradP_);
+        propsDict.regIOobject::write();
+    }
+}
+
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 Foam::pressureGradientExplicitSource::pressureGradientExplicitSource
 (
     const word& sourceName,
-    const fvMesh& mesh,
     volVectorField& U
 )
 :
+    sourceName_(sourceName),
+    mesh_(U.mesh()),
+    U_(U),
     dict_
     (
         IOobject
         (
             sourceName + "Properties",
-            mesh.time().constant(),
-            mesh,
+            mesh_.time().constant(),
+            mesh_,
             IOobject::MUST_READ,
             IOobject::NO_WRITE
         )
     ),
-    mesh_(mesh),
-    U_(U),
     Ubar_(dict_.lookup("Ubar")),
     gradPini_(readScalar(dict_.lookup("gradPini"))),
     gradP_(gradPini_),
@@ -59,15 +85,15 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource
         topoSetSource::New
         (
             cellSource_,
-            mesh,
+            mesh_,
             dict_.subDict(cellSource_ + "Coeffs")
         )
     ),
     selectedCellSet_
     (
-        mesh,
-        "pressureGradientExplicitSourceCellSet",
-        mesh.nCells()/10 + 1  // Reasonable size estimate.
+        mesh_,
+        sourceName_ + "CellSet",
+        mesh_.nCells()/10 + 1  // Reasonable size estimate.
     )
 {
     // Create the cell set
@@ -78,9 +104,24 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource
     );
 
     // Give some feedback
-    Info<< "pressureGradientExplicitSource(" << sourceName << ")" << nl
-        << "Selected " << returnReduce(selectedCellSet_.size(), sumOp<label>())
-        << " cells." << endl;
+    Info<< "    Selected "
+        << returnReduce(selectedCellSet_.size(), sumOp<label>())
+        << " cells" << endl;
+
+    // Read the initial pressure gradient from file if it exists
+    IFstream propsFile
+    (
+        mesh_.time().timeName()/"uniform"/(sourceName_ + "Properties")
+    );
+
+    if (propsFile.good())
+    {
+        Info<< "    Reading pressure gradient from file" << endl;
+        dictionary propsDict(dictionary::null, propsFile);
+        propsDict.lookup("gradient") >> gradP_;
+    }
+
+    Info<< "    Initial pressure gradient = " << gradP_ << endl;
 }
 
 
@@ -95,7 +136,7 @@ Foam::pressureGradientExplicitSource::Su() const
         (
             IOobject
             (
-                "pressureGradientExplicitSource",
+                sourceName_,
                 mesh_.time().timeName(),
                 mesh_,
                 IOobject::NO_READ,
@@ -164,6 +205,8 @@ void Foam::pressureGradientExplicitSource::update()
 
     Info<< "Uncorrected Ubar = " << magUbarAve << tab
         << "Pressure gradient = " << gradP_ << endl;
+
+    writeGradP();
 }
 
 
diff --git a/src/finiteVolume/cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.H b/src/finiteVolume/cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.H
index 9c518dc8acd679ce04c63248e5f40769749601bd..fb278ef443cdb21639fe7494466e7cc7c5f7dd3b 100644
--- a/src/finiteVolume/cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.H
+++ b/src/finiteVolume/cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.H
@@ -57,8 +57,8 @@ class pressureGradientExplicitSource
 {
     // Private data
 
-        //- Properties dictionary
-        IOdictionary dict_;
+        //- Name of the source
+        const word sourceName_;
 
         //- Reference to the mesh
         const fvMesh& mesh_;
@@ -66,6 +66,9 @@ class pressureGradientExplicitSource
         //- Reference to the velocity field
         volVectorField& U_;
 
+        //- Properties dictionary
+        IOdictionary dict_;
+
         //- Average velocity
         vector Ubar_;
 
@@ -90,6 +93,9 @@ class pressureGradientExplicitSource
 
     // Private Member Functions
 
+        //- Write the pressure gradient to file (for restarts etc)
+        void writeGradP() const;
+
         //- Disallow default bitwise copy construct
         pressureGradientExplicitSource(const pressureGradientExplicitSource&);
 
@@ -105,7 +111,6 @@ public:
         pressureGradientExplicitSource
         (
             const word& sourceName,
-            const fvMesh& mesh,
             volVectorField& U
         );
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C
index 1846ada328e389e97412dc809b36f6e7e1c691f1..ff96264cd4843bf67dc84ef0df6bd5fea0682909 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C
@@ -175,9 +175,8 @@ void turbulentInletFvPatchField<Type>::updateCoeffs()
             ranGen_.randomise(randomField[facei]);
         }
 
-        // Correction-factor proposed by Yi Wang to compensate for the loss
-        // of RMS fluctuation due to the temporal correlation introduced by
-        // the alpha parameter.
+        // Correction-factor to compensate for the loss of RMS fluctuation
+        // due to the temporal correlation introduced by the alpha parameter.
         scalar rmsCorr = sqrt(12*(2*alpha_ - sqr(alpha_)))/alpha_;
 
         patchField =
@@ -206,6 +205,7 @@ void turbulentInletFvPatchField<Type>::write(Ostream& os) const
     os.writeKeyword("fluctuationScale")
         << fluctuationScale_ << token::END_STATEMENT << nl;
     referenceField_.writeEntry("referenceField", os);
+    os.writeKeyword("alpha") << alpha_ << token::END_STATEMENT << nl;
     this->writeEntry("value", os);
 }
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.H
index 518a0f689f74509fcf74c69a2268b4f759e8a086..944c7f991d5b2aea06d1154e458a606a24133e20 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.H
@@ -63,7 +63,6 @@ class turbulentInletFvPatchField
 :
     public fixedValueFvPatchField<Type>
 {
-
     // Private data
 
         Random ranGen_;
diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C
index 47ef5eb98fd05bdb4e5d1b280ab52224b5d5171a..ca0ef6c0380a4b0dd804f6ad5771e888f0cd6153 100644
--- a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C
+++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C
@@ -269,8 +269,8 @@ void Foam::MULES::implicitSolve
         }
         else
         {
-            Info<< "max(" + psi.name() + " - 1 = " << maxPsiM1 << endl;
-            Info<< "min(" + psi.name() + ") = " << minPsi << endl;
+            Info<< "MULES: max(" << psi.name() << " - 1) = " << maxPsiM1
+                << " min(" << psi.name() << ") = " << minPsi << endl;
 
             phiBD = psiConvectionDiffusion.flux();
 
diff --git a/src/lagrangian/dieselSpray/Make/files b/src/lagrangian/dieselSpray/Make/files
index 86dd21c0bcd473295a4737b9821555c70fd0af84..7fd1ca7f2a48980a44c05565ed59f2dd78d908cb 100644
--- a/src/lagrangian/dieselSpray/Make/files
+++ b/src/lagrangian/dieselSpray/Make/files
@@ -26,6 +26,7 @@ $(injector)/injector/injector.C
 $(injector)/injector/injectorIO.C
 $(injector)/injectorType/injectorType.C
 $(injector)/unitInjector/unitInjector.C
+$(injector)/multiHoleInjector/multiHoleInjector.C
 $(injector)/commonRailInjector/commonRailInjector.C
 $(injector)/swirlInjector/swirlInjector.C
 $(injector)/definedInjector/definedInjector.C
diff --git a/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C b/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C
index 9249c8ac65cba2198cc7abaee228c32399b377bc..0f00cb79eb9ddb199b687d45177e81d7580a0440 100644
--- a/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C
+++ b/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C
@@ -187,13 +187,14 @@ Foam::label Foam::commonRailInjector::nParcelsToInject
     return nParcels;
 }
 
-const Foam::vector Foam::commonRailInjector::position() const
+const Foam::vector Foam::commonRailInjector::position(const label n) const
 {
     return position_;
 }
 
 Foam::vector Foam::commonRailInjector::position
 (
+    const label n,
     const scalar time,
     const bool twoD,
     const scalar angleOfWedge,
@@ -236,12 +237,21 @@ Foam::vector Foam::commonRailInjector::position
     return position_;
 }
 
+Foam::label Foam::commonRailInjector::nHoles() const
+{
+    return 1;
+}
+
 Foam::scalar Foam::commonRailInjector::d() const
 {
     return d_;
 }
 
-const Foam::vector& Foam::commonRailInjector::direction() const
+const Foam::vector& Foam::commonRailInjector::direction
+(
+    const label i,
+    const scalar time
+) const
 {
     return direction_;
 }
@@ -358,7 +368,7 @@ void Foam::commonRailInjector::correctProfiles
 
     forAll(velocityProfile_, i)
     {
-        scalar Pinj = getTableValue(injectionPressureProfile_, massFlowRateProfile_[i][0]);
+        scalar Pinj = getTableValue(injectionPressureProfile_, velocityProfile_[i][0]);
         scalar Vinj = sqrt(2.0*(Pinj - referencePressure)/rho);
         scalar mfr = massFlowRateProfile_[i][1]/(rho*A);
         scalar Cd = mfr/Vinj;
@@ -367,4 +377,14 @@ void Foam::commonRailInjector::correctProfiles
     }
 }
 
+Foam::vector Foam::commonRailInjector::tan1(const label n) const
+{
+    return tangentialInjectionVector1_;
+}
+
+Foam::vector Foam::commonRailInjector::tan2(const label n) const
+{
+    return tangentialInjectionVector2_;
+}
+
 // ************************************************************************* //
diff --git a/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.H b/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.H
index fcb222bc879b644c33992e0c2f6bfdaded3e6cf3..c829799029c84e7761308304d52113de71258ef6 100644
--- a/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.H
+++ b/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.H
@@ -132,11 +132,12 @@ public:
         ) const;
 
         //- Return the injection position
-        const vector position() const;
+        const vector position(const label n) const;
 
         //- Return the injection position
         vector position
         (
+            const label n,
             const scalar time,
             const bool twoD,
             const scalar angleOfWedge,
@@ -146,11 +147,18 @@ public:
             Random& rndGen
         ) const;
     
+        //- Return the number of holes
+        label nHoles() const;
+
         //- Return the injector diameter
         scalar d() const;
 
         //- Return the injection direction
-        const vector& direction() const;
+        const vector& direction
+        (
+            const label i,
+            const scalar time
+        ) const;
 
         //- Return the mass of the injected particle
         scalar mass
@@ -206,6 +214,9 @@ public:
         List<pair> CdProfile() const;
         scalar Cd(const scalar time) const;
 
+        vector tan1(const label n) const;
+        vector tan2(const label n) const;
+
         void correctProfiles
         (
             const liquidMixture& fuel,
diff --git a/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C b/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C
index 89960f39782b03a15fd18188d71a1139a3544010..8d422973cfa8c640d692bcb1c22ef6ab63041490 100644
--- a/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C
+++ b/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C
@@ -178,13 +178,14 @@ Foam::label Foam::definedInjector::nParcelsToInject
     return nParcels;
 }
 
-const Foam::vector Foam::definedInjector::position() const
+const Foam::vector Foam::definedInjector::position(const label n) const
 {
     return position_;
 }
 
 Foam::vector Foam::definedInjector::position
 (
+    const label n,
     const scalar time,
     const bool twoD,
     const scalar angleOfWedge,
@@ -227,12 +228,21 @@ Foam::vector Foam::definedInjector::position
     return position_;
 }
 
+Foam::label Foam::definedInjector::nHoles() const
+{
+    return 1;
+}
+
 Foam::scalar Foam::definedInjector::d() const
 {
     return d_;
 }
 
-const Foam::vector& Foam::definedInjector::direction() const
+const Foam::vector& Foam::definedInjector::direction
+(
+    const label i,
+    const scalar time
+) const
 {
     return direction_;
 }
@@ -344,4 +354,14 @@ void Foam::definedInjector::correctProfiles
     }
 }
 
+Foam::vector Foam::definedInjector::tan1(const label n) const
+{
+    return tangentialInjectionVector1_;
+}
+
+Foam::vector Foam::definedInjector::tan2(const label n) const
+{
+    return tangentialInjectionVector2_;
+}
+
 // ************************************************************************* //
diff --git a/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.H b/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.H
index 6389b94339b791e2e188d120b590879aeda8867f..66ca317b3ae549075a5a4c79af350abba1b39f5f 100644
--- a/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.H
+++ b/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.H
@@ -132,11 +132,12 @@ public:
         ) const;
 
         //- Return the injection position
-        const vector position() const;
+        const vector position(const label n) const;
 
         //- Return the injection position
         vector position
         (
+            const label n,
             const scalar time,
             const bool twoD,
             const scalar angleOfWedge,
@@ -146,11 +147,18 @@ public:
             Random& rndGen
         ) const;
     
+        //- Return the number of holes
+        label nHoles() const;
+
         //- Return the injector diameter
         scalar d() const;
 
         //- Return the injection direction
-        const vector& direction() const;
+        const vector& direction
+        (
+            const label i,
+            const scalar time
+        ) const;
 
         //- Return the mass of the injected particle
         scalar mass
@@ -210,6 +218,9 @@ public:
 
         scalar Cd(const scalar time) const;
 
+        vector tan1(const label n) const;
+        vector tan2(const label n) const;
+
         void correctProfiles
         (
             const liquidMixture& fuel,
diff --git a/src/lagrangian/dieselSpray/injector/injectorType/injectorType.H b/src/lagrangian/dieselSpray/injector/injectorType/injectorType.H
index 878cc8897d3b16ac233f1b466cfbbc9c411b351a..ab789f5213f69af10a244e1a825ac2281352af06 100644
--- a/src/lagrangian/dieselSpray/injector/injectorType/injectorType.H
+++ b/src/lagrangian/dieselSpray/injector/injectorType/injectorType.H
@@ -114,11 +114,12 @@ public:
         ) const = 0;
 
         //- Return the injection position
-        virtual const vector position() const = 0;
+        virtual const vector position(const label n) const = 0;
 
         //- Return the injection position
         virtual vector position
         (
+            const label n,
             const scalar time,
             const bool twoD,
             const scalar angleOfWedge,
@@ -127,12 +128,19 @@ public:
             const vector& axisOfWedgeNormal,
             Random& rndGen
         ) const = 0;
+
+        //- Return the number of holes
+        virtual label nHoles() const = 0;
     
         //- Return the injector diameter
         virtual scalar d() const = 0;
 
-        //- Return the injection direction
-        virtual const vector& direction() const = 0;
+        //- Return the injection direction for hole i
+        virtual const vector& direction
+        (
+            const label i, 
+            const scalar time
+        ) const = 0;
 
         //- Return the mass of the injected liquid between times
         virtual scalar mass
@@ -189,6 +197,12 @@ public:
 
         virtual bool pressureIndependentVelocity() const = 0;
 
+        //- Return a vector perpendicular to the injection direction and tan2 for hole n
+        virtual vector tan1(const label n) const = 0;
+
+        //- Return a vector perpendicular to the injection direction and tan1 for hole n
+        virtual vector tan2(const label n) const = 0;
+
         scalar getTableValue
         (
             const List<pair>& table,
diff --git a/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C b/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C
new file mode 100644
index 0000000000000000000000000000000000000000..54b4c4f4860bf68a6b6b4a0ea3a83fb05537f360
--- /dev/null
+++ b/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C
@@ -0,0 +1,420 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+\*---------------------------------------------------------------------------*/
+
+#include "multiHoleInjector.H"
+#include "addToRunTimeSelectionTable.H"
+#include "Random.H"
+#include "mathematicalConstants.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+namespace Foam
+{
+
+defineTypeNameAndDebug(multiHoleInjector, 0);
+
+addToRunTimeSelectionTable
+(
+    injectorType,
+    multiHoleInjector,
+    dictionary
+);
+}
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+// Construct from components
+Foam::multiHoleInjector::multiHoleInjector
+(
+    const Foam::Time& t,
+    const Foam::dictionary& dict
+)
+:
+    injectorType(t, dict),
+    propsDict_(dict.subDict(typeName + "Props")),
+    centerPosition_(propsDict_.lookup("position")),
+    xyAngle_(readScalar(propsDict_.lookup("xyAngle"))),
+    zAngle_(readScalar(propsDict_.lookup("zAngle"))),
+    nHoles_(readLabel(propsDict_.lookup("nHoles"))),
+    umbrellaAngle_(readScalar(propsDict_.lookup("umbrellaAngle"))),
+    nozzleTipDiameter_(readScalar(propsDict_.lookup("nozzleTipDiameter"))),
+    angleSpacing_(propsDict_.lookup("angleSpacing")),
+    d_(readScalar(propsDict_.lookup("diameter"))),
+    Cd_(readScalar(propsDict_.lookup("Cd"))),
+    mass_(readScalar(propsDict_.lookup("mass"))),
+    nParcels_(readLabel(propsDict_.lookup("nParcels"))),
+    X_(propsDict_.lookup("X")),
+    massFlowRateProfile_(propsDict_.lookup("massFlowRateProfile")),
+    velocityProfile_(massFlowRateProfile_),
+    injectionPressureProfile_(massFlowRateProfile_),
+    CdProfile_(massFlowRateProfile_),
+    TProfile_(propsDict_.lookup("temperatureProfile")),
+    averageParcelMass_(nHoles_*mass_/nParcels_),
+    direction_(nHoles_),
+    position_(nHoles_),
+    pressureIndependentVelocity_(true),
+    tangentialInjectionVector1_(nHoles_),
+    tangentialInjectionVector2_(nHoles_)
+{
+
+
+    // check if time entries for soi and eoi match
+    if (mag(massFlowRateProfile_[0][0]-TProfile_[0][0]) > SMALL)
+    {
+        FatalError << "multiHoleInjector::multiHoleInjector(const time& t, const dictionary dict) " << endl
+            << " start-times do not match for TemperatureProfile and massFlowRateProfile."
+            << abort(FatalError);
+    }
+
+    if (mag(massFlowRateProfile_[massFlowRateProfile_.size()-1][0]-TProfile_[TProfile_.size()-1][0]) > SMALL)
+    {
+        FatalError << "multiHoleInjector::multiHoleInjector(const time& t, const dictionary dict) " << endl
+            << " end-times do not match for TemperatureProfile and massFlowRateProfile."
+            << abort(FatalError);
+    }
+
+    // convert CA to real time
+    forAll(massFlowRateProfile_, i)
+    {
+        massFlowRateProfile_[i][0] = t.userTimeToTime(massFlowRateProfile_[i][0]);
+        velocityProfile_[i][0] = massFlowRateProfile_[i][0];
+        injectionPressureProfile_[i][0] = massFlowRateProfile_[i][0];
+    }
+    
+    forAll(TProfile_, i)
+    {
+        TProfile_[i][0] = t.userTimeToTime(TProfile_[i][0]);
+    }
+
+    scalar integratedMFR = integrateTable(massFlowRateProfile_);
+
+    forAll(massFlowRateProfile_, i)
+    {
+        // correct the massFlowRateProfile to match the injected mass
+        massFlowRateProfile_[i][1] *= mass_/integratedMFR;
+        
+        CdProfile_[i][0] = massFlowRateProfile_[i][0];
+        CdProfile_[i][1] = Cd_;
+    }
+
+    setTangentialVectors();
+
+    // check molar fractions
+    scalar Xsum = 0.0;
+    forAll(X_, i)
+    {
+        Xsum += X_[i];
+    }
+
+    if (mag(Xsum - 1.0) > SMALL)
+    {
+        Info << "Warning!!!\n multiHoleInjector::multiHoleInjector(const time& t, Istream& is)"
+            << "X does not add up to 1.0, correcting molar fractions."
+            << endl;
+        forAll(X_, i)
+        {
+            X_[i] /= Xsum;
+        }
+    }
+
+}
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::multiHoleInjector::~multiHoleInjector()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::multiHoleInjector::setTangentialVectors()
+{
+    scalar pi180 = mathematicalConstant::pi/180.0;
+    scalar alpha = xyAngle_*pi180;
+    scalar phi = zAngle_*pi180;
+
+    vector xp(cos(alpha), sin(alpha), 0.0);
+    vector zp(cos(alpha)*sin(phi), sin(alpha)*sin(phi), cos(phi));
+    if (mag(zp-xp) < 1.0e-15)
+    {
+        xp = vector(0.0, 0.0, -1.0);
+        xp -= (xp & zp)*zp;
+        xp /= mag(xp);
+    }
+    vector yp = zp^xp;
+
+//    Info << "xp = " << xp << endl;
+//    Info << "yp = " << yp << endl;
+//    Info << "zp = " << zp << endl;
+
+    scalar angle = 0.0;
+    scalar u = umbrellaAngle_*pi180/2.0;
+    for(label i=0; i<nHoles_; i++)
+    {
+        angle += angleSpacing_[i];
+        scalar v = angle*pi180;
+        direction_[i] = cos(v)*sin(u)*xp + sin(v)*sin(u)*yp + cos(u)*zp;
+        vector dp = direction_[i] - (direction_[i] & zp)*direction_[i];
+        if (mag(dp) > SMALL)
+        {
+            dp /= mag(dp);
+        }
+        position_[i] = centerPosition_ + 0.5*nozzleTipDiameter_*dp;
+//        Info << "i = " << i << ", dir = " << direction_[i] << ", pos = " << position_[i] << endl;
+    }
+
+    Random rndGen(label(0));
+
+    for(label i=0; i<nHoles_; i++)
+    {
+        vector tangent(vector::zero);
+        scalar magV = 0;
+        while (magV < SMALL)
+        {
+            vector testThis = rndGen.vector01();
+            
+            tangent = testThis - (testThis & direction_[i])*direction_[i];
+            magV = mag(tangent);
+        }
+
+        tangentialInjectionVector1_[i] = tangent/magV;
+        tangentialInjectionVector2_[i] = direction_[i] ^ tangentialInjectionVector1_[i];
+
+    }   
+}
+
+
+Foam::label Foam::multiHoleInjector::nParcelsToInject
+(
+    const scalar time0,
+    const scalar time1
+) const
+{
+
+    scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
+    label nParcels = label(mInj/averageParcelMass_ + 0.49);
+    
+    return nParcels;
+}
+
+const Foam::vector Foam::multiHoleInjector::position(const label n) const
+{
+    return position_[n];
+}
+
+Foam::vector Foam::multiHoleInjector::position
+(
+    const label n,
+    const scalar time,
+    const bool twoD,
+    const scalar angleOfWedge,
+    const vector& axisOfSymmetry,
+    const vector& axisOfWedge,
+    const vector& axisOfWedgeNormal,
+    Random& rndGen
+) const
+{
+    if (twoD)
+    {
+        scalar is = position_[n] & axisOfSymmetry;
+        scalar magInj = mag(position_[n] - is*axisOfSymmetry);
+
+        vector halfWedge =
+            axisOfWedge*cos(0.5*angleOfWedge)
+          + axisOfWedgeNormal*sin(0.5*angleOfWedge);
+        halfWedge /= mag(halfWedge);
+
+        return (is*axisOfSymmetry + magInj*halfWedge);
+    }
+    else
+    {
+        // otherwise, disc injection
+        scalar iRadius = d_*rndGen.scalar01();
+        scalar iAngle = 2.0*mathematicalConstant::pi*rndGen.scalar01();
+
+        return
+        ( 
+            position_[n]
+          + iRadius
+          * (
+              tangentialInjectionVector1_[n]*cos(iAngle)
+            + tangentialInjectionVector2_[n]*sin(iAngle)
+          )
+        );
+        
+    }
+    return position_[0];
+}
+
+Foam::label Foam::multiHoleInjector::nHoles() const
+{
+    return nHoles_;
+}
+
+Foam::scalar Foam::multiHoleInjector::d() const
+{
+    return d_;
+}
+
+const Foam::vector& Foam::multiHoleInjector::direction
+(
+    const label i,
+    const scalar time
+) const
+{
+    return direction_[i];
+}
+
+Foam::scalar Foam::multiHoleInjector::mass
+(
+    const scalar time0,
+    const scalar time1,
+    const bool twoD,
+    const scalar angleOfWedge
+) const
+{
+    scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
+
+    // correct mass if calculation is 2D 
+    if (twoD)
+    {
+        mInj *= 0.5*angleOfWedge/mathematicalConstant::pi;
+    }
+
+    return mInj;
+}
+
+Foam::scalar Foam::multiHoleInjector::mass() const
+{
+    return mass_;
+}
+
+const Foam::scalarField& Foam::multiHoleInjector::X() const
+{
+    return X_;
+}
+
+Foam::List<Foam::multiHoleInjector::pair> Foam::multiHoleInjector::T() const
+{
+    return TProfile_;
+}
+
+Foam::scalar Foam::multiHoleInjector::T(const scalar time) const
+{
+    return getTableValue(TProfile_, time);
+}
+
+Foam::scalar Foam::multiHoleInjector::tsoi() const
+{
+    return massFlowRateProfile_[0][0];
+}
+
+Foam::scalar Foam::multiHoleInjector::teoi() const
+{
+    return massFlowRateProfile_[massFlowRateProfile_.size()-1][0];
+}
+
+Foam::scalar Foam::multiHoleInjector::massFlowRate
+(
+    const scalar time
+) const
+{
+    return getTableValue(massFlowRateProfile_, time);
+}
+
+Foam::scalar Foam::multiHoleInjector::injectionPressure
+(
+    const scalar time
+) const
+{
+    return getTableValue(injectionPressureProfile_, time);
+}
+
+Foam::scalar Foam::multiHoleInjector::velocity
+(
+    const scalar time
+) const
+{
+    return getTableValue(velocityProfile_, time);
+}
+
+Foam::List<Foam::multiHoleInjector::pair> Foam::multiHoleInjector::CdProfile() const
+{
+    return CdProfile_;
+}
+
+Foam::scalar Foam::multiHoleInjector::Cd
+(
+    const scalar time
+) const
+{
+    return Cd_;
+}
+
+Foam::scalar Foam::multiHoleInjector::fractionOfInjection(const scalar time) const
+{
+    return integrateTable(massFlowRateProfile_, time)/mass_;
+}
+
+Foam::scalar Foam::multiHoleInjector::injectedMass
+(
+    const scalar t
+) const
+{
+    return mass_*fractionOfInjection(t);
+}
+
+
+void Foam::multiHoleInjector::correctProfiles
+(
+    const liquidMixture& fuel,
+    const scalar referencePressure
+)
+{
+
+    scalar A = nHoles_*0.25*mathematicalConstant::pi*pow(d_, 2.0);
+
+    forAll(velocityProfile_, i)
+    {
+        scalar time = velocityProfile_[i][0];
+        scalar rho = fuel.rho(referencePressure, T(time), X_);
+        scalar v = massFlowRateProfile_[i][1]/(Cd_*rho*A);
+        velocityProfile_[i][1] = v;
+        injectionPressureProfile_[i][1] = referencePressure + 0.5*rho*v*v;
+    }
+}
+
+Foam::vector Foam::multiHoleInjector::tan1(const label n) const
+{
+    return tangentialInjectionVector1_[n];
+}
+
+Foam::vector Foam::multiHoleInjector::tan2(const label n) const
+{
+    return tangentialInjectionVector2_[n];
+}
+
+// ************************************************************************* //
diff --git a/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.H b/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.H
new file mode 100644
index 0000000000000000000000000000000000000000..30233d72a409d9c37aa31488f6e192419fb0978b
--- /dev/null
+++ b/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.H
@@ -0,0 +1,248 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Class
+    Foam::multiHoleInjector
+
+Description
+    The unit injector
+
+SourceFiles
+    multiHoleInjectorI.H
+    multiHoleInjector.C
+    multiHoleInjectorIO.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef multiHoleInjector_H
+#define multiHoleInjector_H
+
+#include "injectorType.H"
+#include "vector.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                           Class multiHoleInjector Declaration
+\*---------------------------------------------------------------------------*/
+
+class multiHoleInjector
+:
+    public injectorType
+{
+
+private:
+
+    typedef VectorSpace<Vector<scalar>, scalar, 2> pair;
+
+    // Private data
+
+        dictionary propsDict_;
+
+        vector centerPosition_;
+        scalar xyAngle_;
+        scalar zAngle_;
+        label nHoles_;
+        scalar umbrellaAngle_;
+        scalar nozzleTipDiameter_;
+        List<scalar> angleSpacing_;
+        scalar d_;
+        scalar Cd_;
+        scalar mass_;
+        label nParcels_;
+        scalarField X_;
+        List<pair> massFlowRateProfile_;
+        List<pair> velocityProfile_;
+        List<pair> injectionPressureProfile_;
+        List<pair> CdProfile_;
+        List<pair> TProfile_;
+        scalar averageParcelMass_;
+        List<vector> direction_;
+        List<vector> position_;
+
+        bool pressureIndependentVelocity_;
+
+        //- two orthogonal vectors that are also orthogonal
+        //  to the injection direction
+        List<vector> tangentialInjectionVector1_, tangentialInjectionVector2_;
+
+
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        multiHoleInjector(const multiHoleInjector&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const multiHoleInjector&);
+
+        //- Create two vectors orthonoal to each other
+        //  and the injection vector
+        void setTangentialVectors();
+
+        //- Return the fraction of the total injected liquid
+        scalar fractionOfInjection(const scalar time) const;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("multiHoleInjector");
+
+
+    // Constructors
+
+        //- Construct from components
+        multiHoleInjector
+        (
+            const Time& t,
+            const dictionary& dict
+        );
+
+
+    // Destructor
+
+        ~multiHoleInjector();
+
+
+    // Member Functions
+
+        //- Return number of particles to inject
+        label nParcelsToInject
+        (
+            const scalar t0,
+            const scalar t1
+        ) const;
+
+        //- Return the injection position
+        const vector position(const label n) const;
+
+        //- Return the injection position
+        vector position
+        (
+            const label n,
+            const scalar time,
+            const bool twoD,
+            const scalar angleOfWedge,
+            const vector& axisOfSymmetry,
+            const vector& axisOfWedge,
+            const vector& axisOfWedgeNormal,
+            Random& rndGen
+        ) const;
+    
+        //- Return the number of holes
+        label nHoles() const;
+
+        //- Return the injector diameter
+        scalar d() const;
+
+        //- Return the injection direction
+        const vector& direction
+        (
+            const label i,
+            const scalar time
+        ) const;
+
+        //- Return the mass of the injected particle
+        scalar mass
+        (
+            const scalar t0,
+            const scalar t1,
+            const bool twoD,
+            const scalar angleOfWedge
+        ) const;
+
+        //- Return the mass injected by the injector
+        scalar mass() const;
+
+        //- Return the fuel mass fractions of the injected particle
+        const scalarField& X() const;
+
+        //- Return the temperature profile of the injected particle
+        List<pair> T() const;
+
+        //- Return the temperature of the injected particle
+        scalar T(const scalar time) const;
+
+        //- Return the start-of-injection time
+        scalar tsoi() const;
+
+        //- Return the end-of-injection time
+        scalar teoi() const;
+
+        //- Return the injected liquid mass
+        scalar injectedMass(const scalar t) const;
+
+        List<pair> massFlowRateProfile() const
+        {
+            return massFlowRateProfile_;
+        }
+
+        scalar massFlowRate(const scalar time) const;
+
+        List<pair> injectionPressureProfile() const
+        {
+            return injectionPressureProfile_;
+        }
+    
+        scalar injectionPressure(const scalar time) const;
+
+        List<pair> velocityProfile() const
+        {
+            return velocityProfile_;
+        }
+        
+        scalar velocity(const scalar time) const;
+
+        List<pair> CdProfile() const;
+        scalar Cd(const scalar time) const;
+
+        vector tan1(const label n) const;
+        vector tan2(const label n) const;
+
+        void correctProfiles
+        (
+            const liquidMixture& fuel,
+            const scalar referencePressure
+        );
+
+        bool pressureIndependentVelocity() const
+        {
+            return pressureIndependentVelocity_;
+        }
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.C b/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.C
index ef3196695d18242f594af429beeb16eed262e6ba..192319f8ced148c3004fceb550623053e638705b 100644
--- a/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.C
+++ b/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.C
@@ -187,13 +187,14 @@ Foam::label Foam::swirlInjector::nParcelsToInject
     return nParcels;
 }
 
-const Foam::vector Foam::swirlInjector::position() const
+const Foam::vector Foam::swirlInjector::position(const label n) const
 {
     return position_;
 }
 
 Foam::vector Foam::swirlInjector::position
 (
+    const label n,
     const scalar time,
     const bool twoD,
     const scalar angleOfWedge,
@@ -236,12 +237,21 @@ Foam::vector Foam::swirlInjector::position
     return position_;
 }
 
+Foam::label Foam::swirlInjector::nHoles() const
+{
+    return 1;
+}
+
 Foam::scalar Foam::swirlInjector::d() const
 {
     return d_;
 }
 
-const Foam::vector& Foam::swirlInjector::direction() const
+const Foam::vector& Foam::swirlInjector::direction
+(
+    const label i,
+    const scalar time
+) const
 {
     return direction_;
 }
@@ -370,4 +380,14 @@ void Foam::swirlInjector::correctProfiles
     }
 }
 
+Foam::vector Foam::swirlInjector::tan1(const label n) const
+{
+    return tangentialInjectionVector1_;
+}
+
+Foam::vector Foam::swirlInjector::tan2(const label n) const
+{
+    return tangentialInjectionVector2_;
+}
+
 // ************************************************************************* //
diff --git a/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.H b/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.H
index 8c4853b9b7b257dd8c37c2b21a5ad5e46aa5efcd..4cb6cf1da56fd1a1f56ce256b77a1c29b4d0606c 100644
--- a/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.H
+++ b/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.H
@@ -146,11 +146,12 @@ public:
         ) const;
 
         //- Return the injection position
-        const vector position() const;
+        const vector position(const label n) const;
 
         //- Return the injection position
         vector position
         (
+            const label n,
             const scalar time,
             const bool twoD,
             const scalar angleOfWedge,
@@ -160,11 +161,18 @@ public:
             Random& rndGen
         ) const;
     
+        //- Return the number of holes
+        label nHoles() const;
+
         //- Return the injector diameter
         scalar d() const;
 
         //- Return the injection direction
-        const vector& direction() const;
+        const vector& direction
+        (
+            const label i,
+            const scalar time
+        ) const;
 
         //- Return the mass of the injected particle
         scalar mass
@@ -220,6 +228,9 @@ public:
         //- Return the injected liquid mass
         scalar injectedMass(const scalar t) const;
 
+        vector tan1(const label n) const;
+        vector tan2(const label n) const;
+
         void correctProfiles
         (
             const liquidMixture& fuel,
diff --git a/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C b/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C
index 0429537b2f94e4064638b406163c7d5ca4fca92f..9363379cabaed45dec6768991e50686a6b5dee4f 100644
--- a/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C
+++ b/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C
@@ -60,17 +60,32 @@ Foam::unitInjector::unitInjector
     d_(readScalar(propsDict_.lookup("diameter"))),
     Cd_(readScalar(propsDict_.lookup("Cd"))),
     mass_(readScalar(propsDict_.lookup("mass"))),
-    T_(readScalar(propsDict_.lookup("temperature"))),
     nParcels_(readLabel(propsDict_.lookup("nParcels"))),
     X_(propsDict_.lookup("X")),
     massFlowRateProfile_(propsDict_.lookup("massFlowRateProfile")),
     velocityProfile_(massFlowRateProfile_),
     injectionPressureProfile_(massFlowRateProfile_),
     CdProfile_(massFlowRateProfile_),
-    TProfile_(massFlowRateProfile_),
+    TProfile_(propsDict_.lookup("temperatureProfile")),
     averageParcelMass_(mass_/nParcels_),
     pressureIndependentVelocity_(true)
 {
+
+    // check if time entries for soi and eoi match
+    if (mag(massFlowRateProfile_[0][0]-TProfile_[0][0]) > SMALL)
+    {
+        FatalError << "unitInjector::unitInjector(const time& t, const dictionary dict) " << endl
+            << " start-times do not match for TemperatureProfile and massFlowRateProfile."
+            << abort(FatalError);
+    }
+
+    if (mag(massFlowRateProfile_[massFlowRateProfile_.size()-1][0]-TProfile_[TProfile_.size()-1][0]) > SMALL)
+    {
+        FatalError << "unitInjector::unitInjector(const time& t, const dictionary dict) " << endl
+            << " end-times do not match for TemperatureProfile and massFlowRateProfile."
+            << abort(FatalError);
+    }
+
     // convert CA to real time
     forAll(massFlowRateProfile_, i)
     {
@@ -79,6 +94,11 @@ Foam::unitInjector::unitInjector
         injectionPressureProfile_[i][0] = massFlowRateProfile_[i][0];
     }
     
+    forAll(TProfile_, i)
+    {
+        TProfile_[i][0] = t.userTimeToTime(TProfile_[i][0]);
+    }
+
     scalar integratedMFR = integrateTable(massFlowRateProfile_);
 
     forAll(massFlowRateProfile_, i)
@@ -86,9 +106,6 @@ Foam::unitInjector::unitInjector
         // correct the massFlowRateProfile to match the injected mass
         massFlowRateProfile_[i][1] *= mass_/integratedMFR;
         
-        TProfile_[i][0] = massFlowRateProfile_[i][0];
-        TProfile_[i][1] = T_;
-
         CdProfile_[i][0] = massFlowRateProfile_[i][0];
         CdProfile_[i][1] = Cd_;
     }
@@ -159,13 +176,14 @@ Foam::label Foam::unitInjector::nParcelsToInject
     return nParcels;
 }
 
-const Foam::vector Foam::unitInjector::position() const
+const Foam::vector Foam::unitInjector::position(const label n) const
 {
     return position_;
 }
 
 Foam::vector Foam::unitInjector::position
 (
+    const label n,
     const scalar time,
     const bool twoD,
     const scalar angleOfWedge,
@@ -208,12 +226,21 @@ Foam::vector Foam::unitInjector::position
     return position_;
 }
 
+Foam::label Foam::unitInjector::nHoles() const
+{
+    return 1;
+}
+
 Foam::scalar Foam::unitInjector::d() const
 {
     return d_;
 }
 
-const Foam::vector& Foam::unitInjector::direction() const
+const Foam::vector& Foam::unitInjector::direction
+(
+    const label i,
+    const scalar time
+) const
 {
     return direction_;
 }
@@ -254,7 +281,7 @@ Foam::List<Foam::unitInjector::pair> Foam::unitInjector::T() const
 
 Foam::scalar Foam::unitInjector::T(const scalar time) const
 {
-    return T_;
+    return getTableValue(TProfile_, time);
 }
 
 Foam::scalar Foam::unitInjector::tsoi() const
@@ -328,14 +355,24 @@ void Foam::unitInjector::correctProfiles
     scalar A = 0.25*mathematicalConstant::pi*pow(d_, 2.0);
     scalar pDummy = 1.0e+5;
 
-    scalar rho = fuel.rho(pDummy, T_, X_);
-
     forAll(velocityProfile_, i)
     {
+        scalar time = velocityProfile_[i][0];
+        scalar rho = fuel.rho(pDummy, T(time), X_);
         scalar v = massFlowRateProfile_[i][1]/(Cd_*rho*A);
         velocityProfile_[i][1] = v;
         injectionPressureProfile_[i][1] = referencePressure + 0.5*rho*v*v;
     }
 }
 
+Foam::vector Foam::unitInjector::tan1(const label n) const
+{
+    return tangentialInjectionVector1_;
+}
+
+Foam::vector Foam::unitInjector::tan2(const label n) const
+{
+    return tangentialInjectionVector2_;
+}
+
 // ************************************************************************* //
diff --git a/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.H b/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.H
index 057700aad783026e317c9869c9b2d001c4f393c0..c7592417437a0b4c1d16e17b49d2f638081397a7 100644
--- a/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.H
+++ b/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.H
@@ -68,7 +68,6 @@ private:
         scalar d_;
         scalar Cd_;
         scalar mass_;
-        scalar T_;
         label nParcels_;
         scalarField X_;
         List<pair> massFlowRateProfile_;
@@ -132,11 +131,12 @@ public:
         ) const;
 
         //- Return the injection position
-        const vector position() const;
+        const vector position(const label n) const;
 
         //- Return the injection position
         vector position
         (
+            const label n,
             const scalar time,
             const bool twoD,
             const scalar angleOfWedge,
@@ -146,11 +146,18 @@ public:
             Random& rndGen
         ) const;
     
+        //- Return the number of holes
+        label nHoles() const;
+
         //- Return the injector diameter
         scalar d() const;
 
         //- Return the injection direction
-        const vector& direction() const;
+        const vector& direction
+        (
+            const label i,
+            const scalar time
+        ) const;
 
         //- Return the mass of the injected particle
         scalar mass
@@ -206,6 +213,9 @@ public:
         List<pair> CdProfile() const;
         scalar Cd(const scalar time) const;
 
+        vector tan1(const label n) const;
+        vector tan2(const label n) const;
+
         void correctProfiles
         (
             const liquidMixture& fuel,
diff --git a/src/lagrangian/dieselSpray/parcel/setRelaxationTimes.C b/src/lagrangian/dieselSpray/parcel/setRelaxationTimes.C
index 1737b9c20db7878ea64f0a027a50aa1d1c3c9019..07c6362d16f40e2484eb2f5db7c268ed9fc2728c 100644
--- a/src/lagrangian/dieselSpray/parcel/setRelaxationTimes.C
+++ b/src/lagrangian/dieselSpray/parcel/setRelaxationTimes.C
@@ -86,6 +86,7 @@ void parcel::setRelaxationTimes
     W = 1.0/W;
 
     scalarField Xf(Nf, 0.0);
+    scalarField Yf(Nf, 0.0);
     scalarField psat(Nf, 0.0);
     scalarField msat(Nf, 0.0);
 
@@ -94,6 +95,7 @@ void parcel::setRelaxationTimes
         label j = sDB.liquidToGasIndex()[i];
         scalar Y = sDB.composition().Y()[j][celli];        
         scalar Wi = sDB.gasProperties()[j].W();
+        Yf[i] = Y;
         Xf[i] = Y*W/Wi;
         psat[i] = fuels.properties()[i].pv(pressure, temperature);
         msat[i] = min(1.0, psat[i]/pressure)*Wi/W;
@@ -116,6 +118,22 @@ void parcel::setRelaxationTimes
     scalar rhoFuelVap = pressureAtSurface*fuels.W(X())/(specie::RR*Tf);
 
     scalarField Xs(sDB.fuels().Xs(pressure, temperature, T(), Xf, X()));
+    scalarField Ys(Nf, 0.0);
+    scalar Wliq = 0.0;
+
+    for(label i=0; i<Nf; i++)
+    {
+        label j = sDB.liquidToGasIndex()[i];
+        scalar Wi = sDB.gasProperties()[j].W();
+        Wliq += Xs[i]*Wi;
+    }
+
+    for(label i=0; i<Nf; i++)
+    {
+        label j = sDB.liquidToGasIndex()[i];
+        scalar Wi = sDB.gasProperties()[j].W();
+        Ys[i] = Xs[i]*Wi/Wliq;
+    }
 
     scalar Reynolds = Re(Up, nuf);
     scalar Prandtl = Pr(cpMixture, muf, kMixture);
@@ -238,7 +256,6 @@ void parcel::setRelaxationTimes
                     dp0 = dp;
                 }
                 
-                label j = sDB.liquidToGasIndex()[i];
                 scalar vapourSurfaceEnthalpy = 0.0;
                 scalar vapourFarEnthalpy = 0.0;
                 
@@ -266,8 +283,6 @@ void parcel::setRelaxationTimes
                     vapourSurfaceEnthalpy,
                     vapourFarEnthalpy,
                     cpMixture,
-                    Xs[i],
-                    Xf[j],
                     temperature,
                     kLiquid
                 );
diff --git a/src/lagrangian/dieselSpray/spray/findInjectorCell.H b/src/lagrangian/dieselSpray/spray/findInjectorCell.H
index c68f7deaf88ddb116dd264f5195ecba2fbd60d29..f1a8d7fc152c89feac4149d66366a0145ec9802e 100644
--- a/src/lagrangian/dieselSpray/spray/findInjectorCell.H
+++ b/src/lagrangian/dieselSpray/spray/findInjectorCell.H
@@ -22,7 +22,7 @@ reduce(foundCell, orOp<bool>());
 
 if (!foundCell)
 {
-    injectionPosition = it.position();
+    injectionPosition = it->position(n);
     injectorCell = mesh_.findCell(injectionPosition);
     
     if (injectorCell >= 0)
diff --git a/src/lagrangian/dieselSpray/spray/sprayFunctions.C b/src/lagrangian/dieselSpray/spray/sprayFunctions.C
index 2a747d52f8cb26df973edaaae9972ad32cecd9b0..5159a8179c579d21be54bc9da07cbc5352808ed8 100644
--- a/src/lagrangian/dieselSpray/spray/sprayFunctions.C
+++ b/src/lagrangian/dieselSpray/spray/sprayFunctions.C
@@ -246,7 +246,23 @@ scalar spray::liquidPenetration
     const scalar prc
 ) const
 {
-    vector ip = injectors_[nozzlei].properties()->position();
+
+    label nHoles = injectors_[nozzlei].properties()->nHoles();
+    vector ip(vector::zero);
+    if (nHoles > 1)
+    {
+        for(label i=0;i<nHoles;i++)
+        {
+            ip += injectors_[nozzlei].properties()->position(i);
+        }
+        ip /= nHoles;
+    }
+    else
+    {
+        ip = injectors_[nozzlei].properties()->position(0);
+    }
+
+//    vector ip = injectors_[nozzlei].properties()->position();
     scalar d = 0.0;
     scalar mTot = 0.0;
 
diff --git a/src/lagrangian/dieselSpray/spray/sprayInject.C b/src/lagrangian/dieselSpray/spray/sprayInject.C
index 7b3a5d94c5d58c9b5adb188c15312d368dd58f13..a42acebf58e49297ca457755a180a27d78576e97 100644
--- a/src/lagrangian/dieselSpray/spray/sprayInject.C
+++ b/src/lagrangian/dieselSpray/spray/sprayInject.C
@@ -45,24 +45,31 @@ void spray::inject()
     // Inject the parcels for each injector sequentially
     forAll(injectors_, i)
     {
-        const injectorType& it = injectors_[i].properties();
+        autoPtr<injectorType>& it = injectors()[i].properties();
+        if (!it->pressureIndependentVelocity())
+        {
+            scalar referencePressure = p().average().value();
+            it->correctProfiles(fuels(), referencePressure);
+        }
+
+        const label nHoles = it->nHoles();
 
         // parcels have the same mass during a timestep
-        scalar mass = it.mass(time0, time, twoD_, angleOfWedge_);
+        scalar mass = it->mass(time0, time, twoD_, angleOfWedge_);
 
-        label Np = it.nParcelsToInject(time0, time);
+        label Np = it->nParcelsToInject(time0, time);
 
         if (mass > 0)
         {
             Np = max(1, Np);
-            scalar mp = mass/Np;
+            scalar mp = mass/Np/nHoles;
         
             // constT is only larger than zero for the first 
             // part of the injection
             scalar constT = max
             (
                 0.0,
-                it.tsoi() - time0
+                it->tsoi() - time0
             );
 
             // deltaT is the duration of injection during this timestep
@@ -71,8 +78,8 @@ void spray::inject()
                 runTime_.deltaT().value(),
                 min
                 (
-                    time - it.tsoi(),
-                    it.teoi() - time0
+                    time - it->tsoi(),
+                    it->teoi() - time0
                 )
             );
 
@@ -81,87 +88,92 @@ void spray::inject()
                 // calculate the time of injection for parcel 'j'
                 scalar toi = time0 + constT + deltaT*j/scalar(Np);
 
-                // calculate the velocity of the injected parcel
-                vector injectionPosition = it.position
-                (
-                    toi,
-                    twoD_,
-                    angleOfWedge_,
-                    axisOfSymmetry_,
-                    axisOfWedge_,
-                    axisOfWedgeNormal_,
-                    rndGen_
-                );
-                
-                scalar diameter = injection().d0(i, toi);
-                vector direction = injection().direction(i, toi, diameter);
-                vector U = injection().velocity(i, toi)*direction;
-
-                scalar symComponent = direction & axisOfSymmetry_;
-                vector normal = direction - symComponent*axisOfSymmetry_;
-                normal /= mag(normal);
-
-                // should be set from dict or model
-                scalar deviation = breakup().y0();
-                scalar ddev = breakup().yDot0();
-
-                label injectorCell = mesh_.findCell(injectionPosition);
-                
-#               include "findInjectorCell.H"
-
-                if (injectorCell >= 0)
+                for(label n=0; n<nHoles; n++)
                 {
-                    scalar liquidCore = 1.0;
-                
-                    // construct the parcel that is to be injected
 
-                    parcel* pPtr = new parcel
+                    // calculate the velocity of the injected parcel
+                    vector injectionPosition = it->position
                     (
-                        *this,
-                        injectionPosition,
-                        injectorCell,
-                        normal,
-                        diameter,
-                        it.T(toi),
-                        mp,
-                        deviation,
-                        ddev,
-                        0.0,
-                        0.0,
-                        0.0,
-                        liquidCore,
-                        scalar(i),
-                        U,
-                        vector::zero,
-                        it.X(),
-                        fuels_->components()
+                        n,
+                        toi,
+                        twoD_,
+                        angleOfWedge_,
+                        axisOfSymmetry_,
+                        axisOfWedge_,
+                        axisOfWedgeNormal_,
+                        rndGen_
                     );
+                
+                    scalar diameter = injection().d0(i, toi);
+                    vector direction = injection().direction(i, n, toi, diameter);
+                    vector U = injection().velocity(i, toi)*direction;
 
-                    injectedLiquidKE_ += 0.5*pPtr->m()*pow(mag(U), 2.0);
-                    
-                    scalar dt = time - toi;
-
-                    pPtr->stepFraction() =
-                        (runTime_.deltaT().value() - dt)
-                       /runTime_.deltaT().value();
+                    scalar symComponent = direction & axisOfSymmetry_;
+                    vector normal = direction - symComponent*axisOfSymmetry_;
+                    normal /= mag(normal);
 
-                    bool keepParcel = pPtr->move
-                    (
-                        *this
-                    );
+                    // should be set from dict or model
+                    scalar deviation = breakup().y0();
+                    scalar ddev = breakup().yDot0();
 
-                    if (keepParcel)
-                    {
-                        addParticle(pPtr);
-                    }
-                    else
+                    label injectorCell = mesh_.findCell(injectionPosition);
+                
+#                   include "findInjectorCell.H"
+   
+                    if (injectorCell >= 0)
                     {
-                        delete pPtr;
-                    }
-                }
-            }
-        }
-    }
+                        scalar liquidCore = 1.0;
+                
+                        // construct the parcel that is to be injected
+
+                        parcel* pPtr = new parcel
+                        (
+                            *this,
+                            injectionPosition,
+                            injectorCell,
+                            normal,
+                            diameter,
+                            it->T(toi),
+                            mp,
+                            deviation,
+                            ddev,
+                            0.0,
+                            0.0,
+                            0.0,
+                            liquidCore,
+                            scalar(i),
+                            U,
+                            vector::zero,
+                            it->X(),
+                            fuels_->components()
+                        );
+
+                        injectedLiquidKE_ += 0.5*pPtr->m()*pow(mag(U), 2.0);
+                    
+                        scalar dt = time - toi;
+
+                        pPtr->stepFraction() =
+                            (runTime_.deltaT().value() - dt)
+                           /runTime_.deltaT().value();
+
+                        bool keepParcel = pPtr->move
+                        (
+                            *this
+                        );
+  
+                        if (keepParcel)
+                        {
+                            addParticle(pPtr);
+                        }
+                        else
+                        {
+                            delete pPtr;
+                        }
+                    } // if (injectorCell....
+                } // for(label n=0...
+            } // for(label j=0....
+        } // if (mass>0)...
+    } // forAll(injectors)...
 
     time0_ = time;
 }
diff --git a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C
index ffdeaf4e9ca6f1219446ed1de1ff9addaf1fe92a..47f15462ac6942be43562f5d12e1674c52a16cbd 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C
@@ -140,12 +140,18 @@ void LISA::atomizeParcel
     const injectorType& it = 
         spray_.injectors()[label(p.injector())].properties();
 
-    const vector itPosition = it.position();
+    if (it.nHoles() > 1)
+    {
+        Info << "Warning: This atomization model is not suitable for multihole injector." << endl
+             << "Only the first hole will be used." << endl;
+    }
+
+    const vector itPosition = it.position(0);
     scalar pWalk = mag(p.position() - itPosition);
 
 //  Updating liquid sheet tickness... that is the droplet diameter
-
-    const vector direction = it.direction();
+ 
+    const vector direction = it.direction(0, spray_.runTime().value());
     
     scalar h = (p.position() - itPosition) & direction;
 
diff --git a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C
index 1cb8db82ef48c8ab02696eb8a4256f9c0880d4d0..dc7f2b51f731f4f1a61140931a051f73edc68d2c 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C
@@ -112,7 +112,22 @@ void blobsSheetAtomization::atomizeParcel
     const injectorType& it =
         spray_.injectors()[label(p.injector())].properties();
 
-    const vector itPosition = it.position();
+    vector itPosition(vector::zero);
+    label nHoles = it.nHoles();
+    if (nHoles > 1)
+    {
+        for(label i=0; i<nHoles;i++)
+        {
+            itPosition += it.position(i);
+        }
+        itPosition /= nHoles;
+    }
+    else
+    {
+        itPosition = it.position(0);
+    }
+//    const vector itPosition = it.position();
+
 
     scalar lBU = B_ * sqrt
     (
diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C
index 32e0ee4f49dbadf70bd9bfd69724b260d6b18504..8b4375234c03777f8bfd786ff9fe7102984e5620 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C
@@ -169,7 +169,7 @@ void reitzKHRT::breakupParcel
     // check if we have RT breakup
     if ((p.ct() > tauRT) && (lambdaRT < p.d()))
     {
-        // the RT breakup creates diameter/lmbdaRT new droplets
+        // the RT breakup creates diameter/lambdaRT new droplets
         p.ct() = -GREAT;
         scalar multiplier = p.d()/lambdaRT;
         scalar nDrops = multiplier*Np;
@@ -200,8 +200,6 @@ void reitzKHRT::breakupParcel
 
             scalar averageParcelMass = spray_.injectors()[injector].properties()->mass()/nParcels;
 
-            // NN. Since the parcel doesn't know from which injector
-            // it comes we use the first one to obtain a 'reference' mass
             if
             (
                 (p.ms()/averageParcelMass > msLimit_)
diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C
index fa84ee812410ab16fc34019595d5d9378da27755..4643c14c8edfac5403f0ae249e7ebefd5b3eb50c 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C
@@ -196,8 +196,6 @@ scalar RutlandFlashBoil::boilingTime
     const scalar vapourSurfaceEnthalpy,
     const scalar vapourFarEnthalpy,
     const scalar cpGas,
-    const scalar Xs,
-    const scalar Xf,    
     const scalar temperature,
     const scalar kLiq
 ) const
diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.H b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.H
index 010899df2e557e3c466ac2091fb3d84cccdce29d..6b1589ce5a554322694a85bc4b8f43e23d9ab4a5 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.H
@@ -135,8 +135,6 @@ public:
             const scalar vapourSurfaceEnthalpy,
             const scalar vapourFarEnthalpy,
             const scalar cpGas,
-            const scalar Xs,
-            const scalar Xf,
             const scalar temperature,
             const scalar kLiquid
         ) const;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/evaporationModel.H b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/evaporationModel.H
index a2493609d4819fc417745fe6facd9abe24b26382..e336bc574b945b3b5b0e569ac4f499654b0ac503 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/evaporationModel.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/evaporationModel.H
@@ -143,8 +143,6 @@ public:
             const scalar vapourSurfaceEnthalpy,
             const scalar vapourFarEnthalpy,
             const scalar cpGas,
-            const scalar Xs,
-            const scalar Xf,
             const scalar temperature,
             const scalar kLiq
         ) const = 0;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.C b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.C
index ce506315ce1277448622aa217a549dd2c7e94e48..558ddda1594167316783008e90ee637f320d5f58 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.C
@@ -114,8 +114,6 @@ scalar noEvaporation::boilingTime
     const scalar,
     const scalar,
     const scalar,
-    const scalar,
-    const scalar,
     const scalar
 ) const
 {
diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.H b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.H
index a17dd809632cfd360819392ecb281b3bbf0ce9fd..b4bdc272840072142cd4cba70c675847dfef9d9b 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.H
@@ -111,8 +111,6 @@ public:
             const scalar vapourSurfaceEnthalpy,
             const scalar vapourFarEnthalpy,
             const scalar cpGas,
-            const scalar Xs,
-            const scalar Xf,
             const scalar temperature,
             const scalar kLiq
         ) const;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.C b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.C
index 944dd4df5ab8468f68b9e6aa52edf296d2fec55d..2c27286ca6d222dc71284106c83193c35980bd46 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.C
@@ -117,8 +117,6 @@ scalar saturateEvaporationModel::boilingTime
     const scalar, 
     const scalar, 
     const scalar, 
-    const scalar, 
-    const scalar, 
     const scalar 
 ) const
 {
diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.H b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.H
index 1c02d95750a682844e0e6360e411b06ff292f880..51dfdf98acee248b654a5e8456ff0fbe281f6a17 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.H
@@ -123,8 +123,6 @@ public:
             const scalar, 
             const scalar, 
             const scalar, 
-            const scalar, 
-            const scalar, 
             const scalar 
         ) const;
 
diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.C b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.C
index e1d39fceb6a3005ee8dcb19064bc6781efd9da7f..832dedc94b254293dff0f65979fd2f1544294206 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.C
@@ -181,8 +181,6 @@ scalar standardEvaporationModel::boilingTime
     const scalar, 
     const scalar, 
     const scalar, 
-    const scalar, 
-    const scalar, 
     const scalar 
 ) const
 {
diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.H b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.H
index 8527c5607d0f1a09b39da78f624662bc4986d505..a7c573b49811dddd29ef9745b0a2ab49b3339899 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.H
@@ -127,8 +127,6 @@ public:
             const scalar, 
             const scalar, 
             const scalar, 
-            const scalar, 
-            const scalar, 
             const scalar 
         ) const;
 
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C
index 71112ffa76fcd838fc38fb6f5fed2bf78cd9b190..f6740ec4fb7eaccc532625f6d49db9634cff3955 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C
@@ -64,9 +64,7 @@ ChomiakInjector::ChomiakInjector
             sm.rndGen()
         )
     ),
-    maxSprayAngle_(ChomiakDict_.lookup("maxSprayConeAngle")),
-    tan1_(maxSprayAngle_.size()),
-    tan2_(maxSprayAngle_.size())
+    maxSprayAngle_(ChomiakDict_.lookup("maxSprayConeAngle"))
 {
 
     if (sm.injectors().size() != maxSprayAngle_.size())
@@ -77,24 +75,6 @@ ChomiakInjector::ChomiakInjector
             << abort(FatalError);
     }
 
-    forAll(sm.injectors(), i)
-    {
-        Random rndGen(label(0));
-        vector dir = sm.injectors()[i].properties()->direction();
-        scalar magV = 0.0;
-        vector tangent;
-        
-        while (magV < SMALL)
-        {
-            vector testThis = rndGen.vector01();
-            
-            tangent = testThis - (testThis & dir)*dir;
-            magV = mag(tangent);
-        }
-        
-        tan1_[i] = tangent/magV;
-        tan2_[i] = dir ^ tan1_[i];
-    }
     scalar referencePressure = sm.p().average().value();
 
     // correct velocityProfile
@@ -127,7 +107,8 @@ scalar ChomiakInjector::d0
 vector ChomiakInjector::direction
 (
     const label n,
-    const scalar,
+    const label hole,
+    const scalar time,
     const scalar d
 ) const
 {
@@ -162,13 +143,13 @@ vector ChomiakInjector::direction
     {
         normal = alpha*
         (
-            tan1_[n]*cos(beta) +
-            tan2_[n]*sin(beta)
+            injectors_[n].properties()->tan1(hole)*cos(beta) +
+            injectors_[n].properties()->tan2(hole)*sin(beta)
         );
     }
     
     // set the direction of injection by adding the normal vector
-    vector dir = dcorr*injectors_[n].properties()->direction() + normal;
+    vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal;
     dir /= mag(dir);
 
     return dir;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.H
index 58194d6d977759e500ae9d1784ee98bcbd0170b1..fc754e63bf5b9919ac3f3824ce39770b2baaee9e 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.H
@@ -67,10 +67,6 @@ private:
         autoPtr<pdf> dropletPDF_;
         scalarList maxSprayAngle_;
 
-    // two perpendicular vectors, perpendicular to injection direction
-        List<vector> tan1_;
-        List<vector> tan2_;
-
 public:
 
     //- Runtime type information
@@ -100,7 +96,8 @@ public:
         //- Return the spray angle of the injector
         vector direction
         (
-            const label injector, 
+            const label injector,
+            const label hole, 
             const scalar time,
             const scalar d
         ) const;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C
index a15d1336916f6f47d24a3c615651fd9fba9a17f8..e6925c68c13bf48aa1a3cd09d8df3e038c0e1e44 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C
@@ -67,9 +67,7 @@ blobsSwirlInjector::blobsSwirlInjector
     angle_(0.0),
     u_(0.0),
     x_(0.0),
-    h_(0.0),
-    tan1_(coneAngle_.size()),
-    tan2_(coneAngle_.size())
+    h_(0.0)
 {
 
     if (sm.injectors().size() != coneAngle_.size())
@@ -80,26 +78,6 @@ blobsSwirlInjector::blobsSwirlInjector
             << abort(FatalError);
     }
 
-
-    forAll(sm.injectors(), i)
-    {
-        Random rndGen(label(0));
-        vector dir = sm.injectors()[i].properties()->direction();
-        scalar magV = 0.0;
-        vector tangent;
-        
-        while (magV < SMALL)
-        {
-            vector testThis = rndGen.vector01();
-            
-            tangent = testThis - (testThis & dir)*dir;
-            magV = mag(tangent);
-        }
-        
-        tan1_[i] = tangent/magV;
-        tan2_[i] = dir ^ tan1_[i];
-    }
-
     scalar referencePressure = sm.p().average().value();
 
     // correct velocityProfile
@@ -156,8 +134,9 @@ scalar blobsSwirlInjector::d0
 vector blobsSwirlInjector::direction
 (
     const label n,
-    const scalar,
-    const scalar
+    const label hole,
+    const scalar time,
+    const scalar d
 ) const
 {
 
@@ -186,13 +165,13 @@ vector blobsSwirlInjector::direction
     {
         normal = alpha*
         (
-            tan1_[n]*cos(beta) +
-            tan2_[n]*sin(beta)
+            injectors_[n].properties()->tan1(hole)*cos(beta) +
+            injectors_[n].properties()->tan2(hole)*sin(beta)
         );
     }
     
     // set the direction of injection by adding the normal vector
-    vector dir = dcorr*injectors_[n].properties()->direction() + normal;
+    vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal;
     dir /= mag(dir);
 
     return dir;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.H
index de0e2f278f719f44f55a39a31e1e0e8a0c0f615f..200a6cb1d42b1224f5285a5ab3ee3a04b817579b 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.H
@@ -90,10 +90,6 @@ private:
 
         mutable scalar h_;
 
-    // two perpendicular vectors, perpendicular to injection direction
-        List<vector> tan1_;
-        List<vector> tan2_;
-
     // private member functions
 
         scalar kv
@@ -142,6 +138,7 @@ public:
         vector direction
         (
             const label injector,
+            const label hole,
             const scalar time,
             const scalar d
         ) const;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C
index b5bad617283ecc7c1a9b33af1de7b393550b9aac..52ca12ee6a73b071fa294dbf93eefb96c3c74a21 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C
@@ -57,9 +57,7 @@ constInjector::constInjector
     injectorModel(dict, sm),
     specDict_(dict.subDict(typeName + "Coeffs")),
     dropletNozzleDiameterRatio_(specDict_.lookup("dropletNozzleDiameterRatio")),
-    sprayAngle_(specDict_.lookup("sprayAngle")),
-    tan1_(sprayAngle_.size()),
-    tan2_(sprayAngle_.size())
+    sprayAngle_(specDict_.lookup("sprayAngle"))
 {
     if (sm.injectors().size() != dropletNozzleDiameterRatio_.size())
     {
@@ -77,26 +75,6 @@ constInjector::constInjector
             << abort(FatalError);
     }
 
-
-    forAll(sm.injectors(), i)
-    {
-        Random rndGen(label(0));
-        vector dir = sm.injectors()[i].properties()->direction();
-        scalar magV = 0.0;
-        vector tangent;
-        
-        while (magV < SMALL)
-        {
-            vector testThis = rndGen.vector01();
-            
-            tangent = testThis - (testThis & dir)*dir;
-            magV = mag(tangent);
-        }
-        
-        tan1_[i] = tangent/magV;
-        tan2_[i] = dir ^ tan1_[i];
-    }
-
     scalar referencePressure = sm.p().average().value();
 
     // correct velocity and pressure profiles
@@ -129,12 +107,11 @@ scalar constInjector::d0
 vector constInjector::direction
 (
     const label n,
-    const scalar,
-    const scalar
+    const label hole,
+    const scalar time,
+    const scalar d
 ) const
 {
-    //    return sprayAngle_[n];
-
 
     /*
         randomly distribute parcels in a solid cone
@@ -179,13 +156,13 @@ vector constInjector::direction
     {
         normal = alpha*
         (
-            tan1_[n]*cos(beta) +
-            tan2_[n]*sin(beta)
+            injectors_[n].properties()->tan1(hole)*cos(beta) +
+            injectors_[n].properties()->tan2(hole)*sin(beta)
         );
     }
     
     // set the direction of injection by adding the normal vector
-    vector dir = dcorr*injectors_[n].properties()->direction() + normal;
+    vector dir = dcorr*injectors_[n].properties()->direction(n, time) + normal;
     dir /= mag(dir);
 
     return dir;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.H
index 67fe880c0f3c023e506a8081443634c547ca11d6..4a41808c4b6153fb4f6b63fce7199e3b29edd64d 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.H
@@ -59,10 +59,6 @@ private:
         scalarList dropletNozzleDiameterRatio_;
         scalarList sprayAngle_;
 
-    // two perpendicular vectors, perpendicular to injection direction
-        List<vector> tan1_;
-        List<vector> tan2_;
-
 public:
 
     //- Runtime type information
@@ -93,6 +89,7 @@ public:
         vector direction
         (
             const label injector, 
+            const label hole,
             const scalar time,
             const scalar d
         ) const;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C
index 6f06bb17528c7806a5fcfb30eb079244eb0e1711..740108fdf5ccd5db75d9e8b5e9bac463dd23a72a 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C
@@ -65,9 +65,7 @@ definedHollowConeInjector::definedHollowConeInjector
         )
     ),
     innerConeAngle_(definedHollowConeDict_.lookup("innerConeAngle")),
-    outerConeAngle_(definedHollowConeDict_.lookup("outerConeAngle")),
-    tan1_(sm.injectors().size()),
-    tan2_(sm.injectors().size())
+    outerConeAngle_(definedHollowConeDict_.lookup("outerConeAngle"))
 {
 
     // convert CA to real time - inner cone angle
@@ -109,26 +107,6 @@ definedHollowConeInjector::definedHollowConeInjector
              << abort(FatalError);
     }
 
-    // initialise injectors
-    forAll(sm.injectors(), i)
-    {
-        Random rndGen(label(0));
-        vector dir = sm.injectors()[i].properties()->direction();
-        scalar magV = 0.0;
-        vector tangent;
-        
-        while (magV < SMALL)
-        {
-            vector testThis = rndGen.vector01();
-            
-            tangent = testThis - (testThis & dir)*dir;
-            magV = mag(tangent);
-        }
-        
-        tan1_[i] = tangent/magV;
-        tan2_[i] = dir ^ tan1_[i];
-    }
-
     scalar referencePressure = sm.p().average().value();
     // correct pressureProfile
     forAll(sm.injectors(), i)
@@ -162,6 +140,7 @@ scalar definedHollowConeInjector::d0
 vector definedHollowConeInjector::direction
 (
     const label n,
+    const label hole,
     const scalar t,
     const scalar d
 ) const
@@ -201,13 +180,13 @@ vector definedHollowConeInjector::direction
     {
         normal = alpha*
         (
-            tan1_[n]*cos(beta) +
-            tan2_[n]*sin(beta)
+            injectors_[n].properties()->tan1(hole)*cos(beta) +
+            injectors_[n].properties()->tan2(hole)*sin(beta)
         );
     }
     
     // set the direction of injection by adding the normal vector
-    vector dir = dcorr*injectors_[n].properties()->direction() + normal;
+    vector dir = dcorr*injectors_[n].properties()->direction(hole, t) + normal;
     // normailse direction vector
     dir /= mag(dir);
 
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.H
index 81023e49a9df4e1b8c961d7f8b326a51d87b80c4..83d9613667ca05ef8c26faf1f79eec711d2b6480 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.H
@@ -68,11 +68,6 @@ private:
         List<pair> innerConeAngle_;
         List<pair> outerConeAngle_;
 
-        // two perpendicular vectors, perpendicular to injection direction
-        List<vector> tan1_;
-        List<vector> tan2_;
-
-
 public:
 
     //- Runtime type information
@@ -102,7 +97,8 @@ public:
         //- Return the spray angle of the injector
         vector direction
         (
-            const label injector, 
+            const label injector,
+            const label hole,
             const scalar time,
             const scalar d
         ) const;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C
index 730eee8240c8f0c98780260d4d90e5c954a59f56..c3f56b07f985e5ab3c3ea7b8a54f51c3fff0a0db 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C
@@ -61,32 +61,9 @@ definedPressureSwirlInjector::definedPressureSwirlInjector
     coneInterval_(definedPressureSwirlInjectorDict_.lookup("ConeInterval")),
     maxKv_(definedPressureSwirlInjectorDict_.lookup("maxKv")),
 
-    angle_(0.0),
-    tan1_(coneAngle_.size()),
-    tan2_(coneAngle_.size())
+    angle_(0.0)
 {
 
-
-
-    forAll(sm.injectors(), i)
-    {
-        Random rndGen(label(0));
-        vector dir = sm.injectors()[i].properties()->direction();
-        scalar magV = 0.0;
-        vector tangent;
-        
-        while (magV < SMALL)
-        {
-            vector testThis = rndGen.vector01();
-            
-            tangent = testThis - (testThis & dir)*dir;
-            magV = mag(tangent);
-        }
-        
-        tan1_[i] = tangent/magV;
-        tan2_[i] = dir ^ tan1_[i];
-    }
-
     scalar referencePressure = sm.p().average().value();
 
     // correct velocityProfile
@@ -219,8 +196,9 @@ scalar definedPressureSwirlInjector::d0
 vector definedPressureSwirlInjector::direction
 (
     const label n,
-    const scalar,
-    const scalar
+    const label hole,
+    const scalar time,
+    const scalar d
 ) const
 {
 
@@ -249,13 +227,13 @@ vector definedPressureSwirlInjector::direction
     {
         normal = alpha*
         (
-            tan1_[n]*cos(beta) +
-            tan2_[n]*sin(beta)
+            injectors_[n].properties()->tan1(hole)*cos(beta) +
+            injectors_[n].properties()->tan2(hole)*sin(beta)
         );
     }
     
     // set the direction of injection by adding the normal vector
-    vector dir = dcorr*injectors_[n].properties()->direction() + normal;
+    vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal;
     dir /= mag(dir);
 
     return dir;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.H
index 14415d789b343fbd88fbd71f6bc6611d5a5d4e85..e84dd8f43ef618eb766c0263b60e55e2f5cd13f4 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.H
@@ -71,10 +71,6 @@ private:
     // The initial velocity for the parcels
         mutable scalar u_;
 
-    // two perpendicular vectors, perpendicular to injection direction
-        List<vector> tan1_;
-        List<vector> tan2_;
-
     // private member functions
 
         scalar kv
@@ -118,6 +114,7 @@ public:
         vector direction
         (
             const label injector,
+            const label hole,
             const scalar time,
             const scalar d
         ) const;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C
index 2121a803f11ee6c3ecd9859805069b37e284052f..001102e4f8591470fce95d690f34bb23ddcc2cba 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C
@@ -65,9 +65,7 @@ hollowConeInjector::hollowConeInjector
         )
     ),
     innerAngle_(hollowConeDict_.lookup("innerConeAngle")),
-    outerAngle_(hollowConeDict_.lookup("outerConeAngle")),
-    tan1_(outerAngle_.size()),
-    tan2_(outerAngle_.size())
+    outerAngle_(hollowConeDict_.lookup("outerConeAngle"))
 {
 
     if (sm.injectors().size() != innerAngle_.size())
@@ -86,26 +84,8 @@ hollowConeInjector::hollowConeInjector
             << abort(FatalError);
     }
 
-    forAll(sm.injectors(), i)
-    {
-        Random rndGen(label(0));
-        vector dir = sm.injectors()[i].properties()->direction();
-        scalar magV = 0.0;
-        vector tangent;
-        
-        while (magV < SMALL)
-        {
-            vector testThis = rndGen.vector01();
-            
-            tangent = testThis - (testThis & dir)*dir;
-            magV = mag(tangent);
-        }
-        
-        tan1_[i] = tangent/magV;
-        tan2_[i] = dir ^ tan1_[i];
-    }
-
     scalar referencePressure = sm.ambientPressure();
+
     // correct velocityProfile
     forAll(sm.injectors(), i)
     {
@@ -136,8 +116,9 @@ scalar hollowConeInjector::d0
 vector hollowConeInjector::direction
 (
     const label n,
-    const scalar,
-    const scalar
+    const label hole,
+    const scalar time,
+    const scalar d
 ) const
 {
     scalar angle = innerAngle_[n] + rndGen_.scalar01()*(outerAngle_[n]-innerAngle_[n]);
@@ -166,13 +147,13 @@ vector hollowConeInjector::direction
     {
         normal = alpha*
         (
-            tan1_[n]*cos(beta) +
-            tan2_[n]*sin(beta)
+            injectors_[n].properties()->tan1(hole)*cos(beta) +
+            injectors_[n].properties()->tan2(hole)*sin(beta)
         );
     }
     
     // set the direction of injection by adding the normal vector
-    vector dir = dcorr*injectors_[n].properties()->direction() + normal;
+    vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal;
     dir /= mag(dir);
 
     return dir;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.H
index e53b6afcbb9b9135cc88addbf79d319ac1a836ad..c0469b997c73ff4eb9d384a76430256cf5d1a0bc 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.H
@@ -63,10 +63,6 @@ private:
         scalarList innerAngle_;
         scalarList outerAngle_;
 
-    // two perpendicular vectors, perpendicular to injection direction
-        List<vector> tan1_;
-        List<vector> tan2_;
-
 public:
 
     //- Runtime type information
@@ -96,7 +92,8 @@ public:
         //- Return the spray angle of the injector
         vector direction
         (
-            const label injector, 
+            const label injector,
+            const label hole,
             const scalar time,
             const scalar d
         ) const;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/injectorModel.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/injectorModel.H
index b099208287ce7c304bac71a97752c2c92893241d..22bd419508a32dea6d20ffc66332b48af5d8ff74 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/injectorModel.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/injectorModel.H
@@ -118,6 +118,7 @@ public:
         virtual vector direction
         (
             const label injector, 
+            const label hole,
             const scalar time,
             const scalar d
         ) const = 0;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C
index 83dba60703e261c8652b154e9ac5ee52349b233d..86d419c8d8d798b84bf55bd2993c109563640187 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C
@@ -61,9 +61,7 @@ pressureSwirlInjector::pressureSwirlInjector
     coneInterval_(pressureSwirlInjectorDict_.lookup("ConeInterval")),
     maxKv_(pressureSwirlInjectorDict_.lookup("maxKv")),
 
-    angle_(0.0),
-    tan1_(coneAngle_.size()),
-    tan2_(coneAngle_.size())
+    angle_(0.0)
 {
 
     if (sm.injectors().size() != coneAngle_.size())
@@ -74,26 +72,6 @@ pressureSwirlInjector::pressureSwirlInjector
             << abort(FatalError);
     }
 
-
-    forAll(sm.injectors(), i)
-    {
-        Random rndGen(label(0));
-        vector dir = sm.injectors()[i].properties()->direction();
-        scalar magV = 0.0;
-        vector tangent;
-        
-        while (magV < SMALL)
-        {
-            vector testThis = rndGen.vector01();
-            
-            tangent = testThis - (testThis & dir)*dir;
-            magV = mag(tangent);
-        }
-        
-        tan1_[i] = tangent/magV;
-        tan2_[i] = dir ^ tan1_[i];
-    }
-
     scalar referencePressure = sm.p().average().value();
 
     // correct velocityProfile
@@ -147,8 +125,9 @@ scalar pressureSwirlInjector::d0
 vector pressureSwirlInjector::direction
 (
     const label n,
-    const scalar,
-    const scalar
+    const label hole,
+    const scalar time,
+    const scalar d
 ) const
 {
 
@@ -177,13 +156,13 @@ vector pressureSwirlInjector::direction
     {
         normal = alpha*
         (
-            tan1_[n]*cos(beta) +
-            tan2_[n]*sin(beta)
+            injectors_[n].properties()->tan1(hole)*cos(beta) +
+            injectors_[n].properties()->tan2(hole)*sin(beta)
         );
     }
     
     // set the direction of injection by adding the normal vector
-    vector dir = dcorr*injectors_[n].properties()->direction() + normal;
+    vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal;
     dir /= mag(dir);
 
     return dir;
diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.H
index d57312871377c9bc0aa57dcc0a60c2034185a1a4..91e5bc9f1a118ec1fc30be5f4a926dd9006ea891 100644
--- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.H
+++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.H
@@ -68,10 +68,6 @@ private:
     // The initial velocity for the parcels           
         mutable scalar u_;
 
-    // two perpendicular vectors, perpendicular to injection direction
-        List<vector> tan1_;
-        List<vector> tan2_;
-
     // private member functions
         
         scalar kv
@@ -113,7 +109,8 @@ public:
         //- Return the spray angle of the injector
         vector direction
         (
-            const label injector, 
+            const label injector,
+            const label hole, 
             const scalar time,
             const scalar d
         ) const;
diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C
index dc32224a008a363eec88c75452cdc59bf479c080..1a594764378b2d237cb8aaf0c5b93654ef62e9b5 100644
--- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C
+++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C
@@ -35,65 +35,6 @@ License
 
 // * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * * //
 
-template<class ParcelType>
-void Foam::KinematicCloud<ParcelType>::setInjectorCellAndPosition
-(
-    label& pCell,
-    vector& pPosition
-)
-{
-    const vector originalPosition = pPosition;
-
-    bool foundCell = false;
-
-    pCell = mesh_.findCell(pPosition);
-
-    if (pCell >= 0)
-    {
-        const vector& C = mesh_.C()[pCell];
-        pPosition += 1.0e-6*(C - pPosition);
-
-        foundCell = mesh_.pointInCell
-        (
-            pPosition,
-            pCell
-        );
-    }
-    reduce(foundCell, orOp<bool>());
-
-    // Last chance - find nearest cell and try that one
-    // - the point is probably on an edge
-    if (!foundCell)
-    {
-        pCell =  mesh_.findNearestCell(pPosition);
-
-        if (pCell >= 0)
-        {
-            const vector& C = mesh_.C()[pCell];
-            pPosition += 1.0e-6*(C - pPosition);
-
-            foundCell = mesh_.pointInCell
-            (
-                pPosition,
-                pCell
-            );
-        }
-        reduce(foundCell, orOp<bool>());
-    }
-
-    if (!foundCell)
-    {
-        FatalErrorIn
-        (
-            "void KinematicCloud<ParcelType>::findInjectorCell"
-            "(label&, vector&)"
-        )<< "Cannot find parcel injection cell. "
-         << "Parcel position = " << originalPosition << nl
-         << abort(FatalError);
-    }
-}
-
-
 template<class ParcelType>
 Foam::scalar Foam::KinematicCloud<ParcelType>::setNumberOfParticles
 (
@@ -324,7 +265,7 @@ void Foam::KinematicCloud<ParcelType>::evolve()
         g_.value()
     );
 
-    inject(td);
+    inject();
 
     if (coupled_)
     {
@@ -336,15 +277,11 @@ void Foam::KinematicCloud<ParcelType>::evolve()
 
 
 template<class ParcelType>
-template<class TrackingData>
-void Foam::KinematicCloud<ParcelType>::inject
-(
-    TrackingData& td
-)
+void Foam::KinematicCloud<ParcelType>::inject()
 {
     scalar time = this->db().time().value();
 
-    scalar pRho = td.constProps().rho0();
+    scalar pRho = constProps_.rho0();
 
     this->injection().prepareForNextTimeStep(time0_, time);
 
@@ -419,21 +356,21 @@ void Foam::KinematicCloud<ParcelType>::inject
 
         // Determine the injection cell
         label pCell = -1;
-        setInjectorCellAndPosition(pCell, pPosition);
+        this->injection().findInjectorCellAndPosition(pCell, pPosition);
 
         if (pCell >= 0)
         {
             // construct the parcel that is to be injected
             ParcelType* pPtr = new ParcelType
             (
-                td.cloud(),
+                *this,
                 parcelTypeId_,
                 pPosition,
                 pCell,
                 pDiameter,
                 pU,
                 pNumberOfParticles,
-                td.constProps()
+                constProps_
             );
 
             scalar dt = time - timeInj;
@@ -441,7 +378,7 @@ void Foam::KinematicCloud<ParcelType>::inject
             pPtr->stepFraction() = (this->db().time().deltaT().value() - dt)
                 /this->time().deltaT().value();
 
-            this->injectParcel(td, pPtr);
+            this->injectParcel(pPtr);
          }
     }
 
@@ -455,12 +392,7 @@ void Foam::KinematicCloud<ParcelType>::inject
 
 
 template<class ParcelType>
-template<class TrackingData>
-void Foam::KinematicCloud<ParcelType>::injectParcel
-(
-    TrackingData& td,
-    ParcelType* p
-)
+void Foam::KinematicCloud<ParcelType>::injectParcel(ParcelType* p)
 {
     addParticle(p);
     nParcelsAdded_++;
diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H
index ebd298c44ef8e6444a32e212b3a5ae2ea2f941c3..0d3781413cbb72236afdd2554dc640890e9fba92 100644
--- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H
+++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H
@@ -223,13 +223,6 @@ protected:
 
     // Protected member functions
 
-        //- Set parcel position and cell into which parcel is introduced
-        void setInjectorCellAndPosition
-        (
-            label& pCell,
-            vector& pPosition
-        );
-
         //- Set the number of particles per parcel
         scalar setNumberOfParticles
         (
@@ -241,16 +234,10 @@ protected:
         );
 
         //- Inject more parcels
-        template<class TrackingData>
-        void inject(TrackingData& td);
+        void inject();
 
         //- Inject parcel if it is valid - delete otherwise
-        template<class TrackingData>
-        void injectParcel
-        (
-            TrackingData& td,
-            ParcelType* p
-        );
+        void injectParcel(ParcelType* p);
 
         //- Post-injection checks
         void postInjectCheck();
diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C
index 1f358d6f6cf2c5fa4b5d1c90fb6a1b727d71f457..4bad7642727b81043196feb55ebc140a557f83bd 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C
+++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C
@@ -174,7 +174,7 @@ void Foam::ReactingCloud<ParcelType>::evolve()
         this->g().value()
     );
 
-    inject(td);
+    inject();
 
     if (this->coupled())
     {
@@ -186,15 +186,11 @@ void Foam::ReactingCloud<ParcelType>::evolve()
 
 
 template<class ParcelType>
-template<class TrackingData>
-void Foam::ReactingCloud<ParcelType>::inject
-(
-    TrackingData& td
-)
+void Foam::ReactingCloud<ParcelType>::inject()
 {
     scalar time = this->db().time().value();
 
-    scalar pRho = td.constProps().rho0();
+    scalar pRho = this->constProps().rho0();
 
     this->injection().prepareForNextTimeStep(this->time0(), time);
 
@@ -269,14 +265,14 @@ void Foam::ReactingCloud<ParcelType>::inject
 
         // Determine the injection cell
         label pCell = -1;
-        this->setInjectorCellAndPosition(pCell, pPosition);
+        this->injection().findInjectorCellAndPosition(pCell, pPosition);
 
         if (pCell >= 0)
         {
             // construct the parcel that is to be injected
             ParcelType* pPtr = new ParcelType
             (
-                td.cloud(),
+                *this,
                 this->parcelTypeId(),
                 pPosition,
                 pCell,
@@ -287,7 +283,7 @@ void Foam::ReactingCloud<ParcelType>::inject
                 composition().YLiquid0(),
                 composition().YSolid0(),
                 composition().YMixture0(),
-                td.constProps()
+                this->constProps()
             );
 
             scalar dt = time - timeInj;
@@ -295,7 +291,7 @@ void Foam::ReactingCloud<ParcelType>::inject
             pPtr->stepFraction() = (this->db().time().deltaT().value() - dt)
                 /this->db().time().deltaT().value();
 
-            this->injectParcel(td, pPtr);
+            this->injectParcel(pPtr);
          }
     }
 
diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H
index d1c60f5a974c0c3070b7f515005eed318a94f993..9ce5c98b1aa35210762b134ebfc4510a0a611e30 100644
--- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H
+++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H
@@ -117,8 +117,7 @@ class ReactingCloud
 protected:
 
     //- Inject more parcels
-    template<class TrackingData>
-    void inject(TrackingData& td);
+    void inject();
 
 
 public:
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C
index d6605d6f46d0a1d527b22730a8640c0c6a1ca34a..f23dc19c0a1d9aeb8a8430bd7afb4de79920559f 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C
+++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C
@@ -159,6 +159,57 @@ void Foam::InjectionModel<CloudType>::prepareForNextTimeStep
 }
 
 
+template<class CloudType>
+void Foam::InjectionModel<CloudType>::findInjectorCellAndPosition
+(
+    label& cellI,
+    vector& position
+)
+{
+    const vector p0 = position;
+
+    bool foundCell = false;
+
+    cellI = owner_.mesh().findCell(position);
+
+    if (cellI >= 0)
+    {
+        const vector& C = owner_.mesh().C()[cellI];
+        position += 1.0e-6*(C - position);
+
+        foundCell = owner_.mesh().pointInCell(position, cellI);
+    }
+    reduce(foundCell, orOp<bool>());
+
+    // Last chance - find nearest cell and try that one
+    // - the point is probably on an edge
+    if (!foundCell)
+    {
+        cellI = owner_.mesh().findNearestCell(position);
+
+        if (cellI >= 0)
+        {
+            const vector& C = owner_.mesh().C()[cellI];
+            position += 1.0e-6*(C - position);
+
+            foundCell = owner_.mesh().pointInCell(position, cellI);
+        }
+        reduce(foundCell, orOp<bool>());
+    }
+
+    if (!foundCell)
+    {
+        FatalErrorIn
+        (
+            "InjectionModel<CloudType>::setInjectorCellAndPosition"
+            "(label&, vector&)"
+        )<< "Cannot find parcel injection cell. "
+         << "Parcel position = " << p0 << nl
+         << abort(FatalError);
+    }
+}
+
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 #include "NewInjectionModel.C"
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H
index f19d59723fb955cf9c3e5560fbda1274f2fdee72..0b00ebeda95c90c63448921a79cdd16e12744962 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H
+++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H
@@ -208,6 +208,14 @@ public:
 
         // Injection geometry
 
+            //- Find the cell that contains the injector position
+            //  Will modify position slightly towards the owner cell centroid
+            virtual void findInjectorCellAndPosition
+            (
+                label& cellI,
+                vector& position
+            );
+
             //- Return the injection position
             virtual vector position
             (
diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files
index 99587f8d3c07989d6e6af07e0766db4f9df8c4f7..86d1fe3ddb7b3ba9d88cd2735e351cb79327fecd 100644
--- a/src/meshTools/Make/files
+++ b/src/meshTools/Make/files
@@ -87,6 +87,7 @@ $(cellSources)/nearestToCell/nearestToCell.C
 $(cellSources)/nbrToCell/nbrToCell.C
 $(cellSources)/zoneToCell/zoneToCell.C
 $(cellSources)/sphereToCell/sphereToCell.C
+$(cellSources)/cylinderToCell/cylinderToCell.C
 
 faceSources = sets/faceSources
 $(faceSources)/faceToFace/faceToFace.C
diff --git a/src/meshTools/cellFeatures/cellFeatures.C b/src/meshTools/cellFeatures/cellFeatures.C
index 3107dc79b0d36c09477ee30eb4259e34e969f8d7..b4838a7addf20e6761835bc03f39b7f2d23f3b2a 100644
--- a/src/meshTools/cellFeatures/cellFeatures.C
+++ b/src/meshTools/cellFeatures/cellFeatures.C
@@ -369,8 +369,6 @@ void Foam::cellFeatures::calcSuperFaces() const
                 }
                 else
                 {
-                    superFace.shrink();
-
                     faces[superFaceI].transfer(superFace);
                 }
             }
diff --git a/src/meshTools/indexedOctree/indexedOctree.C b/src/meshTools/indexedOctree/indexedOctree.C
index b8b18401df14a35a14a0143fb6ea6afdd1639fbc..dab1353dd38f72873474f259fc55802112d277a7 100644
--- a/src/meshTools/indexedOctree/indexedOctree.C
+++ b/src/meshTools/indexedOctree/indexedOctree.C
@@ -183,9 +183,7 @@ void indexedOctree<Type>::divide
     result.setSize(8);
     for (direction octant = 0; octant < subIndices.size(); octant++)
     {
-        subIndices[octant].shrink();
         result[octant].transfer(subIndices[octant]);
-        subIndices[octant].clear();
     }
 }
 
diff --git a/src/meshTools/regionSplit/regionSplit.C b/src/meshTools/regionSplit/regionSplit.C
index 0b500536a85dc170f26fb443600f26abdb75db0d..e93674ca7dde79f1be007523e30cc4834dfab6cb 100644
--- a/src/meshTools/regionSplit/regionSplit.C
+++ b/src/meshTools/regionSplit/regionSplit.C
@@ -250,8 +250,7 @@ void Foam::regionSplit::fillSeedMask
         //        << newChangedFaces.size() << endl;
         //}
 
-        changedFaces.transfer(newChangedFaces.shrink());
-        newChangedFaces.clear();
+        changedFaces.transfer(newChangedFaces);
     }
 }
 
diff --git a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C
index e3c42e77beea8e9e198d48e601dba2746ba2f409..63b85e1d686fc66aa514e80b30612d1371b4a5c2 100644
--- a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C
+++ b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C
@@ -239,12 +239,11 @@ Foam::distributedTriSurfaceMesh::constructSegments
         sendMap.setSize(Pstream::nProcs());
         forAll(sendMap, procI)
         {
-            dynSendMap[procI].shrink();
             sendMap[procI].transfer(dynSendMap[procI]);
         }
 
-        allSegments.transfer(dynAllSegments.shrink());
-        allSegmentMap.transfer(dynAllSegmentMap.shrink());
+        allSegments.transfer(dynAllSegments);
+        allSegmentMap.transfer(dynAllSegmentMap);
     }
 
 
@@ -704,13 +703,12 @@ Foam::distributedTriSurfaceMesh::calcLocalQueries
         sendMap.setSize(Pstream::nProcs());
         forAll(sendMap, procI)
         {
-            dynSendMap[procI].shrink();
             sendMap[procI].transfer(dynSendMap[procI]);
         }
 
-        allCentres.transfer(dynAllCentres.shrink());
-        allRadiusSqr.transfer(dynAllRadiusSqr.shrink());
-        allSegmentMap.transfer(dynAllSegmentMap.shrink());
+        allCentres.transfer(dynAllCentres);
+        allRadiusSqr.transfer(dynAllRadiusSqr);
+        allSegmentMap.transfer(dynAllSegmentMap);
     }
 
 
diff --git a/src/meshTools/searchableSurface/searchableBox.C b/src/meshTools/searchableSurface/searchableBox.C
index 34e3faec99b2c04976ea4701d33d07696f49c2f4..3ed3b90c6e1b5429f0b41d46cf01964ed5fd55dd 100644
--- a/src/meshTools/searchableSurface/searchableBox.C
+++ b/src/meshTools/searchableSurface/searchableBox.C
@@ -482,7 +482,6 @@ void Foam::searchableBox::findLineAll
                 pt = inter.hitPoint() + smallVec[pointI];
             }
 
-            hits.shrink();
             info[pointI].transfer(hits);
         }
         else
diff --git a/src/meshTools/searchableSurface/triSurfaceMesh.C b/src/meshTools/searchableSurface/triSurfaceMesh.C
index e8b7c0681ffc3550aa9d3d1ac6336e0a781a29dd..fe9e0c58f9a7306f1a57a94a70ddf0892dbe9927 100644
--- a/src/meshTools/searchableSurface/triSurfaceMesh.C
+++ b/src/meshTools/searchableSurface/triSurfaceMesh.C
@@ -449,7 +449,6 @@ void Foam::triSurfaceMesh::findLineAll
                 pt = inter.hitPoint() + smallVec[pointI];
             }
 
-            hits.shrink();
             info[pointI].transfer(hits);
         }
         else
diff --git a/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.C b/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.C
new file mode 100644
index 0000000000000000000000000000000000000000..63e461145831a1d49e3e755eadd20d512bf7d0d0
--- /dev/null
+++ b/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.C
@@ -0,0 +1,151 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+\*---------------------------------------------------------------------------*/
+
+#include "cylinderToCell.H"
+#include "polyMesh.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(cylinderToCell, 0);
+    addToRunTimeSelectionTable(topoSetSource, cylinderToCell, word);
+    addToRunTimeSelectionTable(topoSetSource, cylinderToCell, istream);
+}
+
+
+Foam::topoSetSource::addToUsageTable Foam::cylinderToCell::usage_
+(
+    cylinderToCell::typeName,
+    "\n    Usage: cylinderToCell (p1X p1Y p1Z) (p2X p2Y p2Z) radius\n\n"
+    "    Select all cells with cell centre within bounding cylinder\n\n"
+);
+
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+void Foam::cylinderToCell::combine(topoSet& set, const bool add) const
+{
+    const vector axis = p2_ - p1_;
+    const scalar rad2 = sqr(radius_);
+    const scalar magAxis2 = magSqr(axis);
+
+    const pointField& ctrs = mesh_.cellCentres();
+
+    forAll(ctrs, cellI)
+    {
+        vector d = ctrs[cellI] - p1_;
+        scalar magD = d & axis;
+
+        if ((magD > 0) && (magD < magAxis2))
+        {
+            scalar d2 = (d & d) - sqr(magD)/magAxis2;
+            if (d2 < rad2)
+            {
+                addOrDelete(set, cellI, add);
+            }
+        }
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::cylinderToCell::cylinderToCell
+(
+    const polyMesh& mesh,
+    const vector& p1,
+    const vector& p2,
+    const scalar radius
+)
+:
+    topoSetSource(mesh),
+    p1_(p1),
+    p2_(p2),
+    radius_(radius)
+{}
+
+
+Foam::cylinderToCell::cylinderToCell
+(
+    const polyMesh& mesh,
+    const dictionary& dict
+)
+:
+    topoSetSource(mesh),
+    p1_(dict.lookup("p1")),
+    p2_(dict.lookup("p2")),
+    radius_(readScalar(dict.lookup("radius")))
+{}
+
+
+// Construct from Istream
+Foam::cylinderToCell::cylinderToCell
+(
+    const polyMesh& mesh,
+    Istream& is
+)
+:
+    topoSetSource(mesh),
+    p1_(checkIs(is)),
+    p2_(checkIs(is)),
+    radius_(readScalar(checkIs(is)))
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::cylinderToCell::~cylinderToCell()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::cylinderToCell::applyToSet
+(
+    const topoSetSource::setAction action,
+    topoSet& set
+) const
+{
+    if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
+    {
+        Info<< "    Adding cells with centre within cylinder, with p1 = "
+            << p1_ << ", p2 = " << p2_ << " and radius = " << radius_ << endl;
+
+        combine(set, true);
+    }
+    else if (action == topoSetSource::DELETE)
+    {
+        Info<< "    Removing cells with centre within sphere, with p1 = "
+            << p1_ << ", p2 = " << p2_ << " and radius = " << radius_ << endl;
+
+        combine(set, false);
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/hmm/calcEntry/calcEntry.H b/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.H
similarity index 59%
rename from applications/test/hmm/calcEntry/calcEntry.H
rename to src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.H
index ced8516f388b9bcff3d4e034d233c2c78f3d87f5..0401e3f3efdd39af81eb2f7017d56a5364978bda 100644
--- a/applications/test/hmm/calcEntry/calcEntry.H
+++ b/src/meshTools/sets/cellSources/cylinderToCell/cylinderToCell.H
@@ -23,70 +23,105 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Class
-    Foam::functionEntries::calcEntry
+    Foam::cylinderToCell
 
 Description
+    A topoSetSource to select cells based on cell centres inside a cylinder.
 
 SourceFiles
-    calcEntry.C
+    cylinderToCell.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef calcEntry_H
-#define calcEntry_H
+#ifndef cylinderToCell_H
+#define cylinderToCell_H
 
-#include "functionEntry.H"
+#include "topoSetSource.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
-namespace functionEntries
-{
 
 /*---------------------------------------------------------------------------*\
-                           Class calcEntry Declaration
+                       Class cylinderToCell Declaration
 \*---------------------------------------------------------------------------*/
 
-class calcEntry
+class cylinderToCell
 :
-    public functionEntry
+    public topoSetSource
 {
-    // Private Member Functions
 
-        //- Disallow default bitwise copy construct
-        calcEntry(const calcEntry&);
+    // Private data
+
+        //- Add usage string
+        static addToUsageTable usage_;
 
-        //- Disallow default bitwise assignment
-        void operator=(const calcEntry&);
+        //- First point on cylinder axis
+        vector p1_;
+
+        //- Second point on cylinder axis
+        vector p2_;
+
+        //- Radius
+        scalar radius_;
+
+
+    // Private Member Functions
+
+        void combine(topoSet& set, const bool add) const;
 
 
 public:
 
     //- Runtime type information
-    TypeName("calc");
+    TypeName("cylinderToCell");
 
 
-    // Member Functions
+    // Constructors
+
+        //- Construct from components
+        cylinderToCell
+        (
+            const polyMesh& mesh,
+            const vector& p1,
+            const vector& p2,
+            const scalar radius
+        );
 
-        static bool insert
+        //- Construct from dictionary
+        cylinderToCell
         (
-            const dictionary& parentDict,
-            primitiveEntry& entry,
-            Istream& is
+            const polyMesh& mesh,
+            const dictionary& dict
         );
 
-        static bool insert
+        //- Construct from Istream
+        cylinderToCell
         (
-            dictionary& parentDict,
-            Istream& is
+            const polyMesh& mesh,
+            Istream&
         );
+
+
+    // Destructor
+
+        virtual ~cylinderToCell();
+
+
+    // Member Functions
+
+        virtual void applyToSet
+        (
+            const topoSetSource::setAction action,
+            topoSet&
+        ) const;
+
 };
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace functionEntries
 } // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C b/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C
index 577d004982f6469a5743d41454bbee724d35f52e..58a86810b13624cd22fe0abb24ac8ffd9d5b85a8 100644
--- a/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C
+++ b/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C
@@ -287,18 +287,12 @@ Foam::edgeSurface::edgeSurface
     }
 
     // Transfer.
-    allEdges.shrink();
     edges_.transfer(allEdges);
-
-    allParentEdges.shrink();
     parentEdges_.transfer(allParentEdges);
 
     forAll(allFaceEdges, faceI)
     {
-        DynamicList<label>& allFEdges = allFaceEdges[faceI];
-
-        allFEdges.shrink();
-        faceEdges_[faceI].transfer(allFEdges);
+        faceEdges_[faceI].transfer(allFaceEdges[faceI]);
     }
 
 
diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C
index 3d07e99a93cb27a60c4db5428a2b738421948408..f46508642548d1c4c1ddc53b9454dca79e6f5b42 100644
--- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C
+++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C
@@ -218,14 +218,8 @@ void Foam::edgeIntersections::intersectEdges
 
 
         // Done current edge. Transfer all data into *this
-        currentIntersections.shrink();
-        currentIntersectionTypes.shrink();
-
         operator[](edgeI).transfer(currentIntersections);
         classification_[edgeI].transfer(currentIntersectionTypes);
-
-        currentIntersections.clear();
-        currentIntersectionTypes.clear();
     }
 
     if (debug)
@@ -651,7 +645,7 @@ Foam::label Foam::edgeIntersections::removeDegenerates
                             offsetPerturb
                             (
                                 surf1,
-                                surf2,  
+                                surf2,
                                 edgeI,
                                 rndGen,
                                 points1,
diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersectionTemplates.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersectionTemplates.C
index fd06704ab1ccaa853eb39aa3f90547f96696f0de..ce5851cf169af0ac2b042328c6013db2a7f645e1 100644
--- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersectionTemplates.C
+++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersectionTemplates.C
@@ -38,7 +38,6 @@ void Foam::surfaceIntersection::transfer
     List<T>& lList
 )
 {
-    dList.shrink();
     lList.transfer(dList);
 }
 
diff --git a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C
index 1732fb45d62f25fa19dcc6b4b51c75b43e512e7d..de668b54d1b225fa65f792a183d28481ff31f01b 100644
--- a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C
+++ b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C
@@ -197,7 +197,7 @@ void Foam::surfaceFeatures::calcFeatPoints(const List<edgeStatus>& edgeStat)
             featurePoints.append(pointI);
         }
     }
-    featurePoints.shrink();
+
     featurePoints_.transfer(featurePoints);
 }
 
diff --git a/src/postProcessing/Allwmake b/src/postProcessing/Allwmake
index e1f7cc56d8290d962530cc3667457b174a6181ea..ab7328b651f0ec2e2094722574fcf0f3243a7d59 100755
--- a/src/postProcessing/Allwmake
+++ b/src/postProcessing/Allwmake
@@ -3,10 +3,8 @@ cd ${0%/*} || exit 1    # run from this directory
 set -x
 
 wmake libo postCalc
-wmake libso forces
-wmake libso fieldAverage
 wmake libso foamCalcFunctions
-wmake libso minMaxFields
-wmake libso systemCall
+
+(cd functionObjects && ./Allwmake)
 
 # ----------------------------------------------------------------- end-of-file
diff --git a/src/postProcessing/functionObjects/Allwmake b/src/postProcessing/functionObjects/Allwmake
new file mode 100755
index 0000000000000000000000000000000000000000..48e5f4d856bfb35b1ddb8cd1ae466776b91fde1b
--- /dev/null
+++ b/src/postProcessing/functionObjects/Allwmake
@@ -0,0 +1,10 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # run from this directory
+set -x
+
+wmake libso fieldAverage
+wmake libso forces
+wmake libso minMaxFields
+wmake libso systemCall
+
+# ----------------------------------------------------------------- end-of-file
diff --git a/src/postProcessing/fieldAverage/Make/files b/src/postProcessing/functionObjects/fieldAverage/Make/files
similarity index 100%
rename from src/postProcessing/fieldAverage/Make/files
rename to src/postProcessing/functionObjects/fieldAverage/Make/files
diff --git a/src/postProcessing/fieldAverage/Make/options b/src/postProcessing/functionObjects/fieldAverage/Make/options
similarity index 100%
rename from src/postProcessing/fieldAverage/Make/options
rename to src/postProcessing/functionObjects/fieldAverage/Make/options
diff --git a/src/postProcessing/fieldAverage/controlDict b/src/postProcessing/functionObjects/fieldAverage/controlDict
similarity index 100%
rename from src/postProcessing/fieldAverage/controlDict
rename to src/postProcessing/functionObjects/fieldAverage/controlDict
diff --git a/src/postProcessing/fieldAverage/fieldAverage/IOFieldAverage.H b/src/postProcessing/functionObjects/fieldAverage/fieldAverage/IOFieldAverage.H
similarity index 100%
rename from src/postProcessing/fieldAverage/fieldAverage/IOFieldAverage.H
rename to src/postProcessing/functionObjects/fieldAverage/fieldAverage/IOFieldAverage.H
diff --git a/src/postProcessing/fieldAverage/fieldAverage/fieldAverage.C b/src/postProcessing/functionObjects/fieldAverage/fieldAverage/fieldAverage.C
similarity index 100%
rename from src/postProcessing/fieldAverage/fieldAverage/fieldAverage.C
rename to src/postProcessing/functionObjects/fieldAverage/fieldAverage/fieldAverage.C
diff --git a/src/postProcessing/fieldAverage/fieldAverage/fieldAverage.H b/src/postProcessing/functionObjects/fieldAverage/fieldAverage/fieldAverage.H
similarity index 100%
rename from src/postProcessing/fieldAverage/fieldAverage/fieldAverage.H
rename to src/postProcessing/functionObjects/fieldAverage/fieldAverage/fieldAverage.H
diff --git a/src/postProcessing/fieldAverage/fieldAverage/fieldAverageTemplates.C b/src/postProcessing/functionObjects/fieldAverage/fieldAverage/fieldAverageTemplates.C
similarity index 100%
rename from src/postProcessing/fieldAverage/fieldAverage/fieldAverageTemplates.C
rename to src/postProcessing/functionObjects/fieldAverage/fieldAverage/fieldAverageTemplates.C
diff --git a/src/postProcessing/fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.C b/src/postProcessing/functionObjects/fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.C
similarity index 100%
rename from src/postProcessing/fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.C
rename to src/postProcessing/functionObjects/fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.C
diff --git a/src/postProcessing/fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.H b/src/postProcessing/functionObjects/fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.H
similarity index 100%
rename from src/postProcessing/fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.H
rename to src/postProcessing/functionObjects/fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.H
diff --git a/src/postProcessing/fieldAverage/fieldAverageItem/fieldAverageItem.C b/src/postProcessing/functionObjects/fieldAverage/fieldAverageItem/fieldAverageItem.C
similarity index 100%
rename from src/postProcessing/fieldAverage/fieldAverageItem/fieldAverageItem.C
rename to src/postProcessing/functionObjects/fieldAverage/fieldAverageItem/fieldAverageItem.C
diff --git a/src/postProcessing/fieldAverage/fieldAverageItem/fieldAverageItem.H b/src/postProcessing/functionObjects/fieldAverage/fieldAverageItem/fieldAverageItem.H
similarity index 100%
rename from src/postProcessing/fieldAverage/fieldAverageItem/fieldAverageItem.H
rename to src/postProcessing/functionObjects/fieldAverage/fieldAverageItem/fieldAverageItem.H
diff --git a/src/postProcessing/fieldAverage/fieldAverageItem/fieldAverageItemIO.C b/src/postProcessing/functionObjects/fieldAverage/fieldAverageItem/fieldAverageItemIO.C
similarity index 100%
rename from src/postProcessing/fieldAverage/fieldAverageItem/fieldAverageItemIO.C
rename to src/postProcessing/functionObjects/fieldAverage/fieldAverageItem/fieldAverageItemIO.C
diff --git a/src/postProcessing/forces/Make/files b/src/postProcessing/functionObjects/forces/Make/files
similarity index 100%
rename from src/postProcessing/forces/Make/files
rename to src/postProcessing/functionObjects/forces/Make/files
diff --git a/src/postProcessing/forces/Make/options b/src/postProcessing/functionObjects/forces/Make/options
similarity index 100%
rename from src/postProcessing/forces/Make/options
rename to src/postProcessing/functionObjects/forces/Make/options
diff --git a/src/postProcessing/forces/forceCoeffs/IOforceCoeffs.H b/src/postProcessing/functionObjects/forces/forceCoeffs/IOforceCoeffs.H
similarity index 100%
rename from src/postProcessing/forces/forceCoeffs/IOforceCoeffs.H
rename to src/postProcessing/functionObjects/forces/forceCoeffs/IOforceCoeffs.H
diff --git a/src/postProcessing/forces/forceCoeffs/forceCoeffs.C b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C
similarity index 100%
rename from src/postProcessing/forces/forceCoeffs/forceCoeffs.C
rename to src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C
diff --git a/src/postProcessing/forces/forceCoeffs/forceCoeffs.H b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H
similarity index 100%
rename from src/postProcessing/forces/forceCoeffs/forceCoeffs.H
rename to src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.H
diff --git a/src/postProcessing/forces/forceCoeffs/forceCoeffsFunctionObject.C b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffsFunctionObject.C
similarity index 100%
rename from src/postProcessing/forces/forceCoeffs/forceCoeffsFunctionObject.C
rename to src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffsFunctionObject.C
diff --git a/src/postProcessing/forces/forceCoeffs/forceCoeffsFunctionObject.H b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffsFunctionObject.H
similarity index 100%
rename from src/postProcessing/forces/forceCoeffs/forceCoeffsFunctionObject.H
rename to src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffsFunctionObject.H
diff --git a/src/postProcessing/forces/forces/IOforces.H b/src/postProcessing/functionObjects/forces/forces/IOforces.H
similarity index 100%
rename from src/postProcessing/forces/forces/IOforces.H
rename to src/postProcessing/functionObjects/forces/forces/IOforces.H
diff --git a/src/postProcessing/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C
similarity index 100%
rename from src/postProcessing/forces/forces/forces.C
rename to src/postProcessing/functionObjects/forces/forces/forces.C
diff --git a/src/postProcessing/forces/forces/forces.H b/src/postProcessing/functionObjects/forces/forces/forces.H
similarity index 100%
rename from src/postProcessing/forces/forces/forces.H
rename to src/postProcessing/functionObjects/forces/forces/forces.H
diff --git a/src/postProcessing/forces/forces/forcesFunctionObject.C b/src/postProcessing/functionObjects/forces/forces/forcesFunctionObject.C
similarity index 100%
rename from src/postProcessing/forces/forces/forcesFunctionObject.C
rename to src/postProcessing/functionObjects/forces/forces/forcesFunctionObject.C
diff --git a/src/postProcessing/forces/forces/forcesFunctionObject.H b/src/postProcessing/functionObjects/forces/forces/forcesFunctionObject.H
similarity index 100%
rename from src/postProcessing/forces/forces/forcesFunctionObject.H
rename to src/postProcessing/functionObjects/forces/forces/forcesFunctionObject.H
diff --git a/src/postProcessing/minMaxFields/IOminMaxFields.H b/src/postProcessing/functionObjects/minMaxFields/IOminMaxFields.H
similarity index 100%
rename from src/postProcessing/minMaxFields/IOminMaxFields.H
rename to src/postProcessing/functionObjects/minMaxFields/IOminMaxFields.H
diff --git a/src/postProcessing/minMaxFields/Make/files b/src/postProcessing/functionObjects/minMaxFields/Make/files
similarity index 100%
rename from src/postProcessing/minMaxFields/Make/files
rename to src/postProcessing/functionObjects/minMaxFields/Make/files
diff --git a/src/postProcessing/minMaxFields/Make/options b/src/postProcessing/functionObjects/minMaxFields/Make/options
similarity index 100%
rename from src/postProcessing/minMaxFields/Make/options
rename to src/postProcessing/functionObjects/minMaxFields/Make/options
diff --git a/src/postProcessing/minMaxFields/minMaxFields.C b/src/postProcessing/functionObjects/minMaxFields/minMaxFields.C
similarity index 100%
rename from src/postProcessing/minMaxFields/minMaxFields.C
rename to src/postProcessing/functionObjects/minMaxFields/minMaxFields.C
diff --git a/src/postProcessing/minMaxFields/minMaxFields.H b/src/postProcessing/functionObjects/minMaxFields/minMaxFields.H
similarity index 100%
rename from src/postProcessing/minMaxFields/minMaxFields.H
rename to src/postProcessing/functionObjects/minMaxFields/minMaxFields.H
diff --git a/src/postProcessing/minMaxFields/minMaxFieldsFunctionObject.C b/src/postProcessing/functionObjects/minMaxFields/minMaxFieldsFunctionObject.C
similarity index 100%
rename from src/postProcessing/minMaxFields/minMaxFieldsFunctionObject.C
rename to src/postProcessing/functionObjects/minMaxFields/minMaxFieldsFunctionObject.C
diff --git a/src/postProcessing/minMaxFields/minMaxFieldsFunctionObject.H b/src/postProcessing/functionObjects/minMaxFields/minMaxFieldsFunctionObject.H
similarity index 100%
rename from src/postProcessing/minMaxFields/minMaxFieldsFunctionObject.H
rename to src/postProcessing/functionObjects/minMaxFields/minMaxFieldsFunctionObject.H
diff --git a/src/postProcessing/minMaxFields/minMaxFieldsTemplates.C b/src/postProcessing/functionObjects/minMaxFields/minMaxFieldsTemplates.C
similarity index 100%
rename from src/postProcessing/minMaxFields/minMaxFieldsTemplates.C
rename to src/postProcessing/functionObjects/minMaxFields/minMaxFieldsTemplates.C
diff --git a/src/postProcessing/systemCall/IOsystemCall.H b/src/postProcessing/functionObjects/systemCall/IOsystemCall.H
similarity index 100%
rename from src/postProcessing/systemCall/IOsystemCall.H
rename to src/postProcessing/functionObjects/systemCall/IOsystemCall.H
diff --git a/src/postProcessing/systemCall/Make/files b/src/postProcessing/functionObjects/systemCall/Make/files
similarity index 100%
rename from src/postProcessing/systemCall/Make/files
rename to src/postProcessing/functionObjects/systemCall/Make/files
diff --git a/src/postProcessing/systemCall/Make/options b/src/postProcessing/functionObjects/systemCall/Make/options
similarity index 100%
rename from src/postProcessing/systemCall/Make/options
rename to src/postProcessing/functionObjects/systemCall/Make/options
diff --git a/src/postProcessing/systemCall/systemCall.C b/src/postProcessing/functionObjects/systemCall/systemCall.C
similarity index 100%
rename from src/postProcessing/systemCall/systemCall.C
rename to src/postProcessing/functionObjects/systemCall/systemCall.C
diff --git a/src/postProcessing/systemCall/systemCall.H b/src/postProcessing/functionObjects/systemCall/systemCall.H
similarity index 100%
rename from src/postProcessing/systemCall/systemCall.H
rename to src/postProcessing/functionObjects/systemCall/systemCall.H
diff --git a/src/postProcessing/systemCall/systemCallFunctionObject.C b/src/postProcessing/functionObjects/systemCall/systemCallFunctionObject.C
similarity index 100%
rename from src/postProcessing/systemCall/systemCallFunctionObject.C
rename to src/postProcessing/functionObjects/systemCall/systemCallFunctionObject.C
diff --git a/src/postProcessing/systemCall/systemCallFunctionObject.H b/src/postProcessing/functionObjects/systemCall/systemCallFunctionObject.H
similarity index 100%
rename from src/postProcessing/systemCall/systemCallFunctionObject.H
rename to src/postProcessing/functionObjects/systemCall/systemCallFunctionObject.H
diff --git a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C b/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C
index e76c2252d476afde8a40196ccdf551bdc4ef140f..11fef3ee17462872c39d862bdb113c6a45b3a133 100644
--- a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C
+++ b/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.C
@@ -32,6 +32,7 @@ License
 template<class OutputFilter>
 Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
 (
+    const word& outputFilterName,
     const objectRegistry& obr,
     const fileName& dictName,
     const IOobject::readOption rOpt,
@@ -49,7 +50,7 @@ Foam::IOOutputFilter<OutputFilter>::IOOutputFilter
             IOobject::NO_WRITE
         )
     ),
-    OutputFilter(OutputFilter::typeName, obr, *this, readFromFiles)
+    OutputFilter(outputFilterName, obr, *this, readFromFiles)
 {}
 
 
diff --git a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H b/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H
index d166a9ea19888fa4dd6742ad4ffa1fb9dde53555..82a7679846743c70965fc744d5ee1262f5c1b658 100644
--- a/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H
+++ b/src/sampling/outputFilters/IOOutputFilter/IOOutputFilter.H
@@ -60,7 +60,7 @@ class IOOutputFilter
 {
     // Private Member Functions
 
-        //- Disallow default bitwise copy construct and assignment
+        // Disallow default bitwise copy construct and assignment
         IOOutputFilter(const IOOutputFilter&);
         void operator=(const IOOutputFilter&);
 
@@ -74,6 +74,7 @@ public:
         //  Allow the possibility to load fields from files
         IOOutputFilter
         (
+            const word& outputFilterName,
             const objectRegistry&,
             const fileName& dictName = OutputFilter::typeName() + "Dict",
             const IOobject::readOption rOpt = IOobject::MUST_READ,
@@ -81,9 +82,8 @@ public:
         );
 
 
-    // Destructor
-
-        virtual ~IOOutputFilter();
+    //- Destructor
+    virtual ~IOOutputFilter();
 
 
     // Member Functions
diff --git a/src/sampling/outputFilters/OutputFilterFunctionObject/OutputFilterFunctionObject.C b/src/sampling/outputFilters/OutputFilterFunctionObject/OutputFilterFunctionObject.C
index 605b946d7cc30b29b5de9539f50094d2a73ec0c9..51ef0cf149bacc82d247950c5c7375d5185a6820 100644
--- a/src/sampling/outputFilters/OutputFilterFunctionObject/OutputFilterFunctionObject.C
+++ b/src/sampling/outputFilters/OutputFilterFunctionObject/OutputFilterFunctionObject.C
@@ -78,6 +78,7 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::start()
             (
                 new IOOutputFilter<OutputFilter>
                 (
+                    name_,
                     time_.lookupObject<objectRegistry>(regionName_),
                     dictName_
                 )
diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C
index b5518732cb988bd8e0184937d0f490f4adafab06..43bdad2e231a88e2d416e0c7361d8fefaf4f5d51 100644
--- a/src/sampling/sampledSet/sampledSets/sampledSets.C
+++ b/src/sampling/sampledSet/sampledSets/sampledSets.C
@@ -102,7 +102,7 @@ bool Foam::sampledSets::checkFieldTypes()
     nFields += grep(symmTensorFields_, fieldTypes);
     nFields += grep(tensorFields_, fieldTypes);
 
-    if (Pstream::master)
+    if (Pstream::master())
     {
         if (debug)
         {
diff --git a/src/sampling/sampledSurface/isoSurface/isoSurface.C b/src/sampling/sampledSurface/isoSurface/isoSurface.C
index e4a11cc71d938708731494ae9417604e1d61a278..5d77290b0f2be3a8ba809df3503e3894868d581e 100644
--- a/src/sampling/sampledSurface/isoSurface/isoSurface.C
+++ b/src/sampling/sampledSurface/isoSurface/isoSurface.C
@@ -815,8 +815,8 @@ Foam::triSurface Foam::isoSurface::stitchTriPoints
             }
         }
 
-        triMap.transfer(newToOldTri.shrink());
-        tris.transfer(dynTris.shrink());
+        triMap.transfer(newToOldTri);
+        tris.transfer(dynTris);
     }
 
 
@@ -875,7 +875,7 @@ Foam::triSurface Foam::isoSurface::stitchTriPoints
                 }
             }
 
-            triMap.transfer(newToOldTri.shrink());
+            triMap.transfer(newToOldTri);
             tris.setSize(newTriI);
         }
     }
diff --git a/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C b/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C
index 5cffcdf0ddf4b8f21c8f2f2f01363ad97ec43df9..6557112012114f2cd64ab819e2d01b0184786e59 100644
--- a/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C
+++ b/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C
@@ -434,7 +434,7 @@ void Foam::isoSurfaceCell::calcSnappedCc
             }
             else
             {
-                // Need to analyse 
+                // Need to analyse
                 forAll(cFaces, cFaceI)
                 {
                     const face& f = mesh_.faces()[cFaces[cFaceI]];
@@ -747,7 +747,7 @@ void Foam::isoSurfaceCell::calcSnappedPoint
                 (
                     false,                  // do not check for duplicate tris
                     localTriPoints,
-                    triPointReverseMap,  
+                    triPointReverseMap,
                     triMap
                 )
             );
@@ -871,8 +871,8 @@ Foam::triSurface Foam::isoSurfaceCell::stitchTriPoints
             }
         }
 
-        triMap.transfer(newToOldTri.shrink());
-        tris.transfer(dynTris.shrink());
+        triMap.transfer(newToOldTri);
+        tris.transfer(dynTris);
     }
 
 
@@ -930,7 +930,7 @@ Foam::triSurface Foam::isoSurfaceCell::stitchTriPoints
                 }
             }
 
-            triMap.transfer(newToOldTri.shrink());
+            triMap.transfer(newToOldTri);
             tris.setSize(newTriI);
         }
     }
@@ -1062,7 +1062,7 @@ void Foam::isoSurfaceCell::calcAddressing
         faceEdges[triI][1] = oldToMerged[edgeI++];
         faceEdges[triI][2] = oldToMerged[edgeI++];
     }
-    
+
 
     // Determine edgeFaces
     edgeFace0.setSize(mergedCentres.size());
@@ -1137,7 +1137,7 @@ void Foam::isoSurfaceCell::walkOrientation
             forAll(fEdges, fp)
             {
                 label edgeI = fEdges[fp];
-    
+
                 // my points:
                 label p0 = tri[fp];
                 label p1 = tri[tri.fcIndex(fp)];
@@ -1174,7 +1174,7 @@ void Foam::isoSurfaceCell::walkOrientation
 
         changedFaces.transfer(newChangedFaces);
     }
-}    
+}
 
 
 void Foam::isoSurfaceCell::orientSurface
@@ -1199,7 +1199,7 @@ void Foam::isoSurfaceCell::orientSurface
         for
         (
             ;
-            seedTriI < surf.size() && flipState[seedTriI] != -1; 
+            seedTriI < surf.size() && flipState[seedTriI] != -1;
             seedTriI++
         )
         {}
@@ -1473,14 +1473,13 @@ Foam::isoSurfaceCell::isoSurfaceCell
         snappedCc = -1;
     }
 
-    snappedPoints.shrink();
-
     if (debug)
     {
         Pout<< "isoSurfaceCell : shifted " << snappedPoints.size()
             << " cell centres to intersection." << endl;
     }
 
+    snappedPoints.shrink();
     label nCellSnaps = snappedPoints.size();
 
     // Per point -1 or a point inside snappedPoints.
diff --git a/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C b/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C
index 49e48578f510fa922268b77a8d470aafc4451cce..3409b2c42115df69101f36380531c15b0472e977 100644
--- a/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C
+++ b/src/surfMesh/surfaceFormats/starcd/STARCDsurfaceFormat.C
@@ -135,26 +135,27 @@ bool Foam::fileFormats::STARCDsurfaceFormat<Face>::read
     label regionI = 0;
 
     label lineLabel, shapeId, nLabels, cellTableId, typeId;
-    labelList starLabels(64);
+    DynamicList<label> vertexLabels(64);
 
     while ((is >> lineLabel).good())
     {
         is >> shapeId >> nLabels >> cellTableId >> typeId;
 
-        if (nLabels > starLabels.size())
-        {
-            starLabels.setSize(nLabels);
-        }
-        starLabels = -1;
+        vertexLabels.clear();
+        vertexLabels.reserve(nLabels);
 
         // read indices - max 8 per line
         for (label i = 0; i < nLabels; ++i)
         {
+            label vrtId;
             if ((i % 8) == 0)
             {
                is >> lineLabel;
             }
-            is >> starLabels[i];
+            is >> vrtId;
+
+            // convert original vertex id to point label
+            vertexLabels.append(mapPointId[vrtId]);
         }
 
         if (typeId == starcdShellType_)
@@ -178,14 +179,7 @@ bool Foam::fileFormats::STARCDsurfaceFormat<Face>::read
                 dynSizes.append(0);
             }
 
-            SubList<label> vertices(starLabels, nLabels);
-
-            // convert orig vertex id to point label
-            forAll(vertices, i)
-            {
-                vertices[i] = mapPointId[vertices[i]];
-            }
-
+            SubList<label> vertices(vertexLabels, vertexLabels.size());
             if (mustTriangulate && nLabels > 3)
             {
                 face f(vertices);
diff --git a/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormatCore.C b/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormatCore.C
index c1114dff6755577b7b74f6f90ba1403c0bf78967..40e624214a2784979d126fa57b68ef3d46e5d202 100644
--- a/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormatCore.C
+++ b/src/surfMesh/surfaceFormats/tri/TRIsurfaceFormatCore.C
@@ -175,7 +175,7 @@ bool Foam::fileFormats::TRIsurfaceFormatCore::read
         }
     }
     // truncate addressed size
-    dynSizes.setSize(nPatch);
+    dynSizes.setCapacity(nPatch);
 
     // transfer to normal lists
     points_.transfer(dynPoints);
diff --git a/applications/test/hmm/calcEntry/calcEntry.C b/src/thermophysicalModels/liquids/CH4N2O/CH4N2O.C
similarity index 54%
rename from applications/test/hmm/calcEntry/calcEntry.C
rename to src/thermophysicalModels/liquids/CH4N2O/CH4N2O.C
index 8801a5255519333336312a2eea45bef2fcdfcaaa..8a99a9f0ed3a604565909a5aeee30eb9ad305079 100644
--- a/applications/test/hmm/calcEntry/calcEntry.C
+++ b/src/thermophysicalModels/liquids/CH4N2O/CH4N2O.C
@@ -22,67 +22,27 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-\*---------------------------------------------------------------------------*/
+Description
 
-#include "calcEntry.H"
-#include "dictionary.H"
-#include "IStringStream.H"
-#include "OStringStream.H"
-#include "addToMemberFunctionSelectionTable.H"
+-------------------------------------------------------------------------------
+*/
 
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+#include "CH4N2O.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
-namespace functionEntries
-{
-    defineTypeNameAndDebug(calcEntry, 0);
-
-    addToMemberFunctionSelectionTable
-    (
-        functionEntry,
-        calcEntry,
-        insert,
-        primitiveEntryIstream
-    );
-
-    addToMemberFunctionSelectionTable
-    (
-        functionEntry,
-        calcEntry,
-        insert,
-        dictionaryIstream
-    );
-}
-}
 
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-bool Foam::functionEntries::calcEntry::insert
-(
-    const dictionary& parentDict,
-    primitiveEntry& entry,
-    Istream& is
-)
-{
-    dictionary args(parentDict, is);
-    OStringStream resultStream;
-    resultStream
-        << (args.lookup("x")[0].number() + args.lookup("y")[0].number());
-    entry.read(parentDict, IStringStream(resultStream.str())());
-    return true;
-}
-
+defineTypeNameAndDebug(CH4N2O, 0);
+addToRunTimeSelectionTable(liquid, CH4N2O,);
+addToRunTimeSelectionTable(liquid, CH4N2O, Istream);
 
-bool Foam::functionEntries::calcEntry::insert
-(
-    dictionary& parentDict,
-    Istream& is
-)
-{
-    return true;
-}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+} // End namespace Foam
 
 // ************************************************************************* //
diff --git a/src/thermophysicalModels/liquids/CH4N2O/CH4N2O.H b/src/thermophysicalModels/liquids/CH4N2O/CH4N2O.H
new file mode 100644
index 0000000000000000000000000000000000000000..25c336f32875542a6132e41320fa773bdd05b9d3
--- /dev/null
+++ b/src/thermophysicalModels/liquids/CH4N2O/CH4N2O.H
@@ -0,0 +1,285 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Class
+    Foam::CH4N2O
+
+Description
+    urea, note that some of the properties are unavailable in the literature and have been copied from water.
+
+SourceFiles
+    CH4N2O.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef CH4N2O_H
+#define CH4N2O_H
+
+#include "liquid.H"
+#include "NSRDSfunc0.H"
+#include "NSRDSfunc1.H"
+#include "NSRDSfunc2.H"
+#include "NSRDSfunc3.H"
+#include "NSRDSfunc4.H"
+#include "NSRDSfunc5.H"
+#include "NSRDSfunc6.H"
+#include "NSRDSfunc7.H"
+#include "NSRDSfunc14.H"
+#include "APIdiffCoefFunc.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                           Class CH4N2O Declaration
+\*---------------------------------------------------------------------------*/
+
+class CH4N2O
+:
+    public liquid
+{
+    // Private data
+
+        NSRDSfunc0 rho_;
+        NSRDSfunc1 pv_;
+        NSRDSfunc6 hl_;
+        NSRDSfunc0 cp_;
+        NSRDSfunc0 h_;
+        NSRDSfunc7 cpg_;
+        NSRDSfunc4 B_;
+        NSRDSfunc1 mu_;
+        NSRDSfunc2 mug_;
+        NSRDSfunc0 K_;
+        NSRDSfunc2 Kg_;
+        NSRDSfunc6 sigma_;
+        APIdiffCoefFunc D_;
+
+public:
+
+    //- Runtime type information
+    TypeName("CH4N2O");
+
+
+    // Constructors
+
+        //- Construct null
+        CH4N2O()
+        :
+            liquid(60.056, 705.0, 9.050e+6, 0.218, 0.337, 405.85, 9.3131e+1, 465.0, 1.52e-29, 0.3449, 4.7813e+4),
+            rho_(1230.006936, 0, 0, 0, 0, 0),
+            pv_(12.06, -3992.0, 0, 0, 0),
+//            hl_(1463034.50113228, 0, 0, 0, 0, 0), 
+// NN.      we cant use constant heat of vapourisation, the below value is linear (sqrt) interpolation to critical temp
+            hl_(705.0, 2534249.0, 0.5, 0.0, 0.0, 0.0),
+            cp_(2006.46063673904, 0, 0, 0, 0, 0),
+            // NN: enthalpy, h_, is not used in the sprayModel.
+            // For consistency, the enthalpy is derived from hlat and hl.
+            // It is, however, convenient to have it available.
+            h_(-6154107.41641135, 2006.46063673904, 0, 0, 0, 0),
+
+            cpg_(811.875582789397, 2099.04089516451, 1627.3, 1603.63660583455, 724.41),
+            B_(-0.000383641934194752, 0.447249234048222, -469062.208605302, 5.5628080458239e+18, -2.3040162514986e+21),
+            mu_(-51.964, 3670.6, 5.7331, -5.3495e-29, 10),
+            mug_(2.6986e-06, 0.498, 1257.7, -19570),
+            K_(-0.4267, 0.0056903, -8.0065e-06, 1.815e-09, 0, 0),
+            Kg_(6.977e-05, 1.1243, 844.9, -148850),
+            sigma_(705.0, 1.0, 0.0, 0.0, 0.0, 0), // set to constant
+            D_(147.18, 20.1, 60.056, 28) // NN: Same as nHeptane
+        {}
+        CH4N2O
+        (
+            const liquid& l,
+            const NSRDSfunc0& density,
+            const NSRDSfunc1& vapourPressure,
+            const NSRDSfunc6& heatOfVapourisation,
+            const NSRDSfunc0& heatCapacity,
+            const NSRDSfunc0& enthalpy,
+            const NSRDSfunc7& idealGasHeatCapacity,
+            const NSRDSfunc4& secondVirialCoeff,
+            const NSRDSfunc1& dynamicViscosity,
+            const NSRDSfunc2& vapourDynamicViscosity,
+            const NSRDSfunc0& thermalConductivity,
+            const NSRDSfunc2& vapourThermalConductivity,
+            const NSRDSfunc6& surfaceTension,
+            const APIdiffCoefFunc& vapourDiffussivity
+        )
+        :
+            liquid(l),
+            rho_(density),
+            pv_(vapourPressure),
+            hl_(heatOfVapourisation),
+            cp_(heatCapacity),
+            h_(enthalpy),
+            cpg_(idealGasHeatCapacity),
+            B_(secondVirialCoeff),
+            mu_(dynamicViscosity),
+            mug_(vapourDynamicViscosity),
+            K_(thermalConductivity),
+            Kg_(vapourThermalConductivity),
+            sigma_(surfaceTension),
+            D_(vapourDiffussivity)
+        {}
+
+        //- Construct from Istream
+        CH4N2O(Istream& is)
+        :
+            liquid(is),
+            rho_(is),
+            pv_(is),
+            hl_(is),
+            cp_(is),
+            h_(is),
+            cpg_(is),
+            B_(is),
+            mu_(is),
+            mug_(is),
+            K_(is),
+            Kg_(is),
+            sigma_(is),
+            D_(is)
+        {}
+
+
+    // Member Functions
+
+        //- Liquid density [kg/m^3]
+        scalar rho(scalar p, scalar T) const
+        {
+            return rho_.f(p, T);
+        }
+
+        //- Vapour pressure [Pa]
+        scalar pv(scalar p, scalar T) const
+        {
+            return pv_.f(p, T);
+        }
+
+        //- Heat of vapourisation [J/kg]
+        scalar hl(scalar p, scalar T) const
+        {
+            return hl_.f(p, T);
+        }
+
+        //- Liquid heat capacity [J/(kg K)]
+        scalar cp(scalar p, scalar T) const
+        {
+            return cp_.f(p, T);
+        }
+
+        //- Liquid Enthalpy [J/(kg)]
+        scalar h(scalar p, scalar T) const
+        {
+            return h_.f(p, T);
+        }
+
+        //- Ideal gas heat capacity [J/(kg K)]
+        scalar cpg(scalar p, scalar T) const
+        {
+            return cpg_.f(p, T);
+        }
+
+        //- Second Virial Coefficient [m^3/kg]
+        scalar B(scalar p, scalar T) const
+        {
+            return B_.f(p, T);
+        }
+
+        //- Liquid viscosity [Pa s]
+        scalar mu(scalar p, scalar T) const
+        {
+            return mu_.f(p, T);
+        }
+
+        //- Vapour viscosity [Pa s]
+        scalar mug(scalar p, scalar T) const
+        {
+            return mug_.f(p, T);
+        }
+
+        //- Liquid thermal conductivity  [W/(m K)]
+        scalar K(scalar p, scalar T) const
+        {
+            return K_.f(p, T);
+        }
+
+        //- Vapour thermal conductivity  [W/(m K)]
+        scalar Kg(scalar p, scalar T) const
+        {
+            return Kg_.f(p, T);
+        }
+
+        //- Surface tension [N/m]
+        scalar sigma(scalar p, scalar T) const
+        {
+            return sigma_.f(p, T);
+        }
+
+        //- Vapour diffussivity [m2/s]
+        scalar D(scalar p, scalar T) const
+        {
+            return D_.f(p, T);
+        }
+
+
+        //- Write the function coefficients
+        void writeData(Ostream& os) const
+        {
+            liquid::writeData(os); os << nl;
+            rho_.writeData(os); os << nl;
+            pv_.writeData(os); os << nl;
+            hl_.writeData(os); os << nl;
+            cp_.writeData(os); os << nl;
+            cpg_.writeData(os); os << nl;
+            B_.writeData(os); os << nl;
+            mu_.writeData(os); os << nl;
+            mug_.writeData(os); os << nl;
+            K_.writeData(os); os << nl;
+            Kg_.writeData(os); os << nl;
+            sigma_.writeData(os); os << nl;
+            D_.writeData(os); os << endl;
+        }
+
+
+    // Ostream Operator
+
+        friend Ostream& operator<<(Ostream& os, const CH4N2O& l)
+        {
+            l.writeData(os);
+            return os;
+        }
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
+
diff --git a/src/thermophysicalModels/liquids/Make/files b/src/thermophysicalModels/liquids/Make/files
index 7d55ee40b759d37ad4064dc6cb66c51a5b0c5463..e2f27128d520e81ed9e7d4e8b9dee691724f1483 100644
--- a/src/thermophysicalModels/liquids/Make/files
+++ b/src/thermophysicalModels/liquids/Make/files
@@ -26,5 +26,8 @@ C2H5OH/C2H5OH.C
 Ar/Ar.C
 N2/N2.C
 MB/MB.C
+CH4N2O/CH4N2O.C
+nC3H8O/nC3H8O.C
+iC3H8O/iC3H8O.C
 
 LIB = $(FOAM_LIBBIN)/libliquids
diff --git a/src/thermophysicalModels/liquids/iC3H8O/iC3H8O.C b/src/thermophysicalModels/liquids/iC3H8O/iC3H8O.C
new file mode 100644
index 0000000000000000000000000000000000000000..0020f9f7458440ea23e884ed127457fc7e6eccc1
--- /dev/null
+++ b/src/thermophysicalModels/liquids/iC3H8O/iC3H8O.C
@@ -0,0 +1,48 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Description
+
+-------------------------------------------------------------------------------
+*/
+
+#include "iC3H8O.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+defineTypeNameAndDebug(iC3H8O, 0);
+addToRunTimeSelectionTable(liquid, iC3H8O,);
+addToRunTimeSelectionTable(liquid, iC3H8O, Istream);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/liquids/iC3H8O/iC3H8O.H b/src/thermophysicalModels/liquids/iC3H8O/iC3H8O.H
new file mode 100644
index 0000000000000000000000000000000000000000..b665999b46e7208d706f11102f07cc500d4e3ade
--- /dev/null
+++ b/src/thermophysicalModels/liquids/iC3H8O/iC3H8O.H
@@ -0,0 +1,281 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Class
+    Foam::iC3H8O
+
+Description
+    iso-propanol
+
+SourceFiles
+    iC3H8O.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef iC3H8O_H
+#define iC3H8O_H
+
+#include "liquid.H"
+#include "NSRDSfunc0.H"
+#include "NSRDSfunc1.H"
+#include "NSRDSfunc2.H"
+#include "NSRDSfunc3.H"
+#include "NSRDSfunc4.H"
+#include "NSRDSfunc5.H"
+#include "NSRDSfunc6.H"
+#include "NSRDSfunc7.H"
+#include "NSRDSfunc14.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                           Class iC3H8O Declaration
+\*---------------------------------------------------------------------------*/
+
+class iC3H8O
+:
+    public liquid
+{
+    // Private data
+
+        NSRDSfunc5 rho_;
+        NSRDSfunc1 pv_;
+        NSRDSfunc6 hl_;
+        NSRDSfunc0 cp_;
+        NSRDSfunc0 h_;
+        NSRDSfunc7 cpg_;
+        NSRDSfunc4 B_;
+        NSRDSfunc1 mu_;
+        NSRDSfunc2 mug_;
+        NSRDSfunc0 K_;
+        NSRDSfunc2 Kg_;
+        NSRDSfunc0 sigma_;
+        NSRDSfunc1 D_;
+
+public:
+
+    //- Runtime type information
+    TypeName("iC3H8O");
+
+
+    // Constructors
+
+        //- Construct null
+        iC3H8O()
+        :
+            liquid(60.096, 508.31, 4.7643e+6, 0.22013, 0.248, 185.28, 3.20e-2, 355.41, 5.5372e-30, 0.6689, 2.3575e+4),
+            rho_(70.91328, 0.26475, 508.31, 0.243),
+            pv_(92.935, -8177.1, -10.031, 3.9988e-06, 2),
+            hl_(508.31, 948149.627263046, 0.087, 0.3007, 0, 0),
+            cp_(7760.91586794462, -68.3672790202343, 0.241380457933972, -0.000235057241746539, 0, 0),
+            // NN: enthalpy, h_, is not used in the sprayModel.
+            // For consistency, the enthalpy is derived from hlat and hl.
+            // It is, however, convenient to have it available.
+            h_(-6227786.27583977, 7760.91586794462, -34.1836395101172, 0.0804601526446574, -5.87643104366347e-05, 0),
+            cpg_(789.73642172524, 3219.8482428115, 1124, 1560.83599574015, 460),
+            B_(0.000502529286474973, -0.104665867944622, -717185.83599574, 3.3047124600639e+18, -1.43270766773163e+21),
+            mu_(-8.23, 2282.2, -0.98495, 0, 0),
+            mug_(1.993e-07, 0.7233, 178, 0),
+            K_(0.2029, -0.0002278, 0, 0, 0, 0),
+            Kg_(-80.642, -1.4549, -604.42, 0),
+            sigma_(0.03818, -3.818e-05, -6.51e-08, 0, 0, 0),
+            D_(4.75e-10, 1.75, 0.0, 0.0, 0.0) // NN. same as iC3H8O
+        {}
+        iC3H8O
+        (
+            const liquid& l,
+            const NSRDSfunc5& density,
+            const NSRDSfunc1& vapourPressure,
+            const NSRDSfunc6& heatOfVapourisation,
+            const NSRDSfunc0& heatCapacity,
+            const NSRDSfunc0& enthalpy,
+            const NSRDSfunc7& idealGasHeatCapacity,
+            const NSRDSfunc4& secondVirialCoeff,
+            const NSRDSfunc1& dynamicViscosity,
+            const NSRDSfunc2& vapourDynamicViscosity,
+            const NSRDSfunc0& thermalConductivity,
+            const NSRDSfunc2& vapourThermalConductivity,
+            const NSRDSfunc0& surfaceTension,
+            const NSRDSfunc1& vapourDiffussivity
+        )
+        :
+            liquid(l),
+            rho_(density),
+            pv_(vapourPressure),
+            hl_(heatOfVapourisation),
+            cp_(heatCapacity),
+            h_(enthalpy),
+            cpg_(idealGasHeatCapacity),
+            B_(secondVirialCoeff),
+            mu_(dynamicViscosity),
+            mug_(vapourDynamicViscosity),
+            K_(thermalConductivity),
+            Kg_(vapourThermalConductivity),
+            sigma_(surfaceTension),
+            D_(vapourDiffussivity)
+        {}
+
+        //- Construct from Istream
+        iC3H8O(Istream& is)
+        :
+            liquid(is),
+            rho_(is),
+            pv_(is),
+            hl_(is),
+            cp_(is),
+            h_(is),
+            cpg_(is),
+            B_(is),
+            mu_(is),
+            mug_(is),
+            K_(is),
+            Kg_(is),
+            sigma_(is),
+            D_(is)
+        {}
+
+
+    // Member Functions
+
+        //- Liquid density [kg/m^3]
+        scalar rho(scalar p, scalar T) const
+        {
+            return rho_.f(p, T);
+        }
+
+        //- Vapour pressure [Pa]
+        scalar pv(scalar p, scalar T) const
+        {
+            return pv_.f(p, T);
+        }
+
+        //- Heat of vapourisation [J/kg]
+        scalar hl(scalar p, scalar T) const
+        {
+            return hl_.f(p, T);
+        }
+
+        //- Liquid heat capacity [J/(kg K)]
+        scalar cp(scalar p, scalar T) const
+        {
+            return cp_.f(p, T);
+        }
+
+        //- Liquid Enthalpy [J/(kg)]
+        scalar h(scalar p, scalar T) const
+        {
+            return h_.f(p, T);
+        }
+
+        //- Ideal gas heat capacity [J/(kg K)]
+        scalar cpg(scalar p, scalar T) const
+        {
+            return cpg_.f(p, T);
+        }
+
+        //- Second Virial Coefficient [m^3/kg]
+        scalar B(scalar p, scalar T) const
+        {
+            return B_.f(p, T);
+        }
+
+        //- Liquid viscosity [Pa s]
+        scalar mu(scalar p, scalar T) const
+        {
+            return mu_.f(p, T);
+        }
+
+        //- Vapour viscosity [Pa s]
+        scalar mug(scalar p, scalar T) const
+        {
+            return mug_.f(p, T);
+        }
+
+        //- Liquid thermal conductivity  [W/(m K)]
+        scalar K(scalar p, scalar T) const
+        {
+            return K_.f(p, T);
+        }
+
+        //- Vapour thermal conductivity  [W/(m K)]
+        scalar Kg(scalar p, scalar T) const
+        {
+            return Kg_.f(p, T);
+        }
+
+        //- Surface tension [N/m]
+        scalar sigma(scalar p, scalar T) const
+        {
+            return sigma_.f(p, T);
+        }
+
+        //- Vapour diffussivity [m2/s]
+        scalar D(scalar p, scalar T) const
+        {
+            return D_.f(p, T);
+        }
+
+
+        //- Write the function coefficients
+        void writeData(Ostream& os) const
+        {
+            liquid::writeData(os); os << nl;
+            rho_.writeData(os); os << nl;
+            pv_.writeData(os); os << nl;
+            hl_.writeData(os); os << nl;
+            cp_.writeData(os); os << nl;
+            cpg_.writeData(os); os << nl;
+            B_.writeData(os); os << nl;
+            mu_.writeData(os); os << nl;
+            mug_.writeData(os); os << nl;
+            K_.writeData(os); os << nl;
+            Kg_.writeData(os); os << nl;
+            sigma_.writeData(os); os << nl;
+            D_.writeData(os); os << endl;
+        }
+
+
+    // Ostream Operator
+
+        friend Ostream& operator<<(Ostream& os, const iC3H8O& l)
+        {
+            l.writeData(os);
+            return os;
+        }
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
+
diff --git a/src/thermophysicalModels/liquids/nC3H8O/nC3H8O.C b/src/thermophysicalModels/liquids/nC3H8O/nC3H8O.C
new file mode 100644
index 0000000000000000000000000000000000000000..96df4a11cc9c1caaf7703e639c253cfb49bfee6d
--- /dev/null
+++ b/src/thermophysicalModels/liquids/nC3H8O/nC3H8O.C
@@ -0,0 +1,48 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Description
+
+-------------------------------------------------------------------------------
+*/
+
+#include "nC3H8O.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+defineTypeNameAndDebug(nC3H8O, 0);
+addToRunTimeSelectionTable(liquid, nC3H8O,);
+addToRunTimeSelectionTable(liquid, nC3H8O, Istream);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/liquids/nC3H8O/nC3H8O.H b/src/thermophysicalModels/liquids/nC3H8O/nC3H8O.H
new file mode 100644
index 0000000000000000000000000000000000000000..2f0079646967b0692fad76730bc7462d25cae16b
--- /dev/null
+++ b/src/thermophysicalModels/liquids/nC3H8O/nC3H8O.H
@@ -0,0 +1,281 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Class
+    Foam::nC3H8O
+
+Description
+    propanol
+
+SourceFiles
+    nC3H8O.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef nC3H8O_H
+#define nC3H8O_H
+
+#include "liquid.H"
+#include "NSRDSfunc0.H"
+#include "NSRDSfunc1.H"
+#include "NSRDSfunc2.H"
+#include "NSRDSfunc3.H"
+#include "NSRDSfunc4.H"
+#include "NSRDSfunc5.H"
+#include "NSRDSfunc6.H"
+#include "NSRDSfunc7.H"
+#include "NSRDSfunc14.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                           Class nC3H8O Declaration
+\*---------------------------------------------------------------------------*/
+
+class nC3H8O
+:
+    public liquid
+{
+    // Private data
+
+        NSRDSfunc5 rho_;
+        NSRDSfunc1 pv_;
+        NSRDSfunc6 hl_;
+        NSRDSfunc0 cp_;
+        NSRDSfunc0 h_;
+        NSRDSfunc7 cpg_;
+        NSRDSfunc4 B_;
+        NSRDSfunc1 mu_;
+        NSRDSfunc2 mug_;
+        NSRDSfunc0 K_;
+        NSRDSfunc2 Kg_;
+        NSRDSfunc0 sigma_;
+        NSRDSfunc1 D_;
+
+public:
+
+    //- Runtime type information
+    TypeName("nC3H8O");
+
+
+    // Constructors
+
+        //- Construct null
+        nC3H8O()
+        :
+            liquid(60.096, 536.71, 5.1696e+6, 0.21853, 0.253, 146.95, 6.5112e-7, 370.35, 5.6039e-30, 0.6279, 2.4557e+4),
+            rho_(75.300288, 0.272, 536.71, 0.2494),
+            pv_(77.46, -7960, -7.5235, 3e-07, 2),
+            hl_(536.71, 1098242.8115016, 0.647, -0.783, 0.613, 0),
+            cp_(216.320553780618, 18.5203674121406, -0.0751797124600639, 0.000126464323748669, 0, 0),
+            // NN: enthalpy, h_, is not used in the sprayModel.
+            // For consistency, the enthalpy is derived from hlat and hl.
+            // It is, however, convenient to have it available.
+            h_(-5533091.96851587, 216.320553780618, 9.26018370607029, -0.0250599041533546, 3.16160809371672e-05, 0),
+            cpg_(961.794462193823, 3467.78487752929, 1542, 2046.72523961661, 649),
+            B_(0.000933506389776358, -1.09325079872204, -531649.361022364, -2.32627795527157e+17, -3.81888977635783e+20),
+            mu_(0.571, 1521, -2.0894, 0, 0),
+            mug_(7.942e-07, 0.5491, 415.8, 0),
+            K_(0.204, -0.000169, 0, 0, 0, 0),
+            Kg_(-613.84, 0.7927, -1157400000, 0),
+            sigma_(0.04533, -6.88e-05, -1.6e-08, 0, 0, 0),
+            D_(4.75e-10, 1.75, 0.0, 0.0, 0.0) // NN. same as iC3H8O
+        {}
+        nC3H8O
+        (
+            const liquid& l,
+            const NSRDSfunc5& density,
+            const NSRDSfunc1& vapourPressure,
+            const NSRDSfunc6& heatOfVapourisation,
+            const NSRDSfunc0& heatCapacity,
+            const NSRDSfunc0& enthalpy,
+            const NSRDSfunc7& idealGasHeatCapacity,
+            const NSRDSfunc4& secondVirialCoeff,
+            const NSRDSfunc1& dynamicViscosity,
+            const NSRDSfunc2& vapourDynamicViscosity,
+            const NSRDSfunc0& thermalConductivity,
+            const NSRDSfunc2& vapourThermalConductivity,
+            const NSRDSfunc0& surfaceTension,
+            const NSRDSfunc1& vapourDiffussivity
+        )
+        :
+            liquid(l),
+            rho_(density),
+            pv_(vapourPressure),
+            hl_(heatOfVapourisation),
+            cp_(heatCapacity),
+            h_(enthalpy),
+            cpg_(idealGasHeatCapacity),
+            B_(secondVirialCoeff),
+            mu_(dynamicViscosity),
+            mug_(vapourDynamicViscosity),
+            K_(thermalConductivity),
+            Kg_(vapourThermalConductivity),
+            sigma_(surfaceTension),
+            D_(vapourDiffussivity)
+        {}
+
+        //- Construct from Istream
+        nC3H8O(Istream& is)
+        :
+            liquid(is),
+            rho_(is),
+            pv_(is),
+            hl_(is),
+            cp_(is),
+            h_(is),
+            cpg_(is),
+            B_(is),
+            mu_(is),
+            mug_(is),
+            K_(is),
+            Kg_(is),
+            sigma_(is),
+            D_(is)
+        {}
+
+
+    // Member Functions
+
+        //- Liquid density [kg/m^3]
+        scalar rho(scalar p, scalar T) const
+        {
+            return rho_.f(p, T);
+        }
+
+        //- Vapour pressure [Pa]
+        scalar pv(scalar p, scalar T) const
+        {
+            return pv_.f(p, T);
+        }
+
+        //- Heat of vapourisation [J/kg]
+        scalar hl(scalar p, scalar T) const
+        {
+            return hl_.f(p, T);
+        }
+
+        //- Liquid heat capacity [J/(kg K)]
+        scalar cp(scalar p, scalar T) const
+        {
+            return cp_.f(p, T);
+        }
+
+        //- Liquid Enthalpy [J/(kg)]
+        scalar h(scalar p, scalar T) const
+        {
+            return h_.f(p, T);
+        }
+
+        //- Ideal gas heat capacity [J/(kg K)]
+        scalar cpg(scalar p, scalar T) const
+        {
+            return cpg_.f(p, T);
+        }
+
+        //- Second Virial Coefficient [m^3/kg]
+        scalar B(scalar p, scalar T) const
+        {
+            return B_.f(p, T);
+        }
+
+        //- Liquid viscosity [Pa s]
+        scalar mu(scalar p, scalar T) const
+        {
+            return mu_.f(p, T);
+        }
+
+        //- Vapour viscosity [Pa s]
+        scalar mug(scalar p, scalar T) const
+        {
+            return mug_.f(p, T);
+        }
+
+        //- Liquid thermal conductivity  [W/(m K)]
+        scalar K(scalar p, scalar T) const
+        {
+            return K_.f(p, T);
+        }
+
+        //- Vapour thermal conductivity  [W/(m K)]
+        scalar Kg(scalar p, scalar T) const
+        {
+            return Kg_.f(p, T);
+        }
+
+        //- Surface tension [N/m]
+        scalar sigma(scalar p, scalar T) const
+        {
+            return sigma_.f(p, T);
+        }
+
+        //- Vapour diffussivity [m2/s]
+        scalar D(scalar p, scalar T) const
+        {
+            return D_.f(p, T);
+        }
+
+
+        //- Write the function coefficients
+        void writeData(Ostream& os) const
+        {
+            liquid::writeData(os); os << nl;
+            rho_.writeData(os); os << nl;
+            pv_.writeData(os); os << nl;
+            hl_.writeData(os); os << nl;
+            cp_.writeData(os); os << nl;
+            cpg_.writeData(os); os << nl;
+            B_.writeData(os); os << nl;
+            mu_.writeData(os); os << nl;
+            mug_.writeData(os); os << nl;
+            K_.writeData(os); os << nl;
+            Kg_.writeData(os); os << nl;
+            sigma_.writeData(os); os << nl;
+            D_.writeData(os); os << endl;
+        }
+
+
+    // Ostream Operator
+
+        friend Ostream& operator<<(Ostream& os, const nC3H8O& l)
+        {
+            l.writeData(os);
+            return os;
+        }
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
+
diff --git a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.C b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.C
index 6c9b91a407e86f283caa7a291110c873d243222c..d10505e6b21c7edbffd71189763aaf4e2f31f7bd 100644
--- a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.C
+++ b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.C
@@ -88,7 +88,7 @@ autoPtr<turbulenceModel> turbulenceModel::New
             )
         );
 
-        turbulencePropertiesDict.lookup("turbulenceModel")
+        turbulencePropertiesDict.lookup("simulationType")
             >> turbulenceModelTypeName;
     }
 
diff --git a/src/turbulenceModels/incompressible/LES/vanDriestDelta/vanDriestDelta.C b/src/turbulenceModels/incompressible/LES/vanDriestDelta/vanDriestDelta.C
index da55d3518bc770e5a8f95141073477ccca629dc5..0979890dbf080d377f36b7692367ed0252d8ee81 100644
--- a/src/turbulenceModels/incompressible/LES/vanDriestDelta/vanDriestDelta.C
+++ b/src/turbulenceModels/incompressible/LES/vanDriestDelta/vanDriestDelta.C
@@ -115,6 +115,10 @@ vanDriestDelta::vanDriestDelta
     Cdelta_
     (
         dd.subDict(type() + "Coeffs").lookupOrDefault<scalar>("Cdelta", 0.158)
+    ),
+    calcInterval_
+    (
+        dd.subDict(type() + "Coeffs").lookupOrDefault<label>("calcInterval", 1)
     )
 {
     delta_ = geometricDelta_();
@@ -131,14 +135,18 @@ void vanDriestDelta::read(const dictionary& d)
     d.readIfPresent<scalar>("kappa", kappa_);
     dd.readIfPresent<scalar>("Aplus", Aplus_);
     dd.readIfPresent<scalar>("Cdelta", Cdelta_);
+    dd.readIfPresent<label>("calcInterval", calcInterval_);
     calcDelta();
 }
 
 
 void vanDriestDelta::correct()
 {
-    geometricDelta_().correct();
-    calcDelta();
+    if (mesh().time().timeIndex() % calcInterval_ == 0)
+    {
+        geometricDelta_().correct();
+        calcDelta();
+    }
 }
 
 
diff --git a/src/turbulenceModels/incompressible/LES/vanDriestDelta/vanDriestDelta.H b/src/turbulenceModels/incompressible/LES/vanDriestDelta/vanDriestDelta.H
index 66fe691c103e777002e4545611acd8d3bea58012..854fa181bb493941ba30aa870d8381b52826539b 100644
--- a/src/turbulenceModels/incompressible/LES/vanDriestDelta/vanDriestDelta.H
+++ b/src/turbulenceModels/incompressible/LES/vanDriestDelta/vanDriestDelta.H
@@ -61,6 +61,7 @@ class vanDriestDelta
         scalar kappa_;
         scalar Aplus_;
         scalar Cdelta_;
+        label calcInterval_;
 
 
     // Private Member Functions
diff --git a/tutorials/dieselFoam/aachenBomb/constant/polyMesh/boundary b/tutorials/buoyantFoam/hotRoom/constant/turbulenceProperties
similarity index 78%
rename from tutorials/dieselFoam/aachenBomb/constant/polyMesh/boundary
rename to tutorials/buoyantFoam/hotRoom/constant/turbulenceProperties
index 776ce2125360feefef39ba39f7b92e300f44f131..321c08496ae7cbe64b73cb2b6f5b2b172bcc9eaf 100644
--- a/tutorials/dieselFoam/aachenBomb/constant/polyMesh/boundary
+++ b/tutorials/buoyantFoam/hotRoom/constant/turbulenceProperties
@@ -8,20 +8,15 @@
 FoamFile
 {
     version     2.0;
-    format      binary;
-    class       polyBoundaryMesh;
-    object      boundary;
+    format      ascii;
+    class       dictionary;
+    object      turbulenceProperties;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-1
-(
-    walls
-    {
-        type            wall;
-        nFaces          19762;
-        startFace       494419;
-    }
-)
+//simulationType       laminar;
+simulationType       RASModel;
+//simulationType       LESModel;
+
 
 // ************************************************************************* //
diff --git a/tutorials/compressibleLesInterFoam/depthCharge2D/0/U b/tutorials/compressibleInterFoam/depthCharge2D/0/U
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge2D/0/U
rename to tutorials/compressibleInterFoam/depthCharge2D/0/U
diff --git a/tutorials/compressibleLesInterFoam/depthCharge2D/0/alpha1.org b/tutorials/compressibleInterFoam/depthCharge2D/0/alpha1.org
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge2D/0/alpha1.org
rename to tutorials/compressibleInterFoam/depthCharge2D/0/alpha1.org
diff --git a/tutorials/compressibleLesInterFoam/depthCharge2D/0/pd.org b/tutorials/compressibleInterFoam/depthCharge2D/0/pd.org
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge2D/0/pd.org
rename to tutorials/compressibleInterFoam/depthCharge2D/0/pd.org
diff --git a/tutorials/compressibleLesInterFoam/depthCharge2D/Allrun b/tutorials/compressibleInterFoam/depthCharge2D/Allrun
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge2D/Allrun
rename to tutorials/compressibleInterFoam/depthCharge2D/Allrun
diff --git a/tutorials/compressibleLesInterFoam/depthCharge2D/constant/LESProperties b/tutorials/compressibleInterFoam/depthCharge2D/constant/LESProperties
similarity index 98%
rename from tutorials/compressibleLesInterFoam/depthCharge2D/constant/LESProperties
rename to tutorials/compressibleInterFoam/depthCharge2D/constant/LESProperties
index 130d0947d9c4402eba4cf9ee019bdd81b319ad1b..bb84772ba51036c08aa1082c7e6720dfe9d65037 100644
--- a/tutorials/compressibleLesInterFoam/depthCharge2D/constant/LESProperties
+++ b/tutorials/compressibleInterFoam/depthCharge2D/constant/LESProperties
@@ -16,7 +16,9 @@ FoamFile
 
 LESModel        laminar;
 
-delta           smooth;
+turbulence      off;
+
+delta           cubeRootVol;
 
 laminarCoeffs
 {
diff --git a/tutorials/compressibleLesInterFoam/depthCharge2D/constant/environmentalProperties b/tutorials/compressibleInterFoam/depthCharge2D/constant/environmentalProperties
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge2D/constant/environmentalProperties
rename to tutorials/compressibleInterFoam/depthCharge2D/constant/environmentalProperties
diff --git a/tutorials/compressibleLesInterFoam/depthCharge2D/constant/polyMesh/blockMeshDict b/tutorials/compressibleInterFoam/depthCharge2D/constant/polyMesh/blockMeshDict
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge2D/constant/polyMesh/blockMeshDict
rename to tutorials/compressibleInterFoam/depthCharge2D/constant/polyMesh/blockMeshDict
diff --git a/tutorials/compressibleLesInterFoam/depthCharge2D/constant/polyMesh/boundary b/tutorials/compressibleInterFoam/depthCharge2D/constant/polyMesh/boundary
similarity index 78%
rename from tutorials/compressibleLesInterFoam/depthCharge2D/constant/polyMesh/boundary
rename to tutorials/compressibleInterFoam/depthCharge2D/constant/polyMesh/boundary
index e1e2119e32dbd8fc336ad4c3ce9de73c190ff41f..a6a3281fd72f7a13b8fb5bd5a0d44edc0abc0059 100644
--- a/tutorials/compressibleLesInterFoam/depthCharge2D/constant/polyMesh/boundary
+++ b/tutorials/compressibleInterFoam/depthCharge2D/constant/polyMesh/boundary
@@ -1,15 +1,16 @@
 /*--------------------------------*- C++ -*----------------------------------*\
 | =========                 |                                                 |
 | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      http://www.OpenFOAM.org               |
-|    \\/     M anipulation  |                                                 |
+|  \\    /   O peration     | Version:  dev-09ca1eb6b56f                      |
+|   \\  /    A nd           |                                                 |
+|    \\/     M anipulation  |                                www.OpenFOAM.org |
 \*---------------------------------------------------------------------------*/
 FoamFile
 {
     version     2.0;
     format      ascii;
     class       polyBoundaryMesh;
+    location    "constant/polyMesh";
     object      boundary;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/tutorials/compressibleLesInterFoam/depthCharge2D/constant/transportProperties b/tutorials/compressibleInterFoam/depthCharge2D/constant/transportProperties
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge2D/constant/transportProperties
rename to tutorials/compressibleInterFoam/depthCharge2D/constant/transportProperties
diff --git a/tutorials/compressibleInterFoam/depthCharge2D/constant/turbulenceProperties b/tutorials/compressibleInterFoam/depthCharge2D/constant/turbulenceProperties
new file mode 100644
index 0000000000000000000000000000000000000000..d3f32ecb06e6235cefb9e465d2767faa80138f38
--- /dev/null
+++ b/tutorials/compressibleInterFoam/depthCharge2D/constant/turbulenceProperties
@@ -0,0 +1,22 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  1.5                                   |
+|   \\  /    A nd           | Web:      http://www.OpenFOAM.org               |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      turbulenceProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+//simulationType       laminar;
+//simulationType       RASModel;
+simulationType       LESModel;
+
+
+// ************************************************************************* //
diff --git a/tutorials/compressibleLesInterFoam/depthCharge2D/system/controlDict b/tutorials/compressibleInterFoam/depthCharge2D/system/controlDict
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge2D/system/controlDict
rename to tutorials/compressibleInterFoam/depthCharge2D/system/controlDict
diff --git a/tutorials/compressibleLesInterFoam/depthCharge2D/system/fvSchemes b/tutorials/compressibleInterFoam/depthCharge2D/system/fvSchemes
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge2D/system/fvSchemes
rename to tutorials/compressibleInterFoam/depthCharge2D/system/fvSchemes
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/system/fvSolution b/tutorials/compressibleInterFoam/depthCharge2D/system/fvSolution
similarity index 99%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/system/fvSolution
rename to tutorials/compressibleInterFoam/depthCharge2D/system/fvSolution
index f97cf54032ec4b42a7b0bb04cdd33dcd4deb1de7..868252473975e23b298727de38f9dd66fbef0b56 100644
--- a/tutorials/compressibleLesInterFoam/depthCharge3D/system/fvSolution
+++ b/tutorials/compressibleInterFoam/depthCharge2D/system/fvSolution
@@ -120,7 +120,7 @@ PISO
     nNonOrthogonalCorrectors 0;
     nAlphaCorr      1;
     nAlphaSubCycles 1;
-    cGamma          1;
+    cAlpha          1;
 }
 
 // ************************************************************************* //
diff --git a/tutorials/compressibleLesInterFoam/depthCharge2D/system/setFieldsDict b/tutorials/compressibleInterFoam/depthCharge2D/system/setFieldsDict
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge2D/system/setFieldsDict
rename to tutorials/compressibleInterFoam/depthCharge2D/system/setFieldsDict
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/0/U b/tutorials/compressibleInterFoam/depthCharge3D/0/U
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/0/U
rename to tutorials/compressibleInterFoam/depthCharge3D/0/U
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/0/alpha1.org b/tutorials/compressibleInterFoam/depthCharge3D/0/alpha1.org
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/0/alpha1.org
rename to tutorials/compressibleInterFoam/depthCharge3D/0/alpha1.org
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/0/pd.org b/tutorials/compressibleInterFoam/depthCharge3D/0/pd.org
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/0/pd.org
rename to tutorials/compressibleInterFoam/depthCharge3D/0/pd.org
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/Allclean b/tutorials/compressibleInterFoam/depthCharge3D/Allclean
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/Allclean
rename to tutorials/compressibleInterFoam/depthCharge3D/Allclean
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/Allrun b/tutorials/compressibleInterFoam/depthCharge3D/Allrun
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/Allrun
rename to tutorials/compressibleInterFoam/depthCharge3D/Allrun
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/constant/LESProperties b/tutorials/compressibleInterFoam/depthCharge3D/constant/LESProperties
similarity index 98%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/constant/LESProperties
rename to tutorials/compressibleInterFoam/depthCharge3D/constant/LESProperties
index 130d0947d9c4402eba4cf9ee019bdd81b319ad1b..bb84772ba51036c08aa1082c7e6720dfe9d65037 100644
--- a/tutorials/compressibleLesInterFoam/depthCharge3D/constant/LESProperties
+++ b/tutorials/compressibleInterFoam/depthCharge3D/constant/LESProperties
@@ -16,7 +16,9 @@ FoamFile
 
 LESModel        laminar;
 
-delta           smooth;
+turbulence      off;
+
+delta           cubeRootVol;
 
 laminarCoeffs
 {
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/constant/environmentalProperties b/tutorials/compressibleInterFoam/depthCharge3D/constant/environmentalProperties
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/constant/environmentalProperties
rename to tutorials/compressibleInterFoam/depthCharge3D/constant/environmentalProperties
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/constant/polyMesh/blockMeshDict b/tutorials/compressibleInterFoam/depthCharge3D/constant/polyMesh/blockMeshDict
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/constant/polyMesh/blockMeshDict
rename to tutorials/compressibleInterFoam/depthCharge3D/constant/polyMesh/blockMeshDict
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/constant/polyMesh/boundary b/tutorials/compressibleInterFoam/depthCharge3D/constant/polyMesh/boundary
similarity index 75%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/constant/polyMesh/boundary
rename to tutorials/compressibleInterFoam/depthCharge3D/constant/polyMesh/boundary
index 178b2ace003c711381d84ede00541b384556c3bd..3517ca55be180a00b154b971fd6945bd75fd1afc 100644
--- a/tutorials/compressibleLesInterFoam/depthCharge3D/constant/polyMesh/boundary
+++ b/tutorials/compressibleInterFoam/depthCharge3D/constant/polyMesh/boundary
@@ -1,15 +1,16 @@
 /*--------------------------------*- C++ -*----------------------------------*\
 | =========                 |                                                 |
 | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      http://www.OpenFOAM.org               |
-|    \\/     M anipulation  |                                                 |
+|  \\    /   O peration     | Version:  dev-09ca1eb6b56f                      |
+|   \\  /    A nd           |                                                 |
+|    \\/     M anipulation  |                                www.OpenFOAM.org |
 \*---------------------------------------------------------------------------*/
 FoamFile
 {
     version     2.0;
     format      ascii;
     class       polyBoundaryMesh;
+    location    "constant/polyMesh";
     object      boundary;
 }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/constant/transportProperties b/tutorials/compressibleInterFoam/depthCharge3D/constant/transportProperties
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/constant/transportProperties
rename to tutorials/compressibleInterFoam/depthCharge3D/constant/transportProperties
diff --git a/tutorials/compressibleInterFoam/depthCharge3D/constant/turbulenceProperties b/tutorials/compressibleInterFoam/depthCharge3D/constant/turbulenceProperties
new file mode 100644
index 0000000000000000000000000000000000000000..fe67e8fecae0729e7345802955479523972bb72d
--- /dev/null
+++ b/tutorials/compressibleInterFoam/depthCharge3D/constant/turbulenceProperties
@@ -0,0 +1,22 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  1.5                                   |
+|   \\  /    A nd           | Web:      http://www.OpenFOAM.org               |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      turbulenceProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+//simulationType laminar;
+//simulationType RASModel;
+simulationType LESModel;
+
+
+// ************************************************************************* //
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/system/controlDict b/tutorials/compressibleInterFoam/depthCharge3D/system/controlDict
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/system/controlDict
rename to tutorials/compressibleInterFoam/depthCharge3D/system/controlDict
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/system/decomposeParDict b/tutorials/compressibleInterFoam/depthCharge3D/system/decomposeParDict
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/system/decomposeParDict
rename to tutorials/compressibleInterFoam/depthCharge3D/system/decomposeParDict
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/system/fvSchemes b/tutorials/compressibleInterFoam/depthCharge3D/system/fvSchemes
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/system/fvSchemes
rename to tutorials/compressibleInterFoam/depthCharge3D/system/fvSchemes
diff --git a/tutorials/compressibleLesInterFoam/depthCharge2D/system/fvSolution b/tutorials/compressibleInterFoam/depthCharge3D/system/fvSolution
similarity index 99%
rename from tutorials/compressibleLesInterFoam/depthCharge2D/system/fvSolution
rename to tutorials/compressibleInterFoam/depthCharge3D/system/fvSolution
index f97cf54032ec4b42a7b0bb04cdd33dcd4deb1de7..868252473975e23b298727de38f9dd66fbef0b56 100644
--- a/tutorials/compressibleLesInterFoam/depthCharge2D/system/fvSolution
+++ b/tutorials/compressibleInterFoam/depthCharge3D/system/fvSolution
@@ -120,7 +120,7 @@ PISO
     nNonOrthogonalCorrectors 0;
     nAlphaCorr      1;
     nAlphaSubCycles 1;
-    cGamma          1;
+    cAlpha          1;
 }
 
 // ************************************************************************* //
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/system/machines b/tutorials/compressibleInterFoam/depthCharge3D/system/machines
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/system/machines
rename to tutorials/compressibleInterFoam/depthCharge3D/system/machines
diff --git a/tutorials/compressibleLesInterFoam/depthCharge3D/system/setFieldsDict b/tutorials/compressibleInterFoam/depthCharge3D/system/setFieldsDict
similarity index 100%
rename from tutorials/compressibleLesInterFoam/depthCharge3D/system/setFieldsDict
rename to tutorials/compressibleInterFoam/depthCharge3D/system/setFieldsDict
diff --git a/tutorials/dieselFoam/aachenBomb/constant/injectorProperties b/tutorials/dieselFoam/aachenBomb/constant/injectorProperties
index 66e47bddebc7818798a167b1153d09d63a31acd0..81b8b07bc6d0135f84a4c63b2b0b78dbc917dd7d 100644
--- a/tutorials/dieselFoam/aachenBomb/constant/injectorProperties
+++ b/tutorials/dieselFoam/aachenBomb/constant/injectorProperties
@@ -25,7 +25,6 @@ FoamFile
             diameter        0.00019;
             Cd              0.9;
             mass            6e-06;
-            temperature     320;
             nParcels        5000;
 
             X
@@ -67,6 +66,14 @@ FoamFile
                 (0.00120833 5.1737)
                 (0.00125 3.9213)
             );
+
+            temperatureProfile
+            (
+                (0.0      320.0)
+                (0.00125  320.0)
+            );
+
+
         }
 
         commonRailInjectorProps
diff --git a/wmake/rules/General/flex++ b/wmake/rules/General/flex++
index 823649beababbba8eba77924ed143e07b2536f37..6f68d78001b65064e3407c2d4bf0453d271384f9 100644
--- a/wmake/rules/General/flex++
+++ b/wmake/rules/General/flex++
@@ -1,6 +1,6 @@
 .SUFFIXES: .L
 
-Ltoo = flex++ -f $$SOURCE ; mv lex.yy.cc $*.C ; $(CC) $(c++FLAGS) -c $*.C -o $@ 
+Ltoo = flex --c++ -f $$SOURCE ; mv lex.yy.cc $*.C ; $(CC) $(c++FLAGS) -c $*.C -o $@
 
 .L.dep:
 	$(MAKE_DEP)
diff --git a/wmake/rules/General/standard b/wmake/rules/General/standard
index 82d2a6c11ebe2317bb6fde241c7d481782b9613a..8e5e436d32aa2754691dbb1ad89418083daceb95 100644
--- a/wmake/rules/General/standard
+++ b/wmake/rules/General/standard
@@ -1,3 +1,5 @@
+include $(GENERAL_RULES)/version
+
 include $(GENERAL_RULES)/sourceToDep
 
 include $(GENERAL_RULES)/java
diff --git a/wmake/rules/General/version b/wmake/rules/General/version
new file mode 100644
index 0000000000000000000000000000000000000000..64f272ed088a902d615f7d771bac5c432bc2c625
--- /dev/null
+++ b/wmake/rules/General/version
@@ -0,0 +1,11 @@
+.SUFFIXES: .Cver
+
+#
+# update version string in C++ file and in $WM_PROJECT_DIR/.build file
+#
+Cvertoo = \
+    sed 's/WM_PROJECT_VERSION/$(shell wmakePrintBuild -update)/' $$SOURCE > $*.C; \
+    $(CC) $(c++FLAGS) -c $*.C -o $@
+
+.Cver.dep:
+	$(MAKE_DEP)
diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild
new file mode 100755
index 0000000000000000000000000000000000000000..1eb59cf46c4f71cacb12d5c40e961b0fcd388a9b
--- /dev/null
+++ b/wmake/wmakePrintBuild
@@ -0,0 +1,151 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# =========                 |
+# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+#  \\    /   O peration     |
+#   \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+#    \\/     M anipulation  |
+#-------------------------------------------------------------------------------
+# License
+#     This file is part of OpenFOAM.
+#
+#     OpenFOAM is free software; you can redistribute it and/or modify it
+#     under the terms of the GNU General Public License as published by the
+#     Free Software Foundation; either version 2 of the License, or (at your
+#     option) any later version.
+#
+#     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+#     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+#     for more details.
+#
+#     You should have received a copy of the GNU General Public License
+#     along with OpenFOAM; if not, write to the Free Software Foundation,
+#     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Script
+#     wmakePrintBuild
+#
+# Description
+#     Print the version used when building the project.
+#
+#------------------------------------------------------------------------------
+Script=${0##*/}
+
+usage() {
+    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
+    cat<<USAGE
+usage: $Script [OPTION]
+options:
+  -check          check the git head commit vs. \$WM_PROJECT_DIR/.build
+                  (exit code 0 for no changes)
+  -update         update the \$WM_PROJECT_DIR/.build from the git information
+  -version VER    specify an alternative version
+
+Print the version used when building the project, in this order of precedence:
+  * the git head commit (prefixed with \$WM_PROJECT_VERSION)
+  * \$WM_PROJECT_DIR/.build
+  * \$WM_PROJECT_VERSION
+
+USAGE
+    exit 1
+}
+#------------------------------------------------------------------------------
+
+unset checkOnly update version
+
+# parse options
+while [ "$#" -gt 0 ]
+do
+    case "$1" in
+    -h | -help)
+        usage
+        ;;
+    -check)
+        checkOnly=true
+        shift
+        ;;
+    -update)
+        update=true
+        shift
+        ;;
+    -version)
+        [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
+        version=$2
+        shift 2
+        ;;
+    *)
+        usage "unknown option/argument: '$*'"
+        ;;
+    esac
+done
+
+#------------------------------------------------------------------------------
+
+#
+# persistent build tag
+#
+build="$WM_PROJECT_DIR/.build"
+previous=$(tail -1 $build 2>/dev/null)
+
+if [ -n "$version" ]
+then
+    # specified a version - no error possible
+    rc=0
+else
+    # building under git (get the head SHA1)
+    version=$(git show-ref --hash=12 --head refs/heads/master 2>/dev/null)
+    rc=$?
+
+    # prefix with WM_PROJECT_VERSION
+    if [ $rc -eq 0 ]
+    then
+        version="${WM_PROJECT_VERSION}-$version"
+    fi
+fi
+
+
+# update persistent build tag if possible
+if [ $rc -eq 0 -a -n "$update" -a "$version" != "$previous" ]
+then
+    if [ -w "$build" -a \( -w "$WM_PROJECT_DIR" -o ! -e "$build" \) ]
+    then
+        echo $version >| "$build" 2>/dev/null
+    fi
+fi
+
+
+# check git vs. persistent build tag - no output
+if [ -n "$checkOnly" ]
+then
+    if [ $rc -eq 0 ]
+    then
+        test "$version" = "$previous"
+        rc=$?
+        if [ $rc -eq 0 ]
+        then
+            echo "same version as previous build"
+        else
+            echo "version changed from previous build"
+        fi
+    else
+        echo "no git description found"
+    fi
+    exit $rc
+fi
+
+
+if [ $rc -eq 0 ]
+then
+    # output the git information or the -version version
+    echo $version
+elif [ -n "$previous" ]
+then
+    # use previous build tag
+    echo $previous
+else
+    # fallback to WM_PROJECT_VERSION alone
+    echo ${WM_PROJECT_VERSION:-unknown}
+fi
+
+#------------------------------------------------------------------------------