diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C
index 96413e02017e72642648bb5c732de4ec9065f5fe..b24f21fe8dfc6d88bac7f046f52353fbcef55fc7 100644
--- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C
+++ b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C
@@ -120,11 +120,14 @@ int main(int argc, char *argv[])
             "cSf_pos",
             interpolate(c, pos, T.name())*mesh.magSf()
         );
+        cSf_pos.setOriented();
+
         surfaceScalarField cSf_neg
         (
             "cSf_neg",
             interpolate(c, neg, T.name())*mesh.magSf()
         );
+        cSf_neg.setOriented();
 
         surfaceScalarField ap
         (
@@ -269,4 +272,5 @@ int main(int argc, char *argv[])
     return 0;
 }
 
+
 // ************************************************************************* //
diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C
index 65ab9d2db3e9ee7ea9eb3246ec3415bcfae01532..6550d62b28cb858759307c5bcde1c442fcdc6108 100644
--- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C
+++ b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C
@@ -101,11 +101,14 @@ int main(int argc, char *argv[])
             "cSf_pos",
             interpolate(c, pos, T.name())*mesh.magSf()
         );
+        cSf_pos.setOriented();
+
         surfaceScalarField cSf_neg
         (
             "cSf_neg",
             interpolate(c, neg, T.name())*mesh.magSf()
         );
+        cSf_neg.setOriented();
 
         surfaceScalarField ap
         (
diff --git a/applications/solvers/electromagnetics/magneticFoam/magnet.H b/applications/solvers/electromagnetics/magneticFoam/magnet.H
index 7e9b04a4c5167922f15f7cbd4852c5921cb0942c..8f15c69635d82b92e28a408966daa30b5c61e94d 100644
--- a/applications/solvers/electromagnetics/magneticFoam/magnet.H
+++ b/applications/solvers/electromagnetics/magneticFoam/magnet.H
@@ -138,9 +138,7 @@ public:
                 >> m.orientation_;
             is.readEnd("magnet");
 
-            // Check state of Istream
-            is.check("operator>>(Istream&, magnet&)");
-
+            is.check(FUNCTION_NAME);
             return is;
         }
 
diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C
index b3504da91a555bc5c0402bdf0c1a6bbf5c591ca7..bbec4a41ab9062ac64daa3258e8f8bad7b3169b0 100644
--- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C
+++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C
@@ -38,7 +38,6 @@ Description
 #include "basicReactingMultiphaseCloud.H"
 #include "rhoCombustionModel.H"
 #include "radiationModel.H"
-#include "IOporosityModelList.H"
 #include "fvOptions.H"
 #include "SLGThermo.H"
 #include "simpleControl.H"
diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C
index 55175d8d8049ecfdb9d9078b3526898a724bac21..627dd41b6f2ec5316cdcae0c0c1031a9759680c6 100644
--- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C
+++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C
@@ -113,6 +113,7 @@ Foam::multiphaseMixtureThermo::multiphaseMixtureThermo
         1e-8/pow(average(mesh_.V()), 1.0/3.0)
     )
 {
+    rhoPhi_.setOriented();
     calcAlphas();
     alphas_.write();
     correct();
@@ -698,6 +699,7 @@ Foam::multiphaseMixtureThermo::surfaceTensionForce() const
     );
 
     surfaceScalarField& stf = tstf.ref();
+    stf.setOriented();
 
     forAllConstIter(PtrDictionary<phaseModel>, phases_, phase1)
     {
diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C
index 798e9c2eb6c6d997f8c7fcd211a6708b6ad9fc52..de3084f69f010f2262fe66fa76156a3b4b0b1f19 100644
--- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C
+++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C
@@ -801,6 +801,7 @@ Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseSystem::surfaceTension
             )
         )
     );
+    tSurfaceTension.ref().setOriented();
 
     forAllConstIter(PtrDictionary<phaseModel>, phases_, iter)
     {
diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C
index a1990a88c9ca733c6be593cd5deb9f773f71ba47..224d0345d6ddc8481542d436e11399fa4187a0f3 100644
--- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C
+++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C
@@ -113,6 +113,8 @@ Foam::phaseModel::phaseModel
         dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0)
     )
 {
+    alphaPhi_.setOriented();
+
     const word phiName = IOobject::groupName("phi", name_);
 
     IOobject phiHeader
diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C
index 21b5edefe45313803f02ade0c7b9a61f156d0e3f..b6144051a45c09a63b963531718910eeda82a49e 100644
--- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C
+++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C
@@ -128,6 +128,8 @@ Foam::multiphaseMixture::multiphaseMixture
         1e-8/pow(average(mesh_.V()), 1.0/3.0)
     )
 {
+    rhoPhi_.setOriented();
+
     calcAlphas();
     alphas_.write();
 }
@@ -273,6 +275,7 @@ Foam::multiphaseMixture::surfaceTensionForce() const
     );
 
     surfaceScalarField& stf = tstf.ref();
+    stf.setOriented();
 
     forAllConstIter(PtrDictionary<phase>, phases_, iter1)
     {
diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C
index 64345bf7597e09c64a97bed915b70398d89a1c61..2213f1a7253e0ca60ca47724196492e1e8a551ad 100644
--- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C
+++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C
@@ -455,6 +455,7 @@ Foam::BlendedInterfacialModel<ModelType>::Ff() const
             dimensionedScalar("zero", ModelType::dimF*dimArea, 0)
         )
     );
+    x.ref().setOriented();
 
     if (model_.valid())
     {
diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C
index b9859eb41d07956825a509ce71274b1b8249dade..02969b89cb86825dda8f261d7118df25cbe53164 100644
--- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C
+++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C
@@ -347,7 +347,7 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::Ff
     }
     else
     {
-        return tmp<surfaceScalarField>
+        tmp<surfaceScalarField> tFf
         (
             new surfaceScalarField
             (
@@ -364,6 +364,10 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::Ff
                 dimensionedScalar("zero", liftModel::dimF*dimArea, 0)
             )
         );
+
+        tFf.ref().setOriented();
+
+        return tFf;
     }
 }
 
@@ -621,6 +625,8 @@ Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::setPhiD
                 )
             )
         );
+
+        phiDs[phasei].setOriented();
     }
 
     return phiDs[phasei];
diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C
index 0605c1171e8a09bcacf947f03036335ab38851ba..2afa388aca951c7c9a496765af7d099f4eab41d7 100644
--- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C
+++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C
@@ -200,6 +200,9 @@ Foam::MovingPhaseModel<BasePhaseModel>::MovingPhaseModel
         dimensionedScalar("0", dimDensity/dimTime, 0)
     )
 {
+    alphaPhi_.setOriented();
+    alphaRhoPhi_.setOriented();
+
     phi_.writeOpt() = IOobject::AUTO_WRITE;
     correctKinematics();
 }
diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C
index 805d99844e3586f95d33624bc333938cc32b472b..627af1db87f08a5912e12c0dd01a4650f53fcd99 100644
--- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C
+++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C
@@ -548,6 +548,8 @@ Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseSystem::surfaceTension
         )
     );
 
+    tSurfaceTension.ref().setOriented();
+
     forAll(phases(), phasej)
     {
         const phaseModel& phase2 = phases()[phasej];
diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C
index 87a249277a33b2fd754c3af103bbf4a8200ffa24..9352b7239733692ed8e5bc2dce356996f764aeea 100644
--- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C
+++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C
@@ -109,6 +109,9 @@ Foam::phaseModel::phaseModel
         dimensionedScalar("0", dimensionSet(1, 0, -1, 0, 0), 0)
     )
 {
+    alphaPhi_.setOriented();
+    alphaRhoPhi_.setOriented();
+
     thermo_->validate("phaseModel " + name_, "h", "e");
 
     const word phiName = IOobject::groupName("phi", name_);
diff --git a/applications/test/NamedEnum/Test-NamedEnum.C b/applications/test/NamedEnum/Test-NamedEnum.C
index 08d1f74972e66c68471671c0b7d32483ed1762d7..079938b6b79405f8baf8c00701113ddd0dc4f7f0 100644
--- a/applications/test/NamedEnum/Test-NamedEnum.C
+++ b/applications/test/NamedEnum/Test-NamedEnum.C
@@ -66,6 +66,9 @@ int main(int argc, char *argv[])
     const List<namedEnumTest::option> options
         = namedEnumTest::namedEnum.enums();
 
+    dictionary testDict;
+    testDict.add("lookup1", "c");
+
     Info<< "enums: " << options << nl;
 
     Info<< "loop over enums (as list):" << nl;
@@ -88,6 +91,30 @@ int main(int argc, char *argv[])
         << namedEnumTest::namedEnum["a"] << nl
         << namedEnumTest::namedEnum[namedEnumTest::a] << nl;
 
+    Info<< "--- test dictionary lookup ---" << endl;
+    {
+        Info<< "dict: " << testDict << endl;
+
+        namedEnumTest::option gotOpt =
+            namedEnumTest::namedEnum.lookupOrDefault
+            (
+                "test",
+                testDict,
+                namedEnumTest::option::a
+            );
+
+        Info<< "got: " << gotOpt << endl;
+
+        gotOpt = namedEnumTest::namedEnum.lookupOrDefault
+        (
+            "lookup1",
+            testDict,
+            namedEnumTest::option::a
+        );
+
+        Info<< "got: " << gotOpt << endl;
+    }
+
     Info<< "--- test read construction ---" << endl;
 
     namedEnumTest::option dummy(namedEnumTest::namedEnum.read(Sin));
diff --git a/applications/test/mapDistributePolyMesh/Make/files b/applications/test/mapDistributePolyMesh/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..eb304044bffb5434b9a322c49b803f4ab42ae0a3
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/Make/files
@@ -0,0 +1,3 @@
+Test-mapDistributePolyMesh.C
+EXE = $(FOAM_USER_APPBIN)/Test-mapDistributePolyMesh
+
diff --git a/applications/test/mapDistributePolyMesh/Make/options b/applications/test/mapDistributePolyMesh/Make/options
new file mode 100644
index 0000000000000000000000000000000000000000..dc318df99832515cca0862ee9d04aea77fda2baf
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/Make/options
@@ -0,0 +1,9 @@
+EXE_INC = \
+    -I$(LIB_SRC)/meshTools/lnInclude \
+    -I$(LIB_SRC)/finiteVolume/lnInclude \
+    -I$(LIB_SRC)/dynamicMesh/lnInclude
+
+EXE_LIBS = \
+    -lfiniteVolume \
+    -ldynamicMesh \
+    -lmeshTools
diff --git a/applications/test/mapDistributePolyMesh/Test-mapDistributePolyMesh.C b/applications/test/mapDistributePolyMesh/Test-mapDistributePolyMesh.C
new file mode 100644
index 0000000000000000000000000000000000000000..a925be3efe8f80c1e0c62959a619d24ceb00ba47
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/Test-mapDistributePolyMesh.C
@@ -0,0 +1,149 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2017 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 3 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, see <http://www.gnu.org/licenses/>.
+
+Application
+    mapDistributePolyMesh
+
+Description
+    Test for procAddressing
+
+\*---------------------------------------------------------------------------*/
+
+#include "IOmapDistributePolyMesh.H"
+#include "argList.H"
+#include "Time.H"
+#include "surfaceFields.H"
+#include "flipOp.H"
+
+using namespace Foam;
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+int main(int argc, char *argv[])
+{
+    #include "setRootCase.H"
+    #include "createTime.H"
+    #include "createMesh.H"
+
+    Info<< "Reading distribute map\n" << endl;
+
+    const word instance("0.005");
+    const scalar instanceValue(0.005);
+
+
+    IOobject io
+    (
+        "procAddressing",
+        instance,
+        fvMesh::meshSubDir,
+        mesh,
+        IOobject::MUST_READ,
+        IOobject::NO_WRITE,
+        false
+    );
+
+    IOmapDistributePolyMesh map(io);
+
+    {
+        // Load the instance mesh
+        runTime.setTime(instanceValue, 0);
+        polyMesh distributedMesh
+        (
+            IOobject
+            (
+                polyMesh::defaultRegion,
+                instance,
+                runTime,
+                IOobject::MUST_READ
+            )
+        );
+
+        // Faces, no flip
+        {
+            const mapDistribute& faceMap = map.faceMap();
+            pointField fc(mesh.faceCentres());
+            faceMap.distribute(fc, noOp());
+            Pout<< "Construct size:" << faceMap.constructSize() << endl;
+            forAll(distributedMesh.faceCentres(), facei)
+            {
+                Pout<< "face:" << facei
+                    << "\tmappedFc:" << fc[facei]
+                    << "\tactual:" << distributedMesh.faceCentres()[facei]
+                    << endl;
+            }
+        }
+        // Faces, flipped field
+        {
+            const mapDistribute& faceMap = map.faceMap();
+            scalarField flux(mesh.faceAreas() & vector(1, 1, 1));
+            faceMap.distribute(flux, flipOp());
+            Pout<< "Construct size:" << faceMap.constructSize() << endl;
+            const scalarField newFlux
+            (
+                distributedMesh.faceAreas()
+              & vector(1, 1, 1)
+            );
+            forAll(newFlux, facei)
+            {
+                Pout<< "face:" << facei
+                    << "\tmappedFlux:" << flux[facei]
+                    << "\tactual:" << newFlux[facei]
+                    << endl;
+            }
+        }
+
+
+        {
+            const mapDistribute& cellMap = map.cellMap();
+            pointField cc(mesh.cellCentres());
+            cellMap.distribute(cc, noOp());
+            Pout<< "Construct size:" << cellMap.constructSize() << endl;
+            forAll(distributedMesh.cellCentres(), celli)
+            {
+                Pout<< "cell:" << celli
+                    << "\tmappedCc:" << cc[celli]
+                    << "\tactual:" << distributedMesh.cellCentres()[celli]
+                    << endl;
+            }
+        }
+        {
+            const mapDistribute& pointMap = map.pointMap();
+            pointField pc(mesh.points());
+            pointMap.distribute(pc, noOp());
+            Pout<< "Construct size:" << pointMap.constructSize() << endl;
+            forAll(distributedMesh.points(), pointi)
+            {
+                Pout<< "point:" << pointi
+                    << "\tmappedPoint:" << pc[pointi]
+                    << "\tactual:" << distributedMesh.points()[pointi]
+                    << endl;
+            }
+        }
+    }
+
+    Info<< "End\n" << endl;
+    return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/0/U b/applications/test/mapDistributePolyMesh/cavity/0/U
new file mode 100644
index 0000000000000000000000000000000000000000..f3ab7eefb66b855923d3c1889ad524e7725d3503
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/0/U
@@ -0,0 +1,41 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       volVectorField;
+    object      U;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+dimensions      [0 1 -1 0 0 0 0];
+
+internalField   uniform (1 1 0);
+
+boundaryField
+{
+    movingWall
+    {
+        type            fixedValue;
+        value           uniform (1 0 0);
+    }
+
+    fixedWalls
+    {
+        type            fixedValue;
+        value           uniform (0 0 0);
+    }
+
+    frontAndBack
+    {
+        type            empty;
+    }
+}
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/0/p b/applications/test/mapDistributePolyMesh/cavity/0/p
new file mode 100644
index 0000000000000000000000000000000000000000..0976329cedb48dfa5dff2d203e19418e7e757993
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/0/p
@@ -0,0 +1,39 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       volScalarField;
+    object      p;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+dimensions      [0 2 -2 0 0 0 0];
+
+internalField   uniform 0;
+
+boundaryField
+{
+    movingWall
+    {
+        type            zeroGradient;
+    }
+
+    fixedWalls
+    {
+        type            zeroGradient;
+    }
+
+    frontAndBack
+    {
+        type            empty;
+    }
+}
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/0/phi b/applications/test/mapDistributePolyMesh/cavity/0/phi
new file mode 100644
index 0000000000000000000000000000000000000000..0a745bbd5b740a431c8300d9f1b5dcae87fc8d55
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/0/phi
@@ -0,0 +1,228 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus.feature-oriented-fields          |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       surfaceScalarField;
+    location    "0";
+    object      fluxU;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+dimensions      [0 3 -1 0 0 0 0];
+oriented        1;
+
+
+internalField   nonuniform List<scalar> 
+180
+(
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+0.0001
+)
+;
+
+boundaryField
+{
+    movingWall
+    {
+        type            calculated;
+        value           uniform 0;
+    }
+    fixedWalls
+    {
+        type            calculated;
+        value           uniform 0;
+    }
+    frontAndBack
+    {
+        type            empty;
+        value           nonuniform 0();
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/Allclean b/applications/test/mapDistributePolyMesh/cavity/Allclean
new file mode 100755
index 0000000000000000000000000000000000000000..1ddaee91ff1648c391e96c435bdbf076d0f58b87
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/Allclean
@@ -0,0 +1,13 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # Run from this directory
+
+# Source tutorial clean functions
+. $WM_PROJECT_DIR/bin/tools/CleanFunctions
+
+cleanCase
+
+# Restore default dictionaries
+cp system/decomposeParDict-2 system/decomposeParDict
+cp system/controlDict-startTime system/controlDict
+
+# -----------------------------------------------------------------------------
diff --git a/applications/test/mapDistributePolyMesh/cavity/Allrun b/applications/test/mapDistributePolyMesh/cavity/Allrun
new file mode 100755
index 0000000000000000000000000000000000000000..9afaa5243d9a1630e3a7597ba8f52b83f7bb08d6
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/Allrun
@@ -0,0 +1,17 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # Run from this directory
+
+# Source tutorial run functions
+. $WM_PROJECT_DIR/bin/tools/RunFunctions
+
+runApplication blockMesh
+
+runApplication decomposePar -decomposeParDict system/decomposeParDict-2
+
+runParallel -s scotch -np 5 redistributePar \
+    -decomposeParDict system/decomposeParDict-5
+
+runParallel -np 5 Test-mapDistributePolyMesh \
+    -decomposeParDict system/decomposeParDict-5
+
+# -----------------------------------------------------------------------------
diff --git a/applications/test/mapDistributePolyMesh/cavity/cavity.foam b/applications/test/mapDistributePolyMesh/cavity/cavity.foam
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/applications/test/mapDistributePolyMesh/cavity/constant/transportProperties b/applications/test/mapDistributePolyMesh/cavity/constant/transportProperties
new file mode 100644
index 0000000000000000000000000000000000000000..de00c3587cd9e0a677d63a6a6db42f7a47fa59a9
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/constant/transportProperties
@@ -0,0 +1,21 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "constant";
+    object      transportProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+nu              nu [ 0 2 -1 0 0 0 0 ] 0.01;
+
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/system/blockMeshDict b/applications/test/mapDistributePolyMesh/cavity/system/blockMeshDict
new file mode 100644
index 0000000000000000000000000000000000000000..3118c894d875f5cf3287d1714402b6bd2cd2f48f
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/system/blockMeshDict
@@ -0,0 +1,75 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      blockMeshDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+convertToMeters 0.1;
+
+vertices
+(
+    (0 0 0)
+    (1 0 0)
+    (1 1 0)
+    (0 1 0)
+    (0 0 0.1)
+    (1 0 0.1)
+    (1 1 0.1)
+    (0 1 0.1)
+);
+
+blocks
+(
+    hex (0 1 2 3 4 5 6 7) (10 10 1) simpleGrading (1 1 1)
+);
+
+edges
+(
+);
+
+boundary
+(
+    movingWall
+    {
+        type wall;
+        faces
+        (
+            (3 7 6 2)
+        );
+    }
+    fixedWalls
+    {
+        type wall;
+        faces
+        (
+            (0 4 7 3)
+            (2 6 5 1)
+            (1 5 4 0)
+        );
+    }
+    frontAndBack
+    {
+        type empty;
+        faces
+        (
+            (0 3 2 1)
+            (4 5 6 7)
+        );
+    }
+);
+
+mergePatchPairs
+(
+);
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/system/controlDict b/applications/test/mapDistributePolyMesh/cavity/system/controlDict
new file mode 100644
index 0000000000000000000000000000000000000000..78ef7651b9c85152e9d156436115b65ecbde1815
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/system/controlDict
@@ -0,0 +1,49 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      controlDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+application     icoFoam;
+
+startFrom       startTime;
+
+startTime       0;
+
+stopAt          endTime;
+
+endTime         0.5;
+
+deltaT          0.005;
+
+writeControl    timeStep;
+
+writeInterval   20;
+
+purgeWrite      0;
+
+writeFormat     ascii;
+
+writePrecision  6;
+
+writeCompression off;
+
+timeFormat      general;
+
+timePrecision   6;
+
+runTimeModifiable true;
+
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/system/controlDict-latestTime b/applications/test/mapDistributePolyMesh/cavity/system/controlDict-latestTime
new file mode 100644
index 0000000000000000000000000000000000000000..8b3e003782dfbb2074f524e3971ae7a1a4ddec06
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/system/controlDict-latestTime
@@ -0,0 +1,49 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      controlDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+application     icoFoam;
+
+startFrom       latestTime;
+
+startTime       0;
+
+stopAt          endTime;
+
+endTime         1.0;
+
+deltaT          0.005;
+
+writeControl    timeStep;
+
+writeInterval   20;
+
+purgeWrite      0;
+
+writeFormat     ascii;
+
+writePrecision  6;
+
+writeCompression off;
+
+timeFormat      general;
+
+timePrecision   6;
+
+runTimeModifiable true;
+
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/system/controlDict-startTime b/applications/test/mapDistributePolyMesh/cavity/system/controlDict-startTime
new file mode 100644
index 0000000000000000000000000000000000000000..78ef7651b9c85152e9d156436115b65ecbde1815
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/system/controlDict-startTime
@@ -0,0 +1,49 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      controlDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+application     icoFoam;
+
+startFrom       startTime;
+
+startTime       0;
+
+stopAt          endTime;
+
+endTime         0.5;
+
+deltaT          0.005;
+
+writeControl    timeStep;
+
+writeInterval   20;
+
+purgeWrite      0;
+
+writeFormat     ascii;
+
+writePrecision  6;
+
+writeCompression off;
+
+timeFormat      general;
+
+timePrecision   6;
+
+runTimeModifiable true;
+
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict
new file mode 100644
index 0000000000000000000000000000000000000000..8c054db9bbb955510d8a4f8d176e8bb51a1e9eaf
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict
@@ -0,0 +1,143 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    note        "mesh decomposition control dictionary";
+    object      decomposeParDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+numberOfSubdomains  2;
+
+//- Keep owner and neighbour on same processor for faces in zones:
+// preserveFaceZones (heater solid1 solid3);
+
+//- Keep owner and neighbour on same processor for faces in patches:
+//  (makes sense only for cyclic patches)
+//preservePatches (cyclic_half0 cyclic_half1);
+
+//- Keep all of faceSet on a single processor. This puts all cells
+//  connected with a point, edge or face on the same processor.
+//  (just having face connected cells might not guarantee a balanced
+//  decomposition)
+// The processor can be -1 (the decompositionMethod chooses the processor
+// for a good load balance) or explicitly provided (upsets balance).
+//singleProcessorFaceSets ((f0 -1));
+
+
+//- Keep owner and neighbour of baffles on same processor (i.e. keep it
+//  detectable as a baffle). Baffles are two boundary face sharing the
+//  same points.
+//preserveBaffles true;
+
+//- Use the volScalarField named here as a weight for each cell in the
+//  decomposition.  For example, use a particle population field to decompose
+//  for a balanced number of particles in a lagrangian simulation.
+// weightField dsmcRhoNMean;
+
+method          scotch;
+//method          hierarchical;
+// method          simple;
+// method          metis;
+// method          manual;
+// method          multiLevel;
+// method          structured;  // does 2D decomposition of structured mesh
+
+multiLevelCoeffs
+{
+    // Decomposition methods to apply in turn. This is like hierarchical but
+    // fully general - every method can be used at every level.
+
+    level0
+    {
+        numberOfSubdomains  64;
+        //method simple;
+        //simpleCoeffs
+        //{
+        //    n           (2 1 1);
+        //    delta       0.001;
+        //}
+        method scotch;
+    }
+    level1
+    {
+        numberOfSubdomains  4;
+        method scotch;
+    }
+}
+
+// Desired output
+
+simpleCoeffs
+{
+    n           (2 1 1);
+    delta       0.001;
+}
+
+hierarchicalCoeffs
+{
+    n           (1 2 1);
+    delta       0.001;
+    order       xyz;
+}
+
+metisCoeffs
+{
+ /*
+    processorWeights
+    (
+        1
+        1
+        1
+        1
+    );
+  */
+}
+
+scotchCoeffs
+{
+    //processorWeights
+    //(
+    //    1
+    //    1
+    //    1
+    //    1
+    //);
+    //writeGraph  true;
+    //strategy "b";
+}
+
+manualCoeffs
+{
+    dataFile    "decompositionData";
+}
+
+structuredCoeffs
+{
+    // Patches to do 2D decomposition on. Structured mesh only; cells have
+    // to be in 'columns' on top of patches.
+    patches     (movingWall);
+
+    // Method to use on the 2D subset
+    method      scotch;
+}
+
+//// Is the case distributed? Note: command-line argument -roots takes
+//// precedence
+//distributed     yes;
+//// Per slave (so nProcs-1 entries) the directory above the case.
+//roots
+//(
+//    "/tmp"
+//    "/tmp"
+//);
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-2 b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-2
new file mode 100644
index 0000000000000000000000000000000000000000..8c054db9bbb955510d8a4f8d176e8bb51a1e9eaf
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-2
@@ -0,0 +1,143 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    note        "mesh decomposition control dictionary";
+    object      decomposeParDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+numberOfSubdomains  2;
+
+//- Keep owner and neighbour on same processor for faces in zones:
+// preserveFaceZones (heater solid1 solid3);
+
+//- Keep owner and neighbour on same processor for faces in patches:
+//  (makes sense only for cyclic patches)
+//preservePatches (cyclic_half0 cyclic_half1);
+
+//- Keep all of faceSet on a single processor. This puts all cells
+//  connected with a point, edge or face on the same processor.
+//  (just having face connected cells might not guarantee a balanced
+//  decomposition)
+// The processor can be -1 (the decompositionMethod chooses the processor
+// for a good load balance) or explicitly provided (upsets balance).
+//singleProcessorFaceSets ((f0 -1));
+
+
+//- Keep owner and neighbour of baffles on same processor (i.e. keep it
+//  detectable as a baffle). Baffles are two boundary face sharing the
+//  same points.
+//preserveBaffles true;
+
+//- Use the volScalarField named here as a weight for each cell in the
+//  decomposition.  For example, use a particle population field to decompose
+//  for a balanced number of particles in a lagrangian simulation.
+// weightField dsmcRhoNMean;
+
+method          scotch;
+//method          hierarchical;
+// method          simple;
+// method          metis;
+// method          manual;
+// method          multiLevel;
+// method          structured;  // does 2D decomposition of structured mesh
+
+multiLevelCoeffs
+{
+    // Decomposition methods to apply in turn. This is like hierarchical but
+    // fully general - every method can be used at every level.
+
+    level0
+    {
+        numberOfSubdomains  64;
+        //method simple;
+        //simpleCoeffs
+        //{
+        //    n           (2 1 1);
+        //    delta       0.001;
+        //}
+        method scotch;
+    }
+    level1
+    {
+        numberOfSubdomains  4;
+        method scotch;
+    }
+}
+
+// Desired output
+
+simpleCoeffs
+{
+    n           (2 1 1);
+    delta       0.001;
+}
+
+hierarchicalCoeffs
+{
+    n           (1 2 1);
+    delta       0.001;
+    order       xyz;
+}
+
+metisCoeffs
+{
+ /*
+    processorWeights
+    (
+        1
+        1
+        1
+        1
+    );
+  */
+}
+
+scotchCoeffs
+{
+    //processorWeights
+    //(
+    //    1
+    //    1
+    //    1
+    //    1
+    //);
+    //writeGraph  true;
+    //strategy "b";
+}
+
+manualCoeffs
+{
+    dataFile    "decompositionData";
+}
+
+structuredCoeffs
+{
+    // Patches to do 2D decomposition on. Structured mesh only; cells have
+    // to be in 'columns' on top of patches.
+    patches     (movingWall);
+
+    // Method to use on the 2D subset
+    method      scotch;
+}
+
+//// Is the case distributed? Note: command-line argument -roots takes
+//// precedence
+//distributed     yes;
+//// Per slave (so nProcs-1 entries) the directory above the case.
+//roots
+//(
+//    "/tmp"
+//    "/tmp"
+//);
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-5 b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-5
new file mode 100644
index 0000000000000000000000000000000000000000..0692228c7c8437894a89a99d023d5a0031babb27
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-5
@@ -0,0 +1,143 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    note        "mesh decomposition control dictionary";
+    object      decomposeParDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+numberOfSubdomains  5;
+
+//- Keep owner and neighbour on same processor for faces in zones:
+// preserveFaceZones (heater solid1 solid3);
+
+//- Keep owner and neighbour on same processor for faces in patches:
+//  (makes sense only for cyclic patches)
+//preservePatches (cyclic_half0 cyclic_half1);
+
+//- Keep all of faceSet on a single processor. This puts all cells
+//  connected with a point, edge or face on the same processor.
+//  (just having face connected cells might not guarantee a balanced
+//  decomposition)
+// The processor can be -1 (the decompositionMethod chooses the processor
+// for a good load balance) or explicitly provided (upsets balance).
+//singleProcessorFaceSets ((f0 -1));
+
+
+//- Keep owner and neighbour of baffles on same processor (i.e. keep it
+//  detectable as a baffle). Baffles are two boundary face sharing the
+//  same points.
+//preserveBaffles true;
+
+//- Use the volScalarField named here as a weight for each cell in the
+//  decomposition.  For example, use a particle population field to decompose
+//  for a balanced number of particles in a lagrangian simulation.
+// weightField dsmcRhoNMean;
+
+method          scotch;
+//method          hierarchical;
+// method          simple;
+// method          metis;
+// method          manual;
+// method          multiLevel;
+// method          structured;  // does 2D decomposition of structured mesh
+
+multiLevelCoeffs
+{
+    // Decomposition methods to apply in turn. This is like hierarchical but
+    // fully general - every method can be used at every level.
+
+    level0
+    {
+        numberOfSubdomains  64;
+        //method simple;
+        //simpleCoeffs
+        //{
+        //    n           (2 1 1);
+        //    delta       0.001;
+        //}
+        method scotch;
+    }
+    level1
+    {
+        numberOfSubdomains  4;
+        method scotch;
+    }
+}
+
+// Desired output
+
+simpleCoeffs
+{
+    n           (2 1 1);
+    delta       0.001;
+}
+
+hierarchicalCoeffs
+{
+    n           (1 2 1);
+    delta       0.001;
+    order       xyz;
+}
+
+metisCoeffs
+{
+ /*
+    processorWeights
+    (
+        1
+        1
+        1
+        1
+    );
+  */
+}
+
+scotchCoeffs
+{
+    //processorWeights
+    //(
+    //    1
+    //    1
+    //    1
+    //    1
+    //);
+    //writeGraph  true;
+    //strategy "b";
+}
+
+manualCoeffs
+{
+    dataFile    "decompositionData";
+}
+
+structuredCoeffs
+{
+    // Patches to do 2D decomposition on. Structured mesh only; cells have
+    // to be in 'columns' on top of patches.
+    patches     (movingWall);
+
+    // Method to use on the 2D subset
+    method      scotch;
+}
+
+//// Is the case distributed? Note: command-line argument -roots takes
+//// precedence
+//distributed     yes;
+//// Per slave (so nProcs-1 entries) the directory above the case.
+//roots
+//(
+//    "/tmp"
+//    "/tmp"
+//);
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-hierarchical b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-hierarchical
new file mode 100644
index 0000000000000000000000000000000000000000..4914ae5e029b602c9d6ff3b27bfce7bc6c557398
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-hierarchical
@@ -0,0 +1,29 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    note        "mesh decomposition control dictionary";
+    object      decomposeParDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+numberOfSubdomains  2;
+
+method          hierarchical;
+
+hierarchicalCoeffs
+{
+    n           (1 2 1);
+    delta       0.001;
+    order       xyz;
+}
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-scotch b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-scotch
new file mode 100644
index 0000000000000000000000000000000000000000..9df92a84e456a9513c9fc1a9cf9db324fe67ccbd
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-scotch
@@ -0,0 +1,28 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    note        "mesh decomposition control dictionary";
+    object      decomposeParDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+numberOfSubdomains  2;
+
+//method          scotch;
+method          hierarchical;
+hierarchicalCoeffs
+{
+    n           (2 1 1);
+    delta       0.001;
+    order       xyz;
+}
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/system/fvSchemes b/applications/test/mapDistributePolyMesh/cavity/system/fvSchemes
new file mode 100644
index 0000000000000000000000000000000000000000..b43ea748acac4a463d3b4345302831e83227cce6
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/system/fvSchemes
@@ -0,0 +1,51 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      fvSchemes;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ddtSchemes
+{
+    default         Euler;
+}
+
+gradSchemes
+{
+    default         Gauss linear;
+    grad(p)         Gauss linear;
+}
+
+divSchemes
+{
+    default         none;
+    div(phi,U)      Gauss linear;
+}
+
+laplacianSchemes
+{
+    default         Gauss linear orthogonal;
+}
+
+interpolationSchemes
+{
+    default         linear;
+}
+
+snGradSchemes
+{
+    default         orthogonal;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/system/fvSolution b/applications/test/mapDistributePolyMesh/cavity/system/fvSolution
new file mode 100644
index 0000000000000000000000000000000000000000..3be65f5ab562344fb13785933c69541e9b74ccba
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/system/fvSolution
@@ -0,0 +1,46 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    location    "system";
+    object      fvSolution;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+solvers
+{
+    "(p|pFinal)"
+    {
+        solver          PCG;
+        preconditioner  DIC;
+        tolerance       1e-06;
+        relTol          0;
+    }
+
+    U
+    {
+        solver          smoothSolver;
+        smoother        symGaussSeidel;
+        tolerance       1e-05;
+        relTol          0;
+    }
+}
+
+PISO
+{
+    nCorrectors     2;
+    nNonOrthogonalCorrectors 0;
+    pRefCell        0;
+    pRefValue       0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/system/processorField b/applications/test/mapDistributePolyMesh/cavity/system/processorField
new file mode 100644
index 0000000000000000000000000000000000000000..19c72f5418f12d49627896aa1ff317a2d288416a
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/system/processorField
@@ -0,0 +1,64 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      postProcessingDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+functions
+{
+    processorField
+    {
+        // Type of functionObject
+        type            processorField;
+
+        // Where to load it from (if not already in solver)
+        libs            ("libfieldFunctionObjects.so");
+
+        // Function object enabled flag
+        enabled         true;
+
+        // When to output the average fields
+        writeControl    writeTime;
+    }
+    cellID
+    {
+        // Load the library containing the 'coded' functionObject
+        functionObjectLibs ("libutilityFunctionObjects.so");
+        type coded;
+        // Name of on-the-fly generated functionObject
+        redirectType cellID;
+        codeExecute
+        #{
+            volScalarField cellID
+            (
+                IOobject
+                (
+                    "cellID",
+                    mesh().time().timeName(),
+                    mesh(),
+                    IOobject::NO_READ
+                ),
+                mesh(),
+                dimensionedScalar("cellID", dimless, 0)
+            );
+            forAll(cellID, celli)
+            {
+                cellID[celli] = celli;
+            }
+            cellID.correctBoundaryConditions();
+            cellID.write();
+        #};
+    }
+}
+
+// ************************************************************************* //
diff --git a/applications/test/mapDistributePolyMesh/cavity/system/renumberMeshDict-random b/applications/test/mapDistributePolyMesh/cavity/system/renumberMeshDict-random
new file mode 100644
index 0000000000000000000000000000000000000000..67631d08ee7fb015c2b803817018d376ac1c7e23
--- /dev/null
+++ b/applications/test/mapDistributePolyMesh/cavity/system/renumberMeshDict-random
@@ -0,0 +1,112 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  plus                                  |
+|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    note        "mesh renumbering dictionary";
+    object      renumberMeshDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+// Write maps from renumbered back to original mesh
+writeMaps true;
+
+// Optional entry: sort cells on coupled boundaries to last for use with
+// e.g. nonBlockingGaussSeidel.
+sortCoupledFaceCells false;
+
+// Optional entry: renumber on a block-by-block basis. It uses a
+// blockCoeffs dictionary to construct a decompositionMethod to do
+// a block subdivision) and then applies the renumberMethod to each
+// block in turn. This can be used in large cases to keep the blocks
+// fitting in cache with all the the cache misses bunched at the end.
+// This number is the approximate size of the blocks - this gets converted
+// to a number of blocks that is the input to the decomposition method.
+//blockSize 1000;
+
+// Optional entry: sort points into internal and boundary points
+//orderPoints false;
+
+// Optional: suppress renumbering cellSets,faceSets,pointSets
+//renumberSets false;
+
+
+//method          CuthillMcKee;
+//method          Sloan;
+//method          manual;
+method          random;
+//method          structured;
+//method          spring;
+//method          zoltan;             // only if compiled with zoltan support
+
+//CuthillMcKeeCoeffs
+//{
+//    // Reverse CuthillMcKee (RCM) or plain
+//    reverse true;
+//}
+
+manualCoeffs
+{
+    // In system directory: new-to-original (i.e. order) labelIOList
+    dataFile "cellMap";
+}
+
+
+// For extruded (i.e. structured in one direction) meshes
+structuredCoeffs
+{
+    // Patches that mesh was extruded from. These determine the starting
+    // layer of cells
+    patches (movingWall);
+    // Method to renumber the starting layer of cells
+    method  random;
+
+    // Renumber in columns (depthFirst) or in layers
+    depthFirst true;
+
+    // Reverse ordering
+    reverse false;
+}
+
+
+springCoeffs
+{
+    // Maximum jump of cell indices. Is fraction of number of cells
+    maxCo 0.01;
+
+    // Limit the amount of movement; the fraction maxCo gets decreased
+    // with every iteration
+    freezeFraction 0.999;
+
+    // Maximum number of iterations
+    maxIter 1000;
+}
+
+
+blockCoeffs
+{
+    method          scotch;
+    //method hierarchical;
+    //hierarchicalCoeffs
+    //{
+    //    n           (1 2 1);
+    //    delta       0.001;
+    //    order       xyz;
+    //}
+}
+
+
+zoltanCoeffs
+{
+    ORDER_METHOD    LOCAL_HSFC;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C b/applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C
index 3df020099ff8f3d0ed08d3271c9c47e9682c9391..c561dc71839cba0209c9f3ccc1c584eb22884d82 100644
--- a/applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C
+++ b/applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2015 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2016-2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -66,7 +66,7 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeInternalField
         IOobject::NO_WRITE
     );
 
-    return tmp<DimensionedField<Type, volMesh>>
+    tmp<DimensionedField<Type, volMesh>> tfield
     (
         new DimensionedField<Type, volMesh>
         (
@@ -76,6 +76,10 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeInternalField
             internalField
         )
     );
+
+    tfield.ref().oriented() = fld.oriented();
+
+    return tfield;
 }
 
 
@@ -209,7 +213,7 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeField
         IOobject::NO_WRITE
     );
 
-    return tmp<GeometricField<Type, fvPatchField, volMesh>>
+    tmp<GeometricField<Type, fvPatchField, volMesh>> tfield
     (
         new GeometricField<Type, fvPatchField, volMesh>
         (
@@ -220,6 +224,10 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeField
             basePatchFields
         )
     );
+
+    tfield.ref().oriented()= fld.oriented();
+
+    return tfield;
 }
 
 
@@ -269,7 +277,7 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField
     }
 
     // Map all faces
-    Field<Type> internalField(flatFld, mapper);
+    Field<Type> internalField(flatFld, mapper, fld.oriented()());
 
     // Trim to internal faces (note: could also have special mapper)
     internalField.setSize
@@ -372,7 +380,7 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField
         IOobject::NO_WRITE
     );
 
-    return tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
+    tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tfield
     (
         new GeometricField<Type, fvsPatchField, surfaceMesh>
         (
@@ -383,6 +391,10 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField
             basePatchFields
         )
     );
+
+    tfield.ref().oriented() = fld.oriented();
+
+    return tfield;
 }
 
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
index 602f68b2d048f973828d76498e5838c988f76dac..dcf612a663ef2440b4b53943ce2c3ab24f4ab796 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
@@ -341,6 +341,7 @@ int main(int argc, char *argv[])
 
     #include "createTime.H"
 
+    const bool decomposePoly   = !args.optionFound("poly");
     const bool doWriteInternal = !args.optionFound("noInternal");
     const bool doFaceZones     = !args.optionFound("noFaceZones");
     const bool doLinks         = !args.optionFound("noLinks");
@@ -349,7 +350,7 @@ int main(int argc, char *argv[])
     const bool noLagrangian    = args.optionFound("noLagrangian");
 
     // Decomposition of polyhedral cells into tets/pyramids cells
-    vtkTopo::decomposePoly     = !args.optionFound("poly");
+    vtkTopo::decomposePoly     = decomposePoly;
 
     if (binary && (sizeof(floatScalar) != 4 || sizeof(label) != 4))
     {
@@ -410,8 +411,6 @@ int main(int argc, char *argv[])
     args.optionReadIfPresent("pointSet", pointSetName);
 
 
-    instantList timeDirs = timeSelector::select0(runTime, args);
-
     #include "createNamedMesh.H"
 
     // VTK/ directory in the case
@@ -449,6 +448,9 @@ int main(int argc, char *argv[])
 
     mkDir(fvPath);
 
+    instantList timeDirs = timeSelector::select0(runTime, args);
+
+
     // Mesh wrapper: does subsetting and decomposition
     vtkMesh vMesh(mesh, cellSetName);
 
@@ -492,7 +494,7 @@ int main(int argc, char *argv[])
             // Filename as if patch with same name.
             mkDir(fvPath/set.name());
 
-            fileName patchFileName
+            fileName outputName
             (
                 fvPath/set.name()/set.name()
               + "_"
@@ -500,12 +502,12 @@ int main(int argc, char *argv[])
               + ".vtk"
             );
 
-            Info<< "    FaceSet   : " << patchFileName << endl;
-
-            writeFaceSet(binary, vMesh.mesh(), set, patchFileName);
+            Info<< "    faceSet   : " << outputName << endl;
 
+            writeFaceSet(binary, vMesh.mesh(), set, outputName);
             continue;
         }
+
         // If pointSet: write pointSet only (as polydata)
         if (pointSetName.size())
         {
@@ -515,7 +517,7 @@ int main(int argc, char *argv[])
             // Filename as if patch with same name.
             mkDir(fvPath/set.name());
 
-            fileName patchFileName
+            fileName outputName
             (
                 fvPath/set.name()/set.name()
               + "_"
@@ -523,10 +525,9 @@ int main(int argc, char *argv[])
               + ".vtk"
             );
 
-            Info<< "    pointSet   : " << patchFileName << endl;
-
-            writePointSet(binary, vMesh.mesh(), set, patchFileName);
+            Info<< "    pointSet   : " << outputName << endl;
 
+            writePointSet(binary, vMesh.mesh(), set, outputName);
             continue;
         }
 
@@ -868,11 +869,11 @@ int main(int argc, char *argv[])
         {
             mkDir(fvPath/"allPatches");
 
-            fileName patchFileName;
+            fileName outputName;
 
             if (vMesh.useSubMesh())
             {
-                patchFileName =
+                outputName =
                     fvPath/"allPatches"/cellSetName
                   + "_"
                   + timeDesc
@@ -880,21 +881,21 @@ int main(int argc, char *argv[])
             }
             else
             {
-                patchFileName =
+                outputName =
                     fvPath/"allPatches"/"allPatches"
                   + "_"
                   + timeDesc
                   + ".vtk";
             }
 
-            Info<< "    Combined patches     : " << patchFileName << endl;
+            Info<< "    Combined patches     : " << outputName << endl;
 
             patchWriter writer
             (
                 vMesh.mesh(),
                 binary,
                 nearCellValue,
-                patchFileName,
+                outputName,
                 getSelectedPatches(patches, excludePatches)
             );
 
@@ -946,11 +947,11 @@ int main(int argc, char *argv[])
                 {
                     mkDir(fvPath/pp.name());
 
-                    fileName patchFileName;
+                    fileName outputName;
 
                     if (vMesh.useSubMesh())
                     {
-                        patchFileName =
+                        outputName =
                             fvPath/pp.name()/cellSetName
                           + "_"
                           + timeDesc
@@ -958,22 +959,22 @@ int main(int argc, char *argv[])
                     }
                     else
                     {
-                        patchFileName =
+                        outputName =
                             fvPath/pp.name()/pp.name()
                           + "_"
                           + timeDesc
                           + ".vtk";
                     }
 
-                    Info<< "    Patch     : " << patchFileName << endl;
+                    Info<< "    Patch     : " << outputName << endl;
 
                     patchWriter writer
                     (
                         vMesh.mesh(),
                         binary,
                         nearCellValue,
-                        patchFileName,
-                        labelList(1, patchi)
+                        outputName,
+                        labelList{patchi}
                     );
 
                     if (!isA<emptyPolyPatch>(pp))
@@ -1068,11 +1069,11 @@ int main(int argc, char *argv[])
 
                 mkDir(fvPath/fz.name());
 
-                fileName patchFileName;
+                fileName outputName;
 
                 if (vMesh.useSubMesh())
                 {
-                    patchFileName =
+                    outputName =
                         fvPath/fz.name()/cellSetName
                       + "_"
                       + timeDesc
@@ -1080,14 +1081,14 @@ int main(int argc, char *argv[])
                 }
                 else
                 {
-                    patchFileName =
+                    outputName =
                         fvPath/fz.name()/fz.name()
                       + "_"
                       + timeDesc
                       + ".vtk";
                 }
 
-                Info<< "    FaceZone  : " << patchFileName << endl;
+                Info<< "    FaceZone  : " << outputName << endl;
 
                 indirectPrimitivePatch pp
                 (
@@ -1100,7 +1101,7 @@ int main(int argc, char *argv[])
                     binary,
                     pp,
                     fz.name(),
-                    patchFileName
+                    outputName
                 );
 
                 // Number of fields
@@ -1131,14 +1132,13 @@ int main(int argc, char *argv[])
             // Always create the cloud directory.
             mkDir(fvPath/cloud::prefix/cloudName);
 
-            fileName lagrFileName
+            fileName outputName
             (
                 fvPath/cloud::prefix/cloudName/cloudName
               + "_" + timeDesc + ".vtk"
             );
 
-            Info<< "    Lagrangian: " << lagrFileName << endl;
-
+            Info<< "    Lagrangian: " << outputName << endl;
 
             IOobjectList sprayObjs
             (
@@ -1189,7 +1189,7 @@ int main(int argc, char *argv[])
                 (
                     vMesh.mesh(),
                     binary,
-                    lagrFileName,
+                    outputName,
                     cloudName,
                     false
                 );
@@ -1219,7 +1219,7 @@ int main(int argc, char *argv[])
                 (
                     vMesh.mesh(),
                     binary,
-                    lagrFileName,
+                    outputName,
                     cloudName,
                     true
                 );
diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFuns.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFuns.H
index 1776eefe09e86d88737c60edc70f1f3cbf37bbcd..60fe2a6d01034da4ee0de19da4cecd93b346e354 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFuns.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFuns.H
@@ -104,6 +104,7 @@ public:
 
     //- Append elements to DynamicList
     static void insert(const labelList&, DynamicList<label>&);
+
     template<class Type>
     static void insert(const List<Type>&, DynamicList<floatScalar>&);
 
@@ -140,36 +141,6 @@ public:
         const vtkMesh&
     );
 
-    //- Write generic GeometricFields
-    template<class Type, template<class> class PatchField, class GeoMesh>
-    static void write
-    (
-        std::ostream&,
-        const bool binary,
-        const PtrList<GeometricField<Type, PatchField, GeoMesh>>&,
-        const vtkMesh&
-    );
-
-    //- Write generic dimensioned internal fields
-    template<class Type>
-    static void write
-    (
-        std::ostream&,
-        const bool binary,
-        const PtrList<DimensionedField<Type, volMesh>>&,
-        const vtkMesh&
-    );
-
-    //- Interpolate and write volFields
-    template<class Type>
-    static void write
-    (
-        std::ostream&,
-        const bool binary,
-        const volPointInterpolation&,
-        const PtrList<GeometricField<Type, fvPatchField, volMesh>>&,
-        const vtkMesh&
-    );
 };
 
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFunsTemplates.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFunsTemplates.C
index a6778a461c3ff444769191591dc2648f019797a1..8929a1ad80eeab28e2509d1964b2f6d22d3a18a5 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFunsTemplates.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFunsTemplates.C
@@ -43,22 +43,6 @@ void Foam::writeFuns::insert
 }
 
 
-//// Store List (indexed through map) in dest
-//template<class Type>
-//void Foam::writeFuns::insert
-//(
-//    const labelList& map,
-//    const List<Type>& source,
-//    DynamicList<floatScalar>& dest
-//)
-//{
-//    forAll(map, i)
-//    {
-//        insert(source[map[i]], dest);
-//    }
-//}
-
-
 template<class Type>
 void Foam::writeFuns::write
 (
@@ -159,53 +143,4 @@ void Foam::writeFuns::write
 }
 
 
-template<class Type, template<class> class PatchField, class GeoMesh>
-void Foam::writeFuns::write
-(
-    std::ostream& os,
-    const bool binary,
-    const PtrList<GeometricField<Type, PatchField, GeoMesh>>& flds,
-    const vtkMesh& vMesh
-)
-{
-    forAll(flds, i)
-    {
-        write(os, binary, flds[i].dimensionedInternalField(), vMesh);
-    }
-}
-
-
-template<class Type>
-void Foam::writeFuns::write
-(
-    std::ostream& os,
-    const bool binary,
-    const PtrList<DimensionedField<Type, volMesh>>& flds,
-    const vtkMesh& vMesh
-)
-{
-    forAll(flds, i)
-    {
-        write(os, binary, flds[i], vMesh);
-    }
-}
-
-
-template<class Type>
-void Foam::writeFuns::write
-(
-    std::ostream& os,
-    const bool binary,
-    const volPointInterpolation& pInterp,
-    const PtrList<GeometricField<Type, fvPatchField, volMesh>>& flds,
-    const vtkMesh& vMesh
-)
-{
-    forAll(flds, i)
-    {
-        write(os, binary, flds[i], pInterp.interpolate(flds[i])(), vMesh);
-    }
-}
-
-
 // ************************************************************************* //
diff --git a/etc/codeTemplates/source/_TemplateIO.C b/etc/codeTemplates/source/_TemplateIO.C
index f1e498671e4840e61a72de74d6f1b07d33725ad4..4097eaa24f56f43ffc316b0298e5142cc79e267d 100644
--- a/etc/codeTemplates/source/_TemplateIO.C
+++ b/etc/codeTemplates/source/_TemplateIO.C
@@ -35,8 +35,7 @@ Foam::CLASSNAME::CLASSNAME(Istream& is)
     member1(is),
     member2(is)
 {
-    // Check state of Istream
-    is.check("Foam::CLASSNAME::CLASSNAME(Foam::Istream&)");
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -44,25 +43,14 @@ Foam::CLASSNAME::CLASSNAME(Istream& is)
 
 Foam::Istream& Foam::operator>>(Istream& is, CLASSNAME&)
 {
-    // Check state of Istream
-    is.check
-    (
-        "Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::CLASSNAME&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
 
 Foam::Ostream& Foam::operator<<(Ostream& os, const CLASSNAME&)
 {
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
-        "const Foam::CLASSNAME&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/etc/codeTemplates/template/_TemplateTemplateIO.C b/etc/codeTemplates/template/_TemplateTemplateIO.C
index 05921c96458977c882c55558c514b3c0a399a33b..f17a357c97944268aabac4f687ff678d290e96c7 100644
--- a/etc/codeTemplates/template/_TemplateTemplateIO.C
+++ b/etc/codeTemplates/template/_TemplateTemplateIO.C
@@ -36,8 +36,7 @@ Foam::CLASSNAME<TemplateArgument>::CLASSNAME(Istream& is)
     member1(is),
     member2(is)
 {
-    // Check state of Istream
-    is.check("Foam::CLASSNAME<TemplateArgument>::CLASSNAME(Foam::Istream&)");
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -50,13 +49,7 @@ Foam::Istream& Foam::operator>>
     CLASSNAME<TemplateArgument>&
 )
 {
-    // Check state of Istream
-    is.check
-    (
-        "Foam::Istream& Foam::operator>>"
-        "(Foam::Istream&, Foam::CLASSNAME<TemplateArgument>&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -68,13 +61,7 @@ Foam::Ostream& Foam::operator<<
     const CLASSNAME<TemplateArgument>&
 )
 {
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<"
-        "(Ostream&, const CLASSNAME<TemplateArgument>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/etc/cshrc b/etc/cshrc
index 4fb51cad68738e4e276cb0bc5c0c6f44adb64b5b..688905c2cf089b89ad4490b76c8a143fb5c7bc33 100644
--- a/etc/cshrc
+++ b/etc/cshrc
@@ -43,7 +43,7 @@ setenv WM_PROJECT_VERSION plus
 #   values to an appropriate path.
 #
 setenv FOAM_INST_DIR `lsof +p $$ |& \
-    sed -n -e 's@[^/]*@@' -e 's@/'$WM_PROJECT'[^/]*/etc/cshrc@@p'`
+    sed -n -e 's@[^/]*@@' -e 's@/'$WM_PROJECT'[^/]*/etc/cshrc.*@@p'`
 # setenv FOAM_INST_DIR  $HOME/$WM_PROJECT
 # setenv FOAM_INST_DIR  /opt/$WM_PROJECT
 # setenv FOAM_INST_DIR  /usr/local/$WM_PROJECT
diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C
index d444b83a0b64522207dfec51fb9e88dc8bca2c2d..f4cad0fccb8a49bc62fe0ec48993ffb12d0be7f4 100644
--- a/src/OSspecific/POSIX/POSIX.C
+++ b/src/OSspecific/POSIX/POSIX.C
@@ -770,7 +770,7 @@ bool Foam::cp(const fileName& src, const fileName& dest, const bool followLink)
         // If dest is a directory, create the destination file name.
         if (destFile.type() == fileName::DIRECTORY)
         {
-            destFile = destFile/src.component(src.components().size() -1);
+            destFile = destFile/src.components().last();
         }
 
         // Make sure the destination directory exists.
diff --git a/src/OSspecific/POSIX/fileStat.C b/src/OSspecific/POSIX/fileStat.C
index f40192f03bc4b4292641877e539dc03a4a50ce6b..afb955bfe266040ea503032419684962e5e373e1 100644
--- a/src/OSspecific/POSIX/fileStat.C
+++ b/src/OSspecific/POSIX/fileStat.C
@@ -123,9 +123,7 @@ Foam::Istream& Foam::operator>>(Istream& is, fileStat& fStat)
     fStat.status_.st_mtime = stat[11];
     fStat.status_.st_ctime = stat[12];
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, fileStat&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OSspecific/POSIX/memInfo/memInfo.C b/src/OSspecific/POSIX/memInfo/memInfo.C
index 43037b5c79349e1190f88ba9ee31e76eda9a636a..c0ff2dd99bf1586172f43df8789575339c84e018 100644
--- a/src/OSspecific/POSIX/memInfo/memInfo.C
+++ b/src/OSspecific/POSIX/memInfo/memInfo.C
@@ -118,12 +118,7 @@ Foam::Istream& Foam::operator>>(Istream& is, memInfo& m)
 
     is.readEnd("memInfo");
 
-    // Check state of Istream
-    is.check
-    (
-        "Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::memInfo&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -136,12 +131,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const memInfo& m)
         << m.rss_
         << token::END_LIST;
 
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<(Foam::Ostream&, const Foam::memInfo&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files
index 41d694211aae5135d8340335133f0080fc7976e2..f95dc85741bbcb8bb740606b61ea57a538c00f11 100644
--- a/src/OpenFOAM/Make/files
+++ b/src/OpenFOAM/Make/files
@@ -275,6 +275,8 @@ dimensionedTypes/dimensionedSphericalTensor/dimensionedSphericalTensor.C
 dimensionedTypes/dimensionedSymmTensor/dimensionedSymmTensor.C
 dimensionedTypes/dimensionedTensor/dimensionedTensor.C
 
+orientedType/orientedType.C
+
 matrices/solution/solution.C
 
 scalarMatrices = matrices/scalarMatrices
diff --git a/src/OpenFOAM/algorithms/indexedOctree/volumeType.C b/src/OpenFOAM/algorithms/indexedOctree/volumeType.C
index 95868f6c0c3f58e105b82ece76ecda59924daf50..1bb1356b9670d1deefb5ed23b398bb559ffef36d 100644
--- a/src/OpenFOAM/algorithms/indexedOctree/volumeType.C
+++ b/src/OpenFOAM/algorithms/indexedOctree/volumeType.C
@@ -61,9 +61,7 @@ Foam::Istream& Foam::operator>>(Istream& is, volumeType& vt)
     // Read end of volumeType
     is.readEnd("volumeType");
 
-    // Check state of Istream
-    is.check("operator>>(Istream&, volumeType&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
index 2c8167adcee45afb665e519a15231d7113468879..9bf799d6b341de7d3c2943a48e82bf4556c40d3f 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
@@ -74,7 +74,7 @@ Foam::HashTable<T, Key, Hash>::HashTable(const label size)
     {
         table_ = new hashedEntry*[tableSize_];
 
-        for (label hashIdx = 0; hashIdx < tableSize_; hashIdx++)
+        for (label hashIdx = 0; hashIdx < tableSize_; ++hashIdx)
         {
             table_[hashIdx] = nullptr;
         }
@@ -203,6 +203,17 @@ Foam::HashTable<T, Key, Hash>::find
 (
     const Key& key
 ) const
+{
+    return this->cfind(key);
+}
+
+
+template<class T, class Key, class Hash>
+typename Foam::HashTable<T, Key, Hash>::const_iterator
+Foam::HashTable<T, Key, Hash>::cfind
+(
+    const Key& key
+) const
 {
     if (nElmts_)
     {
@@ -912,7 +923,7 @@ bool Foam::HashTable<T, Key, Hash>::operator==
 
     for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter)
     {
-        const_iterator other = find(iter.key());
+        const_iterator other = this->cfind(iter.key());
 
         if (!other.found() || other.object() != iter.object())
         {
diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
index 3b3338084d9b1a3d46fcd8fe308d6d93f2a2cb71..3f9a2df85fc41a92137ce58a0e05ab96bb2d2056 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
@@ -327,6 +327,10 @@ public:
         //  If not found iterator = end()
         const_iterator find(const Key& key) const;
 
+        //- Find and return an const_iterator set at the hashed entry
+        //  If not found iterator = end()
+        const_iterator cfind(const Key& key) const;
+
         //- Return hashed entry if it exists, or return the given default
         inline const T& lookup(const Key& key, const T& deflt) const;
 
diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTableIO.C b/src/OpenFOAM/containers/HashTables/HashTable/HashTableIO.C
index 0eb3fadb459ed6fb047ce7a14e1f09248afc1527..54cd7ed9220457492984a513f936009d09512a66 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTableIO.C
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTableIO.C
@@ -129,9 +129,7 @@ Foam::Ostream& Foam::HashTable<T, Key, Hash>::writeKeys
         os << token::END_LIST << nl;  // End delimiter
     }
 
-    // Check state of IOstream
     os.check(FUNCTION_NAME);
-
     return os;
 }
 
@@ -145,12 +143,12 @@ Foam::Istream& Foam::operator>>
     HashTable<T, Key, Hash>& L
 )
 {
-    is.fatalCheck("operator>>(Istream&, HashTable<T, Key, Hash>&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     // Anull list
     L.clear();
 
-    is.fatalCheck("operator>>(Istream&, HashTable<T, Key, Hash>&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     token firstToken(is);
 
@@ -251,7 +249,7 @@ Foam::Istream& Foam::operator>>
             << exit(FatalIOError);
     }
 
-    is.fatalCheck("operator>>(Istream&, HashTable<T, Key, Hash>&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     return is;
 }
@@ -278,9 +276,7 @@ Foam::Ostream& Foam::operator<<
     // Write end delimiter
     os << token::END_LIST;
 
-    // Check state of IOstream
     os.check(FUNCTION_NAME);
-
     return os;
 }
 
diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C
index ec30dfc20a0e71eb4a4a631871adb6c2e0b18b02..c024ff335e210a5cdc0ec34925e598fe5a4c2fd3 100644
--- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C
+++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C
@@ -158,6 +158,17 @@ Foam::StaticHashTable<T, Key, Hash>::find
 (
     const Key& key
 ) const
+{
+    return this->cfind(key);
+}
+
+
+template<class T, class Key, class Hash>
+typename Foam::StaticHashTable<T, Key, Hash>::const_iterator
+Foam::StaticHashTable<T, Key, Hash>::cfind
+(
+    const Key& key
+) const
 {
     if (nElmts_)
     {
diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H
index 5b0a3ef8a59fb88c9c94cd22278c46eda6765420..850eb1fc43d3bf5055c70c8c56a9f200de9a5b9b 100644
--- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H
+++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H
@@ -203,6 +203,10 @@ public:
             //  If not found iterator = end()
             const_iterator find(const Key& key) const;
 
+            //- Find and return an const_iterator set at the hashed entry
+            //  If not found iterator = end()
+            const_iterator cfind(const Key& key) const;
+
             //- Return the table of contents
             List<Key> toc() const;
 
diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableIO.C b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableIO.C
index 7e4b3832611f05121682b4a3517bb0aba8272984..c7e06724530eaf65ecea01c608937065c5fb45f2 100644
--- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableIO.C
+++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableIO.C
@@ -94,12 +94,12 @@ Foam::StaticHashTable<T, Key, Hash>::printInfo(Ostream& os) const
 template<class T, class Key, class Hash>
 Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
 {
-    is.fatalCheck("operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     // Anull list
     L.clear();
 
-    is.fatalCheck("operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     token firstToken(is);
 
@@ -200,7 +200,7 @@ Foam::Istream& Foam::operator>>(Istream& is, StaticHashTable<T, Key, Hash>& L)
             << exit(FatalIOError);
     }
 
-    is.fatalCheck("operator>>(Istream&, StaticHashTable<T, Key, Hash>&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     return is;
 }
@@ -229,9 +229,7 @@ Foam::Ostream& Foam::operator<<
     // Write end delimiter
     os << token::END_LIST;
 
-    // Check state of IOstream
-    os.check("Ostream& operator<<(Ostream&, const StaticHashTable&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/containers/Identifiers/Keyed/KeyedI.H b/src/OpenFOAM/containers/Identifiers/Keyed/KeyedI.H
index d07aeb0f6af080661f00b9af7a180f72096287f6..59f49406871d3dfcb1fb43d5adbd59a23c00be8d 100644
--- a/src/OpenFOAM/containers/Identifiers/Keyed/KeyedI.H
+++ b/src/OpenFOAM/containers/Identifiers/Keyed/KeyedI.H
@@ -125,9 +125,7 @@ inline Foam::Istream& Foam::operator>>(Istream& is, Keyed<T>& item)
     // Read end of Keyed item/key pair
     is.readEnd("Keyed<T>");
 
-    // Check state of Ostream
-    is.check("Istream& operator>>(Istream&, Keyed&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILListIO.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILListIO.C
index 5b398198e583e8f13d7f899bb030f56ed8459b50..961569aea775a457d904ba3a9a9978c76bb40449 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILListIO.C
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/ILList/ILListIO.C
@@ -33,7 +33,7 @@ template<class LListBase, class T>
 template<class INew>
 void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
 {
-    is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     token firstToken(is);
 
@@ -97,7 +97,7 @@ void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
         }
 
         token lastToken(is);
-        is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
+        is.fatalCheck(FUNCTION_NAME);
 
         while
         (
@@ -111,7 +111,7 @@ void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
             this->append(iNew(is).ptr());
 
             is >> lastToken;
-            is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
+            is.fatalCheck(FUNCTION_NAME);
         }
     }
     else
@@ -122,7 +122,7 @@ void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
             << exit(FatalIOError);
     }
 
-    is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
+    is.fatalCheck(FUNCTION_NAME);
 }
 
 
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LListIO.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LListIO.C
index 028901452822906fe81f31143b5327c8532bc28a..11ce9dd852816ea4ce4435ca8e91dd5cb7340758 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LListIO.C
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LList/LListIO.C
@@ -44,7 +44,7 @@ Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
     // Anull list
     L.clear();
 
-    is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     token firstToken(is);
 
@@ -98,7 +98,7 @@ Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
         }
 
         token lastToken(is);
-        is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
+        is.fatalCheck(FUNCTION_NAME);
 
         while
         (
@@ -114,7 +114,7 @@ Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
             L.append(element);
 
             is >> lastToken;
-            is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
+            is.fatalCheck(FUNCTION_NAME);
         }
     }
     else
@@ -126,7 +126,7 @@ Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
     }
 
     // Check state of IOstream
-    is.fatalCheck(" operator>>(Istream&, LList<LListBase,>&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     return is;
 }
@@ -152,9 +152,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const LList<LListBase, T>& lst)
     // Write end of contents
     os << token::END_LIST;
 
-    // Check state of IOstream
-    os.check("Ostream& operator<<(Ostream&, const LList<LListBase, T>&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrListIO.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrListIO.C
index e23b2ddae1a1a7f3c13934ab470a2e1d237c63d3..1db2a59a50ef9adc8d794ac59966bc0ac1005d7c 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrListIO.C
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/LPtrList/LPtrListIO.C
@@ -34,10 +34,7 @@ template<class LListBase, class T>
 template<class INew>
 void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
 {
-    is.fatalCheck
-    (
-        "LPtrList<LListBase, T>::read(Istream&, const INew&)"
-    );
+    is.fatalCheck(FUNCTION_NAME);
 
     token firstToken(is);
 
@@ -102,7 +99,7 @@ void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
         }
 
         token lastToken(is);
-        is.fatalCheck("LPtrList<LListBase, T>::read(Istream&, const INew&)");
+        is.fatalCheck(FUNCTION_NAME);
 
         while
         (
@@ -116,10 +113,7 @@ void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
             this->append(iNew(is).ptr());
 
             is >> lastToken;
-            is.fatalCheck
-            (
-                "LPtrList<LListBase, T>::read(Istream&, const INew&)"
-            );
+            is.fatalCheck(FUNCTION_NAME);
         }
     }
     else
@@ -132,7 +126,7 @@ void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
             << exit(FatalIOError);
     }
 
-    is.fatalCheck("LPtrList<LListBase, T>::read(Istream&, const INew&)");
+    is.fatalCheck(FUNCTION_NAME);
 }
 
 
@@ -190,9 +184,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const LPtrList<LListBase, T>& lst)
     // Write end of contents
     os << token::END_LIST;
 
-    // Check state of IOstream
-    os.check("Ostream& operator<<(Ostream&, const LPtrList<LListBase, T>&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILListIO.C b/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILListIO.C
index 137affd92bf438d14f532aff0dc48009674932a0..3f34eb83116c287fc865c409f57ea290c33d457f 100644
--- a/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILListIO.C
+++ b/src/OpenFOAM/containers/LinkedLists/accessTypes/UILList/UILListIO.C
@@ -52,9 +52,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const UILList<LListBase, T>& lst)
     // Write end of contents
     os << token::END_LIST;
 
-    // Check state of IOstream
-    os.check("Ostream& operator<<(Ostream&, const UILList<LListBase, T>&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/containers/Lists/Distribution/Distribution.C b/src/OpenFOAM/containers/Lists/Distribution/Distribution.C
index e6d45249959002730420e82650684d1ec2c34cc8..a6f960db6e76cb756f9e07e4248914fd025710dd 100644
--- a/src/OpenFOAM/containers/Lists/Distribution/Distribution.C
+++ b/src/OpenFOAM/containers/Lists/Distribution/Distribution.C
@@ -591,9 +591,7 @@ Foam::Istream& Foam::operator>>
         >> d.binWidth_
         >> d.listStarts_;
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, Distribution<Type>&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -609,9 +607,7 @@ Foam::Ostream& Foam::operator<<
         << d.binWidth_ << token::SPACE
         << d.listStarts_;
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, " "const Distribution&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C
index 895e373488a7a869f598d75c1cc8382f64c76b5a..6d1d65b20e21c2f2b7583fdcda1dfd2a54cf0579 100644
--- a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C
+++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C
@@ -139,9 +139,7 @@ Foam::Ostream& Foam::FixedList<T, Size>::writeList
         os.write(reinterpret_cast<const char*>(L.cdata()), Size*sizeof(T));
     }
 
-    // Check state of IOstream
-    os.check("const FixedList::writeList(Ostream&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
@@ -158,7 +156,7 @@ Foam::FixedList<T, Size>::FixedList(Istream& is)
 template<class T, unsigned Size>
 Foam::Istream& Foam::operator>>(Foam::Istream& is, FixedList<T, Size>& L)
 {
-    is.fatalCheck("operator>>(Istream&, FixedList<T, Size>&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     if (is.format() == IOstream::ASCII || !contiguous<T>())
     {
diff --git a/src/OpenFOAM/containers/Lists/List/ListIO.C b/src/OpenFOAM/containers/Lists/List/ListIO.C
index 46183bb45b625805af80fac89a5f5a9053febc0d..b21b6a86648404ed633256ba9d503cf0ec84781f 100644
--- a/src/OpenFOAM/containers/Lists/List/ListIO.C
+++ b/src/OpenFOAM/containers/Lists/List/ListIO.C
@@ -46,11 +46,11 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& L)
     // Anull list
     L.setSize(0);
 
-    is.fatalCheck("operator>>(Istream&, List<T>&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     token firstToken(is);
 
-    is.fatalCheck("operator>>(Istream&, List<T>&) : reading first token");
+    is.fatalCheck(FUNCTION_NAME);
 
     if (firstToken.isCompound())
     {
diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H
index 3960b4ffe2a6296b6170c81914726a1734b3408c..46f3784a162270505a927528cea29a70d593e5f2 100644
--- a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H
+++ b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H
@@ -171,17 +171,26 @@ labelList invert(const label len, const labelUList& map);
 labelListList invertOneToMany(const label len, const labelUList& map);
 
 //- Invert many-to-many.
-//  Input and output types need to be inherited from List.
-//  eg, faces to pointFaces.
-template<class InList, class OutList>
-void invertManyToMany(const label len, const UList<InList>&, List<OutList>&);
+//  Input and output types must be inherited from List and also
+//  contain ints/labels. Used, for example, for faces to pointFaces.
+template<class InputIntListType, class OutputIntListType>
+void invertManyToMany
+(
+    const label len,
+    const UList<InputIntListType>& input,
+    List<OutputIntListType>& output
+);
 
-template<class InList, class OutList>
-List<OutList> invertManyToMany(const label len, const UList<InList>& in)
+template<class InputIntListType, class OutputIntListType>
+List<OutputIntListType> invertManyToMany
+(
+    const label len,
+    const UList<InputIntListType>& input
+)
 {
-    List<OutList> out;
-    invertManyToMany<InList,OutList>(len, in, out);
-    return out;
+    List<OutputIntListType> output;
+    invertManyToMany<InputIntListType,OutputIntListType>(len, input, output);
+    return output;
 }
 
 //- Create identity map of the given length with (map[i] == i)
diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C
index 9267221e99cbae5345f015f56c5feb8c18f368b8..48e8b73897e45446996033e9ea4a3d6ba8a11cc0 100644
--- a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C
+++ b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C
@@ -124,16 +124,11 @@ void Foam::inplaceMapValue
     Container& lst
 )
 {
-    for
-    (
-        typename Container::iterator iter = lst.begin();
-        iter != lst.end();
-        ++iter
-    )
+    for (auto iter = lst.begin(); iter != lst.end(); ++iter)
     {
-        if (iter() >= 0)
+        if (iter.object() >= 0)
         {
-            iter() = oldToNew[iter()];
+            iter.object() = oldToNew[iter.object()];
         }
     }
 }
@@ -148,16 +143,11 @@ void Foam::inplaceMapKey
 {
     Container newLst(lst.size());
 
-    for
-    (
-        typename Container::iterator iter = lst.begin();
-        iter != lst.end();
-        ++iter
-    )
+    for (auto iter = lst.begin(); iter != lst.end(); ++iter)
     {
         if (iter.key() >= 0)
         {
-            newLst.insert(oldToNew[iter.key()], iter());
+            newLst.insert(oldToNew[iter.key()], iter.object());
         }
     }
 
@@ -477,46 +467,45 @@ void Foam::inplaceSubsetList
 }
 
 
-template<class InList, class OutList>
+template<class InputIntListType, class OutputIntListType>
 void Foam::invertManyToMany
 (
-    const label nEdges,
-    const UList<InList>& pointEdges,
-    List<OutList>& edges
+    const label len,
+    const UList<InputIntListType>& input,
+    List<OutputIntListType>& output
 )
 {
-    // Number of points per edge
-    labelList nPointsPerEdge(nEdges, 0);
+    // The output list sizes
+    labelList sizes(len, 0);
 
-    forAll(pointEdges, pointi)
+    forAll(input, listi)
     {
-        const InList& pEdges = pointEdges[pointi];
+        const InputIntListType& sublist = input[listi];
 
-        forAll(pEdges, j)
+        forAll(sublist, idx)
         {
-            nPointsPerEdge[pEdges[j]]++;
+            sizes[sublist[idx]]++;
         }
     }
 
-    // Size edges
-    edges.setSize(nEdges);
-
-    forAll(nPointsPerEdge, edgeI)
+    // Size output
+    output.setSize(len);
+    forAll(sizes, outi)
     {
-        edges[edgeI].setSize(nPointsPerEdge[edgeI]);
+        output[outi].setSize(sizes[outi]);
     }
-    nPointsPerEdge = 0;
 
-    // Fill edges
-    forAll(pointEdges, pointi)
+    // Fill output
+    sizes = 0;
+    forAll(input, listi)
     {
-        const InList& pEdges = pointEdges[pointi];
+        const InputIntListType& sublist = input[listi];
 
-        forAll(pEdges, j)
+        forAll(sublist, idx)
         {
-            label edgeI = pEdges[j];
+            const label outi = sublist[idx];
 
-            edges[edgeI][nPointsPerEdge[edgeI]++] = pointi;
+            output[outi][sizes[outi]++] = listi;
         }
     }
 }
diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedList.C b/src/OpenFOAM/containers/Lists/PackedList/PackedList.C
index 53889b02ad4c73e8fe742291fc395d033edb0614..b862792b1270a3a2b82e409fa8ecc6dba529794a 100644
--- a/src/OpenFOAM/containers/Lists/PackedList/PackedList.C
+++ b/src/OpenFOAM/containers/Lists/PackedList/PackedList.C
@@ -266,7 +266,7 @@ Foam::Istream& Foam::PackedList<nBits>::read(Istream& is)
     PackedList<nBits>& lst = *this;
 
     lst.clear();
-    is.fatalCheck("PackedList<nBits>::read(Istream&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     token firstTok(is);
     is.fatalCheck
@@ -349,7 +349,7 @@ Foam::Istream& Foam::PackedList<nBits>::read(Istream& is)
         if (firstTok.pToken() == token::BEGIN_LIST)
         {
             token nextTok(is);
-            is.fatalCheck("PackedList<nBits>::read(Istream&)");
+            is.fatalCheck(FUNCTION_NAME);
 
             while
             (
@@ -362,13 +362,13 @@ Foam::Istream& Foam::PackedList<nBits>::read(Istream& is)
                 lst.append(lst.readValue(is));
 
                 is  >> nextTok;
-                is.fatalCheck("PackedList<nBits>::read(Istream&)");
+                is.fatalCheck(FUNCTION_NAME);
             }
         }
         else if (firstTok.pToken() == token::BEGIN_BLOCK)
         {
             token nextTok(is);
-            is.fatalCheck("PackedList<nBits>::read(Istream&)");
+            is.fatalCheck(FUNCTION_NAME);
 
             while
             (
@@ -381,7 +381,7 @@ Foam::Istream& Foam::PackedList<nBits>::read(Istream& is)
                 lst.setPair(is);
 
                 is  >> nextTok;
-                is.fatalCheck("PackedList<nBits>::read(Istream&)");
+                is.fatalCheck(FUNCTION_NAME);
             }
         }
         else
diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H b/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H
index 2397a45768e2614282f7d3cf822b3b88db1b9341..7849d5a792df016274e76c70a73629996ab6c243 100644
--- a/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H
+++ b/src/OpenFOAM/containers/Lists/PackedList/PackedListI.H
@@ -137,8 +137,7 @@ inline void Foam::PackedList<nBits>::setPair(Istream& is)
 
     set(ind, val);
 
-    // Check state of Istream
-    is.check("PackedList<nBits>::setPair(Istream&)");
+    is.check(FUNCTION_NAME);
 }
 
 
diff --git a/src/OpenFOAM/containers/Lists/PtrList/PtrListIO.C b/src/OpenFOAM/containers/Lists/PtrList/PtrListIO.C
index a9ce86e43ce1a89e1cb508c8e7abd8903aea8a9a..6aff9ed81e06d6d7578419172a584f261250f73f 100644
--- a/src/OpenFOAM/containers/Lists/PtrList/PtrListIO.C
+++ b/src/OpenFOAM/containers/Lists/PtrList/PtrListIO.C
@@ -35,7 +35,7 @@ template<class T>
 template<class INew>
 void Foam::PtrList<T>::read(Istream& is, const INew& inewt)
 {
-    is.fatalCheck("PtrList<T>::read(Istream&, const INew&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     token firstToken(is);
 
diff --git a/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectListIO.C b/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectListIO.C
index f6a82069c20ba9231df739ffc1b0b3129098faa4..5e711c072411100c72b4f301242feaa2fe8accf7 100644
--- a/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectListIO.C
+++ b/src/OpenFOAM/containers/Lists/UIndirectList/UIndirectListIO.C
@@ -120,9 +120,7 @@ Foam::Ostream& Foam::UIndirectList<T>::writeList
         }
     }
 
-    // Check state of IOstream
-    os.check("UIndirectList::writeList(Ostream&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/containers/Lists/UList/UListIO.C b/src/OpenFOAM/containers/Lists/UList/UListIO.C
index cd6d8cd6bf43cf3ec39b94f257a9694a2fe2888d..efb2ad3ffce3935884d40209ef04f8909eef907e 100644
--- a/src/OpenFOAM/containers/Lists/UList/UListIO.C
+++ b/src/OpenFOAM/containers/Lists/UList/UListIO.C
@@ -150,9 +150,7 @@ Foam::Ostream& Foam::UList<T>::writeList
         }
     }
 
-    // Check state of IOstream
-    os.check("UList<T>::writeList(Ostream&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
@@ -169,7 +167,7 @@ Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::UList<T>& L)
 template<class T>
 Foam::Istream& Foam::operator>>(Istream& is, UList<T>& L)
 {
-    is.fatalCheck("operator>>(Istream&, UList<T>&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     token firstToken(is);
 
diff --git a/src/OpenFOAM/containers/Lists/UPtrList/UPtrListIO.C b/src/OpenFOAM/containers/Lists/UPtrList/UPtrListIO.C
index 59657676136c666bb760e3e0e8ff85a01ba69bad..2852654dda0f7bf017089075463441f9e7d0044f 100644
--- a/src/OpenFOAM/containers/Lists/UPtrList/UPtrListIO.C
+++ b/src/OpenFOAM/containers/Lists/UPtrList/UPtrListIO.C
@@ -44,9 +44,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const UPtrList<T>& L)
     // Write end delimiter
     os << nl << decrIndent << indent << token::END_LIST << nl;
 
-    // Check state of IOstream
-    os.check("Ostream& operator<<(Ostream&, const UPtrList&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/containers/NamedEnum/NamedEnum.C b/src/OpenFOAM/containers/NamedEnum/NamedEnum.C
index 89784a1400b731514148fcb57d313b9e3bd92c00..0f5e05630f70402f72b51a5e2e49f5e7313e8e24 100644
--- a/src/OpenFOAM/containers/NamedEnum/NamedEnum.C
+++ b/src/OpenFOAM/containers/NamedEnum/NamedEnum.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,33 +24,60 @@ License
 \*---------------------------------------------------------------------------*/
 
 #include "NamedEnum.H"
+#include "dictionary.H"
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+template<class Enum, int nEnum>
+template<class StringType>
+Foam::List<StringType> Foam::NamedEnum<Enum, nEnum>::getNamesList()
+{
+    List<StringType> lst(nEnum);
+
+    label count = 0;
+    for (int enumi=0; enumi < nEnum; ++enumi)
+    {
+        if (names[enumi] && names[enumi][0])
+        {
+            lst[count++] = names[enumi];
+        }
+    }
+
+    lst.setSize(count);
+    return lst;
+}
+
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class Enum, int nEnum>
 Foam::NamedEnum<Enum, nEnum>::NamedEnum()
 :
-    HashTable<int>(2*nEnum)
+    table_type(2*nEnum)
 {
-    for (int enumI = 0; enumI < nEnum; ++enumI)
+    for (int enumi=0; enumi < nEnum; ++enumi)
     {
-        if (!names[enumI] || names[enumI][0] == '\0')
+        if (names[enumi] && names[enumi][0])
+        {
+            insert(names[enumi], enumi);
+        }
+        else
         {
-            stringList goodNames(enumI);
+            // Bad name - generate error message
+            stringList goodNames(enumi);
 
-            for (int i = 0; i < enumI; ++i)
+            for (int i = 0; i < enumi; ++i)
             {
                 goodNames[i] = names[i];
             }
 
             FatalErrorInFunction
-                << "Illegal enumeration name at position " << enumI << endl
-                << "after entries " << goodNames << ".\n"
+                << "Illegal enumeration name at position " << enumi << nl
+                << "after entries " << goodNames << nl
                 << "Possibly your NamedEnum<Enum, nEnum>::names array"
                 << " is not of size " << nEnum << endl
                 << abort(FatalError);
         }
-        insert(names[enumI], enumI);
     }
 }
 
@@ -60,14 +87,13 @@ Foam::NamedEnum<Enum, nEnum>::NamedEnum()
 template<class Enum, int nEnum>
 Enum Foam::NamedEnum<Enum, nEnum>::read(Istream& is) const
 {
-    const word name(is);
-
-    HashTable<int>::const_iterator iter = find(name);
+    const word enumName(is);
+    table_type::const_iterator iter = find(enumName);
 
     if (!iter.found())
     {
         FatalIOErrorInFunction(is)
-            << name << " is not in enumeration: "
+            << enumName << " is not in enumeration: "
             << sortedToc() << exit(FatalIOError);
     }
 
@@ -78,45 +104,47 @@ Enum Foam::NamedEnum<Enum, nEnum>::read(Istream& is) const
 template<class Enum, int nEnum>
 void Foam::NamedEnum<Enum, nEnum>::write(const Enum e, Ostream& os) const
 {
-    os  << operator[](e);
+    os  << names[int(e)];
 }
 
 
 template<class Enum, int nEnum>
-Foam::stringList Foam::NamedEnum<Enum, nEnum>::strings()
+Enum Foam::NamedEnum<Enum, nEnum>::lookup
+(
+    const word& key,
+    const dictionary& dict
+) const
 {
-    stringList lst(nEnum);
+    const word enumName(dict.lookup(key));
+    table_type::const_iterator iter = find(enumName);
 
-    label nElem = 0;
-    for (int enumI = 0; enumI < nEnum; ++enumI)
+    if (!iter.found())
     {
-        if (names[enumI] && names[enumI][0])
-        {
-            lst[nElem++] = names[enumI];
-        }
+        FatalIOErrorInFunction(dict)
+            << enumName << " is not in enumeration: "
+            << sortedToc() << exit(FatalIOError);
     }
 
-    lst.setSize(nElem);
-    return lst;
+    return Enum(iter.object());
 }
 
 
 template<class Enum, int nEnum>
-Foam::wordList Foam::NamedEnum<Enum, nEnum>::words()
+Enum Foam::NamedEnum<Enum, nEnum>::lookupOrDefault
+(
+    const word& key,
+    const dictionary& dict,
+    const enum_type deflt
+) const
 {
-    wordList lst(nEnum);
-
-    label nElem = 0;
-    for (int enumI = 0; enumI < nEnum; ++enumI)
+    if (dict.found(key))
     {
-        if (names[enumI] && names[enumI][0])
-        {
-            lst[nElem++] = names[enumI];
-        }
+        return lookup(key, dict);
+    }
+    else
+    {
+        return deflt;
     }
-
-    lst.setSize(nElem);
-    return lst;
 }
 
 
@@ -125,18 +153,32 @@ Foam::List<Enum> Foam::NamedEnum<Enum, nEnum>::enums()
 {
     List<Enum> lst(nEnum);
 
-    label nElem = 0;
-    for (int enumI = 0; enumI < nEnum; ++enumI)
+    label count = 0;
+    for (int enumi = 0; enumi < nEnum; ++enumi)
     {
-        if (names[enumI] && names[enumI][0])
+        if (names[enumi] && names[enumi][0])
         {
-            lst[nElem++] = Enum(enumI);
+            lst[count++] = Enum(enumi);
         }
     }
 
-    lst.setSize(nElem);
+    lst.setSize(count);
     return lst;
 }
 
 
+template<class Enum, int nEnum>
+Foam::stringList Foam::NamedEnum<Enum, nEnum>::strings()
+{
+    return getNamesList<string>();
+}
+
+
+template<class Enum, int nEnum>
+Foam::wordList Foam::NamedEnum<Enum, nEnum>::words()
+{
+    return getNamesList<word>();
+}
+
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/containers/NamedEnum/NamedEnum.H b/src/OpenFOAM/containers/NamedEnum/NamedEnum.H
index b2705f2805065dd981aa32ff5dbe44f3e8c05d70..0c1c0826fa35391abc87120609e3d141412619e5 100644
--- a/src/OpenFOAM/containers/NamedEnum/NamedEnum.H
+++ b/src/OpenFOAM/containers/NamedEnum/NamedEnum.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2017 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -25,7 +25,9 @@ Class
     Foam::NamedEnum
 
 Description
-    Initialise the NamedEnum HashTable from the static list of names.
+    A NamedEnum is a wrapper around a static list of names that represent
+    a particular enumeration. Internally it uses a HashTable for quicker
+    lookups.
 
 SourceFiles
     NamedEnum.C
@@ -44,6 +46,7 @@ SourceFiles
 
 namespace Foam
 {
+class dictionary;
 
 // Forward declaration
 template<class Enum, int> class NamedEnum;
@@ -57,11 +60,19 @@ class NamedEnum
 :
     public HashTable<int>
 {
-    //- nEnum must be positive (non-zero)
+    //- The nEnum must be positive (non-zero)
     static_assert(nEnum > 0, "nEnum must be positive (non-zero)");
 
+    //- The type of HashTable used for the lookup.
+    typedef HashTable<int> table_type;
+
+
     // Private Member Functions
 
+        //- The names as a list of strings
+        template<class StringType>
+        static List<StringType> getNamesList();
+
         //- Disallow default bitwise copy construct
         NamedEnum(const NamedEnum&) = delete;
 
@@ -71,6 +82,10 @@ class NamedEnum
 
 public:
 
+    //- The type of enumeration wrapped by NamedEnum
+    typedef Enum enum_type;
+
+
     // Static data members
 
         //- The set of names corresponding to the enumeration Enum
@@ -87,10 +102,33 @@ public:
 
         //- Read a word from Istream and return the corresponding
         //  enumeration element
-        Enum read(Istream&) const;
+        enum_type read(Istream& is) const;
 
         //- Write the name representation of the enumeration to an Ostream
-        void write(const Enum e, Ostream&) const;
+        void write(const enum_type e, Ostream& os) const;
+
+        //- Lookup the key in the dictionary and return the corresponding
+        // enumeration element based on its name.
+        // Fatal if anything is incorrect.
+        enum_type lookup
+        (
+            const word& key,
+            const dictionary& dict
+        ) const;
+
+        //- Find the key in the dictionary and return the corresponding
+        //  enumeration element based on its name.
+        //  Return the default value if the key was not found in the dictionary.
+        //  Fatal if enumerated name was incorrect.
+        enum_type lookupOrDefault
+        (
+            const word& key,
+            const dictionary& dict,
+            const enum_type deflt
+        ) const;
+
+        //- List of enumerations
+        static List<enum_type> enums();
 
         //- The set of names as a list of strings
         static stringList strings();
@@ -98,26 +136,23 @@ public:
         //- The set of names as a list of words
         static wordList words();
 
-        //- List of enumerations
-        static List<Enum> enums();
-
 
     // Member Operators
 
         //- Return the enumeration element corresponding to the given name
-        const Enum operator[](const char* name) const
+        inline const enum_type operator[](const char* name) const
         {
-            return Enum(HashTable<int>::operator[](name));
+            return enum_type(table_type::operator[](name));
         }
 
         //- Return the enumeration element corresponding to the given name
-        const Enum operator[](const word& name) const
+        inline const enum_type operator[](const word& name) const
         {
-            return Enum(HashTable<int>::operator[](name));
+            return enum_type(table_type::operator[](name));
         }
 
         //- Return the name of the given enumeration element
-        const char* operator[](const Enum e) const
+        inline const char* operator[](const enum_type e) const
         {
             return names[int(e)];
         }
diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstreamCommsStruct.C b/src/OpenFOAM/db/IOstreams/Pstreams/UPstreamCommsStruct.C
index 10d8dd993ef6e059a28381aa98b11905eb5c8973..3bce29637a85d786c28879ef24b42a8d159f3ff8 100644
--- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstreamCommsStruct.C
+++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstreamCommsStruct.C
@@ -117,11 +117,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const UPstream::commsStruct& comm)
         << comm.allBelow_ << token::SPACE
         << comm.allNotBelow_;
 
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, const commsStruct&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/db/IOstreams/token/tokenIO.C b/src/OpenFOAM/db/IOstreams/token/tokenIO.C
index 2a2a8a70063a8ea0bab2d97bec26091e89fccac2..c35047408070a79e1656c8df70b2e37a07a11bfd 100644
--- a/src/OpenFOAM/db/IOstreams/token/tokenIO.C
+++ b/src/OpenFOAM/db/IOstreams/token/tokenIO.C
@@ -105,9 +105,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const token& t)
                 << endl;
     }
 
-    // Check state of stream
-    os.check("Ostream& operator<<(Ostream&, const token&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntryIO.C b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntryIO.C
index 0b2c5315eccba1f8844f0f6d0f3684f8a6c266de..5a4feda30eb15d1e611e3882fe7192c117099c2d 100644
--- a/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntryIO.C
+++ b/src/OpenFOAM/db/dictionary/dictionaryEntry/dictionaryEntryIO.C
@@ -38,11 +38,7 @@ Foam::dictionaryEntry::dictionaryEntry
     entry(keyType(is)),
     dictionary(parentDict, is)
 {
-    is.fatalCheck
-    (
-        "dictionaryEntry::dictionaryEntry"
-        "(const dictionary& parentDict, Istream&)"
-    );
+    is.fatalCheck(FUNCTION_NAME);
 }
 
 
@@ -56,11 +52,7 @@ Foam::dictionaryEntry::dictionaryEntry
     entry(key),
     dictionary(key, parentDict, is)
 {
-    is.fatalCheck
-    (
-        "dictionaryEntry::dictionaryEntry"
-        "(const keyType&, const dictionary& parentDict, Istream&)"
-    );
+    is.fatalCheck(FUNCTION_NAME);
 }
 
 
diff --git a/src/OpenFOAM/db/dictionary/dictionaryListEntry/dictionaryListEntryIO.C b/src/OpenFOAM/db/dictionary/dictionaryListEntry/dictionaryListEntryIO.C
index 7d31932e9a106fbd4aa04bc958a44aa4c03dd64d..5043a206c22371f63f52b5c6de1572d76365dd22 100644
--- a/src/OpenFOAM/db/dictionary/dictionaryListEntry/dictionaryListEntryIO.C
+++ b/src/OpenFOAM/db/dictionary/dictionaryListEntry/dictionaryListEntryIO.C
@@ -115,8 +115,7 @@ void Foam::dictionaryListEntry::write(Ostream& os) const
     // Write end delimiter
     os << decrIndent << indent << token::END_LIST << nl;
 
-    // Check state of IOstream
-    os.check("Ostream& operator<<(Ostream&, const dictionaryListEntry&)");
+    os.check(FUNCTION_NAME);
 }
 
 
diff --git a/src/OpenFOAM/db/dictionary/functionEntries/functionEntry/functionEntry.C b/src/OpenFOAM/db/dictionary/functionEntries/functionEntry/functionEntry.C
index f91ee70bf65d6c5f21b4d1a245d0860563d896c8..d72a67791f0cf02a34eecab3c15f3d47c01cac2c 100644
--- a/src/OpenFOAM/db/dictionary/functionEntries/functionEntry/functionEntry.C
+++ b/src/OpenFOAM/db/dictionary/functionEntries/functionEntry/functionEntry.C
@@ -84,11 +84,7 @@ bool Foam::functionEntry::execute
     Istream& is
 )
 {
-    is.fatalCheck
-    (
-        "functionEntry::execute"
-        "(const word& functionName, dictionary& parentDict, Istream&)"
-    );
+    is.fatalCheck(FUNCTION_NAME);
 
     if (!executedictionaryIstreamMemberFunctionTablePtr_)
     {
@@ -127,11 +123,7 @@ bool Foam::functionEntry::execute
     Istream& is
 )
 {
-    is.fatalCheck
-    (
-        "functionEntry::execute"
-        "(const word&, const dictionary&, primitiveEntry&, Istream&)"
-    );
+    is.fatalCheck(FUNCTION_NAME);
 
     if (!executeprimitiveEntryIstreamMemberFunctionTablePtr_)
     {
diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C
index 1c447e88abcbe44dadb7ccb65a88538ca226fa24..39580f5a4fe3e3f2b034335d44fb266c1b3c860f 100644
--- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C
+++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C
@@ -91,10 +91,7 @@ bool Foam::primitiveEntry::expandFunction
 
 bool Foam::primitiveEntry::read(const dictionary& dict, Istream& is)
 {
-    is.fatalCheck
-    (
-        "primitiveEntry::readData(const dictionary&, Istream&)"
-    );
+    is.fatalCheck(FUNCTION_NAME);
 
     label blockCount = 0;
     token currToken;
@@ -145,10 +142,7 @@ bool Foam::primitiveEntry::read(const dictionary& dict, Istream& is)
         }
     }
 
-    is.fatalCheck
-    (
-        "primitiveEntry::readData(const dictionary&, Istream&)"
-    );
+    is.fatalCheck(FUNCTION_NAME);
 
     if (currToken.good())
     {
diff --git a/src/OpenFOAM/dimensionSet/dimensionSetIO.C b/src/OpenFOAM/dimensionSet/dimensionSetIO.C
index 7f7648e10d1e6a94541763e57a1d4cc7603e71eb..768acc8efc8569248b2c03789ab7cf0b45bb3a22 100644
--- a/src/OpenFOAM/dimensionSet/dimensionSetIO.C
+++ b/src/OpenFOAM/dimensionSet/dimensionSetIO.C
@@ -477,9 +477,8 @@ Foam::Istream& Foam::dimensionSet::read
                 << exit(FatalIOError);
         }
     }
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, dimensionSet&)");
 
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -617,9 +616,7 @@ Foam::Istream& Foam::dimensionSet::read
         }
     }
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, dimensionSet&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -691,9 +688,7 @@ Foam::Ostream& Foam::dimensionSet::write
 
     os  << token::END_SQR;
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const dimensionSet&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
@@ -722,9 +717,7 @@ Foam::Istream& Foam::operator>>(Istream& is, dimensionSet& dset)
             << exit(FatalIOError);
     }
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, dimensionSet&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -734,9 +727,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const dimensionSet& dset)
     scalar multiplier;
     dset.write(os, multiplier);
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const dimensionSet&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C
index dca595c6a3e3ef4b34f26669c5c68f3726c21b19..d281845b9220af52708310f96d1b1af5dba0690b 100644
--- a/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C
+++ b/src/OpenFOAM/dimensionedTypes/dimensionedType/dimensionedType.C
@@ -339,12 +339,7 @@ Foam::dimensioned<Type>::read(Istream& is, const dictionary& readSet)
     is >> value_;
     value_ *= mult;
 
-    // Check state of Istream
-    is.check
-    (
-        "Istream& dimensioned<Type>::read(Istream& is, const dictionary&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -367,13 +362,7 @@ Foam::Istream& Foam::dimensioned<Type>::read
     is >> value_;
     value_ *= mult;
 
-    // Check state of Istream
-    is.check
-    (
-        "Istream& dimensioned<Type>::read"
-        "(Istream& is, const HashTable<dimensionedScalar>&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -392,12 +381,7 @@ Foam::Istream& Foam::dimensioned<Type>::read(Istream& is)
     is >> value_;
     value_ *= mult;
 
-    // Check state of Istream
-    is.check
-    (
-        "Istream& dimensioned<Type>::read(Istream& is)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -612,9 +596,7 @@ Foam::Istream& Foam::operator>>(Istream& is, dimensioned<Type>& dt)
     is >> dt.value_;
     dt.value_ *= multiplier;
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, dimensioned<Type>&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -634,9 +616,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const dimensioned<Type>& dt)
     // Write the value
     os << dt.value()/mult;
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const dimensioned<Type>&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C
index 5823ee3f57c1ea360c962e4119788cf50acd18d4..e4717cd7fecf18ee9a9d749e39859c49bd0388b4 100644
--- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C
+++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C
@@ -80,7 +80,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
     regIOobject(io),
     Field<Type>(field),
     mesh_(mesh),
-    dimensions_(dims)
+    dimensions_(dims),
+    oriented_()
 {
     checkFieldSize();
 }
@@ -134,7 +135,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
     regIOobject(io),
     Field<Type>(GeoMesh::size(mesh)),
     mesh_(mesh),
-    dimensions_(dims)
+    dimensions_(dims),
+    oriented_()
 {
     if (checkIOFlags)
     {
@@ -155,7 +157,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
     regIOobject(io),
     Field<Type>(GeoMesh::size(mesh), dt.value()),
     mesh_(mesh),
-    dimensions_(dt.dimensions())
+    dimensions_(dt.dimensions()),
+    oriented_()
 {
     if (checkIOFlags)
     {
@@ -173,7 +176,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
     regIOobject(df),
     Field<Type>(df),
     mesh_(df.mesh_),
-    dimensions_(df.dimensions_)
+    dimensions_(df.dimensions_),
+    oriented_(df.oriented_)
 {}
 
 
@@ -187,7 +191,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
     regIOobject(df, reuse),
     Field<Type>(df, reuse),
     mesh_(df.mesh_),
-    dimensions_(df.dimensions_)
+    dimensions_(df.dimensions_),
+    oriented_(df.oriented_)
 {}
 
 
@@ -200,7 +205,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
     regIOobject(df(), true),
     Field<Type>(df),
     mesh_(df->mesh_),
-    dimensions_(df->dimensions_)
+    dimensions_(df->dimensions_),
+    oriented_(df->oriented_)
 {}
 
 
@@ -218,7 +224,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
         tdf.isTmp()
     ),
     mesh_(tdf().mesh_),
-    dimensions_(tdf().dimensions_)
+    dimensions_(tdf().dimensions_),
+    oriented_(tdf().oriented_)
 {
     tdf.clear();
 }
@@ -235,7 +242,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
     regIOobject(io),
     Field<Type>(df),
     mesh_(df.mesh_),
-    dimensions_(df.dimensions_)
+    dimensions_(df.dimensions_),
+    oriented_(df.oriented_)
 {}
 
 
@@ -250,7 +258,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
     regIOobject(io, df),
     Field<Type>(df, reuse),
     mesh_(df.mesh_),
-    dimensions_(df.dimensions_)
+    dimensions_(df.dimensions_),
+    oriented_(df.oriented_)
 {}
 
 
@@ -264,7 +273,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
     regIOobject(newName, df, newName == df.name()),
     Field<Type>(df),
     mesh_(df.mesh_),
-    dimensions_(df.dimensions_)
+    dimensions_(df.dimensions_),
+    oriented_(df.oriented_)
 {}
 
 
@@ -279,7 +289,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
     regIOobject(newName, df, true),
     Field<Type>(df, reuse),
     mesh_(df.mesh_),
-    dimensions_(df.dimensions_)
+    dimensions_(df.dimensions_),
+    oriented_(df.oriented_)
 {}
 
 
@@ -293,7 +304,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
     regIOobject(newName, df, true),
     Field<Type>(df),
     mesh_(df->mesh_),
-    dimensions_(df->dimensions_)
+    dimensions_(df->dimensions_),
+    oriented_(df->oriented_)
 {}
 
 
@@ -312,7 +324,8 @@ DimensionedField<Type, GeoMesh>::DimensionedField
         tdf.isTmp()
     ),
     mesh_(tdf().mesh_),
-    dimensions_(tdf().dimensions_)
+    dimensions_(tdf().dimensions_),
+    oriented_(tdf().oriented_)
 {
     tdf.clear();
 }
@@ -487,6 +500,7 @@ void DimensionedField<Type, GeoMesh>::operator=
     checkField(*this, df, "=");
 
     dimensions_ = df.dimensions();
+    oriented_ = df.oriented();
     Field<Type>::operator=(df);
 }
 
@@ -510,6 +524,7 @@ void DimensionedField<Type, GeoMesh>::operator=
     checkField(*this, df, "=");
 
     dimensions_ = df.dimensions();
+    oriented_ = df.oriented();
     this->transfer(const_cast<DimensionedField<Type, GeoMesh>&>(df));
     tdf.clear();
 }
@@ -537,6 +552,7 @@ void DimensionedField<Type, GeoMesh>::operator op                              \
     checkField(*this, df, #op);                                                \
                                                                                \
     dimensions_ op df.dimensions();                                            \
+    oriented_ op df.oriented();                                                \
     Field<Type>::operator op(df);                                              \
 }                                                                              \
                                                                                \
diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H
index b37c63724fcc35b71d80e2f131b78ede67087687..e37bcccc214413a624a3c6d3c39637f307da5775 100644
--- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H
+++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H
@@ -41,6 +41,7 @@ SourceFiles
 #include "regIOobject.H"
 #include "Field.H"
 #include "dimensionedType.H"
+#include "orientedType.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -65,7 +66,7 @@ template<class Type, class GeoMesh> Ostream& operator<<
 
 
 /*---------------------------------------------------------------------------*\
-                           Class DimensionedField Declaration
+                      Class DimensionedField Declaration
 \*---------------------------------------------------------------------------*/
 
 template<class Type, class GeoMesh>
@@ -99,6 +100,9 @@ private:
         //- Dimension set for this field
         dimensionSet dimensions_;
 
+        //- Oriented flag
+        orientedType oriented_;
+
 
     // Private Member Functions
 
@@ -283,6 +287,15 @@ public:
         //- Return non-const access to dimensions
         inline dimensionSet& dimensions();
 
+        //- Return oriented type
+        inline const orientedType& oriented() const;
+
+        //- Return non-const access to the oriented type
+        inline orientedType& oriented();
+
+        //- Set the oriented flag
+        inline void setOriented(const bool oriented = true);
+
         //- Return field
         inline const Field<Type>& field() const;
 
diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctionsM.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctionsM.C
index 6da09d945c4afbdddffaf9d023134f39a0e2f9a6..8e69d617454b145dbf6a30fb6f1f19305b3ddcba 100644
--- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctionsM.C
+++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctionsM.C
@@ -52,6 +52,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func                                \
                                                                                \
     Func(tRes.ref().field(), df1.field());                                     \
                                                                                \
+    tRes.ref().oriented() = Dfunc(df1.oriented());                             \
+                                                                               \
     return tRes;                                                               \
 }                                                                              \
                                                                                \
@@ -75,6 +77,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func                                \
                                                                                \
     Func(tRes.ref().field(), df1.field());                                     \
                                                                                \
+    tRes.ref().oriented() = Dfunc(df1.oriented());                             \
+                                                                               \
     tdf1.clear();                                                              \
                                                                                \
     return tRes;                                                               \
@@ -108,6 +112,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
                                                                                \
     Foam::OpFunc(tRes.ref().field(), df1.field());                             \
                                                                                \
+    tRes.ref().oriented() = Dfunc(df1.oriented());                             \
+                                                                               \
     return tRes;                                                               \
 }                                                                              \
                                                                                \
@@ -131,6 +137,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
                                                                                \
     Foam::OpFunc(tRes.ref().field(), df1.field());                             \
                                                                                \
+    tRes.ref().oriented() = Dfunc(df1.oriented());                             \
+                                                                               \
     tdf1.clear();                                                              \
                                                                                \
     return tRes;                                                               \
@@ -165,6 +173,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func                                \
                                                                                \
     Func(tRes.ref().field(), df1.field(), df2.field());                        \
                                                                                \
+    tRes.ref().oriented() = Func(df1.oriented(), df2.oriented());              \
+                                                                               \
     return tRes;                                                               \
 }                                                                              \
                                                                                \
@@ -189,6 +199,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func                                \
                                                                                \
     Func(tRes.ref().field(), df1.field(), df2.field());                        \
                                                                                \
+    tRes.ref().oriented() = Func(df1.oriented(), df2.oriented());              \
+                                                                               \
     tdf2.clear();                                                              \
                                                                                \
     return tRes;                                                               \
@@ -215,6 +227,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func                                \
                                                                                \
     Func(tRes.ref().field(), df1.field(), df2.field());                        \
                                                                                \
+    tRes.ref().oriented() = Func(df1.oriented(), df2.oriented());              \
+                                                                               \
     tdf1.clear();                                                              \
                                                                                \
     return tRes;                                                               \
@@ -244,6 +258,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func                                \
                                                                                \
     Func(tRes.ref().field(), df1.field(), df2.field());                        \
                                                                                \
+    tRes.ref().oriented() = Func(df1.oriented(), df2.oriented());              \
+                                                                               \
     tdf1.clear();                                                              \
     tdf2.clear();                                                              \
                                                                                \
@@ -279,6 +295,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func                                \
                                                                                \
     Func(tRes.ref().field(), dt1.value(), df2.field());                        \
                                                                                \
+    tRes.ref().oriented() = df2.oriented();                                    \
+                                                                               \
     return tRes;                                                               \
 }                                                                              \
                                                                                \
@@ -314,6 +332,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func                                \
                                                                                \
     Func(tRes.ref().field(), dt1.value(), df2.field());                        \
                                                                                \
+    tRes.ref().oriented() = df2.oriented();                                    \
+                                                                               \
     tdf2.clear();                                                              \
                                                                                \
     return tRes;                                                               \
@@ -356,6 +376,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func                                \
                                                                                \
     Func(tRes.ref().field(), df1.field(), dt2.value());                        \
                                                                                \
+    tRes.ref().oriented() = df1.oriented();                                    \
+                                                                               \
     return tRes;                                                               \
 }                                                                              \
                                                                                \
@@ -391,6 +413,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> Func                                \
                                                                                \
     Func(tRes.ref().field(), df1.field(), dt2.value());                        \
                                                                                \
+    tRes.ref().oriented() = df1.oriented();                                    \
+                                                                               \
     tdf1.clear();                                                              \
                                                                                \
     return tRes;                                                               \
@@ -440,6 +464,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
                                                                                \
     Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field());                \
                                                                                \
+    tRes.ref().oriented() = df1.oriented() Op df2.oriented();                  \
+                                                                               \
     return tRes;                                                               \
 }                                                                              \
                                                                                \
@@ -464,6 +490,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
                                                                                \
     Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field());                \
                                                                                \
+    tRes.ref().oriented() = df1.oriented() Op df2.oriented();                  \
+                                                                               \
     tdf2.clear();                                                              \
                                                                                \
     return tRes;                                                               \
@@ -490,6 +518,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
                                                                                \
     Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field());                \
                                                                                \
+    tRes.ref().oriented() = df1.oriented() Op df2.oriented();                  \
+                                                                               \
     tdf1.clear();                                                              \
                                                                                \
     return tRes;                                                               \
@@ -519,6 +549,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
                                                                                \
     Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field());                \
                                                                                \
+    tRes.ref().oriented() = df1.oriented() Op df2.oriented();                  \
+                                                                               \
     tdf1.clear();                                                              \
     tdf2.clear();                                                              \
                                                                                \
@@ -528,7 +560,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
+#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc)  \
                                                                                \
 TEMPLATE                                                                       \
 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
@@ -552,6 +584,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
         )                                                                      \
     );                                                                         \
                                                                                \
+    tRes.ref().oriented() = df2.oriented();                                    \
+                                                                               \
     Foam::OpFunc(tRes.ref().field(), dt1.value(), df2.field());                \
                                                                                \
     return tRes;                                                               \
@@ -589,6 +623,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
                                                                                \
     Foam::OpFunc(tRes.ref().field(), dt1.value(), tdf2().field());             \
                                                                                \
+    tRes.ref().oriented() = df2.oriented();                                    \
+                                                                               \
     tdf2.clear();                                                              \
                                                                                \
     return tRes;                                                               \
@@ -605,7 +641,7 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
 }
 
 
-#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
+#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)  \
                                                                                \
 TEMPLATE                                                                       \
 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
@@ -631,6 +667,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
                                                                                \
     Foam::OpFunc(tRes.ref().field(), df1.field(), dt2.value());                \
                                                                                \
+    tRes.ref().oriented() = df1.oriented();                                    \
+                                                                               \
     return tRes;                                                               \
 }                                                                              \
                                                                                \
@@ -666,6 +704,8 @@ tmp<DimensionedField<ReturnType, GeoMesh>> operator Op                         \
                                                                                \
     Foam::OpFunc(tRes.ref().field(), tdf1().field(), dt2.value());             \
                                                                                \
+    tRes.ref().oriented() = df1.oriented();                                    \
+                                                                               \
     tdf1.clear();                                                              \
                                                                                \
     return tRes;                                                               \
diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H
index 64cfd315895bc29de04ac1b18ceb88dc4e2b8fd3..b4a5b5d8b5afdca66c34240db825b06be1b9a2bd 100644
--- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H
+++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -48,14 +48,39 @@ Foam::DimensionedField<Type, GeoMesh>::dimensions() const
     return dimensions_;
 }
 
+
 template<class Type, class GeoMesh>
-inline Foam::dimensionSet&
-Foam::DimensionedField<Type, GeoMesh>::dimensions()
+inline Foam::dimensionSet& Foam::DimensionedField<Type, GeoMesh>::dimensions()
 {
     return dimensions_;
 }
 
 
+template<class Type, class GeoMesh>
+inline const Foam::orientedType&
+Foam::DimensionedField<Type, GeoMesh>::oriented() const
+{
+    return oriented_;
+}
+
+
+template<class Type, class GeoMesh>
+inline Foam::orientedType& Foam::DimensionedField<Type, GeoMesh>::oriented()
+{
+    return oriented_;
+}
+
+
+template<class Type, class GeoMesh>
+inline void Foam::DimensionedField<Type, GeoMesh>::setOriented
+(
+    const bool oriented
+)
+{
+    oriented_.setOriented(oriented);
+}
+
+
 template<class Type, class GeoMesh>
 inline const Foam::Field<Type>&
 Foam::DimensionedField<Type, GeoMesh>::field() const
@@ -63,6 +88,7 @@ Foam::DimensionedField<Type, GeoMesh>::field() const
     return *this;
 }
 
+
 template<class Type, class GeoMesh>
 inline Foam::Field<Type>&
 Foam::DimensionedField<Type, GeoMesh>::field()
diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldIO.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldIO.C
index 74da71025c3122c36fe03cdb041c232f742a9b6f..9ecc2a0ff43cda42a64f4d60f313309b8044ca33 100644
--- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldIO.C
+++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldIO.C
@@ -37,6 +37,7 @@ void Foam::DimensionedField<Type, GeoMesh>::readField
 )
 {
     dimensions_.reset(dimensionSet(fieldDict.lookup("dimensions")));
+    oriented_.read(fieldDict);
 
     Field<Type> f(fieldDictEntry, fieldDict, GeoMesh::size(mesh_));
     this->transfer(f);
@@ -74,7 +75,8 @@ Foam::DimensionedField<Type, GeoMesh>::DimensionedField
     regIOobject(io),
     Field<Type>(0),
     mesh_(mesh),
-    dimensions_(dimless)
+    dimensions_(dimless),
+    oriented_()
 {
     readField(dictionary(readStream(typeName)), fieldDictEntry);
 }
@@ -92,7 +94,8 @@ Foam::DimensionedField<Type, GeoMesh>::DimensionedField
     regIOobject(io),
     Field<Type>(0),
     mesh_(mesh),
-    dimensions_(dimless)
+    dimensions_(dimless),
+    oriented_()
 {
     readField(fieldDict, fieldDictEntry);
 }
@@ -107,19 +110,15 @@ bool Foam::DimensionedField<Type, GeoMesh>::writeData
     const word& fieldDictEntry
 ) const
 {
-    os.writeKeyword("dimensions") << dimensions() << token::END_STATEMENT
-        << nl << nl;
+    os.writeEntry("dimensions", dimensions());
+    oriented_.writeEntry(os);
 
-    Field<Type>::writeEntry(fieldDictEntry, os);
+    os<< nl << nl;
 
-    // Check state of Ostream
-    os.check
-    (
-        "bool DimensionedField<Type, GeoMesh>::writeData"
-        "(Ostream& os, const word& fieldDictEntry) const"
-    );
+    Field<Type>::writeEntry(fieldDictEntry, os);
 
-    return (os.good());
+    os.check(FUNCTION_NAME);
+    return os.good();
 }
 
 
diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C
index f60ed5047b5ad7b94800058aa22e4470de4224bd..f6ca2a766c6e02a958545682b2fa1bccd38e7b6f 100644
--- a/src/OpenFOAM/fields/Fields/Field/Field.C
+++ b/src/OpenFOAM/fields/Fields/Field/Field.C
@@ -28,7 +28,6 @@ License
 #include "dictionary.H"
 #include "contiguous.H"
 #include "mapDistributeBase.H"
-#include "flipOp.H"
 
 // * * * * * * * * * * * * * * * Static Members  * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C
index 38a8b94efac2df52a475c03c8bf8f6c78d15cbd8..c37fcf3fda48345a134cbdf1165368497e58c889 100644
--- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C
+++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C
@@ -573,12 +573,7 @@ writeEntry(const word& keyword, Ostream& os) const
     this->writeEntries(os);
     os.endBlock() << flush;
 
-    // Check state of IOstream
-    os.check
-    (
-        "GeometricField<Type, PatchField, GeoMesh>::Boundary::"
-        "writeEntry(const word& keyword, Ostream& os) const"
-    );
+    os.check(FUNCTION_NAME);
 }
 
 
diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C
index b75ce6c3eb9c1c7e05df31ccac672b905168f404..c985a3135f6af3720c87d3091ef4e36bc3146c14 100644
--- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C
+++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C
@@ -1175,6 +1175,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=
     // Only assign field contents not ID
 
     this->dimensions() = gf.dimensions();
+    this->oriented() = gf.oriented();
 
     if (tgf.isTmp())
     {
@@ -1246,7 +1247,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator op              \
 {                                                                              \
     checkField(*this, gf, #op);                                                \
                                                                                \
-    ref() op gf();            \
+    ref() op gf();                                                             \
     boundaryFieldRef() op gf.boundaryField();                                  \
 }                                                                              \
                                                                                \
@@ -1266,7 +1267,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::operator op              \
     const dimensioned<TYPE>& dt                                                \
 )                                                                              \
 {                                                                              \
-    ref() op dt;                                       \
+    ref() op dt;                                                               \
     boundaryFieldRef() op dt.value();                                          \
 }
 
@@ -1291,14 +1292,8 @@ Foam::Ostream& Foam::operator<<
     os  << nl;
     gf.boundaryField().writeEntry("boundaryField", os);
 
-    // Check state of IOstream
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, "
-        "const GeometricField<Type, PatchField, GeoMesh>&)"
-    );
-
-    return (os);
+    os.check(FUNCTION_NAME);
+    return os;
 }
 
 
diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C
index 49a7ce2d62202ceaa566ae33c7fd9a2496e5141d..4113b1d752b68430395af1e3d0231123cd9eb69a 100644
--- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C
+++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C
@@ -51,6 +51,7 @@ void component
 {
     component(gcf.primitiveFieldRef(), gf.primitiveField(), d);
     component(gcf.boundaryFieldRef(), gf.boundaryField(), d);
+    gcf.oriented() = gf.oriented();
 }
 
 
@@ -63,6 +64,7 @@ void T
 {
     T(gf.primitiveFieldRef(), gf1.primitiveField());
     T(gf.boundaryFieldRef(), gf1.boundaryField());
+    gf.oriented() = gf1.oriented();
 }
 
 
@@ -81,6 +83,7 @@ void pow
 {
     pow(gf.primitiveFieldRef(), gf1.primitiveField(), r);
     pow(gf.boundaryFieldRef(), gf1.boundaryField(), r);
+    gf.oriented() = pow(gf1.oriented(), r);
 }
 
 template
@@ -175,6 +178,7 @@ void sqr
 {
     sqr(gf.primitiveFieldRef(), gf1.primitiveField());
     sqr(gf.boundaryFieldRef(), gf1.boundaryField());
+    gf.oriented() = sqr(gf1.oriented());
 }
 
 template<class Type, template<class> class PatchField, class GeoMesh>
@@ -263,6 +267,7 @@ void magSqr
 {
     magSqr(gsf.primitiveFieldRef(), gf.primitiveField());
     magSqr(gsf.boundaryFieldRef(), gf.boundaryField());
+    gsf.oriented() = magSqr(gf.oriented());
 }
 
 template<class Type, template<class> class PatchField, class GeoMesh>
@@ -335,6 +340,7 @@ void mag
 {
     mag(gsf.primitiveFieldRef(), gf.primitiveField());
     mag(gsf.boundaryFieldRef(), gf.boundaryField());
+    gsf.oriented() = mag(gf.oriented());
 }
 
 template<class Type, template<class> class PatchField, class GeoMesh>
@@ -412,6 +418,7 @@ void cmptAv
 {
     cmptAv(gcf.primitiveFieldRef(), gf.primitiveField());
     cmptAv(gcf.boundaryFieldRef(), gf.boundaryField());
+    gcf.oriented() = cmptAv(gf.oriented());
 }
 
 template<class Type, template<class> class PatchField, class GeoMesh>
@@ -611,6 +618,8 @@ void opFunc                                                                    \
         gf1.boundaryField(),                                                   \
         gf2.boundaryField()                                                    \
     );                                                                         \
+                                                                               \
+    gf.oriented() = gf1.oriented() op gf2.oriented();                          \
 }                                                                              \
                                                                                \
 template                                                                       \
@@ -757,6 +766,7 @@ void opFunc                                                                    \
 {                                                                              \
     Foam::opFunc(gf.primitiveFieldRef(), gf1.primitiveField(), dvs.value());   \
     Foam::opFunc(gf.boundaryFieldRef(), gf1.boundaryField(), dvs.value());     \
+    gf.oriented() = gf1.oriented();                                            \
 }                                                                              \
                                                                                \
 template                                                                       \
@@ -870,6 +880,7 @@ void opFunc                                                                    \
 {                                                                              \
     Foam::opFunc(gf.primitiveFieldRef(), dvs.value(), gf1.primitiveField());   \
     Foam::opFunc(gf.boundaryFieldRef(), dvs.value(), gf1.boundaryField());     \
+    gf.oriented() = gf1.oriented();                                            \
 }                                                                              \
                                                                                \
 template                                                                       \
diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctionsM.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctionsM.C
index 377339dae972d2c59c39574d9f129392b9ac405e..9ff2ed8639cca3cd015240e441ce8c9249b7a23e 100644
--- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctionsM.C
+++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctionsM.C
@@ -43,6 +43,7 @@ void Func                                                                      \
 {                                                                              \
     Foam::Func(res.primitiveFieldRef(), gf1.primitiveField());                 \
     Foam::Func(res.boundaryFieldRef(), gf1.boundaryField());                   \
+    res.oriented() = gf1.oriented();                                           \
 }                                                                              \
                                                                                \
 TEMPLATE                                                                       \
@@ -112,6 +113,7 @@ void OpFunc                                                                    \
 {                                                                              \
     Foam::OpFunc(res.primitiveFieldRef(), gf1.primitiveField());               \
     Foam::OpFunc(res.boundaryFieldRef(), gf1.boundaryField());                 \
+    res.oriented() = gf1.oriented();                                           \
 }                                                                              \
                                                                                \
 TEMPLATE                                                                       \
@@ -192,6 +194,7 @@ void Func                                                                      \
         gf1.boundaryField(),                                                   \
         gf2.boundaryField()                                                    \
     );                                                                         \
+    res.oriented() = Func(gf1.oriented(), gf2.oriented());                     \
 }                                                                              \
                                                                                \
 TEMPLATE                                                                       \
@@ -320,6 +323,7 @@ void Func                                                                      \
 {                                                                              \
     Foam::Func(res.primitiveFieldRef(), dt1.value(), gf2.primitiveField());    \
     Foam::Func(res.boundaryFieldRef(), dt1.value(), gf2.boundaryField());      \
+    res.oriented() = gf2.oriented();                                           \
 }                                                                              \
                                                                                \
 TEMPLATE                                                                       \
@@ -411,6 +415,7 @@ void Func                                                                      \
 {                                                                              \
     Foam::Func(res.primitiveFieldRef(), gf1.primitiveField(), dt2.value());    \
     Foam::Func(res.boundaryFieldRef(), gf1.boundaryField(), dt2.value());      \
+    res.oriented() = gf1.oriented();                                           \
 }                                                                              \
                                                                                \
 TEMPLATE                                                                       \
@@ -511,6 +516,7 @@ void OpFunc                                                                    \
     (res.primitiveFieldRef(), gf1.primitiveField(), gf2.primitiveField());     \
     Foam::OpFunc                                                               \
     (res.boundaryFieldRef(), gf1.boundaryField(), gf2.boundaryField());        \
+    res.oriented() = gf1.oriented() Op gf2.oriented();                         \
 }                                                                              \
                                                                                \
 TEMPLATE                                                                       \
@@ -639,6 +645,8 @@ void OpFunc                                                                    \
 {                                                                              \
     Foam::OpFunc(res.primitiveFieldRef(), dt1.value(), gf2.primitiveField());  \
     Foam::OpFunc(res.boundaryFieldRef(), dt1.value(), gf2.boundaryField());    \
+    res.oriented() = gf2.oriented();                                           \
+                                                                               \
 }                                                                              \
                                                                                \
 TEMPLATE                                                                       \
@@ -730,6 +738,7 @@ void OpFunc                                                                    \
 {                                                                              \
     Foam::OpFunc(res.primitiveFieldRef(), gf1.primitiveField(), dt2.value());  \
     Foam::OpFunc(res.boundaryFieldRef(), gf1.boundaryField(), dt2.value());    \
+    res.oriented() = gf1.oriented();                                           \
 }                                                                              \
                                                                                \
 TEMPLATE                                                                       \
diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/MapGeometricFields.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/MapGeometricFields.H
index 93a47eda9fe07e933a2c699b299ebf86e72d7f9d..864318a4b0015dbff681a43458300afbb848d7df 100644
--- a/src/OpenFOAM/fields/GeometricFields/GeometricField/MapGeometricFields.H
+++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/MapGeometricFields.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -51,7 +51,7 @@ public:
 
     void operator()
     (
-        Field<Type>& field,
+        DimensionedField<Type, GeoMesh>& field,
         const MeshMapper& mapper
     ) const;
 };
@@ -72,10 +72,12 @@ void MapGeometricFields
     const MeshMapper& mapper
 )
 {
-    HashTable<const GeometricField<Type, PatchField, GeoMesh>*> fields
+    typedef GeometricField<Type, PatchField, GeoMesh> FieldType;
+
+    HashTable<const FieldType*> fields
     (
         mapper.thisDb().objectRegistry::template
-            lookupClass<GeometricField<Type, PatchField, GeoMesh>>()
+            lookupClass<FieldType>()
     );
 
     // It is necessary to enforce that all old-time fields are stored
@@ -83,17 +85,9 @@ void MapGeometricFields
     // old-time-level field is mapped before the field itself, sizes
     // will not match.
 
-    for
-    (
-        typename HashTable<const GeometricField<Type, PatchField, GeoMesh>*>::
-            iterator fieldIter = fields.begin();
-        fieldIter != fields.end();
-        ++fieldIter
-    )
+    forAllConstIter(typename HashTable<const FieldType*>, fields, fieldIter)
     {
-        GeometricField<Type, PatchField, GeoMesh>& field =
-            const_cast<GeometricField<Type, PatchField, GeoMesh>&>
-            (*fieldIter());
+        FieldType& field = const_cast<FieldType&>(*fieldIter());
 
         //Note: check can be removed once pointFields are actually stored on
         //      the pointMesh instead of now on the polyMesh!
@@ -103,17 +97,9 @@ void MapGeometricFields
         }
     }
 
-    for
-    (
-        typename HashTable<const GeometricField<Type, PatchField, GeoMesh>*>::
-            iterator fieldIter = fields.begin();
-        fieldIter != fields.end();
-        ++fieldIter
-    )
+    forAllConstIter(typename HashTable<const FieldType*>, fields, fieldIter)
     {
-        GeometricField<Type, PatchField, GeoMesh>& field =
-            const_cast<GeometricField<Type, PatchField, GeoMesh>&>
-            (*fieldIter());
+        FieldType& field = const_cast<FieldType&>(*fieldIter());
 
         if (&field.mesh() == &mapper.mesh())
         {
@@ -124,15 +110,11 @@ void MapGeometricFields
             }
 
             // Map the internal field
-            MapInternalField<Type, MeshMapper, GeoMesh>()
-            (
-                field.primitiveFieldRef(),
-                mapper
-            );
+            MapInternalField<Type, MeshMapper, GeoMesh>()(field.ref(), mapper);
 
             // Map the patch fields
-            typename GeometricField<Type, PatchField, GeoMesh>
-            ::Boundary& bfield = field.boundaryFieldRef();
+            typename FieldType::Boundary& bfield = field.boundaryFieldRef();
+
             forAll(bfield, patchi)
             {
                 // Cannot check sizes for patch fields because of
diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C
index 53a26f00ba328e93a55bbc163b719a9a16ee792a..2c98caa0e5cc105e311e4099b8a81eabc27ed4a2 100644
--- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C
+++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.C
@@ -329,7 +329,7 @@ Foam::Ostream& Foam::operator<<
 {
     ptf.write(os);
 
-    os.check("Ostream& operator<<(Ostream&, const pointPatchField<Type>&)");
+    os.check(FUNCTION_NAME);
 
     return os;
 }
diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C
index 6873c7c15715bd2bedda80d87b585e8baf917eeb..01b68a32de4aaf63702308af3544a04609801292 100644
--- a/src/OpenFOAM/global/argList/argList.C
+++ b/src/OpenFOAM/global/argList/argList.C
@@ -673,6 +673,17 @@ void Foam::argList::parse
                     adjustOpt = true;
                     source = source/"decomposeParDict";
                 }
+
+                if
+                (
+                   !source.isAbsolute()
+                && !(source.size() && source[0] == '.')
+                )
+                {
+                    source = rootPath_/globalCase_/source;
+                    adjustOpt = true;
+                }
+
                 // Could also check for absolute path, but shouldn't be needed
                 if (adjustOpt)
                 {
diff --git a/src/OpenFOAM/graph/curve/curve.C b/src/OpenFOAM/graph/curve/curve.C
index aadff19fce167ec6241625446f8015d5bb444fc4..87260649760ffb16a39a500d67f5c1b98e256132 100644
--- a/src/OpenFOAM/graph/curve/curve.C
+++ b/src/OpenFOAM/graph/curve/curve.C
@@ -63,7 +63,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const curve& c)
         << c.style_ << nl
         << static_cast<const scalarField&>(c);
 
-    os.check("Ostream& operator>>(Ostream&, const curve&)");
+    os.check(FUNCTION_NAME);
 
     return os;
 }
diff --git a/src/OpenFOAM/graph/graph.C b/src/OpenFOAM/graph/graph.C
index e21540d1851ac28ca4d100221a40fcb9450a4a65..105c69bcd563db2283fe02c9482e8bf973240a92 100644
--- a/src/OpenFOAM/graph/graph.C
+++ b/src/OpenFOAM/graph/graph.C
@@ -298,7 +298,7 @@ void Foam::graph::write
 Foam::Ostream& Foam::operator<<(Ostream& os, const graph& g)
 {
     g.writeTable(os);
-    os.check("Ostream& operator<<(Ostream&, const graph&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.C
index 0e944bd3adb629c7f5644ae2092811faf7e087e3..b7cf4836c0df8ff312aab437a985f79ebc716359 100644
--- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.C
+++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.C
@@ -363,7 +363,7 @@ Foam::Ostream& Foam::operator<<
             << endl << endl;
     }
 
-    os.check("Ostream& operator<<(Ostream&, const LduMatrix&");
+    os.check(FUNCTION_NAME);
 
     return os;
 }
diff --git a/src/OpenFOAM/matrices/Matrix/MatrixIO.C b/src/OpenFOAM/matrices/Matrix/MatrixIO.C
index fc315f4ca46ed33c11456c0801520cbbc313bd02..46b0b29f1255a67cb473f2970b21f14a6105982b 100644
--- a/src/OpenFOAM/matrices/Matrix/MatrixIO.C
+++ b/src/OpenFOAM/matrices/Matrix/MatrixIO.C
@@ -48,7 +48,7 @@ Foam::Istream& Foam::operator>>(Istream& is, Matrix<Form, Type>& M)
     // Anull matrix
     M.clear();
 
-    is.fatalCheck("operator>>(Istream&, Matrix<Form, Type>&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     token firstToken(is);
 
@@ -250,9 +250,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const Matrix<Form, Type>& M)
         }
     }
 
-    // Check state of IOstream
-    os.check("Ostream& operator<<(Ostream&, const Matrix&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C
index e9eb25143af250e109cc6fd6a087c641ee0090aa..922f9b8c5946a9ab9baf1291c782ece8991b3ef3 100644
--- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C
+++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C
@@ -338,7 +338,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const lduMatrix& ldum)
         os  << ldum.upper();
     }
 
-    os.check("Ostream& operator<<(Ostream&, const lduMatrix&");
+    os.check(FUNCTION_NAME);
 
     return os;
 }
@@ -398,7 +398,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy<lduMatrix>& ip)
     //    os  << endl;
     //}
 
-    os.check("Ostream& operator<<(Ostream&, const lduMatrix&");
+    os.check(FUNCTION_NAME);
 
     return os;
 }
diff --git a/src/OpenFOAM/meshes/Identifiers/DynamicID/DynamicID.H b/src/OpenFOAM/meshes/Identifiers/DynamicID/DynamicID.H
index 03942bb9ad1b0db9cbcf6d45486409ea5a1e959c..a0d82fb77947844808aea58ce931691d757909f3 100644
--- a/src/OpenFOAM/meshes/Identifiers/DynamicID/DynamicID.H
+++ b/src/OpenFOAM/meshes/Identifiers/DynamicID/DynamicID.H
@@ -142,9 +142,7 @@ Ostream& operator<<(Ostream& os, const DynamicID<ObjectType>& dynId)
         << dynId.name() << token::SPACE << dynId.index()
         << token::END_LIST;
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const DynamicID<ObjectType>&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.C b/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.C
index 9b7fc8a548d93335410f3091d10e427fad0d62af..e68137a628f921d8de72d62a7107ec960ef50bf4 100644
--- a/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.C
+++ b/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.C
@@ -134,16 +134,18 @@ Foam::coupleGroupIdentifier::coupleGroupIdentifier()
 {}
 
 
-Foam::coupleGroupIdentifier::coupleGroupIdentifier(const word& name)
+Foam::coupleGroupIdentifier::coupleGroupIdentifier(const word& patchGroupName)
 :
-    name_(name)
+    name_(patchGroupName)
 {}
 
 
 Foam::coupleGroupIdentifier::coupleGroupIdentifier(const dictionary& dict)
 :
-    name_(dict.lookupOrDefault<word>("coupleGroup", ""))
-{}
+    name_()
+{
+    dict.readIfPresent("coupleGroup", name_);
+}
 
 
 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
@@ -222,7 +224,7 @@ void Foam::coupleGroupIdentifier::write(Ostream& os) const
 {
     if (valid())
     {
-        os.writeKeyword("coupleGroup") << name() << token::END_STATEMENT << nl;
+        os.writeEntry("coupleGroup", name());
     }
 }
 
@@ -232,7 +234,7 @@ void Foam::coupleGroupIdentifier::write(Ostream& os) const
 Foam::Ostream& Foam::operator<<(Ostream& os, const coupleGroupIdentifier& p)
 {
     p.write(os);
-    os.check("Ostream& operator<<(Ostream& os, const coupleGroupIdentifier& p");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.H b/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.H
index 895dcf53ffabc0fa5fa5cd81dc17f091ce9027a8..cf1caa3667c58f43bacd624b9750319369a5bea5 100644
--- a/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.H
+++ b/src/OpenFOAM/meshes/Identifiers/patch/coupleGroupIdentifier.H
@@ -53,11 +53,11 @@ class Ostream;
 
 // Forward declaration of friend functions and operators
 class coupleGroupIdentifier;
-Ostream& operator<<(Ostream&, const coupleGroupIdentifier&);
+Ostream& operator<<(Ostream& os, const coupleGroupIdentifier& p);
 
 
 /*---------------------------------------------------------------------------*\
-                         Class coupleGroupIdentifier Declaration
+                    Class coupleGroupIdentifier Declaration
 \*---------------------------------------------------------------------------*/
 
 class coupleGroupIdentifier
@@ -71,7 +71,11 @@ class coupleGroupIdentifier
     // Private Member Functions
 
         //- Find other patch in specified mesh. Returns index of patch or -1.
-        label findOtherPatchID(const polyMesh&, const polyPatch&) const;
+        label findOtherPatchID
+        (
+            const polyMesh& mesh,
+            const polyPatch& thisPatch
+        ) const;
 
 
 public:
@@ -85,7 +89,7 @@ public:
         coupleGroupIdentifier(const word& patchGroupName);
 
         //- Construct from dictionary
-        coupleGroupIdentifier(const dictionary&);
+        coupleGroupIdentifier(const dictionary& dict);
 
 
     // Member Functions
@@ -97,19 +101,27 @@ public:
         inline bool valid() const;
 
         //- Find other patch in same region. Returns index of patch or -1.
-        label findOtherPatchID(const polyPatch&) const;
+        label findOtherPatchID(const polyPatch& thisPatch) const;
 
         //- Find other patch and region. Returns index of patch and sets
         //  otherRegion to name of region. Fatal error if patch not found
-        label findOtherPatchID(const polyPatch&, word&) const;
+        label findOtherPatchID
+        (
+            const polyPatch& thisPatch,
+            word& otherRegion
+        ) const;
 
         //- Write the data as a dictionary
-        void write(Ostream&) const;
+        void write(Ostream& os) const;
 
 
     // IOstream Operators
 
-        friend Ostream& operator<<(Ostream&, const coupleGroupIdentifier&);
+        friend Ostream& operator<<
+        (
+            Ostream& os,
+            const coupleGroupIdentifier& p
+        );
 };
 
 
diff --git a/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.C b/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.C
index b69ffae4f4c7b4695a5ae797806ccd43d80205a9..c535e5b0bf6c9ad6d5f03a2d51013e4972d7ae54 100644
--- a/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.C
+++ b/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.C
@@ -90,23 +90,23 @@ void Foam::patchIdentifier::write(Ostream& os) const
 {
     if (physicalType_.size())
     {
-        os.writeKeyword("physicalType") << physicalType_
-            << token::END_STATEMENT << nl;
+        os.writeEntry("physicalType", physicalType_);
     }
     if (inGroups_.size())
     {
-        os.writeKeyword("inGroups") << inGroups_
-            << token::END_STATEMENT << nl;
+        os.writeKeyword("inGroups");
+        // Write list with flatOutput
+        inGroups_.writeList(os, 0) << token::END_STATEMENT << nl;
     }
 }
 
 
 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
 
-Foam::Ostream& Foam::operator<<(Ostream& os, const patchIdentifier& pi)
+Foam::Ostream& Foam::operator<<(Ostream& os, const patchIdentifier& p)
 {
-    pi.write(os);
-    os.check("Ostream& operator<<(Ostream&, const patchIdentifier&)");
+    p.write(os);
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.H b/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.H
index e54d27673302e5b298e30e7ac8429eded6f92eb6..760744a87e95442a9d8165b369a9c70b9184ef98 100644
--- a/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.H
+++ b/src/OpenFOAM/meshes/Identifiers/patch/patchIdentifier.H
@@ -25,7 +25,7 @@ Class
     Foam::patchIdentifier
 
 Description
-    Identifies patch by name, patch index and physical type
+    Identifies a patch by name, patch index and physical type
 
 SourceFiles
     patchIdentifier.C
@@ -48,11 +48,11 @@ class dictionary;
 // Forward declaration of friend functions and operators
 
 class patchIdentifier;
-Ostream& operator<<(Ostream&, const patchIdentifier&);
+Ostream& operator<<(Ostream& os, const patchIdentifier& p);
 
 
 /*---------------------------------------------------------------------------*\
-                           Class patchIdentifier Declaration
+                       Class patchIdentifier Declaration
 \*---------------------------------------------------------------------------*/
 
 class patchIdentifier
@@ -68,7 +68,7 @@ class patchIdentifier
         //- Optional physical type
         mutable word physicalType_;
 
-        //- Optional groups patch belongs to
+        //- Optional groups to which the patch belongs
         wordList inGroups_;
 
 public:
@@ -88,14 +88,14 @@ public:
         patchIdentifier
         (
             const word& name,
-            const dictionary&,
+            const dictionary& dict,
             const label index
         );
 
-        //- Construct from geometric patch, resetting the index
+        //- Copy construct from geometric patch, resetting the index
         patchIdentifier
         (
-            const patchIdentifier&,
+            const patchIdentifier& p,
             const label index
         );
 
@@ -106,64 +106,64 @@ public:
 
     // Member Functions
 
-        //- Return name
+        //- Return the patch name
         const word& name() const
         {
             return name_;
         }
 
-        //- Return name for modification
+        //- Modifiable patch name
         word& name()
         {
             return name_;
         }
 
-        //- Return the optional physical type of the patch
+        //- The optional physical type of the patch
         const word& physicalType() const
         {
             return physicalType_;
         }
 
-        //- Return the optional physical type of the patch for modification
+        //- Modifiable optional physical type of the patch
         word& physicalType()
         {
             return physicalType_;
         }
 
-        //- Return the index of this patch in the boundaryMesh
+        //- The index of this patch in the boundaryMesh
         label index() const
         {
             return index_;
         }
 
-        //- Return the index of this patch in the boundaryMesh for modification
+        //- Modifiable the index of this patch in the boundaryMesh
         label& index()
         {
             return index_;
         }
 
-        //- Return the optional groups patch belongs to
+        //- The optional groups that the patch belongs to
         const wordList& inGroups() const
         {
             return inGroups_;
         }
 
-        //- Return the optional groups patch belongs to for modification
+        //- Modifiable optional groups that the patch belongs to
         wordList& inGroups()
         {
             return inGroups_;
         }
 
-        //- Test if in group
-        bool inGroup(const word&) const;
+        //- Check if the patch is in named group
+        bool inGroup(const word& name) const;
 
         //- Write patchIdentifier as a dictionary
-        void write(Ostream&) const;
+        void write(Ostream& os) const;
 
 
     // Ostream Operator
 
-        friend Ostream& operator<<(Ostream&, const patchIdentifier&);
+        friend Ostream& operator<<(Ostream& os, const patchIdentifier& p);
 };
 
 
diff --git a/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.C b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.C
index d9179f42748bb4b1763183e056ec596c2e556896..33e933ba23028f7a2466095f7012da0c71c82df3 100644
--- a/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.C
+++ b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.C
@@ -106,29 +106,22 @@ void Foam::surfZoneIdentifier::write(Ostream& os) const
 }
 
 
-// * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
-// needed for list output
-bool Foam::surfZoneIdentifier::operator!=
-(
-    const surfZoneIdentifier& rhs
-) const
+bool Foam::operator==(const surfZoneIdentifier& a, const surfZoneIdentifier& b)
 {
-    return !(*this == rhs);
+    return
+    (
+        (a.index() == b.index())
+     && (a.name()  == b.name())
+     && (a.geometricType() == b.geometricType())
+    );
 }
 
 
-bool Foam::surfZoneIdentifier::operator==
-(
-    const surfZoneIdentifier& rhs
-) const
+bool Foam::operator!=(const surfZoneIdentifier& a, const surfZoneIdentifier& b)
 {
-    return
-    (
-        (index() == rhs.index())
-     && (name()  == rhs.name())
-     && (geometricType() == rhs.geometricType())
-    );
+    return !(a == b);
 }
 
 
@@ -137,17 +130,15 @@ bool Foam::surfZoneIdentifier::operator==
 Foam::Istream& Foam::operator>>(Istream& is, surfZoneIdentifier& obj)
 {
     is >> obj.name_ >> obj.geometricType_;
-
     return is;
 }
 
 
 Foam::Ostream& Foam::operator<<(Ostream& os, const surfZoneIdentifier& obj)
 {
-    // newlines to separate, since that is what triSurface currently expects
+    // Newlines to separate, since that is what triSurface currently expects
     os  << nl << obj.name_ << nl << obj.geometricType_;
-
-    os.check("Ostream& operator<<(Ostream&, const surfZoneIdentifier&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.H b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.H
index a084e0196a3145d550df311ef9f9cc38d4e8fb08..26922f5aef8b54203d18411cbda4fbea72915ea1 100644
--- a/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.H
+++ b/src/OpenFOAM/meshes/Identifiers/surface/surfZoneIdentifier.H
@@ -51,8 +51,8 @@ class dictionary;
 // Forward declaration of friend functions and operators
 
 class surfZoneIdentifier;
-Istream& operator>>(Istream&, surfZoneIdentifier&);
-Ostream& operator<<(Ostream&, const surfZoneIdentifier&);
+Istream& operator>>(Istream& is, surfZoneIdentifier& p);
+Ostream& operator<<(Ostream& os, const surfZoneIdentifier& p);
 
 /*---------------------------------------------------------------------------*\
                      Class surfZoneIdentifier Declaration
@@ -94,21 +94,20 @@ public:
             const word& name,
             const label index,
             const word& geometricType = word::null
-
         );
 
         //- Construct from dictionary
         surfZoneIdentifier
         (
             const word& name,
-            const dictionary&,
+            const dictionary& dict,
             const label index
         );
 
-        //- Construct from another zone identifier, resetting the index
+        //- Copy construct from another zone identifier, resetting the index
         surfZoneIdentifier
         (
-            const surfZoneIdentifier&,
+            const surfZoneIdentifier& p,
             const label index
         );
 
@@ -156,14 +155,8 @@ public:
         }
 
 
-        //- Write surfZoneIdentifier as a dictionary
-        void write(Ostream&) const;
-
-
-    // Member Operators
-
-        bool operator!=(const surfZoneIdentifier&) const;
-        bool operator==(const surfZoneIdentifier&) const;
+        //- Write identifier as a dictionary
+        void write(Ostream& os) const;
 
 
     // Ostream Operator
@@ -171,20 +164,29 @@ public:
         //- Read name/type.
         friend Istream& operator>>
         (
-            Istream&,
-            surfZoneIdentifier&
+            Istream& is,
+            surfZoneIdentifier& ob
         );
 
         //- Write name/type.
         friend Ostream& operator<<
         (
-            Ostream&,
-            const surfZoneIdentifier&
+            Ostream& os,
+            const surfZoneIdentifier& obj
         );
 
 };
 
 
+// Global Operators
+
+//- Compare zone indentifiers for equality
+bool operator==(const surfZoneIdentifier& a, const surfZoneIdentifier& b);
+
+//- Compare zone indentifiers for inequality
+bool operator!=(const surfZoneIdentifier& a, const surfZoneIdentifier& b);
+
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 } // End namespace Foam
diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.C b/src/OpenFOAM/meshes/boundBox/boundBox.C
index 08da5b207a67b60e698817b7837a44936be73699..a03a7e7597fc3d3f31c33b7c3689b6c3d6a18bac 100644
--- a/src/OpenFOAM/meshes/boundBox/boundBox.C
+++ b/src/OpenFOAM/meshes/boundBox/boundBox.C
@@ -259,8 +259,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb)
         );
     }
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const boundBox&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
@@ -280,8 +279,7 @@ Foam::Istream& Foam::operator>>(Istream& is, boundBox& bb)
         );
     }
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, boundBox&)");
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OpenFOAM/meshes/lduMesh/lduMesh.C b/src/OpenFOAM/meshes/lduMesh/lduMesh.C
index 1717be26c68e28f01bcee18382bc8bdf8fc96302..911cf0a93bd60dd375c4c52c7d17f614a6bd5270 100644
--- a/src/OpenFOAM/meshes/lduMesh/lduMesh.C
+++ b/src/OpenFOAM/meshes/lduMesh/lduMesh.C
@@ -139,7 +139,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy<lduMesh>& ip)
         }
     }
 
-    os.check("Ostream& operator<<(Ostream&, const lduMesh&");
+    os.check(FUNCTION_NAME);
 
     return os;
 }
diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceI.H b/src/OpenFOAM/meshes/meshShapes/face/faceI.H
index ce807528c6598dbbeae7b5489f3f187d6adbeafe..d312560843c35033a0246ebfae1255704dda80b7 100644
--- a/src/OpenFOAM/meshes/meshShapes/face/faceI.H
+++ b/src/OpenFOAM/meshes/meshShapes/face/faceI.H
@@ -176,9 +176,7 @@ inline Foam::Istream& Foam::operator>>(Istream& is, face& f)
         is >> static_cast<labelList&>(f);
     }
 
-    // Check state of Ostream
-    is.check("Istream& operator>>(Istream&, face&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTriI.H b/src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTriI.H
index 861be7665ae56edbff050e0dd13b687adfac06cf..3975314e00911f0769c4a3e202fdd1c107f0ed56 100644
--- a/src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTriI.H
+++ b/src/OpenFOAM/meshes/meshShapes/labelledTri/labelledTriI.H
@@ -137,9 +137,7 @@ inline Foam::Istream& Foam::operator>>(Istream& is, labelledTri& t)
         is.read(reinterpret_cast<char*>(&t), sizeof(labelledTri));
     }
 
-    // Check state of Ostream
-    is.check("Istream& operator>>(Istream&, labelledTri&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -161,9 +159,7 @@ inline Foam::Ostream& Foam::operator<<(Ostream& os, const labelledTri& t)
         );
     }
 
-    // Check state of Ostream
     os.check(FUNCTION_NAME);
-
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C
index 800dfd4d80acaf1288f23d07a1d9bdccb7aa7b91..d1fc64caea5147836a5dd2123e566399580cdef0 100644
--- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C
+++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C
@@ -545,7 +545,7 @@ void Foam::mapDistribute::operator=(const mapDistribute& rhs)
 
 Foam::Istream& Foam::operator>>(Istream& is, mapDistribute& map)
 {
-    is.fatalCheck("operator>>(Istream&, mapDistribute&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     is  >> static_cast<mapDistributeBase&>(map)
         >> map.transformElements_ >> map.transformStart_;
diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.C
index ac970965c809294cd362d4faa19ba189ac02f8d3..fce5b416c3c438b0163d9e05ef41a8f92823eeff 100644
--- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.C
+++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.C
@@ -1248,7 +1248,7 @@ void Foam::mapDistributeBase::operator=(const mapDistributeBase& rhs)
 
 Foam::Istream& Foam::operator>>(Istream& is, mapDistributeBase& map)
 {
-    is.fatalCheck("operator>>(Istream&, mapDistributeBase&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     is  >> map.constructSize_ >> map.subMap_ >> map.constructMap_
         >> map.subHasFlip_ >> map.constructHasFlip_;
diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributePolyMesh.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributePolyMesh.C
index 4adda18a496961cbd8792797ae7ffa90d3cd7508..2f44c1d9a6a58373fe12de6e178a43471c1e9899 100644
--- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributePolyMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributePolyMesh.C
@@ -309,7 +309,7 @@ void Foam::mapDistributePolyMesh::operator=(const mapDistributePolyMesh& rhs)
 
 Foam::Istream& Foam::operator>>(Istream& is, mapDistributePolyMesh& map)
 {
-    is.fatalCheck("operator>>(Istream&, mapDistributePolyMesh&)");
+    is.fatalCheck(FUNCTION_NAME);
 
     is  >> map.nOldPoints_
         >> map.nOldFaces_
diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/objectMap/objectMapI.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/objectMap/objectMapI.H
index 878452a62aafb82f216f5fe478f2db0d304db78e..1563a11fcc63b2825f57cf5f6c1e5184dfaa2176 100644
--- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/objectMap/objectMapI.H
+++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/objectMap/objectMapI.H
@@ -58,8 +58,7 @@ inline objectMap::objectMap(Istream& is)
     // Read master of objectMap
     is.readEnd("objectMap");
 
-    // Check state of Istream
-    is.check("objectMap::objectMap(Istream&)");
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -115,9 +114,7 @@ inline Ostream& operator<<(Ostream& os, const objectMap& a)
         << a.masterObjects_
         << token::END_LIST;
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const objectMap&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
@@ -128,9 +125,7 @@ inline Istream& operator>>(Istream& is, objectMap& a)
     is  >> a.index_ >> a.masterObjects_;
     is.readEnd("objectMap");
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, objectMap&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C
index dfebcf0d3080b4e4b0d2923cacfebf02691b25f0..4790770647978217d20c7dad3a2b0847552278cb 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C
@@ -86,12 +86,7 @@ Foam::polyBoundaryMesh::polyBoundaryMesh
             );
         }
 
-        // Check state of IOstream
-        is.check
-        (
-            "polyBoundaryMesh::polyBoundaryMesh"
-            "(const IOobject&, const polyMesh&)"
-        );
+        is.check(FUNCTION_NAME);
 
         close();
     }
@@ -155,12 +150,7 @@ Foam::polyBoundaryMesh::polyBoundaryMesh
             );
         }
 
-        // Check state of IOstream
-        is.check
-        (
-            "polyBoundaryMesh::polyBoundaryMesh"
-            "(const IOobject&, const polyMesh&, const polyPatchList&)"
-        );
+        is.check(FUNCTION_NAME);
 
         close();
     }
@@ -1121,9 +1111,7 @@ bool Foam::polyBoundaryMesh::writeData(Ostream& os) const
 
     os  << decrIndent << token::END_LIST;
 
-    // Check state of IOstream
-    os.check("polyBoundaryMesh::writeData(Ostream& os) const");
-
+    os.check(FUNCTION_NAME);
     return os.good();
 }
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndices.C b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndices.C
index 8e0d4f3581a7fd4ae504a68f796781dec9484027..bfe4e2088ef877d2af5af7cf94c8a228ffb41c02 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndices.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/tetIndices.C
@@ -114,12 +114,7 @@ Foam::Istream& Foam::operator>>(Istream& is, tetIndices& tI)
         >> tI.facePtB()
         >> tI.tetPt();
 
-    // Check state of Istream
-    is.check
-    (
-        "Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::tetIndices&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -134,13 +129,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const tetIndices& tI)
         << tI.tetPt() << token::SPACE
         << endl;
 
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
-        "const Foam::tetIndices&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C
index 546702bb54ec7ac9c5fd8cdf7f4a83e13436a0a8..7a26581fe7baa08483851392317370989678fd84 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C
@@ -421,7 +421,7 @@ void Foam::polyPatch::operator=(const polyPatch& p)
 Foam::Ostream& Foam::operator<<(Ostream& os, const polyPatch& p)
 {
     p.write(os);
-    os.check("Ostream& operator<<(Ostream& os, const polyPatch& p");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C
index a408ec87a77b5a62fb86bfac84b3d640369fda72..c59ec220911ca966e40cc645db8504a42aae7658 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C
@@ -173,7 +173,7 @@ void Foam::cellZone::operator=(const Xfer<labelList>& addr)
 Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& zn)
 {
     zn.write(os);
-    os.check("Ostream& operator<<(Ostream&, const cellZone&");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C
index 9a6238c73354bc891e2683adcd61a8625bfb6f5a..459e8002d7e2372baa89ab58e073de6e1bcb3f4f 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C
@@ -544,7 +544,7 @@ void Foam::faceZone::writeDict(Ostream& os) const
 Foam::Ostream& Foam::operator<<(Ostream& os, const faceZone& zn)
 {
     zn.write(os);
-    os.check("Ostream& operator<<(Ostream&, const faceZone&");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C
index ccb109025d180840bb8d470ca6e81fd92fe41b02..31680ccf1a0310b12077ce86c2f62af83c449d73 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C
@@ -225,7 +225,7 @@ void Foam::pointZone::operator=(const Xfer<labelList>& addr)
 Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& zn)
 {
     zn.write(os);
-    os.check("Ostream& operator<<(Ostream&, const pointZone&");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C
index 8e26d4e81933da1535bf7bf40e8b95fce48409db..5ff0eebb7b49ed8985b29722c416e513dbd1d84a 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C
@@ -242,7 +242,7 @@ void Foam::zone::write(Ostream& os) const
 Foam::Ostream& Foam::operator<<(Ostream& os, const zone& z)
 {
     z.write(os);
-    os.check("Ostream& operator<<(Ostream& f, const zone& z");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/primitiveShapes/line/lineI.H b/src/OpenFOAM/meshes/primitiveShapes/line/lineI.H
index c4757716cfc9ad71d0fd17e3eaac235a55ee8cbe..034f86878034c75a7e60b95cf812206f05b6ebd9 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/line/lineI.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/line/lineI.H
@@ -280,7 +280,7 @@ inline Foam::Istream& Foam::operator>>
     is  >> l.a_ >> l.b_;
     is.readEnd("line");
 
-    is.check("Istream& operator>>(Istream&, line&)");
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OpenFOAM/meshes/primitiveShapes/objectHit/PointIndexHit.H b/src/OpenFOAM/meshes/primitiveShapes/objectHit/PointIndexHit.H
index 13118adb01524280993bff4af8697135c4522a2b..63a8068cb510721c523670dec0f0d87a56f5445b 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/objectHit/PointIndexHit.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/objectHit/PointIndexHit.H
@@ -212,12 +212,11 @@ public:
                 );
             }
 
-            // Check state of Ostream
-            os.check("Ostream& operator<<(Ostream&, const PointIndexHit&)");
-
+            os.check(FUNCTION_NAME);
             return os;
         }
 
+
         friend Istream& operator>>(Istream& is, PointIndexHit& pHit)
         {
             if (is.format() == IOstream::ASCII)
@@ -233,9 +232,7 @@ public:
                 );
             }
 
-            // Check state of Istream
-            is.check("Istream& operator>>(Istream&, PointIndexHit&)");
-
+            is.check(FUNCTION_NAME);
             return is;
         }
 
diff --git a/src/OpenFOAM/meshes/primitiveShapes/pyramid/pyramidI.H b/src/OpenFOAM/meshes/primitiveShapes/pyramid/pyramidI.H
index 636990dcc681119a86a51aa5e3d83a933c831ba0..a657a889f8150b7ec82ea543da343926cc8332c3 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/pyramid/pyramidI.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/pyramid/pyramidI.H
@@ -45,7 +45,7 @@ template<class Point, class PointRef, class polygonRef>
 inline Foam::pyramid<Point, PointRef, polygonRef>::pyramid(Istream& is)
 {
     is >> base_ >> apex_;
-    is.check("pyramid::pyramid(Istream&)");
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -105,7 +105,7 @@ inline Foam::Istream& Foam::operator>>
 )
 {
     is  >> p.base_ >> p.apex_;
-    is.check("Istream& operator>>(Istream&, pyramid&)");
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H
index d95f42dc1ebe2fbf4198f0a848032b730168a6ae..b98fc15bb8088f36443445877435677f365ed3cf 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H
@@ -967,7 +967,7 @@ inline Foam::Istream& Foam::operator>>
     is  >> t.a_ >> t.b_ >> t.c_ >> t.d_;
     is.readEnd("tetrahedron");
 
-    is.check("Istream& operator>>(Istream&, tetrahedron&)");
+    is.check(FUNCTION_NAME);
 
     return is;
 }
diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H
index 605e10589b58666229c99f26a676cf7e406ed268..7608c1ceb4058f6899ad1c527a410b8ab4efe1ab 100644
--- a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H
+++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H
@@ -869,7 +869,7 @@ inline Foam::Istream& Foam::operator>>
     is  >> t.a_ >> t.b_ >> t.c_;
     is.readEnd("triangle");
 
-    is.check("Istream& operator>>(Istream&, triangle&)");
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OpenFOAM/orientedType/orientedType.C b/src/OpenFOAM/orientedType/orientedType.C
new file mode 100644
index 0000000000000000000000000000000000000000..4a04453ac09a3da6e0190477bcaef7562c7db649
--- /dev/null
+++ b/src/OpenFOAM/orientedType/orientedType.C
@@ -0,0 +1,562 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2017 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 3 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, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "orientedType.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    template<>
+    const char* NamedEnum
+    <
+        orientedType::orientedOption,
+        3
+    >::names[] =
+    {
+        "oriented",
+        "unoriented",
+        "unknown"
+    };
+}
+
+const Foam::NamedEnum<Foam::orientedType::orientedOption, 3>
+    Foam::orientedType::orientedOptionNames;
+
+
+bool Foam::orientedType::checkType
+(
+    const orientedType& ot1,
+    const orientedType& ot2
+)
+{
+    if
+    (
+        (ot1.oriented() == UNKNOWN)
+     || (ot2.oriented() == UNKNOWN)
+     || (ot1.oriented() == ot2.oriented())
+    )
+    {
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::orientedType::orientedType()
+:
+    oriented_(UNKNOWN)
+{}
+
+
+Foam::orientedType::orientedType(const orientedType& ot)
+:
+    oriented_(ot.oriented_)
+{}
+
+
+Foam::orientedType::orientedType(const bool oriented)
+:
+    oriented_(oriented ? ORIENTED : UNORIENTED)
+{}
+
+
+Foam::orientedType::orientedType(Istream& is)
+:
+    oriented_(orientedOptionNames.read(is))
+{
+    is.check(FUNCTION_NAME);
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+Foam::orientedType::orientedOption& Foam::orientedType::oriented()
+{
+    return oriented_;
+}
+
+
+Foam::orientedType::orientedOption Foam::orientedType::oriented() const
+{
+    return oriented_;
+}
+
+
+void Foam::orientedType::setOriented(const bool oriented)
+{
+    oriented_ = oriented ? ORIENTED : UNORIENTED;
+}
+
+
+void Foam::orientedType::read(const dictionary& dict)
+{
+    if (dict.found("oriented"))
+    {
+        oriented_ = orientedOptionNames.read(dict.lookup("oriented"));
+    }
+    else
+    {
+        oriented_ = UNKNOWN;
+    }
+}
+
+
+void Foam::orientedType::writeEntry(Ostream& os) const
+{
+    if (oriented_ == ORIENTED)
+    {
+        os.writeEntry("oriented", orientedOptionNames[oriented_]);
+    }
+}
+
+
+// * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
+
+void Foam::orientedType::operator=(const orientedType& ot)
+{
+    // Oriented state is inherited on assignment
+    oriented_ = ot.oriented();
+}
+
+
+void Foam::orientedType::operator+=(const orientedType& ot)
+{
+    // Set the oriented status if it was unknown
+    if (oriented_ == UNKNOWN)
+    {
+        oriented_ = ot.oriented();
+    }
+
+    if (!checkType(*this, ot))
+    {
+        FatalErrorInFunction
+            << "Operator += is undefined for "
+            << orientedOptionNames[oriented_] << " and "
+            << orientedOptionNames[ot.oriented()] << " types"
+            << abort(FatalError);
+    }
+}
+
+
+void Foam::orientedType::operator-=(const orientedType& ot)
+{
+    // Set the oriented status if it was unknown
+    if (oriented_ == UNKNOWN)
+    {
+        oriented_ = ot.oriented();
+    }
+
+    if (!checkType(*this, ot))
+    {
+        FatalErrorInFunction
+            << "Operator -= is undefined for "
+            << orientedOptionNames[oriented_] << " and "
+            << orientedOptionNames[ot.oriented()] << " types"
+            << abort(FatalError);
+    }
+}
+
+
+void Foam::orientedType::operator*=(const orientedType& ot)
+{
+    const orientedType& ot1 = *this;
+    if (ot1() ^ ot())
+    {
+        oriented_ = ORIENTED;
+    }
+    else
+    {
+        oriented_ = UNORIENTED;
+    }
+}
+
+
+void Foam::orientedType::operator/=(const orientedType& ot)
+{
+    const orientedType& ot1 = *this;
+    if (ot1() ^ ot())
+    {
+        oriented_ = ORIENTED;
+    }
+    else
+    {
+        oriented_ = UNORIENTED;
+    }
+}
+
+
+void Foam::orientedType::operator*=(const scalar s)
+{
+    // No change to oriented_ flag
+}
+
+
+void Foam::orientedType::operator/=(const scalar s)
+{
+    // No change to oriented_ flag
+}
+
+
+bool Foam::orientedType::operator()() const
+{
+    return oriented_ == ORIENTED;
+}
+
+
+// * * * * * * * * * * * * * * * Friend Functions  * * * * * * * * * * * * * //
+
+Foam::orientedType Foam::max(const orientedType& ot1, const orientedType& ot2)
+{
+    if (!orientedType::checkType(ot1, ot2))
+    {
+        FatalErrorInFunction
+            << "Operator max is undefined for "
+            << orientedType::orientedOptionNames[ot1.oriented()] << " and "
+            << orientedType::orientedOptionNames[ot2.oriented()] << " types"
+            << abort(FatalError);
+    }
+
+    return ot1;
+}
+
+
+Foam::orientedType Foam::min(const orientedType& ot1, const orientedType& ot2)
+{
+    if (!orientedType::checkType(ot1, ot2))
+    {
+        FatalErrorInFunction
+            << "Operator min is undefined for "
+            << orientedType::orientedOptionNames[ot1.oriented()] << " and "
+            << orientedType::orientedOptionNames[ot2.oriented()] << "types"
+            << abort(FatalError);
+    }
+
+    return ot1;
+}
+
+
+Foam::orientedType Foam::cmptMultiply
+(
+    const orientedType& ot1,
+    const orientedType& ot2
+)
+{
+    return ot1 ^ ot2;
+}
+
+
+Foam::orientedType Foam::cmptDivide
+(
+    const orientedType& ot1,
+    const orientedType& ot2
+)
+{
+    return ot1 ^ ot2;
+}
+
+
+Foam::orientedType Foam::cmptAv(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType Foam::pow(const orientedType& ot, const scalar r)
+{
+    // Undefined???
+    // - only defined for integers where:
+    //   - odd powers = oriented_ = yes (if ot is oriented)
+    //   - even powers = oriented_ = no
+    return ot;
+}
+
+
+Foam::orientedType Foam::sqr(const orientedType& ot)
+{
+    return orientedType(false);
+}
+
+
+Foam::orientedType Foam::pow3(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType Foam::pow4(const orientedType& ot)
+{
+    return orientedType(false);
+}
+
+
+Foam::orientedType Foam::pow5(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType Foam::pow6(const orientedType& ot)
+{
+    return orientedType(false);
+}
+
+
+Foam::orientedType Foam::pow025(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType Foam::sqrt(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType Foam::cbrt(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType Foam::magSqr(const orientedType& ot)
+{
+    return orientedType(false);
+}
+
+
+Foam::orientedType  Foam::mag(const orientedType& ot)
+{
+    return orientedType(false);
+}
+
+
+Foam::orientedType  Foam::sign(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType  Foam::pos(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType  Foam::neg(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType  Foam::posPart(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType  Foam::negPart(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType  Foam::inv(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType Foam::trans(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType Foam::atan2
+(
+    const orientedType& ot1,
+    const orientedType& ot2
+)
+{
+    if (!orientedType::checkType(ot1, ot2))
+    {
+        FatalErrorInFunction
+            << "Operator atan2 is undefined for "
+            << orientedType::orientedOptionNames[ot1.oriented()] << " and "
+            << orientedType::orientedOptionNames[ot2.oriented()] << "types"
+            << abort(FatalError);
+    }
+
+    return ot1;
+}
+
+
+Foam::orientedType Foam::transform(const orientedType& ot)
+{
+    return ot;
+}
+
+
+// * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //
+
+Foam::Istream& Foam::operator>>(Istream& is, orientedType& ot)
+{
+    ot.oriented_ = orientedType::orientedOptionNames.read(is);
+
+    is.check(FUNCTION_NAME);
+
+    return is;
+}
+
+
+Foam::Ostream& Foam::operator<<(Ostream& os, const orientedType& ot)
+{
+    os << orientedType::orientedOptionNames[ot.oriented()];
+
+    os.check(FUNCTION_NAME);
+
+    return os;
+}
+
+
+// * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
+
+Foam::orientedType Foam::operator+
+(
+    const orientedType& ot1,
+    const orientedType& ot2
+)
+{
+    if (!orientedType::checkType(ot1, ot2))
+    {
+        FatalErrorInFunction
+            << "Operator + is undefined for "
+            << orientedType::orientedOptionNames[ot1.oriented()] << " and "
+            << orientedType::orientedOptionNames[ot2.oriented()] << " types"
+            << abort(FatalError);
+    }
+
+    // Note use of () operators to convert to boolean op
+    return orientedType(ot1() || ot2());
+}
+
+
+Foam::orientedType Foam::operator-(const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType Foam::operator-
+(
+    const orientedType& ot1,
+    const orientedType& ot2
+)
+{
+    if (!orientedType::checkType(ot1, ot2))
+    {
+        FatalErrorInFunction
+            << "Operator - is undefined for "
+            << orientedType::orientedOptionNames[ot1.oriented()] << " and "
+            << orientedType::orientedOptionNames[ot2.oriented()] << " types"
+            << abort(FatalError);
+    }
+
+    // Note use of () operators to convert to boolean op
+    return orientedType(ot1() || ot2());
+}
+
+
+Foam::orientedType Foam::operator*(const scalar s, const orientedType& ot)
+{
+    return ot;
+}
+
+
+Foam::orientedType Foam::operator/(const orientedType& ot, const scalar s)
+{
+    return ot;
+}
+
+
+Foam::orientedType Foam::operator/
+(
+    const orientedType& ot1,
+    const orientedType& ot2
+)
+{
+    return ot1 ^ ot2;
+}
+
+
+Foam::orientedType Foam::operator*
+(
+    const orientedType& ot1,
+    const orientedType& ot2
+)
+{
+    return ot1 ^ ot2;
+}
+
+
+Foam::orientedType Foam::operator^
+(
+    const orientedType& ot1,
+    const orientedType& ot2
+)
+{
+    // Note use of () operators to convert to boolean op
+    return orientedType(ot1() ^ ot2());
+}
+
+
+Foam::orientedType Foam::operator&
+(
+    const orientedType& ot1,
+    const orientedType& ot2
+)
+{
+    return ot1 ^ ot2;
+}
+
+
+Foam::orientedType Foam::operator&&
+(
+    const orientedType& ot1,
+    const orientedType& ot2
+)
+{
+    return orientedType(false);
+}
+
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/orientedType/orientedType.H b/src/OpenFOAM/orientedType/orientedType.H
new file mode 100644
index 0000000000000000000000000000000000000000..d050f71dcb5aaeb960f7e2a7b4658d55b04f1b0f
--- /dev/null
+++ b/src/OpenFOAM/orientedType/orientedType.H
@@ -0,0 +1,202 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2017 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 3 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, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::orientedType
+
+Description
+    Class to determine the 'oriented' status of surface fields
+
+SourceFiles
+    orientedType.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef orientedType_H
+#define orientedType_H
+
+#include "Istream.H"
+#include "Ostream.H"
+#include "dictionary.H"
+#include "NamedEnum.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of friend functions and operators
+
+class orientedType;
+
+Istream& operator>>(Istream&, orientedType&);
+
+Ostream& operator<<(Ostream&, const orientedType&);
+
+/*---------------------------------------------------------------------------*\
+                        Class orientedType Declaration
+\*---------------------------------------------------------------------------*/
+
+class orientedType
+{
+public:
+
+    // Public data types
+
+        //- Enumeration defining the valid oriented flags
+        enum orientedOption
+        {
+            ORIENTED,
+            UNORIENTED,
+            UNKNOWN
+        };
+
+        static const NamedEnum<orientedOption, 3> orientedOptionNames;
+
+
+private:
+
+    // Private data
+
+        //- Oriented flag
+        orientedOption oriented_;
+
+
+public:
+
+    // Constructors
+
+        //- Null constructor - flag initialised to false
+        orientedType();
+
+        //- Copy constructor
+        orientedType(const orientedType& ot);
+
+        //- Construct from bool
+        orientedType(const bool oriented);
+
+        //- Construct from Istream
+        orientedType(Istream& is);
+
+
+    // Member functions
+
+        //- Return true if can operate on this pair of oriented types
+        static bool checkType
+        (
+            const orientedType& ot1,
+            const orientedType& ot2
+        );
+
+        //- Return non-const reference to the oriented flag
+        orientedOption& oriented();
+
+        //- Return const reference to the oriented flag
+        orientedOption oriented() const;
+
+        //- Set the oriented flag
+        void setOriented(const bool oriented = true);
+
+        //- Read the oriented state from dictionary
+        void read(const dictionary& dict);
+
+        //- Write the oriented flag entry
+        void writeEntry(Ostream& os) const;
+
+
+    // Member operators
+
+        void operator=(const orientedType& ot);
+
+        void operator+=(const orientedType& ot);
+        void operator-=(const orientedType& ot);
+        void operator*=(const orientedType& ot);
+        void operator/=(const orientedType& ot);
+        void operator*=(const scalar s);
+        void operator/=(const scalar s);
+        bool operator()() const;
+
+
+    // IOstream operators
+
+        friend Istream& operator>>(Istream& is, orientedType& ot);
+
+        friend Ostream& operator<<(Ostream& os, const orientedType& ot);
+};
+
+
+// * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
+
+orientedType max(const orientedType& ot1, const orientedType& ot2);
+orientedType min(const orientedType& ot1, const orientedType& ot2);
+orientedType cmptMultiply(const orientedType& ot1, const orientedType& ot2);
+orientedType cmptDivide(const orientedType& ot1, const orientedType& ot);
+orientedType cmptAv(const orientedType& ot);
+
+
+orientedType pow(const orientedType& ot, const scalar r);
+orientedType sqr(const orientedType& ot);
+orientedType pow3(const orientedType& ot);
+orientedType pow4(const orientedType& ot);
+orientedType pow5(const orientedType& ot);
+orientedType pow6(const orientedType& ot);
+orientedType pow025(const orientedType& ot);
+
+
+orientedType sqrt(const orientedType& ot);
+orientedType cbrt(const orientedType& ot);
+orientedType magSqr(const orientedType& ot);
+orientedType mag(const orientedType& ot);
+orientedType sign(const orientedType& ot);
+orientedType pos(const orientedType& ot);
+orientedType neg(const orientedType& ot);
+orientedType posPart(const orientedType& ot);
+orientedType negPart(const orientedType& ot);
+orientedType inv(const orientedType& ot);
+
+
+orientedType trans(const orientedType& ot);
+orientedType atan2(const orientedType& ot1, const orientedType& ot2);
+orientedType transform(const orientedType& ot);
+
+orientedType operator-(const orientedType& ot);
+orientedType operator*(const scalar s, const orientedType& ot);
+orientedType operator/(const orientedType& ot, const scalar s);
+
+orientedType operator+(const orientedType& ot1, const orientedType& ot2);
+orientedType operator-(const orientedType& ot1, const orientedType& ot2);
+orientedType operator/(const orientedType& ot1, const orientedType& ot2);
+orientedType operator*(const orientedType& ot1, const orientedType& ot2);
+orientedType operator^(const orientedType& ot1, const orientedType& ot2);
+orientedType operator&(const orientedType& ot1, const orientedType& ot2);
+orientedType operator&&(const orientedType& ot1, const orientedType& ot2);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/Scalar/Scalar.C b/src/OpenFOAM/primitives/Scalar/Scalar.C
index a801378b2185b69ea7c06f4b172b7cd011005e10..941349cce66314793c405c09af1827db90a64c9e 100644
--- a/src/OpenFOAM/primitives/Scalar/Scalar.C
+++ b/src/OpenFOAM/primitives/Scalar/Scalar.C
@@ -111,9 +111,7 @@ Istream& operator>>(Istream& is, Scalar& s)
         return is;
     }
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, Scalar&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -121,7 +119,7 @@ Istream& operator>>(Istream& is, Scalar& s)
 Ostream& operator<<(Ostream& os, const Scalar s)
 {
     os.write(s);
-    os.check("Ostream& operator<<(Ostream&, const Scalar&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/Tuple2/Tuple2.H b/src/OpenFOAM/primitives/Tuple2/Tuple2.H
index c19b645ddf384b5730a7c222c494046799a8904a..bf911ebc56bfc42ca40e2fdc66e558a7d9fee582 100644
--- a/src/OpenFOAM/primitives/Tuple2/Tuple2.H
+++ b/src/OpenFOAM/primitives/Tuple2/Tuple2.H
@@ -234,9 +234,7 @@ inline Istream& operator>>(Istream& is, Tuple2<Type1, Type2>& t2)
     is >> t2.f_ >> t2.s_;
     is.readEnd("Tuple2");
 
-    // Check state of Istream
-    is.check("operator>>(Istream&, Tuple2<Type1, Type2>&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C
index baba05c6ec8bca3ca68944492e4ffd516088667b..27b68c50108d865d055c012c39161c922c75c718 100644
--- a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C
+++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C
@@ -48,7 +48,7 @@ Foam::VectorSpace<Form, Cmpt, Ncmpts>::VectorSpace
     is.readEnd("VectorSpace<Form, Cmpt, Ncmpts>");
 
     // Check state of Istream
-    is.check("VectorSpace<Form, Cmpt, Ncmpts>::VectorSpace(Istream&)");
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -94,7 +94,7 @@ Foam::Istream& Foam::operator>>
     is.readEnd("VectorSpace<Form, Cmpt, Ncmpts>");
 
     // Check state of Istream
-    is.check("operator>>(Istream&, VectorSpace<Form, Cmpt, Ncmpts>&)");
+    is.check(FUNCTION_NAME);
 
     return is;
 }
@@ -116,9 +116,7 @@ Foam::Ostream& Foam::operator<<
 
     os << token::END_LIST;
 
-    // Check state of Ostream
-    os.check("operator<<(Ostream&, const VectorSpace<Form, Cmpt, Ncmpts>&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/chars/char/charIO.C b/src/OpenFOAM/primitives/chars/char/charIO.C
index ca69b91e0598436f36db305ba408aa532fe0883c..583cd24b0cf1e8ae9ecd7fb7ca34de1ca5f86145 100644
--- a/src/OpenFOAM/primitives/chars/char/charIO.C
+++ b/src/OpenFOAM/primitives/chars/char/charIO.C
@@ -39,7 +39,7 @@ char Foam::readChar(Istream& is)
 Foam::Istream& Foam::operator>>(Istream& is, char& c)
 {
     is.read(c);
-    is.check("Istream& operator>>(Istream&, char&)");
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -47,7 +47,7 @@ Foam::Istream& Foam::operator>>(Istream& is, char& c)
 Foam::Ostream& Foam::operator<<(Ostream& os, const char c)
 {
     os.write(c);
-    os.check("Ostream& operator<<(Ostream&, const char)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
@@ -55,7 +55,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const char c)
 Foam::Ostream& Foam::operator<<(Ostream& os, const char* s)
 {
     os.write(s);
-    os.check("Ostream& operator<<(Ostream&, const char*)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/chars/wchar/wcharIO.C b/src/OpenFOAM/primitives/chars/wchar/wcharIO.C
index a7bf57cddf029101ddd8011e9cc76ac0e1f779cd..fc710a52dd38901c60cd106cf83f4831f8e5ae25 100644
--- a/src/OpenFOAM/primitives/chars/wchar/wcharIO.C
+++ b/src/OpenFOAM/primitives/chars/wchar/wcharIO.C
@@ -95,7 +95,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const wchar_t wc)
         os.write(char(0xBD));
     }
 
-    os.check("Ostream& operator<<(Ostream&, const wchar_t)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/complex/complex.C b/src/OpenFOAM/primitives/complex/complex.C
index 91f9a529eed9599ca98112775eee49752fe7b933..959659c76b59c0c247feff1023123edb2c273c33 100644
--- a/src/OpenFOAM/primitives/complex/complex.C
+++ b/src/OpenFOAM/primitives/complex/complex.C
@@ -64,9 +64,7 @@ Foam::Istream& Foam::operator>>(Istream& is, complex& c)
     // Read end of complex
     is.readEnd("complex");
 
-    // Check state of Istream
-    is.check("operator>>(Istream&, complex&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C
index bccc14d7f5ebfd51d17ae823d881ad60db63736b..c551c91271119e750fdc2ff37d4e77fade18e0e9 100644
--- a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C
+++ b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C
@@ -133,11 +133,7 @@ Foam::Ostream& Foam::operator<<
     const Function1<Type>& f1
 )
 {
-    // Check state of Ostream
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, const Function1<Type>&)"
-    );
+    os.check(FUNCTION_NAME);
 
     os  << f1.name_;
     f1.writeData(os);
diff --git a/src/OpenFOAM/primitives/functions/Polynomial/PolynomialIO.C b/src/OpenFOAM/primitives/functions/Polynomial/PolynomialIO.C
index 0b24c9578f822cbe3548757990d34fc1e0b3cd56..7af8e6e5b31023b1e8c423b76f4bae0f23fac4d9 100644
--- a/src/OpenFOAM/primitives/functions/Polynomial/PolynomialIO.C
+++ b/src/OpenFOAM/primitives/functions/Polynomial/PolynomialIO.C
@@ -37,12 +37,7 @@ Foam::Ostream& Foam::operator<<
     os  << static_cast
             <VectorSpace<Polynomial<PolySize>, scalar, PolySize>>(poly);
 
-    // Check state of Ostream
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, const Polynomial<PolySize>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.C b/src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.C
index e10d5a7c97a287cc95c406664e20f8b374b3d55e..c93c1d125644c1d898036827a066869c8f0f13fd 100644
--- a/src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.C
+++ b/src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.C
@@ -320,7 +320,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const polynomialFunction& poly)
 
 
     // Check state of Ostream
-    os.check("operator<<(Ostream&, const polynomialFunction&)");
+    os.check(FUNCTION_NAME);
 
     return os;
 }
diff --git a/src/OpenFOAM/primitives/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransform.C b/src/OpenFOAM/primitives/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransform.C
index b0b7df27ef45730922234b26b963eee5f51c24d7..488d6dc366210a90b5e7c6b53af81b08dc37fabd 100644
--- a/src/OpenFOAM/primitives/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransform.C
+++ b/src/OpenFOAM/primitives/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransform.C
@@ -107,7 +107,7 @@ Foam::Istream& Foam::operator>>(Istream& is, vectorTensorTransform& tr)
     is.readEnd("vectorTensorTransform");
 
     // Check state of Istream
-    is.check("operator>>(Istream&, vectorTensorTransform&)");
+    is.check(FUNCTION_NAME);
 
     return is;
 }
diff --git a/src/OpenFOAM/primitives/hashes/SHA1/SHA1Digest.C b/src/OpenFOAM/primitives/hashes/SHA1/SHA1Digest.C
index 478681b20496adb4356778ab3f3a1775bf5ab347..6fe25953b1ae2f03127f5246350c8bad07fb6a06 100644
--- a/src/OpenFOAM/primitives/hashes/SHA1/SHA1Digest.C
+++ b/src/OpenFOAM/primitives/hashes/SHA1/SHA1Digest.C
@@ -147,7 +147,7 @@ Foam::Ostream& Foam::SHA1Digest::write(Ostream& os, const bool prefixed) const
         os.write(hexChars[(v_[i] & 0xF)]);
     }
 
-    os.check("SHA1Digest::write(Ostream&, const bool)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
@@ -268,7 +268,7 @@ Foam::Istream& Foam::operator>>(Istream& is, SHA1Digest& dig)
         v[i] = (c1 << 4) + c2;
     }
 
-    is.check("Istream& operator>>(Istream&, SHA1Digest&)");
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OpenFOAM/primitives/ints/int32/int32IO.C b/src/OpenFOAM/primitives/ints/int32/int32IO.C
index c5023315f026dad37ec6e4e240a76b03abe1b872..1759f87daa508a2afb64445480dc65b8b74aef64 100644
--- a/src/OpenFOAM/primitives/ints/int32/int32IO.C
+++ b/src/OpenFOAM/primitives/ints/int32/int32IO.C
@@ -71,9 +71,7 @@ Foam::Istream& Foam::operator>>(Istream& is, int32_t& i)
         return is;
     }
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, int32_t&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -102,7 +100,7 @@ bool Foam::read(const char* buf, int32_t& s)
 Foam::Ostream& Foam::operator<<(Ostream& os, const int32_t i)
 {
     os.write(label(i));
-    os.check("Ostream& operator<<(Ostream&, const int32_t)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/ints/int64/int64IO.C b/src/OpenFOAM/primitives/ints/int64/int64IO.C
index 0523bb94cbbbac954481bc7890ef9463a9b82b03..fe6ce5f56896857a26f86e26199699eb778e46be 100644
--- a/src/OpenFOAM/primitives/ints/int64/int64IO.C
+++ b/src/OpenFOAM/primitives/ints/int64/int64IO.C
@@ -71,9 +71,7 @@ Foam::Istream& Foam::operator>>(Istream& is, int64_t& i)
         return is;
     }
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, int64_t&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -100,7 +98,7 @@ bool Foam::read(const char* buf, int64_t& s)
 Foam::Ostream& Foam::operator<<(Ostream& os, const int64_t i)
 {
     os.write(label(i));
-    os.check("Ostream& operator<<(Ostream&, const int64_t)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/ints/uint32/uint32IO.C b/src/OpenFOAM/primitives/ints/uint32/uint32IO.C
index f88f5b1ad86d403cd0568f3278ab8ac950c7c1ad..9c46c5d649c1fd1708722b4ee04417709d58456d 100644
--- a/src/OpenFOAM/primitives/ints/uint32/uint32IO.C
+++ b/src/OpenFOAM/primitives/ints/uint32/uint32IO.C
@@ -69,9 +69,7 @@ Foam::Istream& Foam::operator>>(Istream& is, uint32_t& i)
         return is;
     }
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, uint32_t&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -97,7 +95,7 @@ bool Foam::read(const char* buf, uint32_t& s)
 Foam::Ostream& Foam::operator<<(Ostream& os, const uint32_t i)
 {
     os.write(label(i));
-    os.check("Ostream& operator<<(Ostream&, const uint32_t)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/ints/uint64/uint64IO.C b/src/OpenFOAM/primitives/ints/uint64/uint64IO.C
index 3e110d933a63e19d401bbf77d136aa5f2c49d9ee..02e8d2284dee9935c2d0a0aebf68a7677c99ae5f 100644
--- a/src/OpenFOAM/primitives/ints/uint64/uint64IO.C
+++ b/src/OpenFOAM/primitives/ints/uint64/uint64IO.C
@@ -69,9 +69,7 @@ Foam::Istream& Foam::operator>>(Istream& is, uint64_t& i)
         return is;
     }
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, uint64_t&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -97,7 +95,7 @@ bool Foam::read(const char* buf, uint64_t& s)
 Foam::Ostream& Foam::operator<<(Ostream& os, const uint64_t i)
 {
     os.write(label(i));
-    os.check("Ostream& operator<<(Ostream&, const uint64_t)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/predicates/predicates.H b/src/OpenFOAM/primitives/predicates/predicates.H
index 8731fb451899bfc348202d340d0c9d71a608c006..e751c7e957f662c98f2d643d6559985c3aa206f0 100644
--- a/src/OpenFOAM/primitives/predicates/predicates.H
+++ b/src/OpenFOAM/primitives/predicates/predicates.H
@@ -59,7 +59,7 @@ public:
     inline always()
     {}
 
-    //- Evalulated as a bool - return true
+    //- Evaluated as a bool - return true
     inline operator bool() const
     {
         return true;
@@ -79,8 +79,8 @@ public:
         return true;
     }
 
-    //- String matching returning true
-    inline bool match(const std::string& unused, bool literal=false) const
+    //- String match returning true
+    inline bool match(const std::string&, bool literal=false) const
     {
         return true;
     }
@@ -101,7 +101,7 @@ public:
     inline never()
     {}
 
-    //- Evalulated as a bool - return false
+    //- Evaluated as a bool - return false
     inline operator bool() const
     {
         return false;
@@ -121,8 +121,8 @@ public:
         return false;
     }
 
-    //- String matching returning false
-    inline bool match(const std::string& unused, bool literal=false) const
+    //- String match returning false
+    inline bool match(const std::string&, bool literal=false) const
     {
         return false;
     }
diff --git a/src/OpenFOAM/primitives/quaternion/quaternion.C b/src/OpenFOAM/primitives/quaternion/quaternion.C
index fa509113e0ae7dbc0d1fc2b9ebf6dbfbe6057975..18cfda5a60e8103bf2409d1b229176c6e5670cc8 100644
--- a/src/OpenFOAM/primitives/quaternion/quaternion.C
+++ b/src/OpenFOAM/primitives/quaternion/quaternion.C
@@ -159,9 +159,7 @@ Foam::Istream& Foam::operator>>(Istream& is, quaternion& q)
     // Read end of quaternion
     is.readEnd("quaternion");
 
-    // Check state of Istream
-    is.check("operator>>(Istream&, quaternion&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OpenFOAM/primitives/ranges/labelRange/labelRange.C b/src/OpenFOAM/primitives/ranges/labelRange/labelRange.C
index 38349e92b2f0892a9ea65e85d7ecf097666b9a29..b0715f8b403190930a42f45ff5228df427dcb9b2 100644
--- a/src/OpenFOAM/primitives/ranges/labelRange/labelRange.C
+++ b/src/OpenFOAM/primitives/ranges/labelRange/labelRange.C
@@ -185,7 +185,7 @@ Foam::Istream& Foam::operator>>(Istream& is, labelRange& range)
     is  >> range.start_ >> range.size_;
     is.readEnd("labelRange");
 
-    is.check("operator>>(Istream&, labelRange&)");
+    is.check(FUNCTION_NAME);
 
     // Disallow invalid sizes
     if (range.size_ < 0)
@@ -204,7 +204,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const labelRange& range)
         << range.start() << token::SPACE << range.size()
         << token::END_LIST;
 
-    os.check("operator<<(Ostream&, const labelRange&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/septernion/septernion.C b/src/OpenFOAM/primitives/septernion/septernion.C
index 33cdf44c7c5ed4e3de8f6080ef26c12878e0c9ba..6e786ce7a09dc6197c2bf2c3c8080ca05e717f94 100644
--- a/src/OpenFOAM/primitives/septernion/septernion.C
+++ b/src/OpenFOAM/primitives/septernion/septernion.C
@@ -111,9 +111,7 @@ Foam::Istream& Foam::operator>>(Istream& is, septernion& s)
     // Read end of septernion
     is.readEnd("septernion");
 
-    // Check state of Istream
-    is.check("operator>>(Istream&, septernion&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.C b/src/OpenFOAM/primitives/strings/fileName/fileName.C
index 258167fc1e0d29464d478221a536f56cf8ce4c3a..87ddec68b7c3c1cdab8df0fa3462ff721ad7c661 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileName.C
+++ b/src/OpenFOAM/primitives/strings/fileName/fileName.C
@@ -41,15 +41,15 @@ const Foam::fileName Foam::fileName::null;
 Foam::fileName::fileName(const UList<word>& lst)
 {
     // Estimate overall size
-    size_type sz = lst.size();
-    for (const word& item : lst)
+    size_type sz = lst.size();  // Approx number of '/' needed
+    for (const auto& item : lst)
     {
         sz += item.size();
     }
     reserve(sz);
 
     sz = 0;
-    for (const word& item : lst)
+    for (const auto& item : lst)
     {
         if (item.size())
         {
@@ -63,15 +63,15 @@ Foam::fileName::fileName(const UList<word>& lst)
 Foam::fileName::fileName(std::initializer_list<word> lst)
 {
     // Estimate overall size
-    size_type sz = lst.size();
-    for (const word& item : lst)
+    size_type sz = lst.size();  // Approx number of '/' needed
+    for (const auto& item : lst)
     {
         sz += item.size();
     }
     reserve(sz);
 
     sz = 0;
-    for (const word& item : lst)
+    for (const auto& item : lst)
     {
         if (item.size())
         {
@@ -90,12 +90,6 @@ Foam::fileName::Type Foam::fileName::type(const bool followLink) const
 }
 
 
-bool Foam::fileName::isAbsolute() const
-{
-    return !empty() && operator[](0) == '/';
-}
-
-
 Foam::fileName& Foam::fileName::toAbsolute()
 {
     fileName& f = *this;
@@ -294,81 +288,26 @@ Foam::fileName Foam::fileName::lessExt() const
 
 Foam::word Foam::fileName::ext() const
 {
-    const size_type i = find_ext();
-
-    if (i == npos)
-    {
-        return word::null;
-    }
-    else
-    {
-        return substr(i+1, npos);
-    }
+    return string::ext();
 }
 
 
 Foam::fileName& Foam::fileName::ext(const word& ending)
 {
-    if (!ending.empty() && !empty() && operator[](size()-1) != '/')
-    {
-        append(".");
-        append(ending);
-    }
-
+    string::ext(ending);
     return *this;
 }
 
 
-bool Foam::fileName::hasExt() const
-{
-    return (find_ext() != npos);
-}
-
-
 bool Foam::fileName::hasExt(const word& ending) const
 {
-    size_type i = find_ext();
-    if (i == npos)
-    {
-        return false;
-    }
-
-    ++i; // Do next comparison *after* the dot
-    return
-    (
-        // Lengths must match
-        ((size() - i) == ending.size())
-     && !compare(i, npos, ending)
-    );
+    return string::hasExt(ending);
 }
 
 
 bool Foam::fileName::hasExt(const wordRe& ending) const
 {
-    const size_type i = find_ext();
-    if (i == npos)
-    {
-        return false;
-    }
-
-    std::string end = substr(i+1, npos);
-    return ending.match(end);
-}
-
-
-bool Foam::fileName::removeExt()
-{
-    const size_type i = find_ext();
-
-    if (i == npos)
-    {
-        return false;
-    }
-    else
-    {
-        this->resize(i);
-        return true;
-    }
+    return string::hasExt(ending);
 }
 
 
@@ -444,7 +383,7 @@ void Foam::fileName::operator=(const char* str)
 }
 
 
-// * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
 Foam::fileName Foam::operator/(const string& a, const string& b)
 {
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.H b/src/OpenFOAM/primitives/strings/fileName/fileName.H
index a8f17cf6b0414e989100d2faef12a01c743bd63e..19cd295120f4a066f73c28ba22af9824b8ad4f77 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileName.H
+++ b/src/OpenFOAM/primitives/strings/fileName/fileName.H
@@ -74,10 +74,6 @@ class fileName
 {
     // Private Member Functions
 
-        //- Find position of the file extension dot, return npos on failure.
-        //  A wrapped version of find_last_of("./") with additional logic.
-        inline size_type find_ext() const;
-
         //- Strip invalid characters
         inline void stripInvalid();
 
@@ -154,6 +150,7 @@ public:
         //
         // * Removes trailing '/'
         //
+        // \return True if any contents changed
         bool clean();
 
         //- Cleanup file name
@@ -167,8 +164,8 @@ public:
         //  LINK (only if followLink=false)
         Type type(const bool followLink = true) const;
 
-        //- Return true if file name is absolute
-        bool isAbsolute() const;
+        //- Return true if file name is absolute (starts with a '/')
+        inline bool isAbsolute() const;
 
         //- Convert from relative to absolute
         fileName& toAbsolute();
@@ -194,8 +191,8 @@ public:
         word nameLessExt() const;
 
         //- Return basename, optionally without extension
-        // \deprecated in favour of name() or nameLessExt() which more
-        //  explicitly describe their behaviour (MAR-2017).
+        // \deprecated in favour of name() or nameLessExt() which describe
+        //  their behaviour more explicitly (MAR-2017).
         word name(const bool noExt) const
         {
             return noExt ? this->nameLessExt() : this->name();
@@ -227,7 +224,7 @@ public:
         fileName& ext(const word& ending);
 
         //- Return true if it has an extension or simply ends with a '.'
-        bool hasExt() const;
+        inline bool hasExt() const;
 
         //- Return true if the extension is the same as the given ending.
         bool hasExt(const word& ending) const;
@@ -236,7 +233,7 @@ public:
         bool hasExt(const wordRe& ending) const;
 
         //- Remove extension, returning true if string changed.
-        bool removeExt();
+        inline bool removeExt();
 
 
         //- Return path components as wordList
@@ -288,6 +285,8 @@ public:
 };
 
 
+// Global Operators
+
 //- Assemble words and fileNames as pathnames by adding a '/' separator.
 //  No '/' separator is added if either argument is an empty string.
 fileName operator/(const string& a, const string& b);
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileNameI.H b/src/OpenFOAM/primitives/strings/fileName/fileNameI.H
index e2055f74746685b214aa0b9fe605543eebc7015f..b1199263056a8ca5b1fca44bdc93af252bcf6cbf 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileNameI.H
+++ b/src/OpenFOAM/primitives/strings/fileName/fileNameI.H
@@ -25,21 +25,6 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-inline std::string::size_type Foam::fileName::find_ext() const
-{
-    const size_type i = find_last_of("./");
-
-    if (i == npos || i == 0 || operator[](i) == '/')
-    {
-        return npos;
-    }
-    else
-    {
-        return i;
-    }
-}
-
-
 inline void Foam::fileName::stripInvalid()
 {
     // skip stripping unless debug is active to avoid
@@ -130,4 +115,22 @@ inline bool Foam::fileName::valid(char c)
 }
 
 
+inline bool Foam::fileName::isAbsolute() const
+{
+    return !empty() && operator[](0) == '/';
+}
+
+
+inline bool Foam::fileName::hasExt() const
+{
+    return string::hasExt();
+}
+
+
+inline bool Foam::fileName::removeExt()
+{
+    return string::removeExt();
+}
+
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileNameIO.C b/src/OpenFOAM/primitives/strings/fileName/fileNameIO.C
index 3e193ecf99fad15cfa1b9c544833d5d5e68cc099..42ab4f6936a947a1a8ab42d3ada616ab650c7e46 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileNameIO.C
+++ b/src/OpenFOAM/primitives/strings/fileName/fileNameIO.C
@@ -62,9 +62,7 @@ Foam::Istream& Foam::operator>>(Istream& is, fileName& fn)
 
     fn.stripInvalid();
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, fileName&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -72,7 +70,7 @@ Foam::Istream& Foam::operator>>(Istream& is, fileName& fn)
 Foam::Ostream& Foam::operator<<(Ostream& os, const fileName& fn)
 {
     os.write(fn);
-    os.check("Ostream& operator<<(Ostream&, const fileName&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/strings/keyType/keyType.C b/src/OpenFOAM/primitives/strings/keyType/keyType.C
index 05f54c255455d1b4aec02782cb118c75a9ce3225..e9b120e8e9720602c4d2fd027f4ec42b8cc96852 100644
--- a/src/OpenFOAM/primitives/strings/keyType/keyType.C
+++ b/src/OpenFOAM/primitives/strings/keyType/keyType.C
@@ -104,9 +104,7 @@ Foam::Istream& Foam::operator>>(Istream& is, keyType& kw)
         return is;
     }
 
-    // Check state of IOstream
-    is.check("Istream& operator>>(Istream&, keyType&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -114,7 +112,7 @@ Foam::Istream& Foam::operator>>(Istream& is, keyType& kw)
 Foam::Ostream& Foam::operator<<(Ostream& os, const keyType& kw)
 {
     os.write(kw);
-    os.check("Ostream& operator<<(Ostream&, const keyType&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/strings/string/string.C b/src/OpenFOAM/primitives/strings/string/string.C
index 5f03edeba1c97c0168e8cb149e4b31d3c9582906..dff562641182c6ed17f01b3d1836560df23cc230 100644
--- a/src/OpenFOAM/primitives/strings/string/string.C
+++ b/src/OpenFOAM/primitives/strings/string/string.C
@@ -25,6 +25,8 @@ License
 
 #include "string.H"
 #include "stringOps.H"
+#include "word.H"
+#include "wordRe.H"
 
 /* * * * * * * * * * * * * * * Static Member Data  * * * * * * * * * * * * * */
 
@@ -33,13 +35,75 @@ int Foam::string::debug(Foam::debug::debugSwitch(string::typeName, 0));
 const Foam::string Foam::string::null;
 
 
+// * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
+
+Foam::word Foam::string::ext() const
+{
+    const size_type i = find_ext();
+
+    if (i == npos)
+    {
+        return word::null;
+    }
+    else
+    {
+        return substr(i+1, npos);
+    }
+}
+
+
+bool Foam::string::ext(const Foam::word& ending)
+{
+    if (!ending.empty() && !empty() && operator[](size()-1) != '/')
+    {
+        append(1u, '.');
+        append(ending);
+
+        return true;
+    }
+
+    return false;
+}
+
+
+bool Foam::string::hasExt(const word& ending) const
+{
+    size_type i = find_ext();
+    if (i == npos)
+    {
+        return false;
+    }
+
+    ++i; // Compare *after* the dot
+    return
+    (
+        // Lengths must match
+        ((size() - i) == ending.size())
+     && !compare(i, npos, ending)
+    );
+}
+
+
+bool Foam::string::hasExt(const wordRe& ending) const
+{
+    const size_type i = find_ext();
+    if (i == npos)
+    {
+        return false;
+    }
+
+    const std::string end = substr(i+1, npos);  // Compare *after* the dot
+    return ending.match(end);
+}
+
+
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 Foam::string::size_type Foam::string::count(const char c) const
 {
     size_type cCount = 0;
 
-    for (const_iterator iter = begin(); iter != end(); ++iter)
+    for (const_iterator iter = cbegin(); iter != cend(); ++iter)
     {
         if (*iter == c)
         {
diff --git a/src/OpenFOAM/primitives/strings/string/string.H b/src/OpenFOAM/primitives/strings/string/string.H
index 87cb00104b2f507b787cd71e0d6a48006838fb0e..e624a68456709d7149fef7501215fe1e4d8a04d7 100644
--- a/src/OpenFOAM/primitives/strings/string/string.H
+++ b/src/OpenFOAM/primitives/strings/string/string.H
@@ -58,6 +58,8 @@ namespace Foam
 {
 
 // Forward declaration of classes
+class word;
+class wordRe;
 class Istream;
 class Ostream;
 
@@ -76,6 +78,37 @@ class string
 :
     public std::string
 {
+protected:
+
+    // Protected Member Functions
+
+        //- Find position of a file extension dot, return npos on failure.
+        //  A wrapped version of find_last_of("./") with additional logic.
+        inline size_type find_ext() const;
+
+        //- Return file name extension (part after last .)
+        word ext() const;
+
+        //- Append a '.' and the ending.
+        //  The '.' and ending will not be added when the ending is empty,
+        //  or when the object was or ended with a '/'.
+        //
+        //  \return True if append occurred.
+        bool ext(const word& ending);
+
+        //- Return true if it has an extension or simply ends with a '.'
+        inline bool hasExt() const;
+
+        //- Return true if the extension is the same as the given ending.
+        bool hasExt(const word& ending) const;
+
+        //- Return true if the extension matches the given ending.
+        bool hasExt(const wordRe& ending) const;
+
+        //- Remove extension, returning true if string changed.
+        inline bool removeExt();
+
+
 public:
 
     // Static data members
diff --git a/src/OpenFOAM/primitives/strings/string/stringI.H b/src/OpenFOAM/primitives/strings/string/stringI.H
index b23a71b2d53e0c7d52c23be2895f09b5eb8a7ac8..bae33b3342f081d77271b2a9bb74156cd19f05bf 100644
--- a/src/OpenFOAM/primitives/strings/string/stringI.H
+++ b/src/OpenFOAM/primitives/strings/string/stringI.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -25,6 +25,45 @@ License
 
 #include <iostream>
 
+// * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
+
+inline std::string::size_type Foam::string::find_ext() const
+{
+    const size_type i = find_last_of("./");
+
+    if (i == npos || i == 0 || operator[](i) == '/')
+    {
+        return npos;
+    }
+    else
+    {
+        return i;
+    }
+}
+
+
+inline bool Foam::string::hasExt() const
+{
+    return (find_ext() != npos);
+}
+
+
+inline bool Foam::string::removeExt()
+{
+    const size_type i = find_ext();
+
+    if (i == npos)
+    {
+        return false;
+    }
+    else
+    {
+        this->resize(i);
+        return true;
+    }
+}
+
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 inline Foam::string::string()
diff --git a/src/OpenFOAM/primitives/strings/string/stringIO.C b/src/OpenFOAM/primitives/strings/string/stringIO.C
index 954290fff7b2a19bb66705951bc1494e547eb42d..53c728b548c07d37fdf7d94f48051949f04d3ffd 100644
--- a/src/OpenFOAM/primitives/strings/string/stringIO.C
+++ b/src/OpenFOAM/primitives/strings/string/stringIO.C
@@ -60,9 +60,7 @@ Foam::Istream& Foam::operator>>(Istream& is, string& s)
         return is;
     }
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, string&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -70,7 +68,7 @@ Foam::Istream& Foam::operator>>(Istream& is, string& s)
 Foam::Ostream& Foam::operator<<(Ostream& os, const string& s)
 {
     os.write(s);
-    os.check("Ostream& operator<<(Ostream&, const string&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
@@ -78,7 +76,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const string& s)
 Foam::Ostream& Foam::operator<<(Ostream& os, const std::string& s)
 {
     os.write(string(s));
-    os.check("Ostream& operator<<(Ostream&, const std::string&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/strings/word/word.C b/src/OpenFOAM/primitives/strings/word/word.C
index bbd4050a338a486438ae9cb628311710c8e63e72..2f418d721d2540ebb798ad0d2033bf412f294b8c 100644
--- a/src/OpenFOAM/primitives/strings/word/word.C
+++ b/src/OpenFOAM/primitives/strings/word/word.C
@@ -91,4 +91,46 @@ Foam::word Foam::word::validated(const std::string& s)
 }
 
 
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+Foam::word Foam::word::lessExt() const
+{
+    const size_type i = find_ext();
+
+    if (i == npos)
+    {
+        return *this;
+    }
+    else
+    {
+        return substr(0, i);
+    }
+}
+
+
+Foam::word Foam::word::ext() const
+{
+    return string::ext();
+}
+
+
+Foam::word& Foam::word::ext(const word& ending)
+{
+    string::ext(ending);
+    return *this;
+}
+
+
+bool Foam::word::hasExt(const word& ending) const
+{
+    return string::hasExt(ending);
+}
+
+
+bool Foam::word::hasExt(const wordRe& ending) const
+{
+    return string::hasExt(ending);
+}
+
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/word/word.H b/src/OpenFOAM/primitives/strings/word/word.H
index 4561292ab9076b66cf60c377b00df8ccf4dbd8a8..ebff4c523509b848e6306c4ce87ee8f0968fcfc5 100644
--- a/src/OpenFOAM/primitives/strings/word/word.H
+++ b/src/OpenFOAM/primitives/strings/word/word.H
@@ -117,13 +117,46 @@ public:
         static word validated(const std::string& s);
 
 
+      // File-like functions
+
+        //- Return word without extension (part before last .)
+        word lessExt() const;
+
+        //- Return file name extension (part after last .)
+        word ext() const;
+
+        //- Append a '.' and the ending, and return the object.
+        //  The '.' and ending will not be added when the ending is empty,
+        //  or when the file name is empty or ended with a '/'.
+        word& ext(const word& ending);
+
+        //- Return true if it has an extension or simply ends with a '.'
+        inline bool hasExt() const;
+
+        //- Return true if the extension is the same as the given ending.
+        bool hasExt(const word& ending) const;
+
+        //- Return true if the extension matches the given ending.
+        bool hasExt(const wordRe& ending) const;
+
+        //- Remove extension, returning true if string changed.
+        inline bool removeExt();
+
+
     // Member operators
 
       // Assignment
 
+        //- Copy, no character validation required
         inline void operator=(const word& w);
+
+        //- Copy, stripping invalid characters
         inline void operator=(const string& s);
+
+        //- Copy, stripping invalid characters
         inline void operator=(const std::string& s);
+
+        //- Copy, stripping invalid characters
         inline void operator=(const char* s);
 
 
diff --git a/src/OpenFOAM/primitives/strings/word/wordI.H b/src/OpenFOAM/primitives/strings/word/wordI.H
index 4c6c800b118ac279d5a348088a1fc4c9392ca996..eb170970143a7aa2771d7c69c77eddbf36018c6f 100644
--- a/src/OpenFOAM/primitives/strings/word/wordI.H
+++ b/src/OpenFOAM/primitives/strings/word/wordI.H
@@ -127,6 +127,18 @@ inline bool Foam::word::valid(char c)
 }
 
 
+inline bool Foam::word::hasExt() const
+{
+    return string::hasExt();
+}
+
+
+inline bool Foam::word::removeExt()
+{
+    return string::removeExt();
+}
+
+
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
 inline void Foam::word::operator=(const word& w)
diff --git a/src/OpenFOAM/primitives/strings/word/wordIO.C b/src/OpenFOAM/primitives/strings/word/wordIO.C
index 19221fa2b7f8c9f28e615a222cb40642d450f73e..476dde86fa4c264f72d1734a70f1e46b25c68746 100644
--- a/src/OpenFOAM/primitives/strings/word/wordIO.C
+++ b/src/OpenFOAM/primitives/strings/word/wordIO.C
@@ -79,9 +79,7 @@ Foam::Istream& Foam::operator>>(Istream& is, word& w)
         return is;
     }
 
-    // Check state of IOstream
-    is.check("Istream& operator>>(Istream&, word&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -89,7 +87,7 @@ Foam::Istream& Foam::operator>>(Istream& is, word& w)
 Foam::Ostream& Foam::operator<<(Ostream& os, const word& w)
 {
     os.write(w);
-    os.check("Ostream& operator<<(Ostream&, const word&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordRe.C b/src/OpenFOAM/primitives/strings/wordRe/wordRe.C
index d7725323ca7ed787902cfc3cebd5c744c67060a3..cbee07ee734976148c6ac465b99bbf8f728d3d5d 100644
--- a/src/OpenFOAM/primitives/strings/wordRe/wordRe.C
+++ b/src/OpenFOAM/primitives/strings/wordRe/wordRe.C
@@ -85,9 +85,7 @@ Foam::Istream& Foam::operator>>(Istream& is, wordRe& w)
         return is;
     }
 
-    // Check state of IOstream
-    is.check("Istream& operator>>(Istream&, wordRe&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -95,7 +93,7 @@ Foam::Istream& Foam::operator>>(Istream& is, wordRe& w)
 Foam::Ostream& Foam::operator<<(Ostream& os, const wordRe& w)
 {
     os.writeQuoted(w, w.isPattern());
-    os.check("Ostream& operator<<(Ostream&, const wordRe&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H
index ede0a7a047ea7714941da7ef2aae17e7ddd1d789..4df4325efda64be0beb6e2ba74d759ee323ef53a 100644
--- a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H
+++ b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H
@@ -25,8 +25,8 @@ Class
     Foam::wordRe
 
 Description
-    A wordRe is a word, but can also have a regular expression for matching
-    words.
+    A wordRe is a Foam::word, but can contain a regular expression for
+    matching words or strings.
 
     By default the constructors will generally preserve the argument as a
     string literal and the assignment operators will use the wordRe::DETECT
diff --git a/src/OpenFOAM/primitives/strings/wordRes/wordRes.C b/src/OpenFOAM/primitives/strings/wordRes/wordRes.C
index 3f53f6492ff3a0b8909add61b50f5911cec516a5..618c47932c46f591068930fe430afb04e5e626bb 100644
--- a/src/OpenFOAM/primitives/strings/wordRes/wordRes.C
+++ b/src/OpenFOAM/primitives/strings/wordRes/wordRes.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2016-2017 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -36,15 +36,12 @@ Foam::wordReList Foam::wordRes::uniq(const UList<wordRe>& input)
     label count = 0;
     forAll(input, i)
     {
-        const wordRe& select = input[i];
+        const auto& select = input[i];
 
-        if
-        (
-            select.isPattern()
-         || uniqWord.insert(static_cast<const word&>(select))
-        )
+        if (select.isPattern() || uniqWord.insert(select))
         {
-            retain[count++] = select;
+            retain[count] = select;
+            ++count;
         }
     }
 
@@ -53,4 +50,27 @@ Foam::wordReList Foam::wordRes::uniq(const UList<wordRe>& input)
 }
 
 
+void Foam::wordRes::inplaceUniq(wordReList& input)
+{
+    wordHashSet uniqWord;
+
+    label count = 0;
+    forAll(input, i)
+    {
+        const auto& select = input[i];
+
+        if (select.isPattern() || uniqWord.insert(select))
+        {
+            if (count != i)
+            {
+                input[count] = input[i];
+            }
+            ++count;
+        }
+    }
+
+    input.setSize(count);
+}
+
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/wordRes/wordRes.H b/src/OpenFOAM/primitives/strings/wordRes/wordRes.H
index 5cfe6b9b5758ca341ce4db9b96cd5d16b241700e..00ca657fe80b2c5656a3f3a5f1c810dd71fbcb3c 100644
--- a/src/OpenFOAM/primitives/strings/wordRes/wordRes.H
+++ b/src/OpenFOAM/primitives/strings/wordRes/wordRes.H
@@ -78,6 +78,10 @@ public:
         //  No filtering is done on regular expressions.
         static wordReList uniq(const UList<wordRe>& input);
 
+        //- Inplace subset of wordReList with duplicate words filtered out.
+        //  No filtering is done on regular expressions.
+        static void inplaceUniq(wordReList& input);
+
 
     // Member Functions
 
diff --git a/src/dynamicMesh/boundaryPatch/boundaryPatch.C b/src/dynamicMesh/boundaryPatch/boundaryPatch.C
index b405ad517df3a3622d3bbb08bee19fa11f3ab6ea..fe2f9796e4ce679facb71467d8e5d3d323225cd2 100644
--- a/src/dynamicMesh/boundaryPatch/boundaryPatch.C
+++ b/src/dynamicMesh/boundaryPatch/boundaryPatch.C
@@ -100,7 +100,7 @@ void Foam::boundaryPatch::write(Ostream& os) const
 Foam::Ostream& Foam::operator<<(Ostream& os, const boundaryPatch& p)
 {
     p.write(os);
-    os.check("Ostream& operator<<(Ostream& f, const boundaryPatch&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C
index 86a9617750af5326ad4955c145ffa8137d45068d..e03840aaa531ea6e7a07fe26c019c806989145a7 100644
--- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C
+++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2015-2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -205,6 +205,8 @@ void Foam::fvMeshDistribute::mapExposedFaces
     forAllIter(typename HashTable<fldType*>, flds, iter)
     {
         fldType& fld = *iter();
+        const bool oriented = fld.oriented()();
+
         typename fldType::Boundary& bfld = fld.boundaryFieldRef();
 
         const Field<T>& oldInternal = oldFlds[fieldI++];
@@ -225,7 +227,7 @@ void Foam::fvMeshDistribute::mapExposedFaces
                 {
                     patchFld[i] = oldInternal[oldFaceI];
 
-                    if (map.flipFaceFlux().found(faceI))
+                    if (oriented && map.flipFaceFlux().found(faceI))
                     {
                         patchFld[i] = flipOp()(patchFld[i]);
                     }
diff --git a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H
index 7d9c453b5e3a58f75bec2f02a069158855d32318..3f057d2d574a6ae46fedf8cff309ebeebe4eef65 100644
--- a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H
+++ b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H
@@ -283,16 +283,14 @@ public:
                 const fvMesh& sMesh,
                 const labelList& patchMap,
                 const labelList& cellMap,
-                const labelList& faceMap,
-                const bool negateIfFlipped = true
+                const labelList& faceMap
             );
 
             template<class Type>
             tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
             interpolate
             (
-                const GeometricField<Type, fvsPatchField, surfaceMesh>&,
-                const bool negateIfFlipped = true
+                const GeometricField<Type, fvsPatchField, surfaceMesh>&
             ) const;
 
             //- Map point field
diff --git a/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C b/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C
index 7a0192ee06c9c5862ae8d94b4e75f3ff1278b5ef..228b7df26da3e7ad51f3366f50e8d39f07bcdf18 100644
--- a/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C
+++ b/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C
@@ -102,6 +102,7 @@ tmp<GeometricField<Type, fvPatchField, volMesh>> fvMeshSubset::interpolate
         )
     );
     GeometricField<Type, fvPatchField, volMesh>& resF = tresF.ref();
+    resF.oriented() = vf.oriented();
 
 
     // 2. Change the fvPatchFields to the correct type using a mapper
@@ -180,8 +181,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
     const fvMesh& sMesh,
     const labelList& patchMap,
     const labelList& cellMap,
-    const labelList& faceMap,
-    const bool negateIfFlipped
+    const labelList& faceMap
 )
 {
     // 1. Create the complete field with dummy patch fields
@@ -247,6 +247,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
         )
     );
     GeometricField<Type, fvsPatchField, surfaceMesh>& resF = tresF.ref();
+    resF.oriented() = vf.oriented();
 
 
     // 2. Change the fvsPatchFields to the correct type using a mapper
@@ -310,7 +311,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
                 {
                     Type val = vf.internalField()[baseFacei];
 
-                    if (cellMap[fc[i]] == own[baseFacei] || !negateIfFlipped)
+                    if (cellMap[fc[i]] == own[baseFacei] || !vf.oriented()())
                     {
                         pfld[i] = val;
                     }
@@ -342,8 +343,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
 template<class Type>
 tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
 (
-    const GeometricField<Type, fvsPatchField, surfaceMesh>& sf,
-    const bool negateIfFlipped
+    const GeometricField<Type, fvsPatchField, surfaceMesh>& sf
 ) const
 {
     return interpolate
@@ -352,8 +352,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
         subMesh(),
         patchMap(),
         cellMap(),
-        faceMap(),
-        negateIfFlipped
+        faceMap()
     );
 }
 
@@ -423,6 +422,7 @@ fvMeshSubset::interpolate
         )
     );
     GeometricField<Type, pointPatchField, pointMesh>& resF = tresF.ref();
+    resF.oriented() = vf.oriented();
 
 
     // 2. Change the pointPatchFields to the correct type using a mapper
@@ -532,6 +532,8 @@ tmp<DimensionedField<Type, volMesh>> fvMeshSubset::interpolate
         )
     );
 
+    tresF.ref().oriented() = df.oriented();
+
     return tresF;
 }
 
diff --git a/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.C b/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.C
index 912132391a6b1343bf7bb2c4ada37ce6d3692a93..3ef151d7396ad4fabe4c441a0eadb18f9c1f99ef 100644
--- a/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.C
+++ b/src/dynamicMesh/meshCut/directions/directionInfo/directionInfo.C
@@ -218,10 +218,8 @@ Foam::Ostream& Foam::operator<<
         );
     }
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const directionInfo&)");
+    os.check(FUNCTION_NAME);
     return os;
-
 }
 
 
@@ -240,8 +238,7 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::directionInfo& wDist)
         );
     }
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, directionInfo&)");
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfo.C b/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfo.C
index 819ebc99e00fff66ce087e622470084d78aeeb2f..9776a08cf7101599fb356450e4e186cad39b02e9 100644
--- a/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfo.C
+++ b/src/dynamicMesh/meshCut/wallLayerCells/wallNormalInfo/wallNormalInfo.C
@@ -46,11 +46,11 @@ Foam::Ostream& Foam::operator<<
         );
     }
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const wallNormalInfo&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
+
 Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::wallNormalInfo& wDist)
 {
     if (is.format() == IOstream::ASCII)
@@ -66,9 +66,9 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::wallNormalInfo& wDist)
         );
     }
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, wallNormalInfo&)");
+    is.check(FUNCTION_NAME);
     return is;
 }
 
+
 // ************************************************************************* //
diff --git a/src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.C b/src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.C
index 0f3760654cb11e43358124b3f66d71f1799f9bbb..7a7d4fbcf7f29402cd1f2928f79075b96ca63f15 100644
--- a/src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.C
+++ b/src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.C
@@ -92,7 +92,7 @@ Foam::polyMesh::readUpdateState Foam::meshSubsetHelper::readUpdate()
 {
     polyMesh::readUpdateState meshState = baseMesh_.readUpdate();
 
-    if (meshState != polyMesh::UNCHANGED)
+    if (meshState == polyMesh::TOPO_CHANGE || polyMesh::TOPO_PATCH_CHANGE)
     {
         correct(true);
     }
diff --git a/src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.H b/src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.H
index 891e6d94a6ed625f6a4416203f7deebb9bdf80dc..f531535e79c7b00f251d82f04b6b104eb87ceaee 100644
--- a/src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.H
+++ b/src/dynamicMesh/meshSubsetHelper/meshSubsetHelper.H
@@ -146,7 +146,7 @@ public:
         //- Update mesh subset
         void correct(bool verbose = false);
 
-        //- Read mesh
+        //- Read mesh. Correct on topo-change
         polyMesh::readUpdateState readUpdate();
 
 
diff --git a/src/dynamicMesh/polyTopoChange/polyMeshModifier/polyMeshModifier.C b/src/dynamicMesh/polyTopoChange/polyMeshModifier/polyMeshModifier.C
index ecad881894322f0808e183f47757433e04ece84d..13eb5c6ee94f8cde63cb3848b8a5fd3b9824202a 100644
--- a/src/dynamicMesh/polyTopoChange/polyMeshModifier/polyMeshModifier.C
+++ b/src/dynamicMesh/polyTopoChange/polyMeshModifier/polyMeshModifier.C
@@ -77,7 +77,7 @@ const Foam::polyTopoChanger& Foam::polyMeshModifier::topoChanger() const
 Foam::Ostream& Foam::operator<<(Ostream& os, const polyMeshModifier& pmm)
 {
     pmm.write(os);
-    os.check("Ostream& operator<<(Ostream& f, const polyMeshModifier& pmm)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementData.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementData.C
index 66c70841ed76c3eb77a430de405f6b55f60ff402..e6411fb94ebe659209757c5382cab41ce9f39e15 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementData.C
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementData.C
@@ -46,8 +46,7 @@ Foam::Ostream& Foam::operator<<
         );
     }
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const refinementData&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
@@ -67,8 +66,7 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::refinementData& wDist)
         );
     }
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, refinementData&)");
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C b/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C
index b2e5955f690fffeb68a194edcf58ed2c04263659..8023a5d98b2831e90471f498bcbdce7689b7a868 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChanger/polyTopoChanger.C
@@ -74,7 +74,7 @@ void Foam::polyTopoChanger::readModifiers()
         }
 
         // Check state of IOstream
-        is.check("polyTopoChanger::readModifiers()");
+        is.check(FUNCTION_NAME);
 
         close();
     }
diff --git a/src/engine/ignition/ignitionSiteIO.C b/src/engine/ignition/ignitionSiteIO.C
index 5e8c3d53d4080f1e975149a5421adfef8e8c9077..588a03898b720558489a98f8d601c39a902f93b7 100644
--- a/src/engine/ignition/ignitionSiteIO.C
+++ b/src/engine/ignition/ignitionSiteIO.C
@@ -58,7 +58,7 @@ Foam::ignitionSite::ignitionSite
     timeIndex_(db_.timeIndex())
 {
     // Check state of Istream
-    is.check("ignitionSite::ignitionSite(Istream&)");
+    is.check(FUNCTION_NAME);
 
     findIgnitionCells(mesh_);
 }
@@ -94,7 +94,7 @@ Foam::ignitionSite::ignitionSite
     timeIndex_(db_.timeIndex())
 {
     // Check state of Istream
-    is.check("ignitionSite::ignitionSite(Istream&)");
+    is.check(FUNCTION_NAME);
 
     findIgnitionCells(mesh_);
 }
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddyIO.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddyIO.C
index cb5a49bbaee378daa0300d136819a3f126dc2277..a9009dc03fc95dcc9e22615a19d9c281a1f98dff 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddyIO.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddyIO.C
@@ -39,7 +39,7 @@ Foam::eddy::eddy(Istream& is)
     c1_(readScalar(is)),
     dir1_(readLabel(is))
 {
-    is.check("Foam::eddy::eddy(Foam::Istream&)");
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -62,11 +62,7 @@ void Foam::eddy::operator=(const eddy& e)
 
 Foam::Istream& Foam::operator>>(Istream& is, eddy& e)
 {
-    is.check
-    (
-        "Foam::Istream& Foam::operator>>"
-        "(Foam::Istream&, Foam::eddy&)"
-    );
+    is.check(FUNCTION_NAME);
 
     is  >> e.patchFaceI_
         >> e.position0_
@@ -77,23 +73,14 @@ Foam::Istream& Foam::operator>>(Istream& is, eddy& e)
         >> e.c1_
         >> e.dir1_;
 
-    is.check
-    (
-        "Foam::Istream& Foam::operator>>"
-        "(Foam::Istream&, Foam::eddy&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
 
 Foam::Ostream& Foam::operator<<(Ostream& os, const eddy& e)
 {
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<"
-        "(Foam::Ostream&, const Foam::eddy&)"
-    );
+    os.check(FUNCTION_NAME);
 
     os  << e.patchFaceI_ << token::SPACE
         << e.position0_ << token::SPACE
@@ -104,12 +91,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const eddy& e)
         << e.c1_ << token::SPACE
         << e.dir1_;
 
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<"
-        "(Foam::Ostream&, const Foam::eddy&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C
index f44f574a7c142b73df2e648dc5e5c32755c786e7..52bd26e80950583cc398602c9ef9a797ac66df56 100644
--- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C
@@ -594,7 +594,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const fvPatchField<Type>& ptf)
 {
     ptf.write(os);
 
-    os.check("Ostream& operator<<(Ostream&, const fvPatchField<Type>&");
+    os.check(FUNCTION_NAME);
 
     return os;
 }
diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C
index 664f3ca2f28bc51fe9ed5217884f5e3e2662daae..bf62d071dc2469c1d99832e4ac8c62c85ea88645 100644
--- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C
+++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C
@@ -148,11 +148,7 @@ Foam::tmp<Foam::fvPatchField<Type>> Foam::fvPatchField<Type>::New
         typename dictionaryConstructorTable::iterator patchTypeCstrIter
             = dictionaryConstructorTablePtr_->find(p.type());
 
-        if
-        (
-            patchTypeCstrIter != dictionaryConstructorTablePtr_->end()
-         && patchTypeCstrIter() != cstrIter()
-        )
+        if (patchTypeCstrIter.found() && patchTypeCstrIter() != cstrIter())
         {
             FatalIOErrorInFunction
             (
diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C
index cb0276cc7c49c4c9e8f395804ac7fa99a5155e6e..8a8c96244c34cd17bd23011729a7a3153eb74d63 100644
--- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C
+++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -26,6 +26,7 @@ License
 #include "IOobject.H"
 #include "dictionary.H"
 #include "fvMesh.H"
+#include "surfaceMesh.H"
 #include "fvPatchFieldMapper.H"
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
@@ -93,20 +94,15 @@ Foam::fvsPatchField<Type>::fvsPatchField
     }
     else
     {
-        FatalIOErrorInFunction
-        (
-            dict
-        )   << "essential value entry not provided"
+        FatalIOErrorInFunction(dict)
+            << "essential 'value' entry not provided"
             << exit(FatalIOError);
     }
 }
 
 
 template<class Type>
-Foam::fvsPatchField<Type>::fvsPatchField
-(
-    const fvsPatchField<Type>& ptf
-)
+Foam::fvsPatchField<Type>::fvsPatchField(const fvsPatchField<Type>& ptf)
 :
     Field<Type>(ptf),
     patch_(ptf.patch_),
@@ -149,12 +145,10 @@ void Foam::fvsPatchField<Type>::check(const fvsPatchField<Type>& ptf) const
 
 
 template<class Type>
-void Foam::fvsPatchField<Type>::autoMap
-(
-    const fvPatchFieldMapper& m
-)
+void Foam::fvsPatchField<Type>::autoMap(const fvPatchFieldMapper& m)
 {
-    Field<Type>::autoMap(m);
+    const bool oriented = internalField_.oriented()();
+    Field<Type>::autoMap(m, oriented);
 }
 
 
@@ -382,7 +376,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
 {
     ptf.write(os);
 
-    os.check("Ostream& operator<<(Ostream&, const fvsPatchField<Type>&");
+    os.check(FUNCTION_NAME);
 
     return os;
 }
diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H
index 6c2f12a436fd076b98e9f031d9e88bdeb90b61ac..1b9f0aa2acaf3ca7a966c2dc0a6174256d26e295 100644
--- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H
+++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H
@@ -286,8 +286,7 @@ public:
             }
 
             //- Return dimensioned internal field reference
-            const DimensionedField<Type, surfaceMesh>&
-            internalField() const
+            const DimensionedField<Type, surfaceMesh>& internalField() const
             {
                 return internalField_;
             }
diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldNew.C b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldNew.C
index 32c567f95d051852be424603dc310bbac09335cc..12af314f87581998f7e9af3380e269247ca2cb2d 100644
--- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldNew.C
+++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldNew.C
@@ -136,11 +136,7 @@ Foam::tmp<Foam::fvsPatchField<Type>> Foam::fvsPatchField<Type>::New
         typename dictionaryConstructorTable::iterator patchTypeCstrIter
             = dictionaryConstructorTablePtr_->find(p.type());
 
-        if
-        (
-            patchTypeCstrIter != dictionaryConstructorTablePtr_->end()
-         && patchTypeCstrIter() != cstrIter()
-        )
+        if (patchTypeCstrIter.found() && patchTypeCstrIter() != cstrIter())
         {
             FatalIOErrorInFunction
             (
diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C
index e3f9e6961aa64796bf8443d9b6fde8e4d0878c8d..71be26d88d1a16a688e6794f6457de155c3b6c5a 100644
--- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C
+++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C
@@ -75,8 +75,7 @@ CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field
 
 template<class Type>
 template<class GeoField>
-label CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::
-startTimeIndex() const
+label CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::startTimeIndex() const
 {
     return startTimeIndex_;
 }
@@ -84,8 +83,7 @@ startTimeIndex() const
 
 template<class Type>
 template<class GeoField>
-GeoField& CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::
-operator()()
+GeoField& CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::operator()()
 {
     return *this;
 }
@@ -93,8 +91,10 @@ operator()()
 
 template<class Type>
 template<class GeoField>
-void CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::
-operator=(const GeoField& gf)
+void CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::operator=
+(
+    const GeoField& gf
+)
 {
     GeoField::operator=(gf);
 }
@@ -1259,6 +1259,7 @@ CrankNicolsonDdtScheme<Type>::fvcDdtPhiCorr
             "ddtCorrDdt0(" + phi.name() + ')',
             phi.dimensions()
         );
+    dphidt0.setOriented();
 
     dimensionedScalar rDtCoef = rDtCoef_(ddt0);
 
@@ -1503,6 +1504,8 @@ tmp<surfaceScalarField> CrankNicolsonDdtScheme<Type>::meshPhi
         dimVolume
     );
 
+    meshPhi0.setOriented();
+
     if (evaluate(meshPhi0))
     {
         meshPhi0 =
diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C
index 795fbff9759d98eed2020424d125062249f98ef4..5f372b1e841354886befc3aae8f968a04efa748d 100644
--- a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C
+++ b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C
@@ -115,6 +115,7 @@ gaussLaplacianScheme<Type, GType>::gammaSnGradCorr
            *vf.dimensions()*mesh.deltaCoeffs().dimensions()
         )
     );
+    tgammaSnGradCorr.ref().oriented() = SfGammaCorr.oriented();
 
     for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
     {
diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C
index ae7d0de4585474b8f04bd671b301a69e7c8964e8..5644e7a6b1a4998986354d967af12385b69e7307 100644
--- a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C
+++ b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C
@@ -124,6 +124,7 @@ snGradScheme<Type>::snGrad
         )
     );
     GeometricField<Type, fvsPatchField, surfaceMesh>& ssf = tsf.ref();
+    ssf.setOriented();
 
     // set reference to difference factors array
     const scalarField& deltaCoeffs = tdeltaCoeffs();
diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C
index 4c2ffb5a1f18bc3f11a3f0be6a21833d98738ec2..db21f33d451d6fa4943cccbd21477e847654f434 100644
--- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C
+++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C
@@ -892,6 +892,8 @@ flux() const
     GeometricField<Type, fvsPatchField, surfaceMesh>& fieldFlux =
         tfieldFlux.ref();
 
+    fieldFlux.setOriented();
+
     for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
     {
         fieldFlux.primitiveFieldRef().replace
@@ -2385,7 +2387,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const fvMatrix<Type>& fvm)
         << fvm.internalCoeffs_ << nl
         << fvm.boundaryCoeffs_ << endl;
 
-    os.check("Ostream& operator<<(Ostream&, fvMatrix<Type>&");
+    os.check(FUNCTION_NAME);
 
     return os;
 }
diff --git a/src/finiteVolume/fvMesh/fvMeshGeometry.C b/src/finiteVolume/fvMesh/fvMeshGeometry.C
index a05569849f22117a41c7b234fa8f6a5981c60fa0..c530ee0a9a0c8032062d4bf68e7f3584993c39b8 100644
--- a/src/finiteVolume/fvMesh/fvMeshGeometry.C
+++ b/src/finiteVolume/fvMesh/fvMeshGeometry.C
@@ -67,6 +67,8 @@ void Foam::fvMesh::makeSf() const
         dimArea,
         faceAreas()
     );
+
+    SfPtr_->setOriented();
 }
 
 
@@ -271,8 +273,7 @@ const Foam::volScalarField::Internal& Foam::fvMesh::V00() const
 }
 
 
-Foam::tmp<Foam::volScalarField::Internal>
-Foam::fvMesh::Vsc() const
+Foam::tmp<Foam::volScalarField::Internal> Foam::fvMesh::Vsc() const
 {
     if (moving() && time().subCycling())
     {
@@ -300,8 +301,7 @@ Foam::fvMesh::Vsc() const
 }
 
 
-Foam::tmp<Foam::volScalarField::Internal>
-Foam::fvMesh::Vsc0() const
+Foam::tmp<Foam::volScalarField::Internal> Foam::fvMesh::Vsc0() const
 {
     if (moving() && time().subCycling())
     {
@@ -400,6 +400,7 @@ Foam::tmp<Foam::surfaceVectorField> Foam::fvMesh::delta() const
         )
     );
     surfaceVectorField& delta = tdelta.ref();
+    delta.setOriented();
 
     const volVectorField& C = this->C();
     const labelUList& owner = this->owner();
@@ -410,8 +411,7 @@ Foam::tmp<Foam::surfaceVectorField> Foam::fvMesh::delta() const
         delta[facei] = C[neighbour[facei]] - C[owner[facei]];
     }
 
-    surfaceVectorField::Boundary& deltabf =
-        delta.boundaryFieldRef();
+    surfaceVectorField::Boundary& deltabf =  delta.boundaryFieldRef();
 
     forAll(deltabf, patchi)
     {
@@ -438,6 +438,8 @@ const Foam::surfaceScalarField& Foam::fvMesh::phi() const
         (*phiPtr_) = dimensionedScalar("0", dimVolume/dimTime, 0.0);
     }
 
+    phiPtr_->setOriented();
+
     return *phiPtr_;
 }
 
diff --git a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvSurfaceField.H b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvSurfaceField.H
index 40dfd16f7918cda1e55d4621080764141330fb39..d1f21db48ae9c7a7fcead0390be5c84498a42329 100644
--- a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvSurfaceField.H
+++ b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvSurfaceField.H
@@ -48,7 +48,7 @@ public:
 
     void operator()
     (
-        Field<Type>& field,
+        DimensionedField<Type, surfaceMesh>& field,
         const MeshMapper& mapper
     ) const;
 };
@@ -57,7 +57,7 @@ public:
 template<class Type, class MeshMapper>
 void MapInternalField<Type, MeshMapper, surfaceMesh>::operator()
 (
-    Field<Type>& field,
+    DimensionedField<Type, surfaceMesh>& field,
     const MeshMapper& mapper
 ) const
 {
@@ -69,16 +69,22 @@ void MapInternalField<Type, MeshMapper, surfaceMesh>::operator()
            << abort(FatalError);
     }
 
-    field.autoMap(mapper.surfaceMap());
+    // Passing in oriented flag so that oriented fields (e.g. phi) are negated
+    // if flipped.  Un-oriented fields, e.g U interpolated to faces (Uf) are not
+    // touched
+    field.autoMap(mapper.surfaceMap(), field.oriented()());
 
-    // Flip the flux
-    const labelList flipFaces = mapper.surfaceMap().flipFaceFlux().toc();
-
-    forAll(flipFaces, i)
+    if (field.oriented()())
     {
-        if (flipFaces[i] < field.size())
+        // Flip the flux
+        const labelList flipFaces = mapper.surfaceMap().flipFaceFlux().toc();
+
+        forAll(flipFaces, i)
         {
-            field[flipFaces[i]] *= -1.0;
+            if (flipFaces[i] < field.size())
+            {
+                field[flipFaces[i]] *= -1.0;
+            }
         }
     }
 }
diff --git a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvVolField.H b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvVolField.H
index db8c9ce72b83df1d94023836bf9ca62f4709b434..f23517342fc83625915224a4f17dfa74643e6213 100644
--- a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvVolField.H
+++ b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvVolField.H
@@ -48,7 +48,7 @@ public:
 
     void operator()
     (
-        Field<Type>& field,
+        DimensionedField<Type, volMesh>& field,
         const MeshMapper& mapper
     ) const;
 };
@@ -57,7 +57,7 @@ public:
 template<class Type, class MeshMapper>
 void MapInternalField<Type, MeshMapper, volMesh>::operator()
 (
-    Field<Type>& field,
+    DimensionedField<Type, volMesh>& field,
     const MeshMapper& mapper
 ) const
 {
diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C
index 6e8f8bc7d459c0eedc7c03377d58484839478849..f13c646316b1ec18efafad56511002b4e62560fa 100644
--- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C
+++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -73,8 +73,7 @@ Foam::surfaceInterpolation::~surfaceInterpolation()
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-const Foam::surfaceScalarField&
-Foam::surfaceInterpolation::weights() const
+const Foam::surfaceScalarField& Foam::surfaceInterpolation::weights() const
 {
     if (!weights_)
     {
@@ -85,8 +84,7 @@ Foam::surfaceInterpolation::weights() const
 }
 
 
-const Foam::surfaceScalarField&
-Foam::surfaceInterpolation::deltaCoeffs() const
+const Foam::surfaceScalarField& Foam::surfaceInterpolation::deltaCoeffs() const
 {
     if (!deltaCoeffs_)
     {
@@ -156,11 +154,12 @@ void Foam::surfaceInterpolation::makeWeights() const
         dimless
     );
     surfaceScalarField& weights = *weights_;
+    weights.setOriented();
 
     // Set local references to mesh data
-    // (note that we should not use fvMesh sliced fields at this point yet
-    //  since this causes a loop when generating weighting factors in
-    //  coupledFvPatchField evaluation phase)
+    // Note that we should not use fvMesh sliced fields at this point yet
+    // since this causes a loop when generating weighting factors in
+    // coupledFvPatchField evaluation phase
     const labelUList& owner = mesh_.owner();
     const labelUList& neighbour = mesh_.neighbour();
 
@@ -174,7 +173,7 @@ void Foam::surfaceInterpolation::makeWeights() const
     forAll(owner, facei)
     {
         // Note: mag in the dot-product.
-        // For all valid meshes, the non-orthogonality will be less that
+        // For all valid meshes, the non-orthogonality will be less than
         // 90 deg and the dot-product will be positive.  For invalid
         // meshes (d & s <= 0), this will stabilise the calculation
         // but the result will be poor.
@@ -183,8 +182,7 @@ void Foam::surfaceInterpolation::makeWeights() const
         w[facei] = SfdNei/(SfdOwn + SfdNei);
     }
 
-    surfaceScalarField::Boundary& wBf =
-        weights.boundaryFieldRef();
+    surfaceScalarField::Boundary& wBf = weights.boundaryFieldRef();
 
     forAll(mesh_.boundary(), patchi)
     {
@@ -228,6 +226,7 @@ void Foam::surfaceInterpolation::makeDeltaCoeffs() const
         dimless/dimLength
     );
     surfaceScalarField& deltaCoeffs = *deltaCoeffs_;
+    deltaCoeffs.setOriented();
 
 
     // Set local references to mesh data
@@ -278,6 +277,7 @@ void Foam::surfaceInterpolation::makeNonOrthDeltaCoeffs() const
         dimless/dimLength
     );
     surfaceScalarField& nonOrthDeltaCoeffs = *nonOrthDeltaCoeffs_;
+    nonOrthDeltaCoeffs.setOriented();
 
 
     // Set local references to mesh data
@@ -342,6 +342,7 @@ void Foam::surfaceInterpolation::makeNonOrthCorrectionVectors() const
         dimless
     );
     surfaceVectorField& corrVecs = *nonOrthCorrectionVectors_;
+    corrVecs.setOriented();
 
     // Set local references to mesh data
     const volVectorField& C = mesh_.C();
diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C
index 089d21bee2fae6ad72b7dcf9fd97127d06413a6a..0fbf63650b1034e24cca8fe46fcfb9791a6965fa 100644
--- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C
+++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C
@@ -311,6 +311,8 @@ Foam::surfaceInterpolationScheme<Type>::dotInterpolate
 
     tlambdas.clear();
 
+//    tsf.ref().oriented() = Sf.oriented();
+
     return tsf;
 }
 
@@ -363,6 +365,8 @@ Foam::surfaceInterpolationScheme<Type>::dotInterpolate
         >
     > tsf = dotInterpolate(Sf, vf, weights(vf));
 
+    tsf.ref().oriented() = Sf.oriented();
+
     if (corrected())
     {
         tsf.ref() += Sf & correction(vf);
@@ -397,6 +401,7 @@ Foam::surfaceInterpolationScheme<Type>::dotInterpolate
             surfaceMesh
         >
     > tSfDotinterpVf = dotInterpolate(Sf, tvf());
+
     tvf.clear();
     return tSfDotinterpVf;
 }
diff --git a/src/finiteVolume/interpolation/volPointInterpolation/pointConstraints.C b/src/finiteVolume/interpolation/volPointInterpolation/pointConstraints.C
index 47d9ab90d97a8d9273a09248469bcb286716a814..cd4090a7c85109884bf080a60f1df67e63b22e3a 100644
--- a/src/finiteVolume/interpolation/volPointInterpolation/pointConstraints.C
+++ b/src/finiteVolume/interpolation/volPointInterpolation/pointConstraints.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2013-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -233,7 +233,16 @@ void Foam::pointConstraints::makePatchPatchAddressing()
                     // Allocate new constraint
                     if (patchPatchPoints.size() <= pppi)
                     {
+                        // Check if not enough space. This
+                        // can occasionally happen if -coupled points connect
+                        // to the inside of a patch -these coupled points also
+                        // carry a constraint
                         patchPatchPoints.setSize(pppi+100);
+                        patchPatchPointConstraints_.setSize
+                        (
+                            pppi+100,
+                            pointConstraint()
+                        );
                     }
                     patchPatchPointSet.insert(meshPointi, pppi);
                     patchPatchPoints[pppi] = meshPointi;
diff --git a/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C b/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C
index 7aaf5b494684d570504942e7ca15fe9e5fe2348c..65e4e21abcb46bd79ce500c4ed152c0fa08f131d 100644
--- a/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C
+++ b/src/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItemIO.C
@@ -40,11 +40,7 @@ Foam::functionObjects::fieldAverageItem::fieldAverageItem(Istream& is)
     base_(ITER),
     window_(-1.0)
 {
-    is.check
-    (
-        "Foam::functionObjects::fieldAverageItem::fieldAverageItem"
-        "(Foam::Istream&)"
-    );
+    is.check(FUNCTION_NAME);
 
     const dictionaryEntry entry(dictionary::null, is);
 
@@ -73,11 +69,7 @@ Foam::Istream& Foam::functionObjects::operator>>
     fieldAverageItem& faItem
 )
 {
-    is.check
-    (
-        "Foam::Istream& Foam::operator>>"
-        "(Foam::Istream&, Foam::functionObjects::fieldAverageItem&)"
-    );
+    is.check(FUNCTION_NAME);
 
     const dictionaryEntry entry(dictionary::null, is);
 
@@ -111,11 +103,7 @@ Foam::Ostream& Foam::functionObjects::operator<<
     const fieldAverageItem& faItem
 )
 {
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<"
-        "(Foam::Ostream&, const Foam::functionObjects::fieldAverageItem&)"
-    );
+    os.check(FUNCTION_NAME);
 
     os  << faItem.fieldName_ << nl << token::BEGIN_BLOCK << nl;
     os.writeKeyword("mean") << faItem.mean_ << token::END_STATEMENT << nl;
@@ -138,12 +126,7 @@ Foam::Ostream& Foam::functionObjects::operator<<
 
     os  << token::END_BLOCK << nl;
 
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<"
-        "(Foam::Ostream&, const Foam::functionObjects::fieldAverageItem&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C
index 5d5bb380d70f261e84cd3d8839772bf3e3cdf56a..f28944d9959727aac7eda4a0009381280e6fbdb1 100644
--- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C
+++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C
@@ -154,7 +154,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
 
     DynamicList<label> faceIds(fZone.size());
     DynamicList<label> facePatchIds(fZone.size());
-    DynamicList<bool>  faceFlip(fZone.size());
+    DynamicList<bool> faceFlip(fZone.size());
 
     forAll(fZone, i)
     {
@@ -459,7 +459,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::totalArea() const
     }
     else
     {
-        totalArea = gSum(filterField(mesh_.magSf(), false));
+        totalArea = gSum(filterField(mesh_.magSf()));
     }
 
     return totalArea;
@@ -479,10 +479,13 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::needsSf() const
         case opAverage:
         case opMin:
         case opMax:
+        {
             return false;
-
+        }
         default:
+        {
             return true;
+        }
     }
 }
 
@@ -496,10 +499,13 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::needsWeight() const
         case opWeightedAverage:
         case opWeightedAreaAverage:
         case opWeightedAreaIntegrate:
+        {
             return true;
-
+        }
         default:
+        {
             return false;
+        }
     }
 }
 
@@ -596,7 +602,6 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
 
 
     weightFieldName_ = "none";
-    orientWeightField_ = false;
     if (needsWeight())
     {
         if (dict.readIfPresent("weightField", weightFieldName_))
@@ -610,41 +615,21 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
 
             Info<< "    weight field  = " << weightFieldName_ << nl;
         }
-
-        if (dict.found("orientedWeightField"))
-        {
-            if (regionType_ == stSurface || regionType_ == stSampledSurface)
-            {
-                FatalIOErrorInFunction(dict)
-                    << "Cannot use orientedWeightField "
-                    << "for surface/sampledSurface"
-                    << exit(FatalIOError);
-            }
-
-            if (weightFieldName_ == "none")
-            {
-                dict.lookup("orientedWeightField") >> weightFieldName_;
-                orientWeightField_ = true;
-
-                Info<< "    weight field  = " << weightFieldName_ << nl;
-            }
-            else
-            {
-                FatalIOErrorInFunction(dict)
-                    << "Cannot specify both weightField and orientedWeightField"
-                    << exit(FatalIOError);
-            }
-        }
     }
 
+    // Backwards compatibility for v1612+ and older
     List<word> orientedFields;
-    orientedFieldsStart_ = labelMax;
     if (dict.readIfPresent("orientedFields", orientedFields))
     {
-        orientedFieldsStart_ = fields_.size();
+        WarningInFunction
+            << "The 'orientedFields' option is deprecated.  These fields can "
+            << "and have been added to the standard 'fields' list."
+            << endl;
+
         fields_.append(orientedFields);
     }
 
+
     surfaceWriterPtr_.clear();
     if (writeFields_)
     {
@@ -854,8 +839,6 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
         [dict.lookupOrDefault<word>("postOperation", "none")]
     ),
     weightFieldName_("none"),
-    orientWeightField_(false),
-    orientedFieldsStart_(labelMax),
     writeArea_(dict.lookupOrDefault("writeArea", false)),
     nFaces_(0),
     faceId_(),
@@ -883,8 +866,6 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
         [dict.lookupOrDefault<word>("postOperation", "none")]
     ),
     weightFieldName_("none"),
-    orientWeightField_(false),
-    orientedFieldsStart_(labelMax),
     writeArea_(dict.lookupOrDefault("writeArea", false)),
     nFaces_(0),
     faceId_(),
@@ -959,7 +940,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
         }
         else
         {
-            Sf = filterField(mesh_.Sf(), true); // Oriented Sf
+            Sf = filterField(mesh_.Sf());
         }
     }
 
@@ -988,12 +969,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
         {
             scalarField weightField
             (
-                getFieldValues<scalar>
-                (
-                    weightFieldName_,
-                    true,
-                    orientWeightField_
-                )
+                getFieldValues<scalar>(weightFieldName_, true)
             );
 
             // Process the fields
@@ -1003,12 +979,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
         {
             vectorField weightField
             (
-                getFieldValues<vector>
-                (
-                    weightFieldName_,
-                    true,
-                    orientWeightField_
-                )
+                getFieldValues<vector>(weightFieldName_, true)
             );
 
             // Process the fields
diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H
index ee460e983aa0c2568c42b301373f89fe89a6f504..a58b27b8a0b55170f214eae7999d2685b1458494 100644
--- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H
+++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H
@@ -91,7 +91,6 @@ Usage
         orientedWeightField  | name of oriented field to apply weighting | no |
         scaleFactor  | scale factor            | no          | 1
         fields       | list of fields to operate on | yes    |
-        orientedFields | list of oriented fields to operate on | no |
     \endtable
 
     Where \c regionType is defined by
@@ -130,8 +129,6 @@ Note
     - faces on empty patches get ignored
     - if the field is a volField the \c faceZone can only consist of boundary
       faces
-    - the `oriented' entries relate to mesh-oriented fields, such as the
-      flux, phi.  These fields will be oriented according to the face normals.
     - Using \c surface:
       - The keyword %subRegion should not be used to select surfaces.
         Specify instead the regionType 'surface' and provide the surface name.
@@ -285,12 +282,6 @@ protected:
         //- Weight field name - optional
         word weightFieldName_;
 
-        //- Flag to indicate if flipMap should be applied to the weight field
-        bool orientWeightField_;
-
-        //- Start index of fields that require application of flipMap
-        label orientedFieldsStart_;
-
         //- Total area of the surfaceFieldValue
         scalar totalArea_;
 
@@ -353,8 +344,7 @@ protected:
         tmp<Field<Type>> getFieldValues
         (
             const word& fieldName,
-            const bool mustGet = false,
-            const bool applyOrientation = false
+            const bool mustGet = false
         ) const;
 
         //- Apply the 'operation' to the values. Operation must preserve Type.
@@ -380,16 +370,14 @@ protected:
         template<class Type>
         tmp<Field<Type>> filterField
         (
-            const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
-            const bool applyOrientation
+            const GeometricField<Type, fvsPatchField, surfaceMesh>& field
         ) const;
 
         //- Filter a volume field according to faceIds
         template<class Type>
         tmp<Field<Type>> filterField
         (
-            const GeometricField<Type, fvPatchField, volMesh>& field,
-            const bool applyOrientation
+            const GeometricField<Type, fvPatchField, volMesh>& field
         ) const;
 
         //- Weighting factor
@@ -424,7 +412,6 @@ protected:
             const word& fieldName,
             const vectorField& Sf,
             const Field<WeightType>& weightField,
-            const bool orient,
             const meshedSurf& surfToWrite
         );
 
diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C
index 6f434ed82c96f1ad526d61c4020f4e2429cf39be..806a06845460250ed251e09c7a2bc40b4cd81218 100644
--- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C
+++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValueTemplates.C
@@ -57,8 +57,7 @@ Foam::tmp<Foam::Field<Type>>
 Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
 (
     const word& fieldName,
-    const bool mustGet,
-    const bool applyOrientation
+    const bool mustGet
 ) const
 {
     typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
@@ -71,7 +70,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
     }
     else if (regionType_ != stSampledSurface && foundObject<sf>(fieldName))
     {
-        return filterField(lookupObject<sf>(fieldName), applyOrientation);
+        return filterField(lookupObject<sf>(fieldName));
     }
     else if (foundObject<vf>(fieldName))
     {
@@ -112,7 +111,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
         }
         else
         {
-            return filterField(fld, applyOrientation);
+            return filterField(fld);
         }
     }
 
@@ -140,7 +139,9 @@ processSameTypeValues
     switch (operation_)
     {
         case opNone:
+        {
             break;
+        }
         case opSum:
         {
             result = gSum(values);
@@ -258,8 +259,10 @@ processSameTypeValues
 
         case opAreaNormalAverage:
         case opAreaNormalIntegrate:
-            // handled in specializations only
+        {
+            // Handled in specializations only
             break;
+        }
     }
 
     return result;
@@ -302,30 +305,17 @@ Foam::label Foam::functionObjects::fieldValues::surfaceFieldValue::writeAll
     forAll(fields_, i)
     {
         const word& fieldName = fields_[i];
-        const bool orient = (i >= orientedFieldsStart_);
 
         if
         (
-            writeValues<scalar>
-            (
-                fieldName, Sf, weightField, orient, surfToWrite
-            )
-         || writeValues<vector>
-            (
-                fieldName, Sf, weightField, orient, surfToWrite
-            )
+            writeValues<scalar>(fieldName, Sf, weightField, surfToWrite)
+         || writeValues<vector>(fieldName, Sf, weightField, surfToWrite)
          || writeValues<sphericalTensor>
             (
-                fieldName, Sf, weightField, orient, surfToWrite
-            )
-         || writeValues<symmTensor>
-            (
-                fieldName, Sf, weightField, orient, surfToWrite
-            )
-         || writeValues<tensor>
-            (
-                fieldName, Sf, weightField, orient, surfToWrite
+                fieldName, Sf, weightField, surfToWrite
             )
+         || writeValues<symmTensor>(fieldName, Sf, weightField, surfToWrite)
+         || writeValues<tensor>(fieldName, Sf, weightField, surfToWrite)
         )
         {
             ++nProcessed;
@@ -349,7 +339,6 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
     const word& fieldName,
     const vectorField& Sf,
     const Field<WeightType>& weightField,
-    const bool orient,
     const meshedSurf& surfToWrite
 )
 {
@@ -357,7 +346,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
 
     if (ok)
     {
-        Field<Type> values(getFieldValues<Type>(fieldName, true, orient));
+        Field<Type> values(getFieldValues<Type>(fieldName, true));
 
         // Write raw values on surface if specified
         if (surfaceWriterPtr_.valid())
@@ -389,7 +378,9 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
             switch (postOperation_)
             {
                 case postOpNone:
+                {
                     break;
+                }
                 case postOpSqrt:
                 {
                     // sqrt: component-wise - doesn't change the type
@@ -438,8 +429,7 @@ template<class Type>
 Foam::tmp<Foam::Field<Type>>
 Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
 (
-    const GeometricField<Type, fvPatchField, volMesh>& field,
-    const bool applyOrientation
+    const GeometricField<Type, fvPatchField, volMesh>& field
 ) const
 {
     tmp<Field<Type>> tvalues(new Field<Type>(faceId_.size()));
@@ -464,16 +454,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
         }
     }
 
-    if (applyOrientation)
-    {
-        forAll(values, i)
-        {
-            if (faceFlip_[i])
-            {
-                values[i] *= -1;
-            }
-        }
-    }
+    // No need to flip values - all boundary faces point outwards
 
     return tvalues;
 }
@@ -483,8 +464,7 @@ template<class Type>
 Foam::tmp<Foam::Field<Type>>
 Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
 (
-    const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
-    const bool applyOrientation
+    const GeometricField<Type, fvsPatchField, surfaceMesh>& field
 ) const
 {
     tmp<Field<Type>> tvalues(new Field<Type>(faceId_.size()));
@@ -504,7 +484,13 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
         }
     }
 
-    if (applyOrientation)
+    if (debug)
+    {
+        Pout<< "field " << field.name() << " oriented: "
+            << field.oriented()() << endl;
+    }
+
+    if (field.oriented()())
     {
         forAll(values, i)
         {
diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.C b/src/functionObjects/field/nearWallFields/findCellParticle.C
index 5f57285a2675d0460628cc5c0c9cc0d01728c951..6c69be4f18052c80d929e1d62f6584f7a1dfb8c7 100644
--- a/src/functionObjects/field/nearWallFields/findCellParticle.C
+++ b/src/functionObjects/field/nearWallFields/findCellParticle.C
@@ -70,12 +70,7 @@ Foam::findCellParticle::findCellParticle
         }
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "findCellParticle::findCellParticle"
-        "(const Cloud<findCellParticle>&, Istream&, bool)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -227,9 +222,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const findCellParticle& p)
         );
     }
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const findCellParticle&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/functionObjects/field/streamLine/streamLineParticle.C b/src/functionObjects/field/streamLine/streamLineParticle.C
index e88f903f8a2e08833d5ed75946a8cf63e3779064..04189af71edf0f71e201a7d937198e04dc8372d1 100644
--- a/src/functionObjects/field/streamLine/streamLineParticle.C
+++ b/src/functionObjects/field/streamLine/streamLineParticle.C
@@ -148,12 +148,7 @@ Foam::streamLineParticle::streamLineParticle
         }
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "streamLineParticle::streamLineParticle"
-        "(const Cloud<streamLineParticle>&, Istream&, bool)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -497,9 +492,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const streamLineParticle& p)
         << token::SPACE << p.sampledScalars_
         << token::SPACE << p.sampledVectors_;
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const streamLineParticle&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.C b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.C
index f27d8603222ae1aa7ee7e93e5eea4f99e159bd93..8166029dbd4335426cbf0b4605a6180c383e174f 100644
--- a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.C
+++ b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.C
@@ -331,12 +331,7 @@ Foam::wallBoundedParticle::wallBoundedParticle
         }
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "wallBoundedParticle::wallBoundedParticle"
-        "(const Cloud<wallBoundedParticle>&, Istream&, bool)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
diff --git a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C
index 82fccd411522471eb8426b9017b5f0abba749209..d626c63fcb9c6d94594e597456b7ee011cef6e7a 100644
--- a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C
+++ b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.C
@@ -185,12 +185,7 @@ Foam::wallBoundedStreamLineParticle::wallBoundedStreamLineParticle
         }
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "wallBoundedStreamLineParticle::wallBoundedStreamLineParticle"
-        "(const Cloud<wallBoundedStreamLineParticle>&, Istream&, bool)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -422,12 +417,7 @@ Foam::Ostream& Foam::operator<<
         << token::SPACE << p.sampledScalars_
         << token::SPACE << p.sampledVectors_;
 
-    // Check state of Ostream
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, const wallBoundedStreamLineParticle&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/functionObjects/utilities/ensightWrite/ensightWrite.C b/src/functionObjects/utilities/ensightWrite/ensightWrite.C
index 30b11ffc9e373ea8f9f08bec40f13a8f6af3d8f4..47cd1050bed4fb196242aee6c254a0c3e2df5124 100644
--- a/src/functionObjects/utilities/ensightWrite/ensightWrite.C
+++ b/src/functionObjects/utilities/ensightWrite/ensightWrite.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2016 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2016-2017 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -26,6 +26,7 @@ License
 #include "ensightWrite.H"
 #include "Time.H"
 #include "polyMesh.H"
+#include "wordRes.H"
 #include "addToRunTimeSelectionTable.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@@ -47,25 +48,6 @@ namespace functionObjects
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-void Foam::functionObjects::ensightWrite::uniqWords(wordReList& lst)
-{
-    boolList retain(lst.size());
-    wordHashSet uniq;
-    forAll(lst, i)
-    {
-        const wordRe& select = lst[i];
-
-        retain[i] =
-        (
-            select.isPattern()
-         || uniq.insert(static_cast<const word&>(select))
-        );
-    }
-
-    inplaceSubset(retain, lst);
-}
-
-
 int Foam::functionObjects::ensightWrite::process(const word& fieldName)
 {
     int state = 0;
@@ -140,7 +122,7 @@ bool Foam::functionObjects::ensightWrite::read(const dictionary& dict)
     if (dict.found("patches"))
     {
         wordReList lst(dict.lookup("patches"));
-        uniqWords(lst);
+        wordRes::inplaceUniq(lst);
 
         writeOpts_.patchSelection(lst);
     }
@@ -148,7 +130,7 @@ bool Foam::functionObjects::ensightWrite::read(const dictionary& dict)
     if (dict.found("faceZones"))
     {
         wordReList lst(dict.lookup("faceZones"));
-        uniqWords(lst);
+        wordRes::inplaceUniq(lst);
 
         writeOpts_.faceZoneSelection(lst);
     }
@@ -174,7 +156,7 @@ bool Foam::functionObjects::ensightWrite::read(const dictionary& dict)
     // output fields
     //
     dict.lookup("fields") >> selectFields_;
-    uniqWords(selectFields_);
+    wordRes::inplaceUniq(selectFields_);
 
     return true;
 }
diff --git a/src/functionObjects/utilities/ensightWrite/ensightWrite.H b/src/functionObjects/utilities/ensightWrite/ensightWrite.H
index edba7c8535a7cafaf3571fbff0b4a4e7497d92a2..67bc5ca3cbcd799c762c0551c5c3118b5c203a11 100644
--- a/src/functionObjects/utilities/ensightWrite/ensightWrite.H
+++ b/src/functionObjects/utilities/ensightWrite/ensightWrite.H
@@ -135,9 +135,6 @@ class ensightWrite
 
     // Private Member Functions
 
-        //- Eliminate duplicate 'word' entries
-        static void uniqWords(wordReList&);
-
         //- Ensight case handler
         ensightCase& ensCase()
         {
diff --git a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcelIO.C b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcelIO.C
index 292f445f9328aeff6ad7fcc37fa42bb2dab6b343..155280d17cef3e2c11d75468fde9a1a74185d49b 100644
--- a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcelIO.C
+++ b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcelIO.C
@@ -66,12 +66,7 @@ Foam::DSMCParcel<ParcelType>::DSMCParcel
         }
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "DSMCParcel<ParcelType>::DSMCParcel"
-        "(const Cloud<ParcelType>&, Istream&, bool)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -164,12 +159,7 @@ Foam::Ostream& Foam::operator<<
         );
     }
 
-    // Check state of Ostream
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, const DSMCParcel<ParcelType>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/basic/Cloud/CloudIO.C b/src/lagrangian/basic/Cloud/CloudIO.C
index 33e26087860f513faab420d27a42221430c24179..83369d1a4f0c28cca547af0324f4ded8a5417275 100644
--- a/src/lagrangian/basic/Cloud/CloudIO.C
+++ b/src/lagrangian/basic/Cloud/CloudIO.C
@@ -262,9 +262,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const Cloud<ParticleType>& pc)
 {
     pc.writeData(os);
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const Cloud<ParticleType>&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/basic/IOPosition/IOPosition.C b/src/lagrangian/basic/IOPosition/IOPosition.C
index b89b2c0b4c3a30aa8202db746275c8f57aa30ed5..5c977b54d29754244db1fea82c9321cb3e568af8 100644
--- a/src/lagrangian/basic/IOPosition/IOPosition.C
+++ b/src/lagrangian/basic/IOPosition/IOPosition.C
@@ -139,11 +139,7 @@ void Foam::IOPosition<CloudType>::readData(CloudType& c, bool checkClass)
             << firstToken.info() << exit(FatalIOError);
     }
 
-    // Check state of IOstream
-    is.check
-    (
-        "void IOPosition<CloudType>::readData(CloudType&, bool)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
diff --git a/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.C b/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.C
index e8ce9f9da0780f1ac77663d6430768981d38ea28..25550be99096ec4de511039ff37c09446cfbffb1 100644
--- a/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.C
+++ b/src/lagrangian/basic/InteractionLists/referredWallFace/referredWallFace.C
@@ -101,13 +101,7 @@ Foam::Istream& Foam::operator>>(Istream& is, referredWallFace& rWF)
 {
     is  >> static_cast<face&>(rWF) >> rWF.pts_ >> rWF.patchi_;
 
-    // Check state of Istream
-    is.check
-    (
-        "Foam::Istream& "
-        "Foam::operator>>(Foam::Istream&, Foam::referredWallFace&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -118,13 +112,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const referredWallFace& rWF)
         << rWF.pts_ << token::SPACE
         << rWF.patchi_;
 
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
-        "const Foam::referredWallFace&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/basic/injectedParticle/injectedParticleIO.C b/src/lagrangian/basic/injectedParticle/injectedParticleIO.C
index 3ae1edd1685e6d304883f49b5bf3e48d957a28eb..39313222c98c2a84c5c109ce2bd8c011d7ff8685 100644
--- a/src/lagrangian/basic/injectedParticle/injectedParticleIO.C
+++ b/src/lagrangian/basic/injectedParticle/injectedParticleIO.C
@@ -72,12 +72,7 @@ Foam::injectedParticle::injectedParticle
         }
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "injectedParticle::injectedParticle"
-        "(const polyMesh&, Istream&, bool)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -207,12 +202,7 @@ Foam::Ostream& Foam::operator<<
         );
     }
 
-    // Check state of Ostream
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, const injectedParticle&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/basic/particle/particleIO.C b/src/lagrangian/basic/particle/particleIO.C
index 3c9513f898935873ab187d380cc25b1226866886..b9e40bc3d9228fb6da0a26b74f4787edf9ef41d3 100644
--- a/src/lagrangian/basic/particle/particleIO.C
+++ b/src/lagrangian/basic/particle/particleIO.C
@@ -83,7 +83,7 @@ Foam::particle::particle(const polyMesh& mesh, Istream& is, bool readFields)
     }
 
     // Check state of Istream
-    is.check("particle::particle(Istream&, bool)");
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -99,7 +99,7 @@ void Foam::particle::writePosition(Ostream& os) const
     }
 
     // Check state of Ostream
-    os.check("particle::writePosition(Ostream& os, bool) const");
+    os.check(FUNCTION_NAME);
 }
 
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcelIO.C
index a5d5074f52776c8d1897abae16d8d66bf8372d4b..f63e02daf069dc90586b16d23ada49232c53366d 100644
--- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcelIO.C
+++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcelIO.C
@@ -73,12 +73,7 @@ Foam::CollidingParcel<ParcelType>::CollidingParcel
         is >> collisionRecords_;
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "CollidingParcel<ParcelType>::Collisions"
-        "(const polyMesh&, Istream&, bool)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -335,12 +330,7 @@ Foam::Ostream& Foam::operator<<
         os  << p.collisionRecords();
     }
 
-    // Check state of Ostream
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, const CollidingParcel<ParcelType>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.C b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.C
index d8622ad69a45a71cf8716d99f6721a75cd802494..06f0f24da9cbfff293aba69db17db89d6425efc8 100644
--- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.C
+++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/CollisionRecordList.C
@@ -42,12 +42,7 @@ Foam::CollisionRecordList<PairType, WallType>::CollisionRecordList(Istream& is)
     pairRecords_(is),
     wallRecords_(is)
 {
-    // Check state of Istream
-    is.check
-    (
-        "Foam::CollisionRecordList<PairType, WallType>::"
-        "CollisionRecordList(Foam::Istream&)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -448,13 +443,7 @@ Foam::Istream& Foam::operator>>
 {
     is  >> cRL.pairRecords_ >> cRL.wallRecords_;
 
-    // Check state of Istream
-    is.check
-    (
-        "Foam::Istream& Foam::operator>>"
-        "(Foam::Istream&, Foam::CollisionRecordList<PairType, WallType>&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -468,13 +457,7 @@ Foam::Ostream& Foam::operator<<
 {
     os  << cRL.pairRecords_ << cRL.wallRecords_;
 
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
-        "const Foam::CollisionRecordList<PairType, WallType>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/PairCollisionRecord/PairCollisionRecordIO.C b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/PairCollisionRecord/PairCollisionRecordIO.C
index 880febc61351caa53a51d889054346526af06d3e..56e5195d7caf721867b2bfef281c98f0eae83dbf 100644
--- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/PairCollisionRecord/PairCollisionRecordIO.C
+++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/PairCollisionRecord/PairCollisionRecordIO.C
@@ -35,11 +35,7 @@ Foam::PairCollisionRecord<Type>::PairCollisionRecord(Istream& is)
     origIdOfOther_(readLabel(is)),
     data_(is)
 {
-    // Check state of Istream
-    is.check
-    (
-        "Foam::PairCollisionRecord<Type>::PairCollisionRecord(Foam::Istream&)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -50,13 +46,7 @@ Foam::Istream& Foam::operator>>(Istream& is, PairCollisionRecord<Type>& pCR)
 {
     is  >> pCR.origProcOfOther_ >> pCR.origIdOfOther_ >> pCR.data_;
 
-    // Check state of Istream
-    is.check
-    (
-        "Foam::Istream&"
-        "Foam::operator>>(Foam::Istream&, Foam::PairCollisionRecord<Type>&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -72,13 +62,7 @@ Foam::Ostream& Foam::operator<<
         << token::SPACE << pCR.origIdOfOther_
         << token::SPACE << pCR.data_;
 
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
-        "const Foam::PairCollisionRecord<Type>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/WallCollisionRecord/WallCollisionRecordIO.C b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/WallCollisionRecord/WallCollisionRecordIO.C
index 48159c01b4759a496a28a7a12b655dac7d5fc030..767aee8cce385afc635bec1f618e6e84d3f6ef20 100644
--- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/WallCollisionRecord/WallCollisionRecordIO.C
+++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollisionRecordList/WallCollisionRecord/WallCollisionRecordIO.C
@@ -35,11 +35,7 @@ Foam::WallCollisionRecord<Type>::WallCollisionRecord(Istream& is)
     pRel_(is),
     data_(is)
 {
-    // Check state of Istream
-    is.check
-    (
-        "Foam::WallCollisionRecord<Type>::WallCollisionRecord(Foam::Istream&)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -50,13 +46,7 @@ Foam::Istream& Foam::operator>>(Istream& is, WallCollisionRecord<Type>& wCR)
 {
     is  >> wCR.accessed_ >> wCR.pRel_ >> wCR.data_;
 
-    // Check state of Istream
-    is.check
-    (
-        "Foam::Istream&"
-        "Foam::operator>>(Foam::Istream&, Foam::WallCollisionRecord<Type>&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -72,13 +62,7 @@ Foam::Ostream& Foam::operator<<
         << token::SPACE << wCR.pRel_
         << token::SPACE << wCR.data_;
 
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
-        "const Foam::WallCollisionRecord<Type>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C
index 2e44545ca523e135b89dfcdcaccedef94e7f3884..7e3b838d7c658bdccd2ba327efcb671313133156 100644
--- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C
+++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C
@@ -92,12 +92,7 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
         }
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "KinematicParcel<ParcelType>::KinematicParcel"
-        "(const polyMesh&, Istream&, bool)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -302,12 +297,7 @@ Foam::Ostream& Foam::operator<<
         );
     }
 
-    // Check state of Ostream
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, const KinematicParcel<ParcelType>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelIO.C
index 452b5b0eab6559f8d45e81be0c72331099693ba7..ec582209c6e75380c2ffcde3139240bec0a72ee7 100644
--- a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelIO.C
+++ b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelIO.C
@@ -69,11 +69,7 @@ Foam::MPPICParcel<ParcelType>::MPPICParcel
         }
     }
 
-    is.check
-    (
-        "MPPICParcel<ParcelType>::Collisions"
-        "(const polyMesh&, Istream&, bool)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -182,11 +178,7 @@ Foam::Ostream& Foam::operator<<
         );
     }
 
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, const MPPICParcel<ParcelType>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C
index cf15a6d49782964089ed5b83e7a7c183c807aae0..399f67879d8472654229a63c4a0c02e6b7f44e39 100644
--- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C
+++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C
@@ -78,16 +78,7 @@ Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel
         YSolid_ /= YMix[SLD] + ROOTVSMALL;
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel"
-        "("
-            "const polyMesh&, "
-            "Istream&, "
-            "bool"
-        ")"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -454,16 +445,7 @@ Foam::Ostream& Foam::operator<<
         os  << YGasLoc << YLiquidLoc << YSolidLoc;
     }
 
-    // Check state of Ostream
-    os.check
-    (
-        "Ostream& operator<<"
-        "("
-            "Ostream&, "
-            "const ReactingMultiphaseParcel<ParcelType>&"
-        ")"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C
index 1b6e90cbe3280fc12e3cb60960905a70c985722e..6574af96cf185ea2ac07201e7924e6f455253d2b 100644
--- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C
+++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C
@@ -75,16 +75,7 @@ Foam::ReactingParcel<ParcelType>::ReactingParcel
         Y_.transfer(Ymix);
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "ReactingParcel<ParcelType>::ReactingParcel"
-        "("
-            "const polyMesh&, "
-            "Istream&, "
-            "bool"
-        ")"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -328,12 +319,7 @@ Foam::Ostream& Foam::operator<<
         os  << p.Y();
     }
 
-    // Check state of Ostream
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, const ReactingParcel<ParcelType>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C
index 60f2e82d6960ccef7c7da355dd01228f1c4d66a8..f23059e22fba52ef83361e1feda2f9c52dd5493a 100644
--- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C
+++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C
@@ -73,11 +73,7 @@ Foam::ThermoParcel<ParcelType>::ThermoParcel
         }
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "ThermoParcel::ThermoParcel(const polyMesh&, Istream&, bool)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -189,12 +185,7 @@ Foam::Ostream& Foam::operator<<
         );
     }
 
-    // Check state of Ostream
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, const ThermoParcel<ParcelType>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C
index eded687e414b2175e70be70b722f15a17bda1c8d..e981fc903b9ad38a5f8697f6122928de60b4c5f5 100644
--- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C
+++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phasePropertiesIO.C
@@ -36,7 +36,7 @@ Foam::phaseProperties::phaseProperties(Istream& is)
     Y_(0),
     carrierIds_(0)
 {
-    is.check("Foam::phaseProperties::phaseProperties(Istream& is)");
+    is.check(FUNCTION_NAME);
 
     dictionaryEntry phaseInfo(dictionary::null, is);
 
@@ -67,10 +67,7 @@ Foam::phaseProperties::phaseProperties(Istream& is)
 
 Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp)
 {
-    is.check
-    (
-        "Foam::Istream& Foam::operator>>(Istream&, phaseProperties&)"
-    );
+    is.check(FUNCTION_NAME);
 
     dictionaryEntry phaseInfo(dictionary::null, is);
 
@@ -102,10 +99,7 @@ Foam::Istream& Foam::operator>>(Istream& is, phaseProperties& pp)
 
 Foam::Ostream& Foam::operator<<(Ostream& os, const phaseProperties& pp)
 {
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<(Ostream&, const phaseProperties&)"
-    );
+    os.check(FUNCTION_NAME);
 
     os  << pp.phaseTypeNames[pp.phase_] << nl << token::BEGIN_BLOCK << nl
         << incrIndent;
@@ -118,11 +112,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const phaseProperties& pp)
 
     os  << decrIndent << token::END_BLOCK << nl;
 
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<(Ostream&, const phaseProperties&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallSiteData/WallSiteData.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallSiteData/WallSiteData.C
index f14910bb9010d5b210e5ec094a46d978732637bc..e70bfc03cb2ef0a949da1d3395441a491c5e902e 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallSiteData/WallSiteData.C
+++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallSiteData/WallSiteData.C
@@ -87,13 +87,7 @@ Foam::Istream& Foam::operator>>
 {
     is  >> wIS.patchi_ >> wIS.wallData_;
 
-    // Check state of Istream
-    is.check
-    (
-        "Foam::Istream& Foam::operator>>"
-        "(Foam::Istream&, Foam::WallSiteData<Type>&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -107,13 +101,7 @@ Foam::Ostream& Foam::operator<<
 {
     os  << wIS.patchi_ << token::SPACE << wIS.wallData_;
 
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<"
-        "(Ostream&, const WallSiteData<Type>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/kinematicParcelInjectionDataIO.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/kinematicParcelInjectionDataIO.C
index 95e598629ccf04da9421014d3b5d33427ad0445a..6c93eee808aa5f86d1a76ea777a315a3fdae5646 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/kinematicParcelInjectionDataIO.C
+++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/kinematicParcelInjectionDataIO.C
@@ -44,7 +44,7 @@ Foam::kinematicParcelInjectionData::kinematicParcelInjectionData(Istream& is)
     is.check("reading mDot");
     is >> mDot_;
 
-    is.check("kinematicParcelInjectionData(Istream& is)");
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -79,7 +79,7 @@ Foam::Istream& Foam::operator>>(Istream& is, kinematicParcelInjectionData& data)
     is.check("reading mDot");
     is >> data.mDot_;
 
-    is.check("operator(Istream&, kinematicParcelInjectionData&)");
+    is.check(FUNCTION_NAME);
 
     return is;
 }
diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C
index 145d7590a5a35a54bfcfc6383cd14d9ea4ef9db6..2f6d4f3f21d775aaa5984809941b835df6dee2fd 100644
--- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C
+++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C
@@ -72,7 +72,7 @@ Foam::Istream& Foam::operator>>
     patchInteractionData& pid
 )
 {
-    is.check("Istream& operator>>(Istream&, patchInteractionData&)");
+    is.check(FUNCTION_NAME);
 
     const dictionaryEntry entry(dictionary::null, is);
 
diff --git a/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/reactingParcelInjectionDataIO.C b/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/reactingParcelInjectionDataIO.C
index 146543c7df1ef94f7881edbf07cacb1758705349..afc9de8766d2af52a7901956f8d9f1fb2066bdb0 100644
--- a/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/reactingParcelInjectionDataIO.C
+++ b/src/lagrangian/intermediate/submodels/Reacting/InjectionModel/ReactingLookupTableInjection/reactingParcelInjectionDataIO.C
@@ -34,7 +34,7 @@ Foam::reactingParcelInjectionData::reactingParcelInjectionData(Istream& is)
     is.check("reading Y's");
     is >> Y_;
 
-    is.check("reactingParcelInjectionData(Istream& is)");
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -61,7 +61,7 @@ Foam::Istream& Foam::operator>>(Istream& is, reactingParcelInjectionData& data)
     is.check("reading Y's");
     is >> data.Y_;
 
-    is.check("operator(Istream&, reactingParcelInjectionData&)");
+    is.check(FUNCTION_NAME);
 
     return is;
 }
diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIO.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIO.C
index cf0244e52f32a4df01ebcc549dbf56dee995791c..c455b08d22820e7c02e407cde064a56d27eca6f2 100644
--- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIO.C
+++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/InjectionModel/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIO.C
@@ -41,7 +41,7 @@ reactingMultiphaseParcelInjectionData(Istream& is)
     is.check("reading YSolid's");
     is >> YSolid_;
 
-    is.check("reactingMultiphaseParcelInjectionData(Istream& is)");
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -78,7 +78,7 @@ Foam::Istream& Foam::operator>>
     is.check("reading YSolid's");
     is >> data.YSolid_;
 
-    is.check("operator(Istream&, reactingMultiphaseParcelInjectionData&)");
+    is.check(FUNCTION_NAME);
 
     return is;
 }
diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/thermoParcelInjectionDataIO.C b/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/thermoParcelInjectionDataIO.C
index 259c7c53b425b8dc2fe780870b1927e2867c59a4..67c88f5e80b31eabf430aaab8e2fab85f35266cc 100644
--- a/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/thermoParcelInjectionDataIO.C
+++ b/src/lagrangian/intermediate/submodels/Thermodynamic/InjectionModel/ThermoLookupTableInjection/thermoParcelInjectionDataIO.C
@@ -37,7 +37,7 @@ Foam::thermoParcelInjectionData::thermoParcelInjectionData(Istream& is)
     is.check("reading Cp");
     is >> Cp_;
 
-    is.check("thermoParcelInjectionData(Istream& is)");
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -67,7 +67,7 @@ Foam::Istream& Foam::operator>>(Istream& is, thermoParcelInjectionData& data)
     is.check("reading Cp");
     is >> data.Cp_;
 
-    is.check("operator(Istream&, thermoParcelInjectionData&)");
+    is.check(FUNCTION_NAME);
 
     return is;
 }
diff --git a/src/lagrangian/molecularDynamics/molecularMeasurements/bufferedAccumulator/bufferedAccumulatorIO.C b/src/lagrangian/molecularDynamics/molecularMeasurements/bufferedAccumulator/bufferedAccumulatorIO.C
index 88d8888a49a4a8a6ac72e0e7886626ee7bd2ca3e..228b5b05d82b673eaeb6b20009504526f9e113bf 100644
--- a/src/lagrangian/molecularDynamics/molecularMeasurements/bufferedAccumulator/bufferedAccumulatorIO.C
+++ b/src/lagrangian/molecularDynamics/molecularMeasurements/bufferedAccumulator/bufferedAccumulatorIO.C
@@ -37,13 +37,7 @@ Foam::operator<<(Ostream& os, const bufferedAccumulator<Type>& bA)
         << static_cast<const List<Field<Type>>&>(bA)
         << bA.bufferOffsets();
 
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
-        "const Foam::bufferedAccumulator&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/molecularDynamics/molecularMeasurements/correlationFunction/correlationFunctionIO.C b/src/lagrangian/molecularDynamics/molecularMeasurements/correlationFunction/correlationFunctionIO.C
index 63d7b68c88c7038e788b2a7ca0938d10ab93f0bf..0886797ea13c09c6b4b0b642182ea29047aab186 100644
--- a/src/lagrangian/molecularDynamics/molecularMeasurements/correlationFunction/correlationFunctionIO.C
+++ b/src/lagrangian/molecularDynamics/molecularMeasurements/correlationFunction/correlationFunctionIO.C
@@ -57,13 +57,7 @@ Foam::Ostream& Foam::operator<<
         << nl << cF.tZeroBuffers()
         << nl << static_cast<const bufferedAccumulator<scalar>&>(cF);
 
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<"
-        "(Ostream&, const correlationFunction<Type>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/molecularDynamics/molecularMeasurements/distribution/distribution.C b/src/lagrangian/molecularDynamics/molecularMeasurements/distribution/distribution.C
index da37720b9c10fbfc302bea43290c325aa9ab7497..2091a519ad0882f9643e99de8a9f2286bec478d8 100644
--- a/src/lagrangian/molecularDynamics/molecularMeasurements/distribution/distribution.C
+++ b/src/lagrangian/molecularDynamics/molecularMeasurements/distribution/distribution.C
@@ -464,13 +464,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const distribution& d)
     os  << d.binWidth_
         << static_cast<const Map<label>&>(d);
 
-    // Check state of Ostream
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, "
-        "const distribution&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/moleculeIO.C b/src/lagrangian/molecularDynamics/molecule/molecule/moleculeIO.C
index 9b15c28c189b673567fe7fdd5a6455cdbed14ef0..d0fe212e6c8eea30f099a9ecddc78c3121e47434 100644
--- a/src/lagrangian/molecularDynamics/molecule/molecule/moleculeIO.C
+++ b/src/lagrangian/molecularDynamics/molecule/molecule/moleculeIO.C
@@ -82,12 +82,7 @@ Foam::molecule::molecule
         }
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "Foam::molecule::molecule"
-        "(const Cloud<molecule>& cloud, Foam::Istream&), bool"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -281,13 +276,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const molecule& mol)
         os  << mol.siteForces_ << mol.sitePositions_;
     }
 
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<"
-        "(Foam::Ostream&, const Foam::molecule&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/molecularDynamics/molecule/reducedUnits/reducedUnitsIO.C b/src/lagrangian/molecularDynamics/molecule/reducedUnits/reducedUnitsIO.C
index 7ee1f39bd088000edf3ef0fe27f2e3d6bfb58f0c..0524db861a57a5cb16171f08420f9f3ef2a89875 100644
--- a/src/lagrangian/molecularDynamics/molecule/reducedUnits/reducedUnitsIO.C
+++ b/src/lagrangian/molecularDynamics/molecule/reducedUnits/reducedUnitsIO.C
@@ -46,13 +46,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const reducedUnits& rU)
         << tab << "refNumberDensity = " << rU.refNumberDensity() << " m^-3"
         << endl;
 
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
-        "const Foam::reducedUnits&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/solidParticle/solidParticleIO.C b/src/lagrangian/solidParticle/solidParticleIO.C
index c27cdbb94d311bbe208b8699e86a179f5439feb8..7cecee7418386936d4674c5fe346dbec343520d7 100644
--- a/src/lagrangian/solidParticle/solidParticleIO.C
+++ b/src/lagrangian/solidParticle/solidParticleIO.C
@@ -58,8 +58,7 @@ Foam::solidParticle::solidParticle
         }
     }
 
-    // Check state of Istream
-    is.check("solidParticle::solidParticle(Istream&)");
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -134,9 +133,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const solidParticle& p)
         );
     }
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const solidParticle&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C
index 1afeb4d32b5985134797da919a392b6da9b6ac19..4f421eed0f790ca8b532cf9248a5d70081f0a45a 100644
--- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C
+++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C
@@ -93,16 +93,7 @@ Foam::SprayParcel<ParcelType>::SprayParcel
         }
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "SprayParcel<ParcelType>::SprayParcel"
-        "("
-            "const polyMesh&, "
-            "Istream&, "
-            "bool"
-        ")"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -389,12 +380,7 @@ Foam::Ostream& Foam::operator<<
         );
     }
 
-    // Check state of Ostream
-    os.check
-    (
-        "Ostream& operator<<(Ostream&, const SprayParcel<ParcelType>&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.H b/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.H
index 260e5dc7bb4da21c43246ffff1530eb35bd010a6..caf5ea259d59b16195c5e747c4afaed6252685ab 100644
--- a/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.H
+++ b/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -56,9 +56,9 @@ class arcEdge
     // Private data
 
         point p1_, p2_, p3_;
-        cylindricalCS cs_;
         scalar angle_;
         scalar radius_;
+        cylindricalCS cs_;
 
 
     // Private Member Functions
diff --git a/src/mesh/blockMesh/blockMeshTools/blockMeshTools.C b/src/mesh/blockMesh/blockMeshTools/blockMeshTools.C
index 465998ce9d65ecd4ea802126e077d6e3517741ba..45eebc495645407c26d80a182a9cc29aac4e7c93 100644
--- a/src/mesh/blockMesh/blockMeshTools/blockMeshTools.C
+++ b/src/mesh/blockMesh/blockMeshTools/blockMeshTools.C
@@ -69,10 +69,7 @@ void Foam::blockMeshTools::read
             << exit(FatalIOError);
     }
 
-    is.fatalCheck
-    (
-        "operator>>(Istream&, List<T>&) : reading entry"
-    );
+    is.fatalCheck(FUNCTION_NAME);
 }
 
 
diff --git a/src/mesh/blockMesh/gradingDescriptor/gradingDescriptor.C b/src/mesh/blockMesh/gradingDescriptor/gradingDescriptor.C
index 6c54e2c4f5347e38a8cf8e94b1cead6e58a57676..ea58a0495e443887082f2c7e9aac6ce951ce79fe 100644
--- a/src/mesh/blockMesh/gradingDescriptor/gradingDescriptor.C
+++ b/src/mesh/blockMesh/gradingDescriptor/gradingDescriptor.C
@@ -122,9 +122,7 @@ Foam::Istream& Foam::operator>>(Istream& is, gradingDescriptor& gd)
         is.readEnd("gradingDescriptor");
     }
 
-    // Check state of Istream
-    is.check("operator>>(Istream&, gradingDescriptor&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/mesh/blockMesh/gradingDescriptor/gradingDescriptors.C b/src/mesh/blockMesh/gradingDescriptor/gradingDescriptors.C
index 6e6418af3d730c4ca42441e653218330b2bf1240..439707ddff573824962e95f80a9f33a211e1642b 100644
--- a/src/mesh/blockMesh/gradingDescriptor/gradingDescriptors.C
+++ b/src/mesh/blockMesh/gradingDescriptor/gradingDescriptors.C
@@ -73,7 +73,7 @@ Foam::Istream& Foam::operator>>(Istream& is, gradingDescriptors& gds)
         is >> static_cast<List<gradingDescriptor>& >(gds);
 
         // Check state of Istream
-        is.check("operator>>(Istream&, gradingDescriptor&)");
+        is.check(FUNCTION_NAME);
 
         // Normalize the blockFractions and nDivFractions
         // of the list of gradingDescriptors
diff --git a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.C b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.C
index dec8a9f47f2b516ec674e64a86084c4e4c578bec..e4ba1c54092df9844d90129ea7efd1f55b57da5a 100644
--- a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.C
+++ b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.C
@@ -81,12 +81,7 @@ Foam::trackedParticle::trackedParticle
         }
     }
 
-    // Check state of Istream
-    is.check
-    (
-        "trackedParticle::trackedParticle"
-        "(const Cloud<trackedParticle>&, Istream&, bool)"
-    );
+    is.check(FUNCTION_NAME);
 }
 
 
@@ -270,9 +265,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const trackedParticle& p)
         );
     }
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const trackedParticle&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/meshTools/AABBTree/AABBTree.C b/src/meshTools/AABBTree/AABBTree.C
index 19c11f33a970842855b5b91244a84162d797e6ff..a8f02d3aa2f89404add3e9c8d40e95dddc26a9cd 100644
--- a/src/meshTools/AABBTree/AABBTree.C
+++ b/src/meshTools/AABBTree/AABBTree.C
@@ -492,7 +492,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const AABBTree<Type>& tree)
             << tree.addressing_;
     }
 
-    os.check("Ostream& operator<<(Ostream&, const AABBTree<Type>&)");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
@@ -519,7 +519,7 @@ Foam::Istream& Foam::operator>>(Istream& is, AABBTree<Type>& tree)
             >> tree.addressing_;
     }
 
-    is.check("Istream& operator>>(Istream&, AABBTree<Type>&)");
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files
index c503db29754c4c38d731a7f71316bbd58f7bc7ce..b77d0bdbc992d0c54db546069cc6ed380b988b5b 100644
--- a/src/meshTools/Make/files
+++ b/src/meshTools/Make/files
@@ -63,8 +63,6 @@ $(csys)/coordinateRotation/EulerCoordinateRotation.C
 $(csys)/coordinateRotation/STARCDCoordinateRotation.C
 $(csys)/coordinateRotation/cylindrical.C
 
-edgeFaceCirculator/edgeFaceCirculator.C
-
 polyMeshZipUpCells/polyMeshZipUpCells.C
 primitiveMeshGeometry/primitiveMeshGeometry.C
 
diff --git a/src/meshTools/coordinateSystems/coordinateSystem.C b/src/meshTools/coordinateSystems/coordinateSystem.C
index e3150ff8f589195cdfab5b284db243ecfdc8215b..e8c507a7f848e6177ca7a6dbc697af94703b1841 100644
--- a/src/meshTools/coordinateSystems/coordinateSystem.C
+++ b/src/meshTools/coordinateSystems/coordinateSystem.C
@@ -378,7 +378,7 @@ bool Foam::operator!=(const coordinateSystem& a, const coordinateSystem& b)
 Foam::Ostream& Foam::operator<<(Ostream& os, const coordinateSystem& cs)
 {
     cs.write(os);
-    os.check("Ostream& operator<<(Ostream&, const coordinateSystem&");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/meshTools/edgeFaceCirculator/edgeFaceCirculator.C b/src/meshTools/edgeFaceCirculator/edgeFaceCirculator.C
deleted file mode 100644
index 5431bb419fb2b14f644a96cb528e15f9c34389c0..0000000000000000000000000000000000000000
--- a/src/meshTools/edgeFaceCirculator/edgeFaceCirculator.C
+++ /dev/null
@@ -1,44 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2017 OpenFOAM Foundation
-     \\/     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 3 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, see <http://www.gnu.org/licenses/>.
-
-\*---------------------------------------------------------------------------*/
-
-#include "edgeFaceCirculator.H"
-#include "primitiveMesh.H"
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-const Foam::primitiveMesh* const Foam::edgeFaceCirculator::endConstIterMeshPtr
-    = nullptr;
-
-const Foam::edgeFaceCirculator Foam::edgeFaceCirculator::endConstIter
-(
-    *Foam::edgeFaceCirculator::endConstIterMeshPtr, // primitiveMesh
-    -1,                                             // faceLabel
-    false,                                          // ownerSide
-    -1,                                             // index
-    false                                           // isBoundaryEdge
-);
-
-
-// ************************************************************************* //
diff --git a/src/meshTools/edgeFaceCirculator/edgeFaceCirculator.H b/src/meshTools/edgeFaceCirculator/edgeFaceCirculator.H
index c9b8ac0708bc8a5aada087094f5749f375580f27..a6a1e9f6ce968675e478a9780a878b63a6a75432 100644
--- a/src/meshTools/edgeFaceCirculator/edgeFaceCirculator.H
+++ b/src/meshTools/edgeFaceCirculator/edgeFaceCirculator.H
@@ -86,19 +86,10 @@ class primitiveMesh;
 
 class edgeFaceCirculator
 {
-    // Static data members
+    // Private Member Data
 
-        //- End iterator primitiveMesh nullptr
-        static const primitiveMesh* const endConstIterMeshPtr;
-
-        //- End iterator
-        static const edgeFaceCirculator endConstIter;
-
-
-    // Private data
-
-        //- Mesh
-        const primitiveMesh& mesh_;
+        //- The underlying mesh pointer
+        const primitiveMesh* meshPtr_;
 
         //- Current face
         label faceLabel_;
@@ -119,16 +110,21 @@ class edgeFaceCirculator
 
     // Private Member Functions
 
+        //- The underlying mesh
+        inline const primitiveMesh& mesh() const;
+
         //- Set to end() iterator
         inline void setEnd();
 
         //- Check and set faceLabel_ and ownerSide_
         inline void setFace(const label facei, const label celli);
 
-        //- Set faceLabel_ to be the other face on the cell that uses the
-        //  edge.
+        //- Set faceLabel_ to be the other face on the cell that uses the edge.
         inline void otherFace(const label celli);
 
+        //- Construct null - this is also an end iterator
+        inline edgeFaceCirculator();
+
 
 public:
 
@@ -145,7 +141,7 @@ public:
         );
 
         //- Construct as copy
-        inline edgeFaceCirculator(const edgeFaceCirculator&);
+        inline edgeFaceCirculator(const edgeFaceCirculator& circ);
 
 
     // Member Functions
@@ -159,8 +155,12 @@ public:
             const label v1
         );
 
+        //- Return the face label, -1 for end iterator
         inline label faceLabel() const;
 
+        //- Return true if the face label corresponds to an internal face
+        inline bool isInternalFace() const;
+
         inline bool ownerSide() const;
 
         inline label index() const;
@@ -197,8 +197,8 @@ public:
         inline edgeFaceCirculator cbegin() const;
 
         //- Iterator set to beyond the end of the walk.
-        inline const edgeFaceCirculator& end() const;
-        inline const edgeFaceCirculator& cend() const;
+        inline const edgeFaceCirculator end() const;
+        inline const edgeFaceCirculator cend() const;
 };
 
 
diff --git a/src/meshTools/edgeFaceCirculator/edgeFaceCirculatorI.H b/src/meshTools/edgeFaceCirculator/edgeFaceCirculatorI.H
index bbebe4382f11ca074d987018e9eb06252795ac87..23c1f76faf4269482d161048c80f07ffb6e82388 100644
--- a/src/meshTools/edgeFaceCirculator/edgeFaceCirculatorI.H
+++ b/src/meshTools/edgeFaceCirculator/edgeFaceCirculatorI.H
@@ -27,6 +27,12 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
+inline const Foam::primitiveMesh& Foam::edgeFaceCirculator::mesh() const
+{
+    return *meshPtr_;
+}
+
+
 void Foam::edgeFaceCirculator::setEnd()
 {
     faceLabel_ = -1;
@@ -42,7 +48,7 @@ void Foam::edgeFaceCirculator::setFace
 {
     faceLabel_ = facei;
 
-    if (!isBoundaryEdge_ && !mesh_.isInternalFace(facei))
+    if (!isBoundaryEdge_ && !mesh().isInternalFace(facei))
     {
         FatalErrorInFunction
             << "Edge is not defined as boundary edge but still walked to"
@@ -54,11 +60,11 @@ void Foam::edgeFaceCirculator::setFace
 
 void Foam::edgeFaceCirculator::otherFace(const label celli)
 {
-    const face& f = mesh_.faces()[faceLabel_];
+    const face& f = mesh().faces()[faceLabel_];
     label v0 = f[index_];
     label v1 = f.nextLabel(index_);
 
-    const cell& cFaces = mesh_.cells()[celli];
+    const cell& cFaces = mesh().cells()[celli];
 
     forAll(cFaces, i)
     {
@@ -66,7 +72,7 @@ void Foam::edgeFaceCirculator::otherFace(const label celli)
 
         if (faceB != faceLabel_)
         {
-            label fp = getMinIndex(mesh_.faces()[faceB], v0, v1);
+            label fp = getMinIndex(mesh().faces()[faceB], v0, v1);
 
             if (fp >= 0)
             {
@@ -81,14 +87,24 @@ void Foam::edgeFaceCirculator::otherFace(const label celli)
         << "Could not find next face stepping"
         << " through cell along edge." << endl
         << "face:" << faceLabel_ << " index in face:" << index_
-        << " edge:" << mesh_.points()[v0] << mesh_.points()[v1]
+        << " edge:" << mesh().points()[v0] << mesh().points()[v1]
         << abort(FatalError);
 }
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-//- Construct from components
+Foam::edgeFaceCirculator::edgeFaceCirculator()
+:
+    meshPtr_(nullptr),
+    faceLabel_(-1),
+    ownerSide_(false),
+    index_(-1),
+    isBoundaryEdge_(false),
+    startFaceLabel_(0)
+{}
+
+
 Foam::edgeFaceCirculator::edgeFaceCirculator
 (
     const primitiveMesh& mesh,
@@ -98,7 +114,7 @@ Foam::edgeFaceCirculator::edgeFaceCirculator
     const bool isBoundaryEdge
 )
 :
-    mesh_(mesh),
+    meshPtr_(&mesh),
     faceLabel_(faceLabel),
     ownerSide_(ownerSide),
     index_(index),
@@ -107,10 +123,9 @@ Foam::edgeFaceCirculator::edgeFaceCirculator
 {}
 
 
-//- Construct copy
 Foam::edgeFaceCirculator::edgeFaceCirculator(const edgeFaceCirculator& circ)
 :
-    mesh_(circ.mesh_),
+    meshPtr_(circ.meshPtr_),
     faceLabel_(circ.faceLabel_),
     ownerSide_(circ.ownerSide_),
     index_(circ.index_),
@@ -158,6 +173,17 @@ Foam::label Foam::edgeFaceCirculator::faceLabel() const
 }
 
 
+bool Foam::edgeFaceCirculator::isInternalFace() const
+{
+    return
+    (
+        faceLabel_ >= 0
+     && meshPtr_
+     && meshPtr_->isInternalFace(faceLabel_)
+    );
+}
+
+
 bool Foam::edgeFaceCirculator::ownerSide() const
 {
     return ownerSide_;
@@ -174,11 +200,11 @@ Foam::label Foam::edgeFaceCirculator::cellLabel() const
 {
     if (ownerSide_)
     {
-        return mesh_.faceOwner()[faceLabel_];
+        return mesh().faceOwner()[faceLabel_];
     }
-    else if (mesh_.isInternalFace(faceLabel_))
+    else if (mesh().isInternalFace(faceLabel_))
     {
-        return mesh_.faceNeighbour()[faceLabel_];
+        return mesh().faceNeighbour()[faceLabel_];
     }
     else
     {
@@ -189,7 +215,7 @@ Foam::label Foam::edgeFaceCirculator::cellLabel() const
 
 bool Foam::edgeFaceCirculator::sameOrder(const label v0, const label v1) const
 {
-    const face& f = mesh_.faces()[faceLabel_];
+    const face& f = mesh().faces()[faceLabel_];
 
     label fp = getMinIndex(f, v0, v1);
 
@@ -216,21 +242,21 @@ void Foam::edgeFaceCirculator::setCanonical()
 
         while (true)
         {
-            if (mesh_.isInternalFace(faceLabel_))
+            if (mesh().isInternalFace(faceLabel_))
             {
                 if (ownerSide_)
                 {
-                    label celli = mesh_.faceNeighbour()[faceLabel_];
+                    label celli = mesh().faceNeighbour()[faceLabel_];
                     otherFace(celli);
                     // Maintain reverse direction of walking
-                    ownerSide_ = (mesh_.faceOwner()[faceLabel_] == celli);
+                    ownerSide_ = (mesh().faceOwner()[faceLabel_] == celli);
                 }
                 else
                 {
-                    label celli = mesh_.faceOwner()[faceLabel_];
+                    label celli = mesh().faceOwner()[faceLabel_];
                     otherFace(celli);
                     // Maintain reverse direction of walking
-                    ownerSide_ = (mesh_.faceOwner()[faceLabel_] == celli);
+                    ownerSide_ = (mesh().faceOwner()[faceLabel_] == celli);
                 }
             }
             else if (ownerSide_)
@@ -239,22 +265,22 @@ void Foam::edgeFaceCirculator::setCanonical()
             }
             else
             {
-                label celli = mesh_.faceOwner()[faceLabel_];
+                label celli = mesh().faceOwner()[faceLabel_];
                 otherFace(celli);
                 // Maintain reverse direction of walking
-                ownerSide_ = (mesh_.faceOwner()[faceLabel_] == celli);
+                ownerSide_ = (mesh().faceOwner()[faceLabel_] == celli);
             }
 
             i++;
 
             if (i >= 1000)
             {
-                const face& f = mesh_.faces()[faceLabel_];
+                const face& f = mesh().faces()[faceLabel_];
 
                 FatalErrorInFunction
                     << "Walked " << i << " cells around edge "
-                    << mesh_.points()[f[index_]]
-                    << mesh_.points()[f.nextLabel(index_)]
+                    << mesh().points()[f[index_]]
+                    << mesh().points()[f.nextLabel(index_)]
                     << " without reaching a boundary face."
                     << " Are you sure this is a boundary edge?"
                     << abort(FatalError);
@@ -281,15 +307,15 @@ void Foam::edgeFaceCirculator::setCanonical()
                 break;
             }
 
-            if (!mesh_.isInternalFace(faceLabel_))
+            if (!mesh().isInternalFace(faceLabel_))
             {
-                const face& f = mesh_.faces()[faceLabel_];
+                const face& f = mesh().faces()[faceLabel_];
 
                 FatalErrorInFunction
                     << "Reached boundary face " << faceLabel_
                     << " when walking around internal edge "
-                    << mesh_.points()[f[index_]]
-                    << mesh_.points()[f.nextLabel(index_)]
+                    << mesh().points()[f[index_]]
+                    << mesh().points()[f.nextLabel(index_)]
                     << "." << endl
                     << "Are you sure this is an internal edge?"
                     << abort(FatalError);
@@ -360,10 +386,10 @@ Foam::edgeFaceCirculator::operator++()
     else if (ownerSide_)
     {
         // Step to owner
-        label celli = mesh_.faceOwner()[faceLabel_];
+        label celli = mesh().faceOwner()[faceLabel_];
         otherFace(celli);
         // Maintain direction of walking
-        ownerSide_ = (mesh_.faceOwner()[faceLabel_] != celli);
+        ownerSide_ = (mesh().faceOwner()[faceLabel_] != celli);
 
         // Check for internal edge : ends on starting face.
         if (!isBoundaryEdge_ && faceLabel_ == startFaceLabel_)
@@ -371,13 +397,13 @@ Foam::edgeFaceCirculator::operator++()
             setEnd();
         }
     }
-    else if (mesh_.isInternalFace(faceLabel_))
+    else if (mesh().isInternalFace(faceLabel_))
     {
         // Step to neighbour
-        label celli = mesh_.faceNeighbour()[faceLabel_];
+        label celli = mesh().faceNeighbour()[faceLabel_];
         otherFace(celli);
         // Maintain direction of walking
-        ownerSide_ = (mesh_.faceOwner()[faceLabel_] != celli);
+        ownerSide_ = (mesh().faceOwner()[faceLabel_] != celli);
 
         // Check for internal edge : ends on starting face.
         if (!isBoundaryEdge_ && faceLabel_ == startFaceLabel_)
@@ -399,7 +425,7 @@ Foam::edgeFaceCirculator Foam::edgeFaceCirculator::begin() const
 {
     edgeFaceCirculator iter
     (
-        mesh_,
+        *meshPtr_,
         faceLabel_,
         ownerSide_,
         index_,
@@ -418,7 +444,7 @@ Foam::edgeFaceCirculator Foam::edgeFaceCirculator::cbegin() const
 {
     edgeFaceCirculator iter
     (
-        mesh_,
+        *meshPtr_,
         faceLabel_,
         ownerSide_,
         index_,
@@ -433,14 +459,14 @@ Foam::edgeFaceCirculator Foam::edgeFaceCirculator::cbegin() const
 }
 
 
-const Foam::edgeFaceCirculator& Foam::edgeFaceCirculator::end() const
+const Foam::edgeFaceCirculator Foam::edgeFaceCirculator::end() const
 {
-    return endConstIter;
+    return edgeFaceCirculator();
 }
 
-const Foam::edgeFaceCirculator& Foam::edgeFaceCirculator::cend() const
+const Foam::edgeFaceCirculator Foam::edgeFaceCirculator::cend() const
 {
-    return endConstIter;
+    return edgeFaceCirculator();
 }
 
 
diff --git a/src/meshTools/edgeMesh/edgeMeshFormats/edgeMesh/edgeMeshFormat.C b/src/meshTools/edgeMesh/edgeMeshFormats/edgeMesh/edgeMeshFormat.C
index 59771b4d7065cf8dc28099ca91ba66861e2668c8..d8b14d5a9cc98d5e618e5c8b5ac1613a26a2a87e 100644
--- a/src/meshTools/edgeMesh/edgeMeshFormats/edgeMesh/edgeMeshFormat.C
+++ b/src/meshTools/edgeMesh/edgeMeshFormats/edgeMesh/edgeMeshFormat.C
@@ -144,13 +144,7 @@ Foam::Ostream& Foam::fileFormats::edgeMeshFormat::write
 
     IOobject::writeDivider(os);
 
-    // Check state of Ostream
-    os.check
-    (
-        "edgeMeshFormat::write"
-        "(Ostream&, const pointField&, const edgeList&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
@@ -208,8 +202,7 @@ void Foam::fileFormats::edgeMeshFormat::write
 
     write(os, mesh.points(), mesh.edges());
 
-    // Check state of Ostream
-    os.check("edgeMeshFormat::write(Ostream&)");
+    os.check(FUNCTION_NAME);
 }
 
 
diff --git a/src/meshTools/edgeMesh/edgeMeshIO.C b/src/meshTools/edgeMesh/edgeMeshIO.C
index f57ddb5a3c1c233e620efac3717a00e1595d6f3e..a187cb2d6c24eeaac1f47de3bc9352bd7c99241e 100644
--- a/src/meshTools/edgeMesh/edgeMeshIO.C
+++ b/src/meshTools/edgeMesh/edgeMeshIO.C
@@ -128,9 +128,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const edgeMesh& em)
 {
     fileFormats::edgeMeshFormat::write(os, em.points_, em.edges_);
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const edgeMesh&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
@@ -141,9 +139,7 @@ Foam::Istream& Foam::operator>>(Istream& is, edgeMesh& em)
 
     em.pointEdgesPtr_.clear();
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, edgeMesh&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C
index a13061b7ff5fb8db2362aada441decaf0ac6dbf1..977cb457caa166d2f733812feeb429b9a2d090d1 100644
--- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C
+++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedEdgeMesh.C
@@ -2446,9 +2446,7 @@ Foam::Istream& Foam::operator>>
 
     vt = static_cast<Foam::extendedEdgeMesh::sideVolumeType>(type);
 
-    // Check state of Istream
-    is.check("operator>>(Istream&, sideVolumeType&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -2497,9 +2495,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const extendedEdgeMesh& em)
         << em.regionEdges_
         << endl;
 
-    // Check state of Ostream
-    os.check("Ostream& operator<<(Ostream&, const extendedEdgeMesh&)");
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
@@ -2523,9 +2519,7 @@ Foam::Istream& Foam::operator>>(Istream& is, extendedEdgeMesh& em)
         >> em.featurePointEdges_
         >> em.regionEdges_;
 
-    // Check state of Istream
-    is.check("Istream& operator>>(Istream&, extendedEdgeMesh&)");
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
diff --git a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C
index 08a688bfa55dd8623902850587d84f0b60c6f558..3df1a97fb45bc188801d7cdd7c1f42a011e8a3d1 100644
--- a/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C
+++ b/src/meshTools/edgeMesh/extendedEdgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C
@@ -250,9 +250,7 @@ bool Foam::extendedFeatureEdgeMesh::writeData(Ostream& os) const
 //
 //    vt = static_cast<Foam::extendedFeatureEdgeMesh::sideVolumeType>(type);
 //
-//    // Check state of Istream
-//    is.check("operator>>(Istream&, sideVolumeType&)");
-//
+//    is.check(FUNCTION_NAME);
 //    return is;
 //}
 //
diff --git a/src/parallel/decompose/decompose/fvFieldDecomposer.C b/src/parallel/decompose/decompose/fvFieldDecomposer.C
index 310d0ce1fec4c7cd7c4e85de059546cc3a9d1dd7..8ff6ee3e06e41b6cc36b85b3e8665ee4657ff310 100644
--- a/src/parallel/decompose/decompose/fvFieldDecomposer.C
+++ b/src/parallel/decompose/decompose/fvFieldDecomposer.C
@@ -107,7 +107,7 @@ processorSurfacePatchFieldDecomposer
         weights_[i].setSize(1);
 
         addressing_[i][0] = mag(addressingSlice[i]) - 1;
-        weights_[i][0] = sign(addressingSlice[i]);
+        weights_[i][0] = 1;
     }
 }
 
@@ -126,59 +126,75 @@ Foam::fvFieldDecomposer::fvFieldDecomposer
     faceAddressing_(faceAddressing),
     cellAddressing_(cellAddressing),
     boundaryAddressing_(boundaryAddressing),
-    patchFieldDecomposerPtrs_
-    (
-        procMesh_.boundary().size(),
-        static_cast<patchFieldDecomposer*>(nullptr)
-    ),
-    processorVolPatchFieldDecomposerPtrs_
-    (
-        procMesh_.boundary().size(),
-        static_cast<processorVolPatchFieldDecomposer*>(nullptr)
-    ),
-    processorSurfacePatchFieldDecomposerPtrs_
-    (
-        procMesh_.boundary().size(),
-        static_cast<processorSurfacePatchFieldDecomposer*>(nullptr)
-    )
+    patchFieldDecomposerPtrs_(procMesh_.boundary().size()),
+    processorVolPatchFieldDecomposerPtrs_(procMesh_.boundary().size()),
+    processorSurfacePatchFieldDecomposerPtrs_(procMesh_.boundary().size()),
+    faceSign_(procMesh_.boundary().size())
 {
     forAll(boundaryAddressing_, patchi)
     {
+        const fvPatch& fvp = procMesh_.boundary()[patchi];
+
         if
         (
             boundaryAddressing_[patchi] >= 0
         && !isA<processorLduInterface>(procMesh.boundary()[patchi])
         )
         {
-            patchFieldDecomposerPtrs_[patchi] = new patchFieldDecomposer
+            patchFieldDecomposerPtrs_.set
             (
-                procMesh_.boundary()[patchi].patchSlice(faceAddressing_),
-                completeMesh_.boundaryMesh()
-                [
-                    boundaryAddressing_[patchi]
-                ].start()
+                patchi,
+                new patchFieldDecomposer
+                (
+                    fvp.patchSlice(faceAddressing_),
+                    completeMesh_.boundaryMesh()
+                    [
+                        boundaryAddressing_[patchi]
+                    ].start()
+                )
             );
         }
         else
         {
-            processorVolPatchFieldDecomposerPtrs_[patchi] =
+            processorVolPatchFieldDecomposerPtrs_.set
+            (
+                patchi,
                 new processorVolPatchFieldDecomposer
                 (
                     completeMesh_,
-                    procMesh_.boundary()[patchi].patchSlice(faceAddressing_)
-                );
+                    fvp.patchSlice(faceAddressing_)
+                )
+            );
 
-            processorSurfacePatchFieldDecomposerPtrs_[patchi] =
+            processorSurfacePatchFieldDecomposerPtrs_.set
+            (
+                patchi,
                 new processorSurfacePatchFieldDecomposer
                 (
                     static_cast<const labelUList&>
                     (
-                        procMesh_.boundary()[patchi].patchSlice
+                        fvp.patchSlice
                         (
                             faceAddressing_
                         )
                     )
-                );
+                )
+            );
+
+            faceSign_.set
+            (
+                patchi,
+                new scalarField(fvp.patchSlice(faceAddressing_).size())
+            );
+
+            {
+                const SubList<label> fa = fvp.patchSlice(faceAddressing_);
+                scalarField& s = faceSign_[patchi];
+                forAll(s, i)
+                {
+                    s[i] = sign(fa[i]);
+                }
+            }
         }
     }
 }
@@ -187,30 +203,7 @@ Foam::fvFieldDecomposer::fvFieldDecomposer
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 Foam::fvFieldDecomposer::~fvFieldDecomposer()
-{
-    forAll(patchFieldDecomposerPtrs_, patchi)
-    {
-        if (patchFieldDecomposerPtrs_[patchi])
-        {
-            delete patchFieldDecomposerPtrs_[patchi];
-        }
-    }
+{}
 
-    forAll(processorVolPatchFieldDecomposerPtrs_, patchi)
-    {
-        if (processorVolPatchFieldDecomposerPtrs_[patchi])
-        {
-            delete processorVolPatchFieldDecomposerPtrs_[patchi];
-        }
-    }
-
-    forAll(processorSurfacePatchFieldDecomposerPtrs_, patchi)
-    {
-        if (processorSurfacePatchFieldDecomposerPtrs_[patchi])
-        {
-            delete processorSurfacePatchFieldDecomposerPtrs_[patchi];
-        }
-    }
-}
 
 // ************************************************************************* //
diff --git a/src/parallel/decompose/decompose/fvFieldDecomposer.H b/src/parallel/decompose/decompose/fvFieldDecomposer.H
index c6953b37a4aa056e5d415b70ce6e6771da4edc63..b4193edc97adced5649596aba0bad02edc5cbe1d 100644
--- a/src/parallel/decompose/decompose/fvFieldDecomposer.H
+++ b/src/parallel/decompose/decompose/fvFieldDecomposer.H
@@ -215,15 +215,18 @@ private:
         const labelList& boundaryAddressing_;
 
         //- List of patch field decomposers
-        List<patchFieldDecomposer*> patchFieldDecomposerPtrs_;
+        PtrList<patchFieldDecomposer> patchFieldDecomposerPtrs_;
 
-        List<processorVolPatchFieldDecomposer*>
+        PtrList<processorVolPatchFieldDecomposer>
             processorVolPatchFieldDecomposerPtrs_;
 
-        List<processorSurfacePatchFieldDecomposer*>
+        PtrList<processorSurfacePatchFieldDecomposer>
             processorSurfacePatchFieldDecomposerPtrs_;
 
 
+        PtrList<scalarField> faceSign_;
+
+
     // Private Member Functions
 
         //- Disallow default bitwise copy construct
diff --git a/src/parallel/decompose/decompose/fvFieldDecomposerDecomposeFields.C b/src/parallel/decompose/decompose/fvFieldDecomposerDecomposeFields.C
index a5e87d2097ca5f247eb11f7a1d4d5189a1b307b7..cffd1a6e1e239ca899475eee1b67a6f9c9addbc1 100644
--- a/src/parallel/decompose/decompose/fvFieldDecomposerDecomposeFields.C
+++ b/src/parallel/decompose/decompose/fvFieldDecomposerDecomposeFields.C
@@ -40,6 +40,8 @@ Foam::fvFieldDecomposer::decomposeField
     const bool allowUnknownPatchFields
 ) const
 {
+    typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
+
     // 1. Create the complete field with dummy patch fields
     PtrList<fvPatchField<Type>> patchFields(boundaryAddressing_.size());
 
@@ -58,9 +60,9 @@ Foam::fvFieldDecomposer::decomposeField
     }
 
     // Create the field for the processor
-    tmp<GeometricField<Type, fvPatchField, volMesh>> tresF
+    tmp<VolFieldType> tresF
     (
-        new GeometricField<Type, fvPatchField, volMesh>
+        new VolFieldType
         (
             IOobject
             (
@@ -76,18 +78,18 @@ Foam::fvFieldDecomposer::decomposeField
             patchFields
         )
     );
-    GeometricField<Type, fvPatchField, volMesh>& resF = tresF.ref();
+    VolFieldType& resF = tresF.ref();
+    resF.oriented() = field().oriented();
 
 
     // 2. Change the fvPatchFields to the correct type using a mapper
     //  constructor (with reference to the now correct internal field)
 
-    typename GeometricField<Type, fvPatchField, volMesh>::
-        Boundary& bf = resF.boundaryFieldRef();
+    typename VolFieldType::Boundary& bf = resF.boundaryFieldRef();
 
     forAll(bf, patchi)
     {
-        if (patchFieldDecomposerPtrs_[patchi])
+        if (patchFieldDecomposerPtrs_.set(patchi))
         {
             bf.set
             (
@@ -97,7 +99,7 @@ Foam::fvFieldDecomposer::decomposeField
                     field.boundaryField()[boundaryAddressing_[patchi]],
                     procMesh_.boundary()[patchi],
                     resF(),
-                    *patchFieldDecomposerPtrs_[patchi]
+                    patchFieldDecomposerPtrs_[patchi]
                 )
             );
         }
@@ -113,7 +115,7 @@ Foam::fvFieldDecomposer::decomposeField
                     Field<Type>
                     (
                         field.primitiveField(),
-                        *processorVolPatchFieldDecomposerPtrs_[patchi]
+                        processorVolPatchFieldDecomposerPtrs_[patchi]
                     )
                 )
             );
@@ -130,7 +132,7 @@ Foam::fvFieldDecomposer::decomposeField
                     Field<Type>
                     (
                         field.primitiveField(),
-                        *processorVolPatchFieldDecomposerPtrs_[patchi]
+                        processorVolPatchFieldDecomposerPtrs_[patchi]
                     )
                 )
             );
@@ -166,6 +168,8 @@ Foam::fvFieldDecomposer::decomposeField
     const GeometricField<Type, fvsPatchField, surfaceMesh>& field
 ) const
 {
+    typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
+
     labelList mapAddr
     (
         labelList::subList
@@ -200,7 +204,7 @@ Foam::fvFieldDecomposer::decomposeField
 
     forAll(field.boundaryField(), patchi)
     {
-        const Field<Type> & p = field.boundaryField()[patchi];
+        const Field<Type>& p = field.boundaryField()[patchi];
 
         const label patchStart = field.mesh().boundaryMesh()[patchi].start();
 
@@ -228,9 +232,9 @@ Foam::fvFieldDecomposer::decomposeField
         );
     }
 
-    tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tresF
+    tmp<SurfaceFieldType> tresF
     (
-        new GeometricField<Type, fvsPatchField, surfaceMesh>
+        new SurfaceFieldType
         (
             IOobject
             (
@@ -246,18 +250,17 @@ Foam::fvFieldDecomposer::decomposeField
             patchFields
         )
     );
-    GeometricField<Type, fvsPatchField, surfaceMesh>& resF = tresF.ref();
-
+    SurfaceFieldType& resF = tresF.ref();
+    resF.oriented() = field().oriented();
 
     // 2. Change the fvsPatchFields to the correct type using a mapper
     //  constructor (with reference to the now correct internal field)
 
-    typename GeometricField<Type, fvsPatchField, surfaceMesh>::
-        Boundary& bf = resF.boundaryFieldRef();
+    typename SurfaceFieldType::Boundary& bf = resF.boundaryFieldRef();
 
     forAll(boundaryAddressing_, patchi)
     {
-        if (patchFieldDecomposerPtrs_[patchi])
+        if (patchFieldDecomposerPtrs_.set(patchi))
         {
             bf.set
             (
@@ -267,7 +270,7 @@ Foam::fvFieldDecomposer::decomposeField
                     field.boundaryField()[boundaryAddressing_[patchi]],
                     procMesh_.boundary()[patchi],
                     resF(),
-                    *patchFieldDecomposerPtrs_[patchi]
+                    patchFieldDecomposerPtrs_[patchi]
                 )
             );
         }
@@ -283,10 +286,15 @@ Foam::fvFieldDecomposer::decomposeField
                     Field<Type>
                     (
                         allFaceField,
-                        *processorSurfacePatchFieldDecomposerPtrs_[patchi]
+                        processorSurfacePatchFieldDecomposerPtrs_[patchi]
                     )
                 )
             );
+
+            if (resF.oriented()())
+            {
+                bf[patchi] *= faceSign_[patchi];
+            }
         }
         else if (isA<processorFvPatch>(procMesh_.boundary()[patchi]))
         {
@@ -300,10 +308,15 @@ Foam::fvFieldDecomposer::decomposeField
                     Field<Type>
                     (
                         allFaceField,
-                        *processorSurfacePatchFieldDecomposerPtrs_[patchi]
+                        processorSurfacePatchFieldDecomposerPtrs_[patchi]
                     )
                 )
             );
+
+            if (resF.oriented()())
+            {
+                bf[patchi] *= faceSign_[patchi];
+            }
         }
         else
         {
diff --git a/src/parallel/reconstruct/reconstruct/fvFieldReconstructorReconstructFields.C b/src/parallel/reconstruct/reconstruct/fvFieldReconstructorReconstructFields.C
index 88a8d1b5320feab5e9d3e43e87f3c886428e786b..e7bd26b2cc95d2c4351c269360a2f62fde4b2f32 100644
--- a/src/parallel/reconstruct/reconstruct/fvFieldReconstructorReconstructFields.C
+++ b/src/parallel/reconstruct/reconstruct/fvFieldReconstructorReconstructFields.C
@@ -56,7 +56,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeInternalField
         );
     }
 
-    return tmp<DimensionedField<Type, volMesh>>
+    tmp<DimensionedField<Type, volMesh>> tfield
     (
         new DimensionedField<Type, volMesh>
         (
@@ -66,6 +66,10 @@ Foam::fvFieldReconstructor::reconstructFvVolumeInternalField
             internalField
         )
     );
+
+    tfield.ref().oriented() = procFields[0].oriented();
+
+    return tfield;
 }
 
 
@@ -282,7 +286,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
 
     // Now construct and write the field
     // setting the internalField and patchFields
-    return tmp<GeometricField<Type, fvPatchField, volMesh>>
+    tmp<GeometricField<Type, fvPatchField, volMesh>> tfield
     (
         new GeometricField<Type, fvPatchField, volMesh>
         (
@@ -293,6 +297,10 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
             patchFields
         )
     );
+
+    tfield.ref().oriented() = procFields[0].oriented();
+
+    return tfield;
 }
 
 
@@ -523,7 +531,7 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
 
     // Now construct and write the field
     // setting the internalField and patchFields
-    return tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
+    tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tfield
     (
         new GeometricField<Type, fvsPatchField, surfaceMesh>
         (
@@ -534,6 +542,10 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
             patchFields
         )
     );
+
+    tfield.ref().oriented() = procFields[0].oriented();
+
+    return tfield;
 }
 
 
diff --git a/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelStateIO.C b/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelStateIO.C
index c17819b410d922abb3ac92b818df8beaa2f81216..038d42a31a01f62718f15c1b30e3e2ad85006371 100644
--- a/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelStateIO.C
+++ b/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelStateIO.C
@@ -59,13 +59,7 @@ Foam::Istream& Foam::RBD::operator>>
         >> state.qDdot_
         >> state.deltaT_;
 
-    // Check state of Istream
-    is.check
-    (
-        "Foam::Istream& Foam::operator>>"
-        "(Foam::Istream&, Foam::RBD::rigidBodyModelState&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -81,13 +75,7 @@ Foam::Ostream& Foam::RBD::operator<<
         << token::SPACE << state.qDdot_
         << token::SPACE << state.deltaT_;
 
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
-        "const Foam::RBD::rigidBodyModelState&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/sampling/sampledSurface/sampledSurface/sampledSurface.C b/src/sampling/sampledSurface/sampledSurface/sampledSurface.C
index 0901dc4c94150b02a2f5d1b787911377fd09ccf6..b075331031339f79facc888298c84c71e55c1c4b 100644
--- a/src/sampling/sampledSurface/sampledSurface/sampledSurface.C
+++ b/src/sampling/sampledSurface/sampledSurface/sampledSurface.C
@@ -244,7 +244,7 @@ void Foam::sampledSurface::print(Ostream& os) const
 Foam::Ostream& Foam::operator<<(Ostream &os, const sampledSurface& s)
 {
     s.print(os);
-    os.check("Ostream& operator<<(Ostream&, const sampledSurface&");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C
index 24984eec5b32110ed936305d52f0dcbb0e427b49..e24f81f448c8383c1ae45da51086b8d681f82b30 100644
--- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C
+++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C
@@ -70,13 +70,7 @@ Foam::Istream& Foam::operator>>
         >> sDoFRBMS.pi_
         >> sDoFRBMS.tau_;
 
-    // Check state of Istream
-    is.check
-    (
-        "Foam::Istream& Foam::operator>>"
-        "(Foam::Istream&, Foam::sixDoFRigidBodyMotionState&)"
-    );
-
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -94,13 +88,7 @@ Foam::Ostream& Foam::operator<<
         << token::SPACE << sDoFRBMS.pi()
         << token::SPACE << sDoFRBMS.tau();
 
-    // Check state of Ostream
-    os.check
-    (
-        "Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
-        "const Foam::sixDoFRigidBodyMotionState&)"
-    );
-
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/surfMesh/MeshedSurface/MeshedSurfaceIO.C b/src/surfMesh/MeshedSurface/MeshedSurfaceIO.C
index a8c8e4c7a3291292151ac3b68cc24b644a9cc4f0..296a93db1e20583857ef11b146043ce31da39af1 100644
--- a/src/surfMesh/MeshedSurface/MeshedSurfaceIO.C
+++ b/src/surfMesh/MeshedSurface/MeshedSurfaceIO.C
@@ -38,7 +38,7 @@ Foam::Istream& Foam::MeshedSurface<Face>::read(Istream& is)
         >> this->storedPoints()
         >> this->storedFaces();
 
-    is.check("MeshedSurface::read(Istream&)");
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -50,7 +50,7 @@ Foam::Ostream& Foam::MeshedSurface<Face>::write(Ostream& os) const
         << this->points()
         << this->surfFaces();
 
-    os.check("MeshedSurface::write(Ostream&) const");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
index 7ac9a3e598c536a08433fe787aff92370aaeb6af..b54f3c4ce1da3a572c956b7c4ba96c1c53add50c 100644
--- a/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
+++ b/src/surfMesh/UnsortedMeshedSurface/UnsortedMeshedSurface.C
@@ -327,9 +327,8 @@ void Foam::UnsortedMeshedSurface<Face>::setOneZone()
         zoneName = "zone0";
     }
 
-    // set single default zone
-    zoneToc_.setSize(1);
-    zoneToc_[0] = surfZoneIdentifier(zoneName, 0);
+    // Set single default zone
+    zoneToc_ = { surfZoneIdentifier(zoneName, 0) };
 }
 
 
@@ -446,7 +445,7 @@ Foam::Istream& Foam::UnsortedMeshedSurface<Face>::read(Istream& is)
         >> this->storedPoints()
         >> this->storedFaces();
 
-    is.check("UnsortedMeshedSurface::read(Istream&)");
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -458,7 +457,7 @@ Foam::Ostream& Foam::UnsortedMeshedSurface<Face>::write(Ostream& os) const
         << this->points()
         << this->surfFaces();
 
-    os.check("UnsortedMeshedSurface::write(Ostream&) const");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/surfMesh/surfZone/surfZone/surfZone.C b/src/surfMesh/surfZone/surfZone/surfZone.C
index 2620f2b4fbf171e78d3908bc2aff5678e48bfe90..e2699243b5c6f5e3d409392a3a8f92a5bc4360a5 100644
--- a/src/surfMesh/surfZone/surfZone/surfZone.C
+++ b/src/surfMesh/surfZone/surfZone/surfZone.C
@@ -148,7 +148,7 @@ Foam::Istream& Foam::operator>>(Istream& is, surfZone& zone)
 {
     zone = surfZone(is, 0);
 
-    is.check("Istream& operator>>(Istream&, surfZone&)");
+    is.check(FUNCTION_NAME);
     return is;
 }
 
@@ -156,7 +156,7 @@ Foam::Istream& Foam::operator>>(Istream& is, surfZone& zone)
 Foam::Ostream& Foam::operator<<(Ostream& os, const surfZone& zone)
 {
     zone.write(os);
-    os.check("Ostream& operator<<(Ostream&, const surfZone&");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/surfMesh/triSurface/interfaces/AC3D/readAC.C b/src/surfMesh/triSurface/interfaces/AC3D/readAC.C
index 8d300f08a1ac5ff2549c48655deb79a023504b39..f17128756885fe36e7dc0fab3939355d78e2f689 100644
--- a/src/surfMesh/triSurface/interfaces/AC3D/readAC.C
+++ b/src/surfMesh/triSurface/interfaces/AC3D/readAC.C
@@ -183,7 +183,7 @@ bool triSurface::readAC(const fileName& ACfileName)
         );
 
         // Object global values
-        string patchName = string("patch") + name(patchi);
+        string patchName = string("patch") + Foam::name(patchi);
         label nVerts = 0;
         tensor rot(I);
         vector loc(0, 0, 0);
@@ -319,7 +319,6 @@ bool triSurface::readAC(const fileName& ACfileName)
                 patches[patchi] =
                     geometricSurfacePatch
                     (
-                        "empty",
                         word(patchName),
                         patchi
                     );
diff --git a/src/surfMesh/triSurface/interfaces/NAS/readNAS.C b/src/surfMesh/triSurface/interfaces/NAS/readNAS.C
index c98b11f08c05fcad586dff2ca36f4056f47ed802..ae55c60ca37df322cf937145351b660c19b096dd 100644
--- a/src/surfMesh/triSurface/interfaces/NAS/readNAS.C
+++ b/src/surfMesh/triSurface/interfaces/NAS/readNAS.C
@@ -372,16 +372,10 @@ bool triSurface::readNAS(const fileName& fName)
     // Convert groupToPatch to patchList.
     geometricSurfacePatchList patches(nPatches);
 
-    forAllConstIter(Map<word>, groupToName, iter)
+    forAllConstIters(groupToName, iter)
     {
-        label patchi = groupToPatch[iter.key()];
-
-        patches[patchi] = geometricSurfacePatch
-        (
-            "empty",
-            iter(),
-            patchi
-        );
+        const label patchIdx = groupToPatch[iter.key()];
+        patches[patchIdx] = geometricSurfacePatch(iter.object(), patchIdx);
     }
 
     Info<< "patches:" << patches << endl;
diff --git a/src/surfMesh/triSurface/interfaces/OBJ/readOBJ.C b/src/surfMesh/triSurface/interfaces/OBJ/readOBJ.C
index 907669961b6042bc35a1e5fe5a200a610acb356c..f13f1535bd29deb3c7c2f6815f3be7afc9f543a1 100644
--- a/src/surfMesh/triSurface/interfaces/OBJ/readOBJ.C
+++ b/src/surfMesh/triSurface/interfaces/OBJ/readOBJ.C
@@ -1,4 +1,3 @@
-
 /*---------------------------------------------------------------------------*\
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
@@ -172,19 +171,19 @@ bool Foam::triSurface::readOBJ(const fileName& OBJfileName)
 
     if (maxGroupID == 0)
     {
-        // Generate default patch
-        patches.setSize(1);
-        patches[0] = geometricSurfacePatch("empty", "patch0", 0);
+        // Add single (default) patch
+        patches = { geometricSurfacePatch("patch0", 0) };
     }
     else
     {
-        forAllConstIter(HashTable<label>, groupToPatch, iter)
+        forAllConstIters(groupToPatch, iter)
         {
-            patches[iter()] = geometricSurfacePatch
+            const label patchIdx = iter.object();
+
+            patches[patchIdx] = geometricSurfacePatch
             (
-                "empty",
                 iter.key(),
-                iter()
+                patchIdx
             );
         }
     }
diff --git a/src/surfMesh/triSurface/interfaces/TRI/readTRI.C b/src/surfMesh/triSurface/interfaces/TRI/readTRI.C
index f11ddcfd5ef3c898333accf756348159f4cb0eab..841ab10692d7f19f7791773180f017bba128fbf2 100644
--- a/src/surfMesh/triSurface/interfaces/TRI/readTRI.C
+++ b/src/surfMesh/triSurface/interfaces/TRI/readTRI.C
@@ -163,7 +163,7 @@ bool Foam::triSurface::readTRI(const fileName& TRIfileName)
     forAll(names, nameI)
     {
         patches_[nameI].name() = names[nameI];
-        patches_[nameI].geometricType() = "empty";
+        patches_[nameI].geometricType() = geometricSurfacePatch::emptyType;
     }
 
     return true;
diff --git a/src/surfMesh/triSurface/interfaces/VTK/readVTK.C b/src/surfMesh/triSurface/interfaces/VTK/readVTK.C
index b413641102d4754d23cda88562680cecce0221cb..d19b38e96c7d61705fe2c83091b65abda6f2493b 100644
--- a/src/surfMesh/triSurface/interfaces/VTK/readVTK.C
+++ b/src/surfMesh/triSurface/interfaces/VTK/readVTK.C
@@ -67,13 +67,13 @@ bool Foam::triSurface::readVTK(const fileName& fName)
 
             patches[zoneI] = geometricSurfacePatch
             (
-                zone.geometricType().size() ? zone.geometricType() : "empty",
                 regionName,
-                zoneI
+                zoneI,
+                zone.geometricType()
             );
 
             // Set triangle regions
-            for (label i = zone.start(); i < zone.start()+zone.size(); i++)
+            for (label i = zone.start(); i < zone.start()+zone.size(); ++i)
             {
                 tris[i].region() = zoneI;
             }
@@ -81,11 +81,9 @@ bool Foam::triSurface::readVTK(const fileName& fName)
     }
     else
     {
-        // Add single patch
-        patches.setSize(1);
-        patches[0] = geometricSurfacePatch("empty", "patch0", 0);
-
+        // Add single (default) patch
         // Triangle regions already set to 0
+        patches = { geometricSurfacePatch("patch0", 0) };
     }
 
 
diff --git a/src/surfMesh/triSurface/patches/geometricSurfacePatch.C b/src/surfMesh/triSurface/patches/geometricSurfacePatch.C
index 6bfd83e14c77407b669b35112ea265e5dcc527ff..45c3191b35df63422372eccfa4f0f67e5a31e39e 100644
--- a/src/surfMesh/triSurface/patches/geometricSurfacePatch.C
+++ b/src/surfMesh/triSurface/patches/geometricSurfacePatch.C
@@ -26,28 +26,54 @@ License
 #include "geometricSurfacePatch.H"
 #include "dictionary.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
 {
+defineTypeNameAndDebug(geometricSurfacePatch, 0);
+}
 
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+const Foam::word Foam::geometricSurfacePatch::emptyType = "empty";
 
-defineTypeNameAndDebug(geometricSurfacePatch, 0);
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct null
-geometricSurfacePatch::geometricSurfacePatch()
+Foam::geometricSurfacePatch::geometricSurfacePatch()
 :
-    geometricType_("empty"),
+    geometricType_(emptyType),
     name_("patch"),
     index_(0)
 {}
 
 
-// Construct from components
-geometricSurfacePatch::geometricSurfacePatch
+Foam::geometricSurfacePatch::geometricSurfacePatch(const label index)
+:
+    geometricType_(emptyType),
+    name_("patch"),
+    index_(index)
+{}
+
+
+Foam::geometricSurfacePatch::geometricSurfacePatch
+(
+    const word& name,
+    const label index,
+    const word& geometricType
+)
+:
+    geometricType_(geometricType),
+    name_(name),
+    index_(index)
+
+{
+    if (geometricType_.empty())
+    {
+        geometricType_ = emptyType;
+    }
+}
+
+
+Foam::geometricSurfacePatch::geometricSurfacePatch
 (
     const word& geometricType,
     const word& name,
@@ -61,13 +87,16 @@ geometricSurfacePatch::geometricSurfacePatch
 {
     if (geometricType_.empty())
     {
-        geometricType_ = "empty";
+        geometricType_ = emptyType;
     }
 }
 
 
-// Construct from Istream
-geometricSurfacePatch::geometricSurfacePatch(Istream& is, const label index)
+Foam::geometricSurfacePatch::geometricSurfacePatch
+(
+    Istream& is,
+    const label index
+)
 :
     geometricType_(is),
     name_(is),
@@ -75,89 +104,82 @@ geometricSurfacePatch::geometricSurfacePatch(Istream& is, const label index)
 {
     if (geometricType_.empty())
     {
-        geometricType_ = "empty";
+        geometricType_ = emptyType;
     }
 }
 
 
-// Construct from dictionary
-geometricSurfacePatch::geometricSurfacePatch
+Foam::geometricSurfacePatch::geometricSurfacePatch
 (
     const word& name,
     const dictionary& dict,
     const label index
 )
 :
-    geometricType_(dict.lookup("geometricType")),
+    geometricType_(emptyType),
     name_(name),
     index_(index)
 {
-    if (geometricType_.empty())
-    {
-        geometricType_ = "empty";
-    }
+    dict.readIfPresent("geometricType", geometricType_);
 }
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-// Write
-void geometricSurfacePatch::write(Ostream& os) const
+void Foam::geometricSurfacePatch::write(Ostream& os) const
 {
     os  << nl << name_
         << nl << geometricType_;
 }
 
 
-void geometricSurfacePatch::writeDict(Ostream& os) const
+void Foam::geometricSurfacePatch::writeDict(Ostream& os) const
 {
-    os  << "    geometricType " << geometricType_ << ';' << nl;
+    os.writeEntry("geometricType", geometricType_);
 }
 
 
-// * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
-bool Foam::geometricSurfacePatch::operator!=(const geometricSurfacePatch& p)
-    const
+bool Foam::operator==
+(
+    const geometricSurfacePatch& a,
+    const geometricSurfacePatch& b
+)
 {
-    return !(*this == p);
+    return
+    (
+        (a.geometricType() == b.geometricType())
+     && (a.name() == b.name())
+    );
 }
 
 
-bool Foam::geometricSurfacePatch::operator==(const geometricSurfacePatch& p)
-    const
+bool Foam::operator!=
+(
+    const geometricSurfacePatch& a,
+    const geometricSurfacePatch& b
+)
 {
-    return
-    (
-        (geometricType() == p.geometricType())
-     && (name() == p.name())
-    );
+    return !(a == b);
 }
 
 
 // * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //
 
-Istream& operator>>(Istream& is, geometricSurfacePatch& gp)
+Foam::Istream& Foam::operator>>(Istream& is, geometricSurfacePatch& p)
 {
-    is >> gp.name_ >> gp.geometricType_;
-
+    is >> p.name_ >> p.geometricType_;
     return is;
 }
 
 
-Ostream& operator<<(Ostream& os, const geometricSurfacePatch& gp)
+Foam::Ostream& Foam::operator<<(Ostream& os, const geometricSurfacePatch& p)
 {
-    gp.write(os);
-    os.check
-    (
-        "Ostream& operator<<(Ostream& f, const geometricSurfacePatch& gp)"
-    );
+    p.write(os);
+    os.check(FUNCTION_NAME);
     return os;
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/src/surfMesh/triSurface/patches/geometricSurfacePatch.H b/src/surfMesh/triSurface/patches/geometricSurfacePatch.H
index 3a54b71975b7e6d0e94b4cb472a1ece77f006762..3adfe452d7a4d77e9870040ab2d63abdc7db4318 100644
--- a/src/surfMesh/triSurface/patches/geometricSurfacePatch.H
+++ b/src/surfMesh/triSurface/patches/geometricSurfacePatch.H
@@ -47,8 +47,14 @@ namespace Foam
 
 class dictionary;
 
+// Forward declaration of friend functions and operators
+class geometricSurfacePatch;
+
+Istream& operator>>(Istream& is, geometricSurfacePatch& p);
+Ostream& operator<<(Ostream& os, const geometricSurfacePatch& p);
+
 /*---------------------------------------------------------------------------*\
-                           Class geometricSurfacePatch Declaration
+                    Class geometricSurfacePatch Declaration
 \*---------------------------------------------------------------------------*/
 
 class geometricSurfacePatch
@@ -66,6 +72,12 @@ class geometricSurfacePatch
 
 public:
 
+    // Public data
+
+        //- The name for an 'empty' type
+        static const word emptyType;
+
+
     //- Runtime type information
     ClassName("geometricSurfacePatch");
 
@@ -75,6 +87,17 @@ public:
         //- Construct null
         geometricSurfacePatch();
 
+        //- Construct null with specified index
+        explicit geometricSurfacePatch(const label index);
+
+        //- Construct from components
+        geometricSurfacePatch
+        (
+            const word& name,
+            const label index,
+            const word& geometricType = word::null
+        );
+
         //- Construct from components
         geometricSurfacePatch
         (
@@ -83,9 +106,6 @@ public:
             const label index
         );
 
-        //- Construct from Istream
-        geometricSurfacePatch(Istream&, const label index);
-
         //- Construct from dictionary
         geometricSurfacePatch
         (
@@ -94,6 +114,9 @@ public:
             const label index
         );
 
+        //- Construct from Istream
+        geometricSurfacePatch(Istream& is, const label index);
+
 
     // Member Functions
 
@@ -109,50 +132,51 @@ public:
             return name_;
         }
 
-        //- Return the type of the patch
+        //- Return the geometric type of the patch
         const word& geometricType() const
         {
             return geometricType_;
         }
 
-        //- Return the type of the patch
+        //- Return the geometric type of the patch for modification
         word& geometricType()
         {
             return geometricType_;
         }
 
-        //- Return the index of this patch in the boundaryMesh
+        //- Return the index of this patch in the surface mesh
         label index() const
         {
             return index_;
         }
 
-        //- Return the index of this patch in the boundaryMesh
+        //- Return the index of this patch in the surface mesh for modification
         label& index()
         {
             return index_;
         }
 
         //- Write
-        void write(Ostream&) const;
+        void write(Ostream& os) const;
 
         //- Write dictionary
-        void writeDict(Ostream&) const;
+        void writeDict(Ostream& os) const;
 
 
-    // Member Operators
+    // Ostream Operator
 
-        bool operator!=(const geometricSurfacePatch&) const;
+        friend Istream& operator>>(Istream& is, geometricSurfacePatch& p);
+        friend Ostream& operator<<(Ostream& os, const geometricSurfacePatch& p);
+};
 
-        //- compare.
-        bool operator==(const geometricSurfacePatch&) const;
 
+// Global Operators
 
-    // Ostream Operator
+//- Compare patches for equality
+bool operator==(const geometricSurfacePatch& a, const geometricSurfacePatch& b);
 
-        friend Ostream& operator<<(Ostream&, const geometricSurfacePatch&);
-        friend Istream& operator>>(Istream&, geometricSurfacePatch&);
-};
+//- Compare patches for inequality
+bool operator!=(const geometricSurfacePatch& a, const geometricSurfacePatch& b);
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/surfMesh/triSurface/patches/surfacePatch.C b/src/surfMesh/triSurface/patches/surfacePatch.C
index 6b09d556230721e5585ea3b49a3e9afb850821c0..f3cbc76dea03fe748c1079ce0171a8c7466cf77e 100644
--- a/src/surfMesh/triSurface/patches/surfacePatch.C
+++ b/src/surfMesh/triSurface/patches/surfacePatch.C
@@ -158,7 +158,7 @@ bool Foam::surfacePatch::operator==(const surfacePatch& p) const
 Foam::Ostream& Foam::operator<<(Ostream& os, const surfacePatch& p)
 {
     p.write(os);
-    os.check("Ostream& operator<<(Ostream& f, const surfacePatch& p");
+    os.check(FUNCTION_NAME);
     return os;
 }
 
diff --git a/src/surfMesh/triSurface/triSurface.C b/src/surfMesh/triSurface/triSurface.C
index d1ff1919c58515a85e360f933aa521c0fb7b4191..fa8c7ba874c733346007586db38076584317fb92 100644
--- a/src/surfMesh/triSurface/triSurface.C
+++ b/src/surfMesh/triSurface/triSurface.C
@@ -623,7 +623,7 @@ Foam::triSurface::calcPatches(labelList& faceMap) const
         }
         else
         {
-            newPatch.geometricType() = "empty";
+            newPatch.geometricType() = geometricSurfacePatch::emptyType;
         }
 
         startFacei += newPatch.size();
@@ -1157,7 +1157,7 @@ void Foam::triSurface::write(Ostream& os) const
         << static_cast<const List<labelledTri>&>(*this) << endl;
 
     // Check state of Ostream
-    os.check("triSurface::write(Ostream&)");
+    os.check(FUNCTION_NAME);
 }
 
 
@@ -1181,14 +1181,15 @@ void Foam::triSurface::writeStats(Ostream& os) const
 
     label nPoints = 0;
     boundBox bb(boundBox::invertedBox);
+    labelHashSet regionsUsed;
 
-    forAll(*this, facei)
+    for (const triSurface::FaceType& f : *this)
     {
-        const triSurface::FaceType& f = operator[](facei);
+        regionsUsed.insert(f.region());
 
         forAll(f, fp)
         {
-            label pointi = f[fp];
+            const label pointi = f[fp];
             if (pointIsUsed.set(pointi, 1))
             {
                 bb.add(points()[pointi]);
@@ -1197,8 +1198,9 @@ void Foam::triSurface::writeStats(Ostream& os) const
         }
     }
 
-    os  << "Triangles    : " << size() << endl
-        << "Vertices     : " << nPoints << endl
+    os  << "Triangles    : " << size()
+        << " in " << regionsUsed.size() <<  " region(s)" << nl
+        << "Vertices     : " << nPoints << nl
         << "Bounding Box : " << bb << endl;
 }
 
diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C b/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C
index b589708163b1de3edc9d3776bbce54fd90f6ad24..56817cd219d5406aebcfef2e76755009d4fba844 100644
--- a/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C
+++ b/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C
@@ -41,7 +41,7 @@ typename Table::iterator Foam::basicThermo::lookupThermo
     typename Table::iterator cstrIter = tablePtr->find(thermoTypeName);
 
     // Print error message if package not found in the table
-    if (cstrIter == tablePtr->end())
+    if (!cstrIter.found())
     {
         FatalErrorInFunction
             << "Unknown " << Thermo::typeName << " type " << nl
@@ -182,7 +182,7 @@ typename Table::iterator Foam::basicThermo::lookupThermo
 
         typename Table::iterator cstrIter = tablePtr->find(thermoTypeName);
 
-        if (cstrIter == tablePtr->end())
+        if (!cstrIter.found())
         {
             FatalErrorInFunction
                 << "Unknown " << Thermo::typeName << " type "
diff --git a/src/thermophysicalModels/specie/specie/specie.C b/src/thermophysicalModels/specie/specie/specie.C
index 508d7556268bb3bfaf514220b970c3dd50e45e6a..a0e81f0a0b47b3be8cbe8b5bbe03c6035dfd70cd 100644
--- a/src/thermophysicalModels/specie/specie/specie.C
+++ b/src/thermophysicalModels/specie/specie/specie.C
@@ -63,7 +63,7 @@ void Foam::specie::write(Ostream& os) const
 Foam::Ostream& Foam::operator<<(Ostream& os, const specie& st)
 {
     st.write(os);
-    os.check("Ostream& operator<<(Ostream& os, const specie& st)");
+    os.check(FUNCTION_NAME);
     return os;
 }