diff --git a/applications/test/stringList/stringListTest.C b/applications/test/stringList/stringListTest.C
index 98391ef5befeca9a19ce85fb157db32fb86d253c..13718be6f06c034b128ce78ef7f7e8a07eb332bf 100644
--- a/applications/test/stringList/stringListTest.C
+++ b/applications/test/stringList/stringListTest.C
@@ -27,6 +27,7 @@ Description
 \*---------------------------------------------------------------------------*/
 
 #include "stringListOps.H"
+#include "IStringStream.H"
 #include "IOstreams.H"
 
 using namespace Foam;
@@ -36,21 +37,59 @@ using namespace Foam;
 
 int main(int argc, char *argv[])
 {
-    stringList sl(3);
-    sl[0] = "hello";
-    sl[1] = "heello";
-    sl[2] = "heeello";
+    stringList strLst
+    (
+        IStringStream
+        (
+            "("
+            "\"hello\""
+            "\"heello\""
+            "\"heeello\""
+            "\"bye\""
+            "\"bbye\""
+            "\"bbbye\""
+            "\"okey\""
+            "\"okkey\""
+            "\"okkkey\""
+            ")"
+        )()
+    );
 
-    labelList matches = findStrings(".*ee.*", sl);
+    wordReList reLst(IStringStream("( okey \"[hy]e+.*\" )")());
 
-    Info<< "matches found for regexp .*ee.* : ";
+    Info<< "stringList " << strLst << nl;
+
+    labelList matches = findStrings(".*ee.*", strLst);
+
+    Info<< "matches found for regexp .*ee.* :" << nl << matches << nl;
+    forAll(matches, i)
+    {
+        Info<< " -> " << strLst[matches[i]] << nl;
+    }
+    Info<< endl;
+
+    matches = findStrings(reLst, strLst);
+
+    Info<< "matches found for " << reLst << nl << matches << nl;
     forAll(matches, i)
     {
-        Info<< " " << sl[matches[i]];
+        Info<< " -> " << strLst[matches[i]] << nl;
     }
     Info<< endl;
 
-    Info << "End\n" << endl;
+    stringList subLst = subsetStrings(".*ee.*", strLst);
+    Info<< "subset stringList: " << subLst << nl;
+
+    subLst = subsetStrings(reLst, strLst);
+    Info<< "subset stringList: " << subLst << nl;
+
+    inplaceSubsetStrings(reLst, strLst);
+    Info<< "subsetted stringList: " << strLst << nl;
+
+    inplaceSubsetStrings(".*l.*", strLst);
+    Info<< "subsetted stringList: " << strLst << nl;
+
+    Info<< "\nEnd\n" << endl;
 
     return 0;
 }
diff --git a/applications/utilities/mesh/generation/blockMesh/Make/files b/applications/utilities/mesh/generation/blockMesh/Make/files
index 81f5f3674918295d0a0f8c5c2fcc141e089886e1..74840e97328085d8311cfb901c9311765de142ec 100644
--- a/applications/utilities/mesh/generation/blockMesh/Make/files
+++ b/applications/utilities/mesh/generation/blockMesh/Make/files
@@ -1,31 +1,3 @@
-curvedEdges = curvedEdges
-
-$(curvedEdges)/curvedEdge.C
-$(curvedEdges)/lineEdge.C
-$(curvedEdges)/polyLine.C
-$(curvedEdges)/polyLineEdge.C
-$(curvedEdges)/arcEdge.C
-$(curvedEdges)/spline.C
-$(curvedEdges)/BSpline.C
-$(curvedEdges)/simpleSplineEdge.C
-$(curvedEdges)/polySplineEdge.C
-$(curvedEdges)/lineDivide.C
-
-blockMesh.C
-blockDescriptor.C
-setEdge.C
-block.C
-createTopology.C
-checkBlockMesh.C
-createBlockOffsets.C
-createMergeList.C
-createPoints.C
-createCells.C
-createPatches.C
-blockPoints.C
-blockCells.C
-blockBoundary.C
-
 blockMeshApp.C
 
 EXE = $(FOAM_APPBIN)/blockMesh
diff --git a/applications/utilities/mesh/generation/blockMesh/Make/options b/applications/utilities/mesh/generation/blockMesh/Make/options
index a5b85e4298be86801fb2b27b96781019a64704cd..2e07c477da808accff105fbb6ae0922d0768cddc 100644
--- a/applications/utilities/mesh/generation/blockMesh/Make/options
+++ b/applications/utilities/mesh/generation/blockMesh/Make/options
@@ -1,8 +1,9 @@
 EXE_INC = \
-    -I$(curvedEdges) \
+    -I$(LIB_SRC)/mesh/blockMesh/lnInclude \
     -I$(LIB_SRC)/meshTools/lnInclude \
     -I$(LIB_SRC)/dynamicMesh/lnInclude
 
 EXE_LIBS = \
+    -lblockMesh \
     -lmeshTools \
     -ldynamicMesh
diff --git a/applications/utilities/mesh/generation/blockMesh/blockBoundary.C b/applications/utilities/mesh/generation/blockMesh/blockBoundary.C
deleted file mode 100644
index 8086aeea546ecba03980fc4bfe20b71aa5c3f194..0000000000000000000000000000000000000000
--- a/applications/utilities/mesh/generation/blockMesh/blockBoundary.C
+++ /dev/null
@@ -1,209 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by the
-    Free Software Foundation; either version 2 of the License, or (at your
-    option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Description
-    private member of block. Creates boundary patches for the block
-
-\*---------------------------------------------------------------------------*/
-
-#include "error.H"
-#include "block.H"
-
-
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
-
-void Foam::block::blockBoundary()
-{
-    label ni = blockDef_.n().x();
-    label nj = blockDef_.n().y();
-    label nk = blockDef_.n().z();
-
-    // x-direction
-
-    label wallLabel = 0;
-    label wallCellLabel = 0;
-
-    // x-min
-    boundaryPatches_[wallLabel].setSize(nj*nk);
-    for (label k = 0; k <= nk - 1; k++)
-    {
-        for (label j = 0; j <= nj - 1; j++)
-        {
-            boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
-
-            // set the points
-            boundaryPatches_[wallLabel][wallCellLabel][0] =
-                vtxLabel(0, j, k);
-            boundaryPatches_[wallLabel][wallCellLabel][1] =
-                vtxLabel(0, j, k + 1);
-            boundaryPatches_[wallLabel][wallCellLabel][2] =
-                vtxLabel(0, j + 1, k + 1);
-            boundaryPatches_[wallLabel][wallCellLabel][3] =
-                vtxLabel(0, j + 1, k);
-
-            // update the counter
-            wallCellLabel++;
-        }
-    }
-
-    // x-max
-    wallLabel++;
-    wallCellLabel = 0;
-
-    boundaryPatches_[wallLabel].setSize(nj*nk);
-
-    for (label k = 0; k <= nk - 1; k++)
-    {
-        for (label j = 0; j <= nj - 1; j++)
-        {
-            boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
-
-            // set the points
-            boundaryPatches_[wallLabel][wallCellLabel][0] =
-                vtxLabel(ni, j, k);
-            boundaryPatches_[wallLabel][wallCellLabel][1] =
-                vtxLabel(ni, j+1, k);
-            boundaryPatches_[wallLabel][wallCellLabel][2] =
-                vtxLabel(ni, j+1, k+1);
-            boundaryPatches_[wallLabel][wallCellLabel][3] =
-                vtxLabel(ni, j, k+1);
-
-            // update the counter
-            wallCellLabel++;
-        }
-    }
-
-    // y-direction
-
-    // y-min
-    wallLabel++;
-    wallCellLabel = 0;
-
-    boundaryPatches_[wallLabel].setSize(ni*nk);
-    for (label i = 0; i <= ni - 1; i++)
-    {
-        for (label k = 0; k <= nk - 1; k++)
-        {
-            boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
-
-            // set the points
-            boundaryPatches_[wallLabel][wallCellLabel][0] =
-                vtxLabel(i, 0, k);
-            boundaryPatches_[wallLabel][wallCellLabel][1] =
-                vtxLabel(i + 1, 0, k);
-            boundaryPatches_[wallLabel][wallCellLabel][2] =
-                vtxLabel(i + 1, 0, k + 1);
-            boundaryPatches_[wallLabel][wallCellLabel][3] =
-                vtxLabel(i, 0, k + 1);
-
-            // update the counter
-            wallCellLabel++;
-        }
-    }
-
-    // y-max
-    wallLabel++;
-    wallCellLabel = 0;
-
-    boundaryPatches_[wallLabel].setSize(ni*nk);
-
-    for (label i = 0; i <= ni - 1; i++)
-    {
-        for (label k = 0; k <= nk - 1; k++)
-        {
-            boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
-
-            // set the points
-            boundaryPatches_[wallLabel][wallCellLabel][0] =
-                vtxLabel(i, nj, k);
-            boundaryPatches_[wallLabel][wallCellLabel][1] =
-                vtxLabel(i, nj, k + 1);
-            boundaryPatches_[wallLabel][wallCellLabel][2] =
-                vtxLabel(i + 1, nj, k + 1);
-            boundaryPatches_[wallLabel][wallCellLabel][3] =
-                vtxLabel(i + 1, nj, k);
-
-            // update the counter
-            wallCellLabel++;
-        }
-    }
-
-    // z-direction
-
-    // z-min
-    wallLabel++;
-    wallCellLabel = 0;
-
-    boundaryPatches_[wallLabel].setSize(ni*nj);
-
-    for (label i = 0; i <= ni - 1; i++)
-    {
-        for (label j = 0; j <= nj - 1; j++)
-        {
-            boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
-
-            // set the points
-            boundaryPatches_[wallLabel][wallCellLabel][0] =
-                vtxLabel(i, j, 0);
-            boundaryPatches_[wallLabel][wallCellLabel][1] =
-                vtxLabel(i, j + 1, 0);
-            boundaryPatches_[wallLabel][wallCellLabel][2] =
-                vtxLabel(i + 1, j + 1, 0);
-            boundaryPatches_[wallLabel][wallCellLabel][3] =
-                vtxLabel(i + 1, j, 0);
-
-            // update the counter
-            wallCellLabel++;
-        }
-    }
-
-    // z-max
-    wallLabel++;
-    wallCellLabel = 0;
-
-    boundaryPatches_[wallLabel].setSize(ni*nj);
-
-    for (label i = 0; i <= ni - 1; i++)
-    {
-        for (label j = 0; j <= nj - 1; j++)
-        {
-            boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
-
-            // set the points
-            boundaryPatches_[wallLabel][wallCellLabel][0] =
-                vtxLabel(i, j, nk);
-            boundaryPatches_[wallLabel][wallCellLabel][1] =
-                vtxLabel(i + 1, j, nk);
-            boundaryPatches_[wallLabel][wallCellLabel][2] =
-                vtxLabel(i + 1, j + 1, nk);
-            boundaryPatches_[wallLabel][wallCellLabel][3] =
-                vtxLabel(i, j + 1, nk);
-
-            // update the counter
-            wallCellLabel++;
-        }
-    }
-}
-
-// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/blockCells.C b/applications/utilities/mesh/generation/blockMesh/blockCells.C
deleted file mode 100644
index acecc7170004699a225cbf0df47a07df77b2d564..0000000000000000000000000000000000000000
--- a/applications/utilities/mesh/generation/blockMesh/blockCells.C
+++ /dev/null
@@ -1,65 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by the
-    Free Software Foundation; either version 2 of the License, or (at your
-    option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Description
-    private member of block. Creates cells for the block.
-
-\*---------------------------------------------------------------------------*/
-
-#include "error.H"
-#include "block.H"
-
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
-
-void Foam::block::blockCells()
-{
-    label ni = blockDef_.n().x();
-    label nj = blockDef_.n().y();
-    label nk = blockDef_.n().z();
-
-    label cellNo = 0;
-
-    for (label k = 0; k <= nk - 1; k++)
-    {
-        for (label j = 0; j <= nj - 1; j++)
-        {
-            for (label i = 0; i <= ni - 1; i++)
-            {
-                cells_[cellNo].setSize(8);
-
-                cells_[cellNo][0] =  vtxLabel(i, j, k);
-                cells_[cellNo][1] =  vtxLabel(i+1, j, k);
-                cells_[cellNo][2] =  vtxLabel(i+1, j+1, k);
-                cells_[cellNo][3] =  vtxLabel(i, j+1, k);
-                cells_[cellNo][4] =  vtxLabel(i, j, k+1);
-                cells_[cellNo][5] =  vtxLabel(i+1, j, k+1);
-                cells_[cellNo][6] =  vtxLabel(i+1, j+1, k+1);
-                cells_[cellNo][7] =  vtxLabel(i, j+1, k+1);
-                cellNo++;
-            }
-        }
-    }
-}
-
-// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/blockDescriptor.C b/applications/utilities/mesh/generation/blockMesh/blockDescriptor.C
deleted file mode 100644
index 7d40c4d7cb00a53ea8a84cbadf2a4cf69b3f8c5b..0000000000000000000000000000000000000000
--- a/applications/utilities/mesh/generation/blockMesh/blockDescriptor.C
+++ /dev/null
@@ -1,248 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by the
-    Free Software Foundation; either version 2 of the License, or (at your
-    option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Description
-
-\*---------------------------------------------------------------------------*/
-
-#include "error.H"
-
-#include "blockDescriptor.H"
-#include "scalarList.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
-
-void blockDescriptor::makeBlockEdges()
-{
-    // for all edges check the list of curved edges. If the edge is curved,
-    // add it to the list. If the edge is not found, create is as a line
-
-    setEdge(0, 0, 1, n_.x());
-    setEdge(1, 3, 2, n_.x());
-    setEdge(2, 7, 6, n_.x());
-    setEdge(3, 4, 5, n_.x());
-
-    setEdge(4, 0, 3, n_.y());
-    setEdge(5, 1, 2, n_.y());
-    setEdge(6, 5, 6, n_.y());
-    setEdge(7, 4, 7, n_.y());
-
-    setEdge(8, 0, 4, n_.z());
-    setEdge(9, 1, 5, n_.z());
-    setEdge(10, 2, 6, n_.z());
-    setEdge(11, 3, 7, n_.z());
-}
-
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-// from components
-blockDescriptor::blockDescriptor
-(
-    const cellShape& bshape,
-    const pointField& blockMeshPoints,
-    const curvedEdgeList& edges,
-    const Vector<label>& n,
-    const scalarList& expand,
-    const word& zoneName
-)
-:
-    blockMeshPoints_(blockMeshPoints),
-    blockShape_(bshape),
-    curvedEdges_(edges),
-    edgePoints_(12),
-    edgeWeights_(12),
-    n_(n),
-    expand_(expand),
-    zoneName_(zoneName)
-{
-    if (expand_.size() != 12)
-    {
-        FatalErrorIn
-        (
-            "blockDescriptor::blockDescriptor"
-            "(const cellShape& bshape, const pointField& blockMeshPoints, "
-            "const curvedEdgeList& edges, label xnum, label ynum, label znum, "
-            "const scalarList& expand, const word& zoneName)"
-        )   << "Unknown definition of expansion ratios"
-            << exit(FatalError);
-    }
-
-    makeBlockEdges();
-}
-
-
-// from Istream
-blockDescriptor::blockDescriptor
-(
-    const pointField& blockMeshPoints,
-    const curvedEdgeList& edges,
-    Istream& is
-)
-:
-    blockMeshPoints_(blockMeshPoints),
-    blockShape_(is),
-    curvedEdges_(edges),
-    edgePoints_(12),
-    edgeWeights_(12),
-    n_(),
-    expand_(12),
-    zoneName_()
-{
-    // Look at first token
-    token t(is);
-    is.putBack(t);
-
-    // Optional zone name
-    if (t.isWord())
-    {
-        zoneName_ = t.wordToken();
-
-        // Consume zoneName token
-        is >> t;
-
-        // New look-ahead
-        is >> t;
-        is.putBack(t);
-    }
-
-    if (t.isPunctuation())
-    {
-        if (t.pToken() == token::BEGIN_LIST)
-        {
-            is >> n_;
-        }
-        else
-        {
-            FatalIOErrorIn
-            (
-                "blockDescriptor::blockDescriptor"
-                "(const pointField&, const curvedEdgeList&, Istream& is)",
-                is
-            )   << "incorrect token while reading n, expected '(', found "
-                << t.info()
-                << exit(FatalIOError);
-        }
-    }
-    else
-    {
-        is >> n_.x() >> n_.y() >> n_.z();
-    }
-
-    is >> t;
-    if (!t.isWord())
-    {
-        is.putBack(t);
-    }
-
-    scalarList expRatios(is);
-
-    if (expRatios.size() == 3)
-    {
-        expand_[0] = expRatios[0];
-        expand_[1] = expRatios[0];
-        expand_[2] = expRatios[0];
-        expand_[3] = expRatios[0];
-
-        expand_[4] = expRatios[1];
-        expand_[5] = expRatios[1];
-        expand_[6] = expRatios[1];
-        expand_[7] = expRatios[1];
-
-        expand_[8] = expRatios[2];
-        expand_[9] = expRatios[2];
-        expand_[10] = expRatios[2];
-        expand_[11] = expRatios[2];
-    }
-    else if (expRatios.size() == 12)
-    {
-        expand_ = expRatios;
-    }
-    else
-    {
-        FatalErrorIn
-        (
-            "blockDescriptor::blockDescriptor"
-            "(const pointField& blockMeshPoints, const curvedEdgeList& edges,"
-            "Istream& is)"
-        )   << "Unknown definition of expansion ratios"
-            << exit(FatalError);
-    }
-
-    // create a list of edges
-    makeBlockEdges();
-}
-
-
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
-
-const pointField& blockDescriptor::points() const
-{
-    return blockMeshPoints_;
-}
-
-const cellShape& blockDescriptor::blockShape() const
-{
-    return blockShape_;
-}
-
-const List<List<point> >& blockDescriptor::blockEdgePoints() const
-{
-    return edgePoints_;
-}
-
-const scalarListList& blockDescriptor::blockEdgeWeights() const
-{
-    return edgeWeights_;
-}
-
-const Vector<label>& blockDescriptor::n() const
-{
-    return n_;
-}
-
-const word& blockDescriptor::zoneName() const
-{
-    return zoneName_;
-}
-
-
-// * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
-
-void blockDescriptor::operator=(const blockDescriptor&)
-{
-    notImplemented("void blockDescriptor::operator=(const blockDescriptor&)");
-}
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
index b4bd379d759a4f7f033010b6270efd41baf06559..6cdec703dcd52eae4e0568b5f3babef066a26803 100644
--- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
+++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
@@ -146,8 +146,10 @@ int main(int argc, char *argv[])
             << exit(FatalError);
     }
 
-    Info<< nl << "Creating block mesh from\n    "
-        << meshDictIoPtr->objectPath() << nl << endl;
+    Info<< "Creating block mesh from\n    "
+        << meshDictIoPtr->objectPath() << endl;
+
+    blockMesh::verbose(true);
 
     IOdictionary meshDict(meshDictIoPtr());
     blockMesh blocks(meshDict);
@@ -195,8 +197,7 @@ int main(int argc, char *argv[])
     }
 
 
-
-    Info<< nl << "Creating mesh from block mesh" << endl;
+    Info<< nl << "Creating polyMesh from blockMesh" << endl;
 
     wordList patchNames = blocks.patchNames();
     wordList patchTypes = blocks.patchTypes();
@@ -204,6 +205,7 @@ int main(int argc, char *argv[])
     word defaultFacesType = emptyPolyPatch::typeName;
     wordList patchPhysicalTypes = blocks.patchPhysicalTypes();
 
+
     preservePatchTypes
     (
         runTime,
@@ -339,7 +341,7 @@ int main(int argc, char *argv[])
     // Set the precision of the points data to 10
     IOstream::defaultPrecision(10);
 
-    Info << nl << "Writing polyMesh" << endl;
+    Info<< nl << "Writing polyMesh" << endl;
     mesh.removeFiles();
     if (!mesh.write())
     {
@@ -348,6 +350,38 @@ int main(int argc, char *argv[])
             << exit(FatalError);
     }
 
+
+    //
+    // write some information
+    //
+    {
+        const polyPatchList& patches = mesh.boundaryMesh();
+
+        Info<< "----------------" << nl
+            << "Mesh Information" << nl
+            << "----------------" << nl
+            << "  " << "boundingBox: " << boundBox(mesh.points()) << nl
+            << "  " << "nPoints: " << mesh.nPoints() << nl
+            << "  " << "nCells: " << mesh.nCells() << nl
+            << "  " << "nFaces: " << mesh.nFaces() << nl
+            << "  " << "nInternalFaces: " << mesh.nInternalFaces() << nl;
+
+        Info<< "----------------" << nl
+            << "Patches" << nl
+            << "----------------" << nl;
+
+        forAll(patches, patchI)
+        {
+            const polyPatch& p = patches[patchI];
+
+            Info<< "  " << "patch " << patchI
+                << " (start: " << p.start()
+                << " size: " << p.size()
+                << ") name: " << p.name()
+                << nl;
+        }
+    }
+
     Info<< nl << "End" << endl;
 
     return 0;
diff --git a/applications/utilities/mesh/generation/blockMesh/blockPoints.C b/applications/utilities/mesh/generation/blockMesh/blockPoints.C
deleted file mode 100644
index f3026ccad0197572a7e8701e0c86e40f02a081c8..0000000000000000000000000000000000000000
--- a/applications/utilities/mesh/generation/blockMesh/blockPoints.C
+++ /dev/null
@@ -1,232 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by the
-    Free Software Foundation; either version 2 of the License, or (at your
-    option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Description
-    private member of block. Creates vertices for cells filling the block.
-
-\*---------------------------------------------------------------------------*/
-
-#include "error.H"
-#include "block.H"
-
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
-
-void Foam::block::blockPoints()
-{
-    // set local variables for mesh specification
-    const label ni = blockDef_.n().x();
-    const label nj = blockDef_.n().y();
-    const label nk = blockDef_.n().z();
-
-    const point p000 = blockDef_.points()[blockDef_.blockShape()[0]];
-    const point p100 = blockDef_.points()[blockDef_.blockShape()[1]];
-    const point p110 = blockDef_.points()[blockDef_.blockShape()[2]];
-    const point p010 = blockDef_.points()[blockDef_.blockShape()[3]];
-
-    const point p001 = blockDef_.points()[blockDef_.blockShape()[4]];
-    const point p101 = blockDef_.points()[blockDef_.blockShape()[5]];
-    const point p111 = blockDef_.points()[blockDef_.blockShape()[6]];
-    const point p011 = blockDef_.points()[blockDef_.blockShape()[7]];
-
-    // list of edge point and weighting factors
-    const List<List<point> >& p = blockDef_.blockEdgePoints();
-    const scalarListList& w = blockDef_.blockEdgeWeights();
-
-    // generate vertices
-
-    for (label k = 0; k <= nk; k++)
-    {
-        for (label j = 0; j <= nj; j++)
-        {
-            for (label i = 0; i <= ni; i++)
-            {
-                label vertexNo = vtxLabel(i, j, k);
-
-                // points on edges
-                vector edgex1 = p000 + (p100 - p000)*w[0][i];
-                vector edgex2 = p010 + (p110 - p010)*w[1][i];
-                vector edgex3 = p011 + (p111 - p011)*w[2][i];
-                vector edgex4 = p001 + (p101 - p001)*w[3][i];
-
-                vector edgey1 = p000 + (p010 - p000)*w[4][j];
-                vector edgey2 = p100 + (p110 - p100)*w[5][j];
-                vector edgey3 = p101 + (p111 - p101)*w[6][j];
-                vector edgey4 = p001 + (p011 - p001)*w[7][j];
-
-                vector edgez1 = p000 + (p001 - p000)*w[8][k];
-                vector edgez2 = p100 + (p101 - p100)*w[9][k];
-                vector edgez3 = p110 + (p111 - p110)*w[10][k];
-                vector edgez4 = p010 + (p011 - p010)*w[11][k];
-
-                // calculate the importance factors for all edges
-                // x - direction
-                scalar impx1 =
-                (
-                    (1.0 - w[0][i])*(1.0 - w[4][j])*(1.0 - w[8][k])
-                  + w[0][i]*(1.0 - w[5][j])*(1.0 - w[9][k])
-                );
-
-                scalar impx2 =
-                (
-                    (1.0 - w[1][i])*w[4][j]*(1.0 - w[11][k])
-                  + w[1][i]*w[5][j]*(1.0 - w[10][k])
-                );
-
-                scalar impx3 =
-                (
-                     (1.0 - w[2][i])*w[7][j]*w[11][k]
-                   + w[2][i]*w[6][j]*w[10][k]
-                );
-
-
-                scalar impx4 =
-                (
-                    (1.0 - w[3][i])*(1.0 - w[7][j])*w[8][k]
-                  + w[3][i]*(1.0 - w[6][j])*w[9][k]
-                );
-
-                scalar magImpx = impx1 + impx2 + impx3 + impx4;
-                impx1 /= magImpx;
-                impx2 /= magImpx;
-                impx3 /= magImpx;
-                impx4 /= magImpx;
-
-
-                // y - direction
-                scalar impy1 =
-                (
-                    (1.0 - w[4][j])*(1.0 - w[0][i])*(1.0 - w[8][k])
-                  + w[4][j]*(1.0 - w[1][i])*(1.0 - w[11][k])
-                );
-
-                scalar impy2 =
-                (
-                    (1.0 - w[5][j])*w[0][i]*(1.0 - w[9][k])
-                  + w[5][j]*w[1][i]*(1.0 - w[10][k])
-                );
-
-                scalar impy3 =
-                (
-                    (1.0 - w[6][j])*w[3][i]*w[9][k]
-                  + w[6][j]*w[2][i]*w[10][k]
-                );
-
-                scalar impy4 =
-                (
-                    (1.0 - w[7][j])*(1.0 - w[3][i])*w[8][k]
-                  + w[7][j]*(1.0 - w[2][i])*w[11][k]
-                );
-
-                scalar magImpy = impy1 + impy2 + impy3 + impy4;
-                impy1 /= magImpy;
-                impy2 /= magImpy;
-                impy3 /= magImpy;
-                impy4 /= magImpy;
-
-
-                // z - direction
-                scalar impz1 =
-                (
-                    (1.0 - w[8][k])*(1.0 - w[0][i])*(1.0 - w[4][j])
-                  + w[8][k]*(1.0 - w[3][i])*(1.0 - w[7][j])
-                );
-
-                scalar impz2 =
-                (
-                    (1.0 - w[9][k])*w[0][i]*(1.0 - w[5][j])
-                  + w[9][k]*w[3][i]*(1.0 - w[6][j])
-                );
-
-                scalar impz3 =
-                (
-                    (1.0 - w[10][k])*w[1][i]*w[5][j]
-                  + w[10][k]*w[2][i]*w[6][j]
-                );
-
-                scalar impz4 =
-                (
-                    (1.0 - w[11][k])*(1.0 - w[1][i])*w[4][j]
-                  + w[11][k]*(1.0 - w[2][i])*w[7][j]
-                );
-
-                scalar magImpz = impz1 + impz2 + impz3 + impz4;
-                impz1 /= magImpz;
-                impz2 /= magImpz;
-                impz3 /= magImpz;
-                impz4 /= magImpz;
-
-                // calculate the correction vectors
-                vector corx1 = impx1*(p[0][i] - edgex1);
-                vector corx2 = impx2*(p[1][i] - edgex2);
-                vector corx3 = impx3*(p[2][i] - edgex3);
-                vector corx4 = impx4*(p[3][i] - edgex4);
-
-                vector cory1 = impy1*(p[4][j] - edgey1);
-                vector cory2 = impy2*(p[5][j] - edgey2);
-                vector cory3 = impy3*(p[6][j] - edgey3);
-                vector cory4 = impy4*(p[7][j] - edgey4);
-
-                vector corz1 = impz1*(p[8][k] - edgez1);
-                vector corz2 = impz2*(p[9][k] - edgez2);
-                vector corz3 = impz3*(p[10][k] - edgez3);
-                vector corz4 = impz4*(p[11][k] - edgez4);
-
-
-                // multiply by the importance factor
-
-                // x - direction
-                edgex1 *= impx1;
-                edgex2 *= impx2;
-                edgex3 *= impx3;
-                edgex4 *= impx4;
-
-                // y - direction
-                edgey1 *= impy1;
-                edgey2 *= impy2;
-                edgey3 *= impy3;
-                edgey4 *= impy4;
-
-                // z - direction
-                edgez1 *= impz1;
-                edgez2 *= impz2;
-                edgez3 *= impz3;
-                edgez4 *= impz4;
-
-
-                // add the contributions
-                vertices_[vertexNo] = edgex1 + edgex2 + edgex3 + edgex4;
-                vertices_[vertexNo] += edgey1 + edgey2 + edgey3 + edgey4;
-                vertices_[vertexNo] += edgez1 + edgez2 + edgez3 + edgez4;
-
-                vertices_[vertexNo] /= 3.0;
-
-                vertices_[vertexNo] += corx1 + corx2 + corx3 + corx4;
-                vertices_[vertexNo] += cory1 + cory2 + cory3 + cory4;
-                vertices_[vertexNo] += corz1 + corz2 + corz3 + corz4;
-            }
-        }
-    }
-}
-
-// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/createCells.C b/applications/utilities/mesh/generation/blockMesh/createCells.C
deleted file mode 100644
index 70c22f91789e31aea928f18837c49fc50325a8f5..0000000000000000000000000000000000000000
--- a/applications/utilities/mesh/generation/blockMesh/createCells.C
+++ /dev/null
@@ -1,74 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by the
-    Free Software Foundation; either version 2 of the License, or (at your
-    option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM; if not, write to the Free Software Foundation,
-    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-\*---------------------------------------------------------------------------*/
-
-#include "error.H"
-
-#include "blockMesh.H"
-#include "cellModeller.H"
-
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
-
-Foam::cellShapeList Foam::blockMesh::createCells()
-{
-    Info<< nl << "Creating cells" << endl;
-
-    PtrList<cellShape> cells(nCells_);
-
-    blockMesh& blocks = *this;
-
-    const cellModel& hex = *(cellModeller::lookup("hex"));
-
-    label cellLabel = 0;
-
-    forAll(blocks, blockLabel)
-    {
-        const labelListList& blockCells = blocks[blockLabel].cells();
-
-        forAll(blockCells, blockCellLabel)
-        {
-            labelList cellPoints(blockCells[blockCellLabel].size());
-
-            forAll(cellPoints, cellPointLabel)
-            {
-                cellPoints[cellPointLabel] =
-                    mergeList_
-                    [
-                        blockCells[blockCellLabel][cellPointLabel]
-                      + blockOffsets_[blockLabel]
-                    ];
-            }
-
-            // Construct collapsed cell and all to list
-            cells.set(cellLabel, new cellShape(hex, cellPoints, true));
-
-            cellLabel++;
-        }
-    }
-
-    return cells;
-}
-
-// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/snappyHexMesh/Make/options b/applications/utilities/mesh/generation/snappyHexMesh/Make/options
index 1c74c3aff57aa36a4bcd788e0aed2d3048c70946..e6db59c8250a374574abe60d32f0445bc89f226a 100644
--- a/applications/utilities/mesh/generation/snappyHexMesh/Make/options
+++ b/applications/utilities/mesh/generation/snappyHexMesh/Make/options
@@ -1,7 +1,7 @@
 EXE_INC = \
     /* -g -DFULLDEBUG -O0 */ \
     -I$(LIB_SRC)/decompositionMethods/decompositionMethods/lnInclude \
-    -I$(LIB_SRC)/autoMesh/lnInclude \
+    -I$(LIB_SRC)/mesh/autoMesh/lnInclude \
     -I$(LIB_SRC)/meshTools/lnInclude \
     -I$(LIB_SRC)/triSurface/lnInclude \
     -I$(LIB_SRC)/dynamicMesh/lnInclude \
diff --git a/applications/utilities/miscellaneous/expandDictionary/Make/options b/applications/utilities/miscellaneous/expandDictionary/Make/options
index fa15f124528ebfcaf279a88a73a0d7954f2e9dc1..18e6fe47afacb902cddccf82632772447704fd88 100644
--- a/applications/utilities/miscellaneous/expandDictionary/Make/options
+++ b/applications/utilities/miscellaneous/expandDictionary/Make/options
@@ -1,5 +1,2 @@
-EXE_INC = \
-    -I$(LIB_SRC)/finiteVolume/lnInclude
-
-EXE_LIBS = \
-    -lfiniteVolume
+/* EXE_INC = */
+/* EXE_LIBS = */
diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options
index ed65d154376ca5fb02e4738b07af1e0541e0d749..421e59a7f140817e59bae04ae1837f5528023836 100644
--- a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options
+++ b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options
@@ -39,4 +39,5 @@ EXE_LIBS = \
     -lthermophysicalFunctions \
     -ltopoChangerFvMesh \
     -ltriSurface \
-    -lautoMesh
+    -lautoMesh \
+    -lblockMesh
diff --git a/applications/utilities/miscellaneous/foamInfoExec/Make/options b/applications/utilities/miscellaneous/foamInfoExec/Make/options
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..18e6fe47afacb902cddccf82632772447704fd88 100644
--- a/applications/utilities/miscellaneous/foamInfoExec/Make/options
+++ b/applications/utilities/miscellaneous/foamInfoExec/Make/options
@@ -0,0 +1,2 @@
+/* EXE_INC = */
+/* EXE_LIBS = */
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C
index 7b61fabb2213ad0e6ead78cf38034c837818e686..e4f2ee2f2573e634e832053536ba858531b5cee3 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C
@@ -113,13 +113,8 @@ int main(int argc, char *argv[])
     }
 
     // control for renumbering iterations
-    bool optIndex = false;
     label indexingNumber = 0;
-    if (args.optionFound("index"))
-    {
-        optIndex = true;
-        indexingNumber = args.optionRead<label>("index");
-    }
+    bool optIndex = args.optionReadIfPresent("index", indexingNumber);
 
     // always write the geometry, unless the -noMesh option is specified
     bool optNoMesh = args.optionFound("noMesh");
@@ -134,7 +129,7 @@ int main(int argc, char *argv[])
     // or a particular time interval
     if (isDir(ensightDir))
     {
-        Info<<"Warning: reusing existing directory" << nl
+        Info<<"Warning: re-using existing directory" << nl
             << "    " << ensightDir << endl;
     }
     mkDir(ensightDir);
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml
index ef25ac03786e43e5dd407cd7ef992d6b1c3b91b4..a78bceb7d5495847af7734fe3e896d589fc639d5 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml
@@ -106,7 +106,7 @@
       animateable="0">
       <BooleanDomain name="bool"/>
       <Documentation>
-        A simple way cause a reader GUI modification.
+        A simple way to cause a reader GUI modification.
       </Documentation>
     </IntVectorProperty>
 
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx
index 47e919c9c310efda544786f239c8904977f4ee55..55964e95407a3d4bdf6ab2a03075efce68009515 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx
@@ -385,14 +385,7 @@ int vtkPV3FoamReader::RequestData
     foamData_->Update(output, output);
 #endif
 
-    if (ShowPatchNames)
-    {
-        addPatchNamesToView();
-    }
-    else
-    {
-        removePatchNamesFromView();
-    }
+    updatePatchNamesView(ShowPatchNames);
 
 #endif
 
@@ -403,27 +396,7 @@ int vtkPV3FoamReader::RequestData
 }
 
 
-void vtkPV3FoamReader::addPatchNamesToView()
-{
-    pqApplicationCore* appCore = pqApplicationCore::instance();
-
-    // Server manager model for querying items in the server manager
-    pqServerManagerModel* smModel = appCore->getServerManagerModel();
-
-    // Get all the pqRenderView instances
-    QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
-
-    for (int viewI=0; viewI<renderViews.size(); viewI++)
-    {
-        foamData_->addPatchNames
-        (
-            renderViews[viewI]->getRenderViewProxy()->GetRenderer()
-        );
-    }
-}
-
-
-void vtkPV3FoamReader::removePatchNamesFromView()
+void vtkPV3FoamReader::updatePatchNamesView(const bool show)
 {
     pqApplicationCore* appCore = pqApplicationCore::instance();
 
@@ -435,9 +408,10 @@ void vtkPV3FoamReader::removePatchNamesFromView()
 
     for (int viewI=0; viewI<renderViews.size(); viewI++)
     {
-        foamData_->removePatchNames
+        foamData_->renderPatchNames
         (
-            renderViews[viewI]->getRenderViewProxy()->GetRenderer()
+            renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
+            show
         );
     }
 }
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h
index bc21cd8ce816978129720a4822454c455897780d..4a6eb3723edb3d67fc27a876c5cd32613ef72b01 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h
@@ -174,11 +174,8 @@ private:
     //- Disallow default bitwise assignment
     void operator=(const vtkPV3FoamReader&);
 
-    //- Add patch names to the view
-    void addPatchNamesToView();
-
-    //- Remove patch names from the view
-    void removePatchNamesFromView();
+    //- Add/remove patch names to/from the view
+    void updatePatchNamesView(const bool show);
 
     int TimeStepRange[2];
     int CacheMesh;
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/files b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/files
index 9699e3c71ebe3c4159b36ee2f5abb09d9730ab2e..e71b857bb2e229412366860d8eaef07c1192bf3b 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/files
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/Make/files
@@ -7,6 +7,6 @@ vtkPV3FoamMeshSet.C
 vtkPV3FoamMeshVolume.C
 vtkPV3FoamMeshZone.C
 vtkPV3FoamUpdateInfo.C
-vtkPV3FoamUtilities.C
+vtkPV3FoamUtils.C
 
 LIB = $(FOAM_LIBBIN)/libvtkPV3Foam
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPoints.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMPoints.H
similarity index 91%
rename from applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPoints.H
rename to applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMPoints.H
index adb4d724b0019f5fd9036b9d667e6ad92ac66969..6e90e75db006f1f4a2cd045ca2e7b26767c650d1 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPoints.H
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMPoints.H
@@ -27,15 +27,15 @@ InClass
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef vtkPV3FoamPoints_H
-#define vtkPV3FoamPoints_H
+#ifndef vtkOpenFOAMPoints_H
+#define vtkOpenFOAMPoints_H
 
 // VTK includes
 #include "vtkPoints.h"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-inline void vtkPV3FoamInsertNextPoint
+inline void vtkInsertNextOpenFOAMPoint
 (
     vtkPoints *points,
     const Foam::point& p
@@ -46,7 +46,7 @@ inline void vtkPV3FoamInsertNextPoint
 
 #if 0
 // this should be faster, but didn't get it working ...
-inline void vtkPV3FoamSetPoint
+inline void vtkSetOpenFOAMPoint
 (
     vtkPoints *points,
     const Foam::label id,
@@ -58,7 +58,7 @@ inline void vtkPV3FoamSetPoint
 
 
 // Convert Foam mesh vertices to VTK
-inline vtkPoints* vtkPV3FoamVTKPoints(const Foam::pointField& points)
+inline vtkPoints* vtkSetOpenFOAMPoints(const Foam::pointField& points)
 {
     vtkPoints *vtkpoints = vtkPoints::New();
     vtkpoints->SetNumberOfPoints(points.size());
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C
index 34628ac9d1ed1a6afa49ef128625ba8b661c6bf6..6a5ab601fb4be12d8f3d424b4f661bf84da1e51a 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C
@@ -590,219 +590,203 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps)
 }
 
 
-void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer)
+void Foam::vtkPV3Foam::renderPatchNames(vtkRenderer* renderer, const bool show)
 {
-    // Remove any patch names previously added to the renderer
-    removePatchNames(renderer);
+    // always remove old actors first
 
-    // get the display patches, strip off any suffix
-    wordHashSet selectedPatches = getSelected
-    (
-        reader_->GetPartSelection(),
-        partInfoPatches_
-    );
-
-    if (!selectedPatches.size())
+    forAll(patchTextActorsPtrs_, patchI)
     {
-        return;
+        renderer->RemoveViewProp(patchTextActorsPtrs_[patchI]);
+        patchTextActorsPtrs_[patchI]->Delete();
     }
+    patchTextActorsPtrs_.clear();
 
-    if (debug)
+    if (show)
     {
-        Info<< "<beg> Foam::vtkPV3Foam::addPatchNames" << nl
-            <<"... add patches: " << selectedPatches << endl;
-    }
+        // get the display patches, strip off any suffix
+        wordHashSet selectedPatches = getSelected
+        (
+            reader_->GetPartSelection(),
+            partInfoPatches_
+        );
 
-    const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh();
+        if (!selectedPatches.size())
+        {
+            return;
+        }
 
-    // Find the total number of zones
-    // Each zone will take the patch name
-    // Number of zones per patch ... zero zones should be skipped
-    labelList nZones(pbMesh.size(), 0);
+        const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh();
 
-    // Per global zone number the average face centre position
-    DynamicList<point> zoneCentre(pbMesh.size());
+        // Find the total number of zones
+        // Each zone will take the patch name
+        // Number of zones per patch ... zero zones should be skipped
+        labelList nZones(pbMesh.size(), 0);
 
-    if (debug)
-    {
-        Info<< "... determining patch zones" << endl;
-    }
+        // Per global zone number the average face centre position
+        DynamicList<point> zoneCentre(pbMesh.size());
 
-    // Loop through all patches to determine zones, and centre of each zone
-    forAll(pbMesh, patchI)
-    {
-        const polyPatch& pp = pbMesh[patchI];
 
-        // Only include the patch if it is selected
-        if (!selectedPatches.found(pp.name()))
+        // Loop through all patches to determine zones, and centre of each zone
+        forAll(pbMesh, patchI)
         {
-            continue;
-        }
+            const polyPatch& pp = pbMesh[patchI];
 
-        const labelListList& edgeFaces = pp.edgeFaces();
-        const vectorField& n = pp.faceNormals();
+            // Only include the patch if it is selected
+            if (!selectedPatches.found(pp.name()))
+            {
+                continue;
+            }
 
-        boolList featEdge(pp.nEdges(), false);
+            const labelListList& edgeFaces = pp.edgeFaces();
+            const vectorField& n = pp.faceNormals();
 
-        forAll(edgeFaces, edgeI)
-        {
-            const labelList& eFaces = edgeFaces[edgeI];
+            boolList featEdge(pp.nEdges(), false);
 
-            if (eFaces.size() == 1)
+            forAll(edgeFaces, edgeI)
             {
-                // Note: could also do ones with > 2 faces but this gives
-                // too many zones for baffles
-                featEdge[edgeI] = true;
+                const labelList& eFaces = edgeFaces[edgeI];
+
+                if (eFaces.size() == 1)
+                {
+                    // Note: could also do ones with > 2 faces but this gives
+                    // too many zones for baffles
+                    featEdge[edgeI] = true;
+                }
+                else if (mag(n[eFaces[0]] & n[eFaces[1]]) < 0.5)
+                {
+                    featEdge[edgeI] = true;
+                }
             }
-            else if (mag(n[eFaces[0]] & n[eFaces[1]]) < 0.5)
-            {
-                featEdge[edgeI] = true;
-            }
-        }
 
-        // Do topological analysis of patch, find disconnected regions
-        patchZones pZones(pp, featEdge);
+            // Do topological analysis of patch, find disconnected regions
+            patchZones pZones(pp, featEdge);
 
-        nZones[patchI] = pZones.nZones();
+            nZones[patchI] = pZones.nZones();
 
-        labelList zoneNFaces(pZones.nZones(), 0);
+            labelList zoneNFaces(pZones.nZones(), 0);
 
-        // Save start of information for current patch
-        label patchStart = zoneCentre.size();
+            // Save start of information for current patch
+            label patchStart = zoneCentre.size();
 
-        // Create storage for additional zone centres
-        forAll(zoneNFaces, zoneI)
-        {
-            zoneCentre.append(vector::zero);
-        }
+            // Create storage for additional zone centres
+            forAll(zoneNFaces, zoneI)
+            {
+                zoneCentre.append(vector::zero);
+            }
 
-        // Do averaging per individual zone
-        forAll(pp, faceI)
-        {
-            label zoneI = pZones[faceI];
-            zoneCentre[patchStart+zoneI] += pp[faceI].centre(pp.points());
-            zoneNFaces[zoneI]++;
-        }
+            // Do averaging per individual zone
+            forAll(pp, faceI)
+            {
+                label zoneI = pZones[faceI];
+                zoneCentre[patchStart+zoneI] += pp[faceI].centre(pp.points());
+                zoneNFaces[zoneI]++;
+            }
 
-        for (label i=0; i<nZones[patchI]; i++)
-        {
-            zoneCentre[patchStart + i] /= zoneNFaces[i];
+            for (label i=0; i<nZones[patchI]; i++)
+            {
+                zoneCentre[patchStart + i] /= zoneNFaces[i];
+            }
         }
-    }
-
-    // Count number of zones we're actually going to display. This is truncated
-    // to a max per patch
 
-    const label MAXPATCHZONES = 20;
+        // Count number of zones we're actually going to display. This is truncated
+        // to a max per patch
 
-    label displayZoneI = 0;
+        const label MAXPATCHZONES = 20;
 
-    forAll(pbMesh, patchI)
-    {
-        displayZoneI += min(MAXPATCHZONES, nZones[patchI]);
-    }
+        label displayZoneI = 0;
 
+        forAll(pbMesh, patchI)
+        {
+            displayZoneI += min(MAXPATCHZONES, nZones[patchI]);
+        }
 
-    zoneCentre.shrink();
 
-    if (debug)
-    {
-        Info<< "patch zone centres = " << zoneCentre << nl
-            << "displayed zone centres = " << displayZoneI << nl
-            << "zones per patch = " << nZones << endl;
-    }
+        zoneCentre.shrink();
 
-    // Set the size of the patch labels to max number of zones
-    patchTextActorsPtrs_.setSize(displayZoneI);
+        if (debug)
+        {
+            Info<< "patch zone centres = " << zoneCentre << nl
+                << "displayed zone centres = " << displayZoneI << nl
+                << "zones per patch = " << nZones << endl;
+        }
 
-    if (debug)
-    {
-        Info<< "constructing patch labels" << endl;
-    }
+        // Set the size of the patch labels to max number of zones
+        patchTextActorsPtrs_.setSize(displayZoneI);
 
-    // Actor index
-    displayZoneI = 0;
+        if (debug)
+        {
+            Info<< "constructing patch labels" << endl;
+        }
 
-    // Index in zone centres
-    label globalZoneI = 0;
+        // Actor index
+        displayZoneI = 0;
 
-    forAll(pbMesh, patchI)
-    {
-        const polyPatch& pp = pbMesh[patchI];
+        // Index in zone centres
+        label globalZoneI = 0;
 
-        // Only selected patches will have a non-zero number of zones
-        label nDisplayZones = min(MAXPATCHZONES, nZones[patchI]);
-        label increment = 1;
-        if (nZones[patchI] >= MAXPATCHZONES)
+        forAll(pbMesh, patchI)
         {
-            increment = nZones[patchI]/MAXPATCHZONES;
-        }
+            const polyPatch& pp = pbMesh[patchI];
 
-        for (label i = 0; i < nDisplayZones; i++)
-        {
-            if (debug)
+            // Only selected patches will have a non-zero number of zones
+            label nDisplayZones = min(MAXPATCHZONES, nZones[patchI]);
+            label increment = 1;
+            if (nZones[patchI] >= MAXPATCHZONES)
             {
-                Info<< "patch name = " << pp.name() << nl
-                    << "anchor = " << zoneCentre[globalZoneI] << nl
-                    << "globalZoneI = " << globalZoneI << endl;
+                increment = nZones[patchI]/MAXPATCHZONES;
             }
 
-            vtkTextActor* txt = vtkTextActor::New();
-
-            txt->SetInput(pp.name().c_str());
-
-            // Set text properties
-            vtkTextProperty* tprop = txt->GetTextProperty();
-            tprop->SetFontFamilyToArial();
-            tprop->BoldOff();
-            tprop->ShadowOff();
-            tprop->SetLineSpacing(1.0);
-            tprop->SetFontSize(12);
-            tprop->SetColor(1.0, 0.0, 0.0);
-            tprop->SetJustificationToCentered();
-
-            // Set text to use 3-D world co-ordinates
-            txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
-
-            txt->GetPositionCoordinate()->SetValue
-            (
-                zoneCentre[globalZoneI].x(),
-                zoneCentre[globalZoneI].y(),
-                zoneCentre[globalZoneI].z()
-            );
-
-            // Add text to each renderer
-            renderer->AddViewProp(txt);
-
-            // Maintain a list of text labels added so that they can be
-            // removed later
-            patchTextActorsPtrs_[displayZoneI] = txt;
-
-            globalZoneI += increment;
-            displayZoneI++;
+            for (label i = 0; i < nDisplayZones; i++)
+            {
+                if (debug)
+                {
+                    Info<< "patch name = " << pp.name() << nl
+                        << "anchor = " << zoneCentre[globalZoneI] << nl
+                        << "globalZoneI = " << globalZoneI << endl;
+                }
+
+                vtkTextActor* txt = vtkTextActor::New();
+
+                txt->SetInput(pp.name().c_str());
+
+                // Set text properties
+                vtkTextProperty* tprop = txt->GetTextProperty();
+                tprop->SetFontFamilyToArial();
+                tprop->BoldOff();
+                tprop->ShadowOff();
+                tprop->SetLineSpacing(1.0);
+                tprop->SetFontSize(12);
+                tprop->SetColor(1.0, 0.0, 0.0);
+                tprop->SetJustificationToCentered();
+
+                // Set text to use 3-D world co-ordinates
+                txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
+
+                txt->GetPositionCoordinate()->SetValue
+                (
+                    zoneCentre[globalZoneI].x(),
+                    zoneCentre[globalZoneI].y(),
+                    zoneCentre[globalZoneI].z()
+                );
+
+                // Add text to each renderer
+                renderer->AddViewProp(txt);
+
+                // Maintain a list of text labels added so that they can be
+                // removed later
+                patchTextActorsPtrs_[displayZoneI] = txt;
+
+                globalZoneI += increment;
+                displayZoneI++;
+            }
         }
-    }
 
-    // Resize the patch names list to the actual number of patch names added
-    patchTextActorsPtrs_.setSize(displayZoneI);
-
-    if (debug)
-    {
-        Info<< "<end> Foam::vtkPV3Foam::addPatchNames" << endl;
+        // Resize the patch names list to the actual number of patch names added
+        patchTextActorsPtrs_.setSize(displayZoneI);
     }
 }
 
 
-void Foam::vtkPV3Foam::removePatchNames(vtkRenderer* renderer)
-{
-    forAll(patchTextActorsPtrs_, patchI)
-    {
-        renderer->RemoveViewProp(patchTextActorsPtrs_[patchI]);
-        patchTextActorsPtrs_[patchI]->Delete();
-    }
-    patchTextActorsPtrs_.clear();
-}
-
 
 void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const
 {
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H
index 4e203eacec8e83c9f720257c21870c039a9ef5a4..05c84744775953e3672c2805f215b7f2d7b966b3 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H
@@ -31,7 +31,6 @@ Description
 SourceFiles
     vtkPV3Foam.C
     vtkPV3Foam.H
-    vtkPV3FoamI.H
     vtkPV3FoamFields.C
     vtkPV3FoamMesh.C
     vtkPV3FoamMeshLagrangian.C
@@ -46,7 +45,7 @@ SourceFiles
     vtkPV3FoamPoints.H
     vtkPV3FoamUpdateInfo.C
     vtkPV3FoamUpdateInfoFields.H
-    vtkPV3FoamUtilities.C
+    vtkPV3FoamUtils.C
     vtkPV3FoamVolFields.H
     vtkPV3FoamAddToSelection.H
 
@@ -316,7 +315,7 @@ class vtkPV3Foam
             vtkDataSet* dataset,
             const partInfo&,
             const label datasetNo,
-            const string& datasetName
+            const std::string& datasetName
         );
 
         // Convenience method use to convert the readers from VTK 5
@@ -627,9 +626,6 @@ class vtkPV3Foam
 
        // GUI selection helper functions
 
-            //- Extract up to the first non-word characters
-            inline static word getFirstWord(const char*);
-
             //- Only keep what is listed in hashSet
             static void pruneObjectList
             (
@@ -715,11 +711,8 @@ public:
         //  returns the count via the parameter
         double* findTimes(int& nTimeSteps);
 
-        //- Add patch names to the display
-        void addPatchNames(vtkRenderer* renderer);
-
-        //- Remove patch names from the display
-        void removePatchNames(vtkRenderer* renderer);
+        //- Add/remove patch names to/from the view
+        void renderPatchNames(vtkRenderer*, const bool show);
 
         //- set the runTime to the first plausible request time,
         //  returns the timeIndex
@@ -751,8 +744,6 @@ public:
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-#    include "vtkPV3FoamI.H"
-
 #endif
 
 // ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C
index 07d322d54250876e929526d46274ecf8e3bece92..e653b05adb5ada83590b9d1646f1434c5f2b0b8b 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C
@@ -33,7 +33,7 @@ Description
 #include "fvMesh.H"
 #include "IOobjectList.H"
 #include "passiveParticle.H"
-#include "vtkPV3FoamPoints.H"
+#include "vtkOpenFOAMPoints.H"
 
 // VTK includes
 #include "vtkCellArray.h"
@@ -86,7 +86,7 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
         vtkIdType particleId = 0;
         forAllConstIter(Cloud<passiveParticle>, parcels, iter)
         {
-            vtkPV3FoamInsertNextPoint(vtkpoints, iter().position());
+            vtkInsertNextOpenFOAMPoint(vtkpoints, iter().position());
 
             vtkcells->InsertNextCell(1, &particleId);
             particleId++;
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C
index 29e8d07020852cca5fe2c74fb74438e813a0824f..d7c0f2f013b6ff47eb3e4f5f6d1a03b7e10fce72 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C
@@ -31,7 +31,7 @@ Description
 // Foam includes
 #include "polyPatch.H"
 #include "primitivePatch.H"
-#include "vtkPV3FoamPoints.H"
+#include "vtkOpenFOAMPoints.H"
 
 // VTK includes
 #include "vtkCellArray.h"
@@ -60,7 +60,7 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
     vtkpoints->Allocate( points.size() );
     forAll(points, i)
     {
-        vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
+        vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
     }
 
     vtkmesh->SetPoints(vtkpoints);
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C
index 7f08a215a3bc6e4db38136383a7d545fb67cca46..f363beae45c2588834788a4ff321b5de064f88e3 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C
@@ -31,7 +31,7 @@ Description
 // Foam includes
 #include "faceSet.H"
 #include "pointSet.H"
-#include "vtkPV3FoamPoints.H"
+#include "vtkOpenFOAMPoints.H"
 
 // VTK includes
 #include "vtkPoints.h"
@@ -75,7 +75,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh
     vtkpoints->Allocate( points.size() );
     forAll(points, i)
     {
-        vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
+        vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
     }
     vtkmesh->SetPoints(vtkpoints);
     vtkpoints->Delete();
@@ -132,7 +132,7 @@ vtkPolyData* Foam::vtkPV3Foam::pointSetVTKMesh
 
     forAllConstIter(pointSet, pSet, iter)
     {
-        vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[iter.key()]);
+        vtkInsertNextOpenFOAMPoint(vtkpoints, meshPoints[iter.key()]);
     }
 
     vtkmesh->SetPoints(vtkpoints);
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C
index 49f9016dc1ff2906a8bb5523b69e5b0efd462a8d..e1fd59ccd0d1c50262ac43d7c2d12b22b4b94020 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C
@@ -31,7 +31,7 @@ Description
 // Foam includes
 #include "fvMesh.H"
 #include "cellModeller.H"
-#include "vtkPV3FoamPoints.H"
+#include "vtkOpenFOAMPoints.H"
 
 // VTK includes
 #include "vtkCellArray.h"
@@ -143,7 +143,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
 
     forAll(points, i)
     {
-        vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
+        vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
     }
 
 
@@ -267,7 +267,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
 
             // Insert the new vertex from the cell-centre
             label newVertexLabel = mesh.nPoints() + addPointI;
-            vtkPV3FoamInsertNextPoint(vtkpoints, mesh.C()[cellI]);
+            vtkInsertNextOpenFOAMPoint(vtkpoints, mesh.C()[cellI]);
 
             // Whether to insert cell in place of original or not.
             bool substituteCell = true;
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C
index 14c5da92c2ab27bdb462d2acb0b22aa4f5913582..0a21310a633b868c8b489943c749cc3b90c48545 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C
@@ -29,7 +29,7 @@ Description
 #include "vtkPV3Foam.H"
 
 // Foam includes
-#include "vtkPV3FoamPoints.H"
+#include "vtkOpenFOAMPoints.H"
 
 // VTK includes
 #include "vtkPoints.h"
@@ -72,7 +72,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
     vtkpoints->Allocate( points.size() );
     forAll(points, i)
     {
-        vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
+        vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
     }
 
     vtkmesh->SetPoints(vtkpoints);
@@ -131,7 +131,7 @@ vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh
 
     forAll(pointLabels, pointI)
     {
-        vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[pointLabels[pointI]]);
+        vtkInsertNextOpenFOAMPoint(vtkpoints, meshPoints[pointLabels[pointI]]);
     }
 
     vtkmesh->SetPoints(vtkpoints);
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtilities.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C
similarity index 93%
rename from applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtilities.C
rename to applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C
index aff0ea4eec14334b336a568665ea4d44d18adb0d..a9d12c303a22b3ea023b3a1c72b23eafc448f09b 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtilities.C
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C
@@ -41,6 +41,34 @@ Description
 #include "vtkMultiBlockDataSet.h"
 #include "vtkInformation.h"
 
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    //! @cond fileScope
+    //  Extract up to the first non-word characters
+    inline word getFirstWord(const char* str)
+    {
+        if (str)
+        {
+            label n = 0;
+            while (str[n] && word::valid(str[n]))
+            {
+                ++n;
+            }
+            return word(str, n, true);
+        }
+        else
+        {
+            return word::null;
+        }
+
+    }
+    //! @endcond fileScope
+
+} // End namespace Foam
+
+
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 void Foam::vtkPV3Foam::AddToBlock
@@ -49,7 +77,7 @@ void Foam::vtkPV3Foam::AddToBlock
     vtkDataSet* dataset,
     const partInfo& selector,
     const label datasetNo,
-    const string& datasetName
+    const std::string& datasetName
 )
 {
     const int blockNo = selector.block();
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/Allwclean b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/Allwclean
new file mode 100755
index 0000000000000000000000000000000000000000..30ee40ddae59aebfc80c648baa6d40ce74204f43
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/Allwclean
@@ -0,0 +1,8 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # run from this directory
+set -x
+
+rm -rf PV3blockMeshReader/Make
+wclean libso vtkPV3blockMesh
+
+# ----------------------------------------------------------------- end-of-file
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/Allwmake b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/Allwmake
new file mode 100755
index 0000000000000000000000000000000000000000..3e2c407e6e11cf08b9cd62d17f5942a3e2e8d424
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/Allwmake
@@ -0,0 +1,21 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # run from this directory
+set -x
+
+if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
+then
+   case "$ParaView_VERSION" in
+   3*)
+      wmake libso vtkPV3blockMesh
+      (
+         cd PV3blockMeshReader
+         mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1
+         cd Make/$WM_OPTIONS
+         cmake ../..
+         make
+      )
+      ;;
+   esac
+fi
+
+# ----------------------------------------------------------------- end-of-file
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..fc645367f49e1f026c64d4a4a140c486c7d48d7e
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt
@@ -0,0 +1,56 @@
+# create a plugin that adds a reader to the ParaView GUI
+# it is added in the file dialog when doing opens/saves.
+
+# The qrc file is processed by Qt's resource compiler (rcc)
+# the qrc file must have a resource prefix of "/ParaViewResources"
+# and ParaView will read anything contained under that prefix
+# the pqReader.xml file contains xml defining readers with their
+# file extensions and descriptions.
+
+cmake_minimum_required(VERSION 2.4)
+
+FIND_PACKAGE(ParaView REQUIRED)
+INCLUDE(${PARAVIEW_USE_FILE})
+
+LINK_DIRECTORIES(
+    $ENV{FOAM_LIBBIN}
+)
+
+INCLUDE_DIRECTORIES(
+    $ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
+    $ENV{WM_PROJECT_DIR}/src/meshing/blockMesh/lnInclude
+    ${PROJECT_SOURCE_DIR}/../vtkPV3blockMesh
+)
+
+ADD_DEFINITIONS(
+    -DWM_$ENV{WM_PRECISION_OPTION}
+)
+
+# Set output library destination to plugin folder
+SET(
+    LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
+    CACHE INTERNAL
+    "Single output directory for building all libraries."
+)
+
+# Build the server-side plugin
+ADD_PARAVIEW_PLUGIN(
+    PV3blockMeshReader_SM "1.0"
+    SERVER_MANAGER_XML PV3blockMeshReader_SM.xml
+    SERVER_MANAGER_SOURCES vtkPV3blockMeshReader.cxx
+)
+
+# Build the client-side plugin
+ADD_PARAVIEW_PLUGIN(
+    PV3blockMeshReader
+    "1.0"
+    GUI_RESOURCES PV3blockMeshReader.qrc
+)
+
+TARGET_LINK_LIBRARIES(
+    PV3blockMeshReader_SM
+    OpenFOAM
+    blockMesh
+    vtkPV3blockMesh
+)
+#-----------------------------------------------------------------------------
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader.qrc b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader.qrc
new file mode 100644
index 0000000000000000000000000000000000000000..5a3d74d0b06982021135362a2b01047409a04f20
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader.qrc
@@ -0,0 +1,5 @@
+<RCC>
+  <qresource prefix="/ParaViewResources" >
+      <file>PV3blockMeshReader.xml</file>
+  </qresource>
+</RCC>
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader.xml b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8b97801148105176fe530eb8dd6118235624329d
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader.xml
@@ -0,0 +1,6 @@
+<ParaViewReaders>
+  <Reader name="PV3blockMeshReader"
+      extensions="blockMesh"
+      file_description="OpenFOAM blockMesh reader">
+  </Reader>
+</ParaViewReaders>
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader_SM.xml b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader_SM.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5eea03fe2bc4515f73cbf713ce20b075c617bc4f
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader_SM.xml
@@ -0,0 +1,98 @@
+<ServerManagerConfiguration>
+  <ProxyGroup name="sources">
+  <SourceProxy
+    name="PV3blockMeshReader"
+    class="vtkPV3blockMeshReader">
+
+    <!-- File name - compulsory -->
+    <StringVectorProperty
+      name="FileName"
+      command="SetFileName"
+      number_of_elements="1"
+      animateable="0">
+      <FileListDomain name="files"/>
+      <Documentation>
+        Specifies the filename for the OpenFOAM blockMesh Reader.
+      </Documentation>
+    </StringVectorProperty>
+
+    <!-- Global settings -->
+
+    <!-- Show Point Numbers check-box -->
+    <IntVectorProperty
+      name="ShowPointNumbers"
+      command="SetShowPointNumbers"
+      number_of_elements="1"
+      default_values="1"
+      animateable="0">
+      <BooleanDomain name="bool"/>
+      <Documentation>
+        Show point numbers in render window.
+      </Documentation>
+    </IntVectorProperty>
+
+    <!-- Update GUI check box -->
+    <IntVectorProperty
+      name="UpdateGUI"
+      command="SetUpdateGUI"
+      number_of_elements="1"
+      default_values="0"
+      animateable="0">
+      <BooleanDomain name="bool"/>
+      <Documentation>
+        A simple way to cause a reader GUI modification.
+      </Documentation>
+    </IntVectorProperty>
+
+
+    <!-- Selections -->
+
+    <!-- Available Parts (blocks) array -->
+    <StringVectorProperty
+      name="PartArrayInfo"
+      information_only="1">
+      <ArraySelectionInformationHelper attribute_name="Part"/>
+    </StringVectorProperty>
+    <StringVectorProperty
+      name="PartStatus"
+      label="Blocks"
+      command="SetPartArrayStatus"
+      number_of_elements="0"
+      repeat_command="1"
+      number_of_elements_per_command="2"
+      element_types="2 0"
+      information_property="PartArrayInfo"
+      animateable="0">
+      <ArraySelectionDomain name="array_list">
+        <RequiredProperties>
+          <Property name="PartArrayInfo" function="ArrayList"/>
+        </RequiredProperties>
+      </ArraySelectionDomain>
+    </StringVectorProperty>
+
+    <!-- Available Parts (blocks) array -->
+    <StringVectorProperty
+      name="CurvedEdgesArrayInfo"
+      information_only="1">
+      <ArraySelectionInformationHelper attribute_name="CurvedEdges"/>
+    </StringVectorProperty>
+    <StringVectorProperty
+      name="CurvedEdgesStatus"
+      label="Curved Edges"
+      command="SetCurvedEdgesArrayStatus"
+      number_of_elements="0"
+      repeat_command="1"
+      number_of_elements_per_command="2"
+      element_types="2 0"
+      information_property="CurvedEdgesArrayInfo"
+      animateable="0">
+      <ArraySelectionDomain name="array_list">
+        <RequiredProperties>
+          <Property name="CurvedEdgesArrayInfo" function="ArrayList"/>
+        </RequiredProperties>
+      </ArraySelectionDomain>
+    </StringVectorProperty>
+
+  </SourceProxy>
+  </ProxyGroup>
+</ServerManagerConfiguration>
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.cxx b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..451c8b5855abc0992d6f501c2c16471a2f8bb705
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.cxx
@@ -0,0 +1,381 @@
+/*=========================================================================
+
+  Program:   Visualization Toolkit
+  Module:    $RCSfile: vtkPV3blockMeshReader.cxx,v $
+
+  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+  All rights reserved.
+  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notice for more information.
+
+=========================================================================*/
+
+#include "vtkPV3blockMeshReader.h"
+
+#include "pqApplicationCore.h"
+#include "pqRenderView.h"
+#include "pqServerManagerModel.h"
+
+// VTK includes
+#include "vtkCallbackCommand.h"
+#include "vtkDataArraySelection.h"
+#include "vtkInformation.h"
+#include "vtkInformationVector.h"
+#include "vtkMultiBlockDataSet.h"
+#include "vtkObjectFactory.h"
+#include "vtkSMRenderViewProxy.h"
+#include "vtkStreamingDemandDrivenPipeline.h"
+#include "vtkStringArray.h"
+
+// Foam includes
+#include "vtkPV3blockMesh.H"
+
+vtkCxxRevisionMacro(vtkPV3blockMeshReader, "$Revision: 1.5$");
+vtkStandardNewMacro(vtkPV3blockMeshReader);
+
+vtkPV3blockMeshReader::vtkPV3blockMeshReader()
+{
+    Debug = 0;
+    vtkDebugMacro(<<"Constructor");
+
+    SetNumberOfInputPorts(0);
+
+    FileName  = NULL;
+    foamData_ = NULL;
+
+    ShowPointNumbers = 1;
+    UpdateGUI = 0;
+
+    PartSelection = vtkDataArraySelection::New();
+    CurvedEdgesSelection = vtkDataArraySelection::New();
+
+    // Setup the selection callback to modify this object when an array
+    // selection is changed.
+    SelectionObserver = vtkCallbackCommand::New();
+    SelectionObserver->SetCallback
+    (
+        &vtkPV3blockMeshReader::SelectionModifiedCallback
+    );
+    SelectionObserver->SetClientData(this);
+
+
+    PartSelection->AddObserver
+    (
+        vtkCommand::ModifiedEvent,
+        this->SelectionObserver
+    );
+
+    CurvedEdgesSelection->AddObserver
+    (
+        vtkCommand::ModifiedEvent,
+        this->SelectionObserver
+    );
+}
+
+
+vtkPV3blockMeshReader::~vtkPV3blockMeshReader()
+{
+    vtkDebugMacro(<<"Deconstructor");
+
+    delete foamData_;
+
+    if (FileName)
+    {
+        delete [] FileName;
+    }
+
+    PartSelection->RemoveObserver(this->SelectionObserver);
+    CurvedEdgesSelection->RemoveObserver(this->SelectionObserver);
+
+    SelectionObserver->Delete();
+    PartSelection->Delete();
+}
+
+
+// Do everything except set the output info
+int vtkPV3blockMeshReader::RequestInformation
+(
+    vtkInformation* vtkNotUsed(request),
+    vtkInformationVector** vtkNotUsed(inputVector),
+    vtkInformationVector* outputVector
+)
+{
+    vtkDebugMacro(<<"RequestInformation");
+
+    if (Foam::vtkPV3blockMesh::debug)
+    {
+        cout<<"REQUEST_INFORMATION\n";
+    }
+
+    if (!FileName)
+    {
+        vtkErrorMacro("FileName has to be specified!");
+        return 0;
+    }
+
+    int nInfo = outputVector->GetNumberOfInformationObjects();
+
+    if (Foam::vtkPV3blockMesh::debug)
+    {
+        cout<<"RequestInformation with " << nInfo << " item(s)\n";
+        for (int infoI = 0; infoI < nInfo; ++infoI)
+        {
+            outputVector->GetInformationObject(infoI)->Print(cout);
+        }
+    }
+
+    if (!foamData_)
+    {
+        foamData_ = new Foam::vtkPV3blockMesh(FileName, this);
+    }
+    else
+    {
+        foamData_->updateInfo();
+    }
+
+    // might need some other type of error handling
+
+//    {
+//        vtkErrorMacro("could not find valid OpenFOAM blockMesh");
+//
+//        // delete foamData and flag it as fatal error
+//        delete foamData_;
+//        foamData_ = NULL;
+//        return 0;
+//    }
+
+
+    return 1;
+}
+
+
+// Set the output info
+int vtkPV3blockMeshReader::RequestData
+(
+    vtkInformation* vtkNotUsed(request),
+    vtkInformationVector** vtkNotUsed(inputVector),
+    vtkInformationVector* outputVector
+)
+{
+    vtkDebugMacro(<<"RequestData");
+
+    if (!FileName)
+    {
+        vtkErrorMacro("FileName has to be specified!");
+        return 0;
+    }
+
+    // catch previous error
+    if (!foamData_)
+    {
+        vtkErrorMacro("Reader failed - perhaps no mesh?");
+        return 0;
+    }
+
+    int nInfo = outputVector->GetNumberOfInformationObjects();
+
+    if (Foam::vtkPV3blockMesh::debug)
+    {
+        cout<<"RequestData with " << nInfo << " item(s)\n";
+        for (int infoI = 0; infoI < nInfo; ++infoI)
+        {
+            outputVector->GetInformationObject(infoI)->Print(cout);
+        }
+    }
+
+    vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
+    (
+        outputVector->GetInformationObject(0)->Get
+        (
+            vtkMultiBlockDataSet::DATA_OBJECT()
+        )
+    );
+
+    if (Foam::vtkPV3blockMesh::debug)
+    {
+        cout<< "update output with "
+            << output->GetNumberOfBlocks() << " blocks\n";
+    }
+
+
+    foamData_->Update(output);
+    updatePointNumbersView(ShowPointNumbers);
+
+    // Do any cleanup on the Foam side
+    foamData_->CleanUp();
+
+    return 1;
+}
+
+
+void vtkPV3blockMeshReader::updatePointNumbersView(const bool show)
+{
+    pqApplicationCore* appCore = pqApplicationCore::instance();
+
+    // Server manager model for querying items in the server manager
+    pqServerManagerModel* smModel = appCore->getServerManagerModel();
+
+    // Get all the pqRenderView instances
+    QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
+
+    for (int viewI=0; viewI<renderViews.size(); ++viewI)
+    {
+        foamData_->renderPointNumbers
+        (
+            renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
+            show
+        );
+    }
+}
+
+
+void vtkPV3blockMeshReader::PrintSelf(ostream& os, vtkIndent indent)
+{
+    vtkDebugMacro(<<"PrintSelf");
+
+    this->Superclass::PrintSelf(os,indent);
+    os<< indent << "File name: "
+      << (this->FileName ? this->FileName : "(none)") << "\n";
+
+    foamData_->PrintSelf(os, indent);
+}
+
+
+// ----------------------------------------------------------------------
+// Parts selection list control
+
+vtkDataArraySelection* vtkPV3blockMeshReader::GetPartSelection()
+{
+    vtkDebugMacro(<<"GetPartSelection");
+    return PartSelection;
+}
+
+
+int vtkPV3blockMeshReader::GetNumberOfPartArrays()
+{
+    vtkDebugMacro(<<"GetNumberOfPartArrays");
+    return PartSelection->GetNumberOfArrays();
+}
+
+
+const char* vtkPV3blockMeshReader::GetPartArrayName(int index)
+{
+    vtkDebugMacro(<<"GetPartArrayName");
+    return PartSelection->GetArrayName(index);
+}
+
+
+int vtkPV3blockMeshReader::GetPartArrayStatus(const char* name)
+{
+    vtkDebugMacro(<<"GetPartArrayStatus");
+    return PartSelection->ArrayIsEnabled(name);
+}
+
+
+void vtkPV3blockMeshReader::SetPartArrayStatus
+(
+    const char* name,
+    int status
+)
+{
+    vtkDebugMacro(<<"SetPartArrayStatus");
+    if (status)
+    {
+        PartSelection->EnableArray(name);
+    }
+    else
+    {
+        PartSelection->DisableArray(name);
+    }
+}
+
+
+// ----------------------------------------------------------------------
+// CurvedEdges selection list control
+
+vtkDataArraySelection* vtkPV3blockMeshReader::GetCurvedEdgesSelection()
+{
+    vtkDebugMacro(<<"GetCurvedEdgesSelection");
+    return CurvedEdgesSelection;
+}
+
+
+int vtkPV3blockMeshReader::GetNumberOfCurvedEdgesArrays()
+{
+    vtkDebugMacro(<<"GetNumberOfCurvedEdgesArrays");
+    return CurvedEdgesSelection->GetNumberOfArrays();
+}
+
+
+const char* vtkPV3blockMeshReader::GetCurvedEdgesArrayName(int index)
+{
+    vtkDebugMacro(<<"GetCurvedEdgesArrayName");
+    return CurvedEdgesSelection->GetArrayName(index);
+}
+
+
+int vtkPV3blockMeshReader::GetCurvedEdgesArrayStatus(const char* name)
+{
+    vtkDebugMacro(<<"GetCurvedEdgesArrayStatus");
+    return CurvedEdgesSelection->ArrayIsEnabled(name);
+}
+
+
+void vtkPV3blockMeshReader::SetCurvedEdgesArrayStatus
+(
+    const char* name,
+    int status
+)
+{
+    vtkDebugMacro(<<"SetCurvedEdgesArrayStatus");
+    if (status)
+    {
+        CurvedEdgesSelection->EnableArray(name);
+    }
+    else
+    {
+        CurvedEdgesSelection->DisableArray(name);
+    }
+}
+
+
+// ----------------------------------------------------------------------
+
+void vtkPV3blockMeshReader::SelectionModifiedCallback
+(
+    vtkObject*,
+    unsigned long,
+    void* clientdata,
+    void*
+)
+{
+    static_cast<vtkPV3blockMeshReader*>(clientdata)->SelectionModified();
+}
+
+
+void vtkPV3blockMeshReader::SelectionModified()
+{
+    vtkDebugMacro(<<"SelectionModified");
+    Modified();
+}
+
+
+int vtkPV3blockMeshReader::FillOutputPortInformation
+(
+    int port,
+    vtkInformation* info
+)
+{
+    if (port == 0)
+    {
+        return this->Superclass::FillOutputPortInformation(port, info);
+    }
+    info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkMultiBlockDataSet");
+    return 1;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.h b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.h
new file mode 100644
index 0000000000000000000000000000000000000000..b26cde357dd481b37d2b07edbf2a458bfb5a0578
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.h
@@ -0,0 +1,153 @@
+/*=========================================================================
+
+  Program:   Visualization Toolkit
+  Module:    $RCSfile: vtkPV3blockMeshReader.h,v $
+
+  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
+  All rights reserved.
+  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notice for more information.
+
+=========================================================================*/
+// .NAME vtkPV3blockMeshReader - reads a dataset in OpenFOAM bockMesh format
+// .SECTION Description
+// vtkPV3blockMeshReader creates an multiblock dataset.
+// It uses the OpenFOAM infrastructure (blockMesh).
+
+#ifndef __vtkPV3blockMeshReader_h
+#define __vtkPV3blockMeshReader_h
+
+// Foam forward declarations
+namespace Foam
+{
+    class vtkPV3blockMesh;
+}
+
+// VTK includes
+#include "vtkMultiBlockDataSetAlgorithm.h"
+
+// VTK forward declarations
+class vtkDataArraySelection;
+class vtkCallbackCommand;
+
+
+class VTK_IO_EXPORT vtkPV3blockMeshReader
+:
+    public vtkMultiBlockDataSetAlgorithm
+{
+public:
+    vtkTypeRevisionMacro(vtkPV3blockMeshReader,vtkMultiBlockDataSetAlgorithm);
+    void PrintSelf(ostream&, vtkIndent);
+
+    static vtkPV3blockMeshReader* New();
+
+    // Description:
+    // Set/Get the filename.
+    vtkSetStringMacro(FileName);
+    vtkGetStringMacro(FileName);
+
+    // Description:
+    // GUI update control
+    vtkSetMacro(UpdateGUI, int);
+    vtkGetMacro(UpdateGUI, int);
+
+    // Description:
+    // FOAM display patch names control
+    vtkSetMacro(ShowPointNumbers, int);
+    vtkGetMacro(ShowPointNumbers, int);
+
+    // Description:
+    // Parts (blocks) selection list control
+    vtkDataArraySelection* GetPartSelection();
+    int  GetNumberOfPartArrays();
+    int  GetPartArrayStatus(const char*);
+    void SetPartArrayStatus(const char*, int status);
+    const char* GetPartArrayName(int index);
+
+    // Description:
+    // Parts (blocks) selection list control
+    vtkDataArraySelection* GetCurvedEdgesSelection();
+    int  GetNumberOfCurvedEdgesArrays();
+    int  GetCurvedEdgesArrayStatus(const char*);
+    void SetCurvedEdgesArrayStatus(const char*, int status);
+    const char* GetCurvedEdgesArrayName(int index);
+
+    // Description:
+    // Callback registered with the SelectionObserver
+    // for all the selection lists
+    static void SelectionModifiedCallback
+    (
+        vtkObject* caller,
+        unsigned long eid,
+        void* clientdata,
+        void* calldata
+    );
+
+    void SelectionModified();
+
+
+protected:
+
+    //- Construct null
+    vtkPV3blockMeshReader();
+
+    //- Destructor
+    ~vtkPV3blockMeshReader();
+
+    //- Return information about mesh, times, etc without loading anything
+    virtual int RequestInformation
+    (
+        vtkInformation*,
+        vtkInformationVector**,
+        vtkInformationVector*
+    );
+
+    //- Get the mesh/fields for a particular time
+    virtual int RequestData
+    (
+        vtkInformation*,
+        vtkInformationVector**,
+        vtkInformationVector*
+    );
+
+    //- Fill in additional port information
+    virtual int FillOutputPortInformation(int, vtkInformation*);
+
+    // The observer to modify this object when array selections are modified
+    vtkCallbackCommand* SelectionObserver;
+
+    char* FileName;
+
+private:
+
+    //- Disallow default bitwise copy construct
+    vtkPV3blockMeshReader(const vtkPV3blockMeshReader&);
+
+    //- Disallow default bitwise assignment
+    void operator=(const vtkPV3blockMeshReader&);
+
+    //- Add/remove point numbers to/from the view
+    void updatePointNumbersView(const bool show);
+
+    int ShowPointNumbers;
+
+    //- Dummy variable/switch to invoke a reader update
+    int UpdateGUI;
+
+    vtkDataArraySelection* PartSelection;
+
+    vtkDataArraySelection* CurvedEdgesSelection;
+
+    //BTX
+    Foam::vtkPV3blockMesh* foamData_;
+    //ETX
+};
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/Make/files b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..f084cc9f28fbc5faa5d02b2a857a9e4fc7f5eaf5
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/Make/files
@@ -0,0 +1,5 @@
+vtkPV3blockMesh.C
+vtkPV3blockMeshConvert.C
+vtkPV3blockMeshUtils.C
+
+LIB = $(FOAM_LIBBIN)/libvtkPV3blockMesh
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/Make/options b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/Make/options
new file mode 100644
index 0000000000000000000000000000000000000000..2e5727ba771c060bb4855afee63eeedc3184a12d
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/Make/options
@@ -0,0 +1,15 @@
+EXE_INC = \
+    -I$(LIB_SRC)/meshTools/lnInclude \
+    -I$(LIB_SRC)/mesh/blockMesh/lnInclude \
+    -I$(ParaView_DIR)/VTK \
+    -I$(ParaView_INST_DIR) \
+    -I$(ParaView_INST_DIR)/VTK \
+    -I$(ParaView_INST_DIR)/VTK/Common \
+    -I$(ParaView_INST_DIR)/VTK/Filtering \
+    -I$(ParaView_INST_DIR)/VTK/Rendering \
+    -I../PV3blockMeshReader
+
+LIB_LIBS = \
+    -lmeshTools \
+    -lblockMesh \
+    $(GLIBS)
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkDataArrayTemplateImplicit.txx b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkDataArrayTemplateImplicit.txx
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkOpenFOAMPoints.H
similarity index 80%
rename from applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H
rename to applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkOpenFOAMPoints.H
index 626c90a7a425960acd8abc2fef199892cdd70b4b..b6fa0c83b0ed105f9bfaadb8d3cbe30229262365 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamI.H
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkOpenFOAMPoints.H
@@ -22,27 +22,30 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
+InClass
+    vtkPV3blockMesh
+
 \*---------------------------------------------------------------------------*/
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+#ifndef vtkOpenFOAMPoints_H
+#define vtkOpenFOAMPoints_H
 
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+// VTK includes
+#include "vtkPoints.h"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-inline Foam::word Foam::vtkPV3Foam::getFirstWord(const char* str)
+inline void vtkInsertNextOpenFOAMPoint
+(
+    vtkPoints *points,
+    const Foam::point& p
+)
 {
-    if (str)
-    {
-        label n = 0;
-        while (str[n] && word::valid(str[n]))
-        {
-            ++n;
-        }
-        return word(str, n, true);
-    }
-    else
-    {
-        return word::null;
-    }
+    points->InsertNextPoint(p.x(), p.y(), p.z());
 }
 
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
 // ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C
new file mode 100644
index 0000000000000000000000000000000000000000..2dc5bc32e3aff5d092706c7bd263d9f9eed2e857
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C
@@ -0,0 +1,433 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+\*---------------------------------------------------------------------------*/
+
+#include "vtkPV3blockMesh.H"
+#include "vtkPV3blockMeshReader.h"
+
+// Foam includes
+#include "blockMesh.H"
+#include "Time.H"
+#include "patchZones.H"
+#include "OStringStream.H"
+
+// VTK includes
+#include "vtkDataArraySelection.h"
+#include "vtkMultiBlockDataSet.h"
+#include "vtkRenderer.h"
+#include "vtkTextActor.h"
+#include "vtkTextProperty.h"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+defineTypeNameAndDebug(Foam::vtkPV3blockMesh, 0);
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+void Foam::vtkPV3blockMesh::resetCounters()
+{
+    // Reset mesh part ids and sizes
+    partInfoBlocks_.reset();
+    partInfoEdges_.reset();
+    partInfoCorners_.reset();
+}
+
+
+void Foam::vtkPV3blockMesh::updateInfoBlocks()
+{
+    if (debug)
+    {
+        Info<< "<beg> Foam::vtkPV3blockMesh::updateInfoBlocks"
+            << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
+    }
+
+    vtkDataArraySelection* selection = reader_->GetPartSelection();
+    partInfoBlocks_ = selection->GetNumberOfArrays();
+
+    const blockMesh& blkMesh = *meshPtr_;
+    const int nBlocks = blkMesh.size();
+    for (int blockI = 0; blockI < nBlocks; ++blockI)
+    {
+        const blockDescriptor& blockDef = blkMesh[blockI].blockDef();
+
+        word partName = Foam::name(blockI);
+
+        // append the (optional) zone name
+        if (!blockDef.zoneName().empty())
+        {
+            partName += " - " + blockDef.zoneName();
+        }
+
+        // Add blockId and zoneName to GUI list
+        selection->AddArray(partName.c_str());
+    }
+
+    partInfoBlocks_ += nBlocks;
+
+    if (debug)
+    {
+        // just for debug info
+        getSelectedArrayEntries(selection);
+
+        Info<< "<end> Foam::vtkPV3blockMesh::updateInfoBlocks" << endl;
+    }
+}
+
+
+void Foam::vtkPV3blockMesh::updateInfoEdges()
+{
+    if (debug)
+    {
+        Info<< "<beg> Foam::vtkPV3blockMesh::updateInfoEdges"
+            << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
+    }
+
+    vtkDataArraySelection* selection = reader_->GetCurvedEdgesSelection();
+    partInfoEdges_ = selection->GetNumberOfArrays();
+
+    const blockMesh& blkMesh = *meshPtr_;
+    const curvedEdgeList& edges = blkMesh.edges();
+
+    const int nEdges = edges.size();
+    forAll(edges, edgeI)
+    {
+        OStringStream ostr;
+
+        ostr<< edges[edgeI].start() << ":" << edges[edgeI].end() << " - "
+            << edges[edgeI].type();
+
+        // Add "beg:end - type" to GUI list
+        selection->AddArray(ostr.str().c_str());
+    }
+
+    partInfoEdges_ += nEdges;
+
+    if (debug)
+    {
+        // just for debug info
+        getSelectedArrayEntries(selection);
+
+        Info<< "<end> Foam::vtkPV3blockMesh::updateInfoEdges" << endl;
+    }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::vtkPV3blockMesh::vtkPV3blockMesh
+(
+    const char* const FileName,
+    vtkPV3blockMeshReader* reader
+)
+:
+    reader_(reader),
+    dbPtr_(NULL),
+    meshPtr_(NULL),
+    partInfoBlocks_("block"),
+    partInfoEdges_("edges"),
+    partInfoCorners_("corners")
+{
+    if (debug)
+    {
+        Info<< "Foam::vtkPV3blockMesh::vtkPV3blockMesh - "
+            << FileName << endl;
+    }
+
+    // avoid argList and get rootPath/caseName directly from the file
+    fileName fullCasePath(fileName(FileName).path());
+
+    if (!isDir(fullCasePath))
+    {
+        return;
+    }
+    if (fullCasePath == ".")
+    {
+        fullCasePath = cwd();
+    }
+
+    // Set the case as an environment variable - some BCs might use this
+    if (fullCasePath.name().find("processor", 0) == 0)
+    {
+        const fileName globalCase = fullCasePath.path();
+
+        setEnv("FOAM_CASE", globalCase, true);
+        setEnv("FOAM_CASENAME", globalCase.name(), true);
+    }
+    else
+    {
+        setEnv("FOAM_CASE", fullCasePath, true);
+        setEnv("FOAM_CASENAME", fullCasePath.name(), true);
+    }
+
+    // look for 'case{region}.OpenFOAM'
+    // could be stringent and insist the prefix match the directory name...
+    // Note: cannot use fileName::name() due to the embedded '{}'
+    string caseName(fileName(FileName).lessExt());
+
+    if (debug)
+    {
+        Info<< "fullCasePath=" << fullCasePath << nl
+            << "FOAM_CASE=" << getEnv("FOAM_CASE") << nl
+            << "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << endl;
+    }
+
+    // Create time object
+    dbPtr_.reset
+    (
+        new Time
+        (
+            Time::controlDictName,
+            fileName(fullCasePath.path()),
+            fileName(fullCasePath.name())
+        )
+    );
+
+    dbPtr_().functionObjects().off();
+
+    updateInfo();
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::vtkPV3blockMesh::~vtkPV3blockMesh()
+{
+    if (debug)
+    {
+        Info<< "<end> Foam::vtkPV3blockMesh::~vtkPV3blockMesh" << endl;
+    }
+
+    delete meshPtr_;
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::vtkPV3blockMesh::updateInfo()
+{
+    if (debug)
+    {
+        Info<< "<beg> Foam::vtkPV3blockMesh::updateInfo"
+            << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] " << endl;
+    }
+
+    resetCounters();
+
+    vtkDataArraySelection* partSelection = reader_->GetPartSelection();
+    vtkDataArraySelection* edgeSelection = reader_->GetCurvedEdgesSelection();
+
+    // enable 'internalMesh' on the first call
+    // or preserve the enabled selections
+    stringList enabledParts;
+    stringList enabledEdges;
+    bool firstTime = false;
+    if (!partSelection->GetNumberOfArrays() && !meshPtr_)
+    {
+        firstTime = true;
+    }
+    else
+    {
+        enabledParts = getSelectedArrayEntries(partSelection);
+        enabledEdges = getSelectedArrayEntries(edgeSelection);
+    }
+
+    // Clear current mesh parts list
+    partSelection->RemoveAllArrays();
+    edgeSelection->RemoveAllArrays();
+
+    // need a blockMesh
+    updateFoamMesh();
+
+    // Update mesh parts list
+    updateInfoBlocks();
+
+    // Update curved edges list
+    updateInfoEdges();
+
+    // restore the enabled selections
+    if (!firstTime)
+    {
+        setSelectedArrayEntries(partSelection, enabledParts);
+        setSelectedArrayEntries(edgeSelection, enabledEdges);
+    }
+
+    if (debug)
+    {
+        Info<< "<end> Foam::vtkPV3blockMesh::updateInfo" << endl;
+    }
+}
+
+
+void Foam::vtkPV3blockMesh::updateFoamMesh()
+{
+    if (debug)
+    {
+        Info<< "<beg> Foam::vtkPV3blockMesh::updateFoamMesh" << endl;
+    }
+
+    // Check to see if the FOAM mesh has been created
+    if (!meshPtr_)
+    {
+        if (debug)
+        {
+            Info<< "Creating blockMesh at time=" << dbPtr_().timeName()
+                << endl;
+        }
+
+        IOdictionary meshDict
+        (
+            IOobject
+            (
+                "blockMeshDict",
+                dbPtr_().constant(),
+                polyMesh::meshSubDir,
+                dbPtr_(),
+                IOobject::MUST_READ,
+                IOobject::NO_WRITE,
+                false
+            )
+        );
+
+        meshPtr_ = new blockMesh(meshDict);
+    }
+
+
+    if (debug)
+    {
+        Info<< "<end> Foam::vtkPV3blockMesh::updateFoamMesh" << endl;
+    }
+}
+
+
+void Foam::vtkPV3blockMesh::Update
+(
+    vtkMultiBlockDataSet* output
+)
+{
+    reader_->UpdateProgress(0.1);
+
+    // Set up mesh parts selection(s)
+    updateBoolListStatus(partStatus_, reader_->GetPartSelection());
+
+    // Set up curved edges selection(s)
+    updateBoolListStatus(edgeStatus_, reader_->GetCurvedEdgesSelection());
+
+    reader_->UpdateProgress(0.2);
+
+    // Update the Foam mesh
+    updateFoamMesh();
+    reader_->UpdateProgress(0.5);
+
+    // Convert mesh elemente
+    int blockNo = 0;
+
+    convertMeshCorners(output, blockNo);
+    convertMeshBlocks(output, blockNo);
+    convertMeshEdges(output, blockNo);
+
+    reader_->UpdateProgress(0.8);
+
+}
+
+
+void Foam::vtkPV3blockMesh::CleanUp()
+{
+    reader_->UpdateProgress(1.0);
+}
+
+
+void Foam::vtkPV3blockMesh::renderPointNumbers
+(
+    vtkRenderer* renderer,
+    const bool show
+)
+{
+    // always remove old actors first
+
+    forAll(pointNumberTextActorsPtrs_, pointI)
+    {
+        renderer->RemoveViewProp(pointNumberTextActorsPtrs_[pointI]);
+        pointNumberTextActorsPtrs_[pointI]->Delete();
+    }
+    pointNumberTextActorsPtrs_.clear();
+
+    if (show && meshPtr_)
+    {
+        const pointField& cornerPts = meshPtr_->blockPointField();
+
+        pointNumberTextActorsPtrs_.setSize(cornerPts.size());
+        forAll(cornerPts, pointI)
+        {
+            vtkTextActor* txt = vtkTextActor::New();
+
+            txt->SetInput(Foam::name(pointI).c_str());
+
+            // Set text properties
+            vtkTextProperty* tprop = txt->GetTextProperty();
+            tprop->SetFontFamilyToArial();
+            tprop->BoldOn();
+            tprop->ShadowOff();
+            tprop->SetLineSpacing(1.0);
+            tprop->SetFontSize(14);
+            tprop->SetColor(1.0, 0.0, 1.0);
+            tprop->SetJustificationToCentered();
+
+            // Set text to use 3-D world co-ordinates
+            txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
+
+            txt->GetPositionCoordinate()->SetValue
+            (
+                cornerPts[pointI].x(),
+                cornerPts[pointI].y(),
+                cornerPts[pointI].z()
+            );
+
+            // Add text to each renderer
+            renderer->AddViewProp(txt);
+
+            // Maintain a list of text labels added so that they can be
+            // removed later
+            pointNumberTextActorsPtrs_[pointI] = txt;
+        }
+    }
+}
+
+
+
+void Foam::vtkPV3blockMesh::PrintSelf(ostream& os, vtkIndent indent) const
+{
+#if 0
+    os  << indent << "Number of nodes: "
+        << (meshPtr_ ? meshPtr_->nPoints() : 0) << "\n";
+
+    os  << indent << "Number of cells: "
+        << (meshPtr_ ? meshPtr_->nCells() : 0) << "\n";
+
+    os  << indent << "Number of available time steps: "
+        << (dbPtr_.valid() ? dbPtr_().times().size() : 0) << endl;
+#endif
+}
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.H b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.H
new file mode 100644
index 0000000000000000000000000000000000000000..6001267ef86c5d720bd188d7e3d4bab2d152af57
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.H
@@ -0,0 +1,353 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Class
+    Foam::vtkPV3blockMesh
+
+Description
+    Provides a reader interface for OpenFOAM blockMesh to VTK interaction
+
+SourceFiles
+    vtkPV3blockMesh.C
+    vtkPV3blockMeshConvert.C
+    vtkPV3blockMeshUpdate.C
+    vtkPV3blockMeshUtils.C
+
+    // Needed by VTK:
+    vtkDataArrayTemplateImplicit.txx
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef vtkPV3blockMesh_H
+#define vtkPV3blockMesh_H
+
+// do not include legacy strstream headers
+#ifndef  VTK_EXCLUDE_STRSTREAM_HEADERS
+# define VTK_EXCLUDE_STRSTREAM_HEADERS
+#endif
+
+#include "className.H"
+#include "fileName.H"
+#include "stringList.H"
+#include "wordList.H"
+
+#include "primitivePatch.H"
+
+// * * * * * * * * * * * * * Forward Declarations  * * * * * * * * * * * * * //
+
+class vtkDataArraySelection;
+class vtkDataSet;
+class vtkPoints;
+class vtkPV3blockMeshReader;
+class vtkRenderer;
+class vtkTextActor;
+class vtkMultiBlockDataSet;
+class vtkPolyData;
+class vtkUnstructuredGrid;
+class vtkIndent;
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Foam class forward declarations
+class argList;
+class Time;
+class blockMesh;
+
+template<class Type> class List;
+
+/*---------------------------------------------------------------------------*\
+                     Class vtkPV3blockMesh Declaration
+\*---------------------------------------------------------------------------*/
+
+class vtkPV3blockMesh
+{
+    // Private classes
+
+        //- Bookkeeping for GUI checklists and the multi-block organization
+        class partInfo
+        {
+            const char *name_;
+            int block_;
+            int start_;
+            int size_;
+
+        public:
+
+            partInfo(const char *name, const int blockNo=0)
+            :
+                name_(name),
+                block_(blockNo),
+                start_(-1),
+                size_(0)
+            {}
+
+            //- Return the block holding these datasets
+            int block() const
+            {
+                return block_;
+            }
+
+            //- Assign block number, return previous value
+            int block(int blockNo)
+            {
+                int prev = block_;
+                block_ = blockNo;
+                return prev;
+            }
+
+            const char* name() const
+            {
+                return name_;
+            }
+
+            int start() const
+            {
+                return start_;
+            }
+
+            int end() const
+            {
+                return start_ + size_;
+            }
+
+            int size() const
+            {
+                return size_;
+            }
+
+            bool empty() const
+            {
+                return !size_;
+            }
+
+            void reset()
+            {
+                start_ = -1;
+                size_ = 0;
+            }
+
+            //- Assign new start and reset the size
+            void operator=(const int i)
+            {
+                start_ = i;
+                size_ = 0;
+            }
+
+            //- Increment the size
+            void operator+=(const int n)
+            {
+                size_ += n;
+            }
+        };
+
+
+    // Private Data
+
+        //- Access to the controlling vtkPV3blockMeshReader
+        vtkPV3blockMeshReader* reader_;
+
+        //- Foam time control
+        autoPtr<Time> dbPtr_;
+
+        //- Foam mesh
+        blockMesh* meshPtr_;
+
+        //- Selected geometrical parts
+        boolList partStatus_;
+
+        //- Selected curved edges
+        boolList edgeStatus_;
+
+        //- First instance and size of bleckMesh blocks
+        //  used to index into partStatus_
+        partInfo partInfoBlocks_;
+
+        //- First instance and size of CurvedEdges
+        //  only partially used
+        partInfo partInfoEdges_;
+
+        //- First instance and size of block corners
+        //  only partially used
+        partInfo partInfoCorners_;
+
+        //- List of point numbers for rendering to window
+        List<vtkTextActor*> pointNumberTextActorsPtrs_;
+
+    // Private Member Functions
+
+        // Convenience method use to convert the readers from VTK 5
+        // multiblock API to the current composite data infrastructure
+        static void AddToBlock
+        (
+            vtkMultiBlockDataSet* output,
+            vtkDataSet* dataset,
+            const partInfo&,
+            const label datasetNo,
+            const std::string& datasetName
+        );
+
+        // Convenience method use to convert the readers from VTK 5
+        // multiblock API to the current composite data infrastructure
+        static vtkDataSet* GetDataSetFromBlock
+        (
+            vtkMultiBlockDataSet* output,
+            const partInfo&,
+            const label datasetNo
+        );
+
+        // Convenience method use to convert the readers from VTK 5
+        // multiblock API to the current composite data infrastructure
+        static label GetNumberOfDataSets
+        (
+            vtkMultiBlockDataSet* output,
+            const partInfo&
+        );
+
+        //- Update boolList from GUI selection
+        static void updateBoolListStatus
+        (
+            boolList&,
+            vtkDataArraySelection*
+        );
+
+        //- Reset data counters
+        void resetCounters();
+
+        // Update information helper functions
+
+            //- Internal block info
+            void updateInfoBlocks();
+
+            //- block curved edges info
+            void updateInfoEdges();
+
+        // Update helper functions
+
+            //- Foam mesh
+            void updateFoamMesh();
+
+        // Mesh conversion functions
+
+            //- mesh blocks
+            void convertMeshBlocks(vtkMultiBlockDataSet*, int& blockNo);
+
+            //- mesh curved edges
+            void convertMeshEdges(vtkMultiBlockDataSet*, int& blockNo);
+
+            //- mesh corners
+            void convertMeshCorners(vtkMultiBlockDataSet*, int& blockNo);
+
+
+       // GUI selection helper functions
+
+            //- Retrieve the current selections
+            static wordHashSet getSelected(vtkDataArraySelection*);
+
+            //- Retrieve a sub-list of the current selections
+            static wordHashSet getSelected
+            (
+                vtkDataArraySelection*,
+                const partInfo&
+            );
+
+            //- Retrieve the current selections
+            static stringList getSelectedArrayEntries(vtkDataArraySelection*);
+
+            //- Retrieve a sub-list of the current selections
+            static stringList getSelectedArrayEntries
+            (
+                vtkDataArraySelection*,
+                const partInfo&
+            );
+
+            //- Set selection(s)
+            static void setSelectedArrayEntries
+            (
+                vtkDataArraySelection*,
+                const stringList&
+            );
+
+
+        //- Disallow default bitwise copy construct
+        vtkPV3blockMesh(const vtkPV3blockMesh&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const vtkPV3blockMesh&);
+
+
+public:
+
+    //- Static data members
+
+        ClassName("vtkPV3blockMesh");
+
+
+    // Constructors
+
+        //- Construct from components
+        vtkPV3blockMesh
+        (
+            const char* const FileName,
+            vtkPV3blockMeshReader* reader
+        );
+
+
+    //- Destructor
+
+        ~vtkPV3blockMesh();
+
+
+    // Member Functions
+
+        //- Update
+        void updateInfo();
+
+        void Update(vtkMultiBlockDataSet* output);
+
+        //- Clean any storage
+        void CleanUp();
+
+        //- Add/remove point numbers to/from the view
+        void renderPointNumbers(vtkRenderer*, const bool show);
+
+     // Access
+
+        //- Debug information
+        void PrintSelf(ostream&, vtkIndent) const;
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C
new file mode 100644
index 0000000000000000000000000000000000000000..c163ba14ed479236779910afa39accd1218de037
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C
@@ -0,0 +1,318 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Description
+
+\*---------------------------------------------------------------------------*/
+
+#include "vtkPV3blockMesh.H"
+#include "vtkPV3blockMeshReader.h"
+
+// Foam includes
+#include "blockMesh.H"
+#include "Time.H"
+
+#include "vtkOpenFOAMPoints.H"
+
+// VTK includes
+#include "vtkCellArray.h"
+#include "vtkDataArraySelection.h"
+#include "vtkMultiBlockDataSet.h"
+#include "vtkPoints.h"
+#include "vtkPolyData.h"
+#include "vtkUnstructuredGrid.h"
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+void Foam::vtkPV3blockMesh::convertMeshBlocks
+(
+    vtkMultiBlockDataSet* output,
+    int& blockNo
+)
+{
+    vtkDataArraySelection* selection = reader_->GetPartSelection();
+    partInfo& selector = partInfoBlocks_;
+    selector.block(blockNo);   // set output block
+    label datasetNo = 0;       // restart at dataset 0
+
+    const blockMesh& blkMesh = *meshPtr_;
+    const Foam::pointField& blockPoints = blkMesh.blockPointField();
+
+    if (debug)
+    {
+        Info<< "<beg> Foam::vtkPV3blockMesh::convertMeshBlocks" << endl;
+    }
+
+    int blockI = 0;
+
+    for
+    (
+        int partId = selector.start();
+        partId < selector.end();
+        ++partId, ++blockI
+    )
+    {
+        if (!partStatus_[partId])
+        {
+            continue;
+        }
+
+        const blockDescriptor& blockDef = blkMesh[blockI].blockDef();
+        word partName("block");
+
+//         // append the (optional) zone name
+//         if (!blockDef.zoneName().empty())
+//         {
+//             partName += " - " + blockDef.zoneName();
+//         }
+//
+        vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
+
+        // Convert Foam mesh vertices to VTK
+        vtkPoints *vtkpoints = vtkPoints::New();
+        vtkpoints->Allocate( blockDef.nPoints() );
+        const labelList& blockLabels = blockDef.blockShape();
+
+        vtkmesh->Allocate(1);
+        vtkIdType nodeIds[8];
+
+        forAll(blockLabels, ptI)
+        {
+            vtkInsertNextOpenFOAMPoint
+            (
+                vtkpoints,
+                blockPoints[blockLabels[ptI]]
+            );
+
+            nodeIds[ptI] = ptI;
+        }
+
+        vtkmesh->InsertNextCell
+        (
+            VTK_HEXAHEDRON,
+            8,
+            nodeIds
+        );
+
+        vtkmesh->SetPoints(vtkpoints);
+        vtkpoints->Delete();
+
+        AddToBlock
+        (
+            output, vtkmesh, selector, datasetNo,
+            selection->GetArrayName(partId)
+        );
+
+        vtkmesh->Delete();
+        datasetNo++;
+    }
+
+
+    // anything added?
+    if (datasetNo)
+    {
+        ++blockNo;
+    }
+
+    if (debug)
+    {
+        Info<< "<end> Foam::vtkPV3blockMesh::convertMeshBlocks" << endl;
+    }
+}
+
+
+void Foam::vtkPV3blockMesh::convertMeshEdges
+(
+    vtkMultiBlockDataSet* output,
+    int& blockNo
+)
+{
+    vtkDataArraySelection* selection = reader_->GetCurvedEdgesSelection();
+    partInfo& selector = partInfoEdges_;
+
+    selector.block(blockNo);   // set output block
+    label datasetNo = 0;       // restart at dataset 0
+
+    const blockMesh& blkMesh = *meshPtr_;
+    const curvedEdgeList& edges = blkMesh.edges();
+
+    int edgeI = 0;
+
+    for
+    (
+        int partId = selector.start();
+        partId < selector.end();
+        ++partId, ++edgeI
+    )
+    {
+        if (!edgeStatus_[partId])
+        {
+            continue;
+        }
+
+        OStringStream ostr;
+
+        ostr<< edges[edgeI].start() << ":" << edges[edgeI].end() << " - "
+            << edges[edgeI].type();
+
+        // search each block
+        forAll(blkMesh, blockI)
+        {
+            const blockDescriptor& blockDef = blkMesh[blockI].blockDef();
+
+            edgeList blkEdges = blockDef.blockShape().edges();
+
+
+            // find the corresponding edge within the block
+
+            label foundEdgeI = -1;
+            forAll(blkEdges, blkEdgeI)
+            {
+                if (edges[edgeI].compare(blkEdges[blkEdgeI]))
+                {
+                    foundEdgeI = blkEdgeI;
+                    break;
+                }
+            }
+
+            if (foundEdgeI != -1)
+            {
+                const List<point>& edgePoints =
+                    blockDef.blockEdgePoints()[foundEdgeI];
+
+
+                vtkPolyData* vtkmesh = vtkPolyData::New();
+                vtkPoints* vtkpoints = vtkPoints::New();
+
+                vtkpoints->Allocate( edgePoints.size() );
+                vtkmesh->Allocate(1);
+
+                vtkIdType pointIds[edgePoints.size()];
+                forAll(edgePoints, ptI)
+                {
+                    vtkInsertNextOpenFOAMPoint(vtkpoints, edgePoints[ptI]);
+                    pointIds[ptI] = ptI;
+                }
+
+                vtkmesh->InsertNextCell
+                (
+                    VTK_POLY_LINE,
+                    edgePoints.size(),
+                    pointIds
+                );
+
+                vtkmesh->SetPoints(vtkpoints);
+                vtkpoints->Delete();
+
+                AddToBlock
+                (
+                    output, vtkmesh, selector, datasetNo,
+                    selection->GetArrayName(partId)
+                );
+
+                vtkmesh->Delete();
+                datasetNo++;
+
+                break;
+            }
+        }
+    }
+
+
+    // anything added?
+    if (datasetNo)
+    {
+        ++blockNo;
+    }
+
+    if (debug)
+    {
+        Info<< "<end> Foam::vtkPV3blockMesh::convertMeshEdges" << endl;
+    }
+
+}
+
+
+void Foam::vtkPV3blockMesh::convertMeshCorners
+(
+    vtkMultiBlockDataSet* output,
+    int& blockNo
+)
+{
+    partInfo& selector = partInfoCorners_;
+    selector.block(blockNo);   // set output block
+    label datasetNo = 0;       // restart at dataset 0
+
+    const pointField& blockPoints = meshPtr_->blockPointField();
+
+    if (debug)
+    {
+        Info<< "<beg> Foam::vtkPV3blockMesh::convertMeshCorners" << endl;
+    }
+
+    if (true)  // or some flag or other condition
+    {
+        vtkPolyData* vtkmesh = vtkPolyData::New();
+        vtkPoints* vtkpoints = vtkPoints::New();
+        vtkCellArray* vtkcells = vtkCellArray::New();
+
+        vtkpoints->Allocate( blockPoints.size() );
+        vtkcells->Allocate( blockPoints.size() );
+
+        vtkIdType pointId = 0;
+        forAll(blockPoints, ptI)
+        {
+            vtkInsertNextOpenFOAMPoint(vtkpoints, blockPoints[ptI]);
+
+            vtkcells->InsertNextCell(1, &pointId);
+            pointId++;
+        }
+
+        vtkmesh->SetPoints(vtkpoints);
+        vtkpoints->Delete();
+
+        vtkmesh->SetVerts(vtkcells);
+        vtkcells->Delete();
+
+        AddToBlock(output, vtkmesh, selector, datasetNo, partInfoCorners_.name());
+        vtkmesh->Delete();
+
+        datasetNo++;
+    }
+
+    // anything added?
+    if (datasetNo)
+    {
+        ++blockNo;
+    }
+
+    if (debug)
+    {
+        Info<< "<end> Foam::vtkPV3blockMesh::convertMeshCorners" << endl;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshUtils.C b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshUtils.C
new file mode 100644
index 0000000000000000000000000000000000000000..b948c5e97978495ea66de789803e09b352523593
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshUtils.C
@@ -0,0 +1,358 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Description
+    Misc helper methods and utilities
+
+\*---------------------------------------------------------------------------*/
+
+#include "vtkPV3blockMesh.H"
+#include "vtkPV3blockMeshReader.h"
+
+// VTK includes
+#include "vtkDataArraySelection.h"
+#include "vtkDataSet.h"
+#include "vtkMultiBlockDataSet.h"
+#include "vtkInformation.h"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    //! @cond fileScope
+    //  Extract up to the first non-word characters
+    inline word getFirstWord(const char* str)
+    {
+        if (str)
+        {
+            label n = 0;
+            while (str[n] && word::valid(str[n]))
+            {
+                ++n;
+            }
+            return word(str, n, true);
+        }
+        else
+        {
+            return word::null;
+        }
+
+    }
+    //! @endcond fileScope
+
+} // End namespace Foam
+
+
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+void Foam::vtkPV3blockMesh::AddToBlock
+(
+    vtkMultiBlockDataSet* output,
+    vtkDataSet* dataset,
+    const partInfo& selector,
+    const label datasetNo,
+    const std::string& datasetName
+)
+{
+    const int blockNo = selector.block();
+
+    vtkDataObject* blockDO = output->GetBlock(blockNo);
+    vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
+
+    if (!block)
+    {
+        if (blockDO)
+        {
+            FatalErrorIn("Foam::vtkPV3blockMesh::AddToBlock")
+                << "Block already has a vtkDataSet assigned to it"
+                << endl;
+            return;
+        }
+
+        block = vtkMultiBlockDataSet::New();
+        output->SetBlock(blockNo, block);
+        block->Delete();
+    }
+
+    if (debug)
+    {
+        Info<< "block[" << blockNo << "] has "
+            << block->GetNumberOfBlocks()
+            <<  " datasets prior to adding set " << datasetNo
+            <<  " with name: " << datasetName << endl;
+    }
+
+    block->SetBlock(datasetNo, dataset);
+
+    // name the block when assigning dataset 0
+    if (datasetNo == 0)
+    {
+        output->GetMetaData(blockNo)->Set
+        (
+            vtkCompositeDataSet::NAME(),
+            selector.name()
+        );
+    }
+
+    if (datasetName.size())
+    {
+        block->GetMetaData(datasetNo)->Set
+        (
+            vtkCompositeDataSet::NAME(),
+            datasetName.c_str()
+        );
+    }
+}
+
+
+vtkDataSet* Foam::vtkPV3blockMesh::GetDataSetFromBlock
+(
+    vtkMultiBlockDataSet* output,
+    const partInfo& selector,
+    const label datasetNo
+)
+{
+    const int blockNo = selector.block();
+
+    vtkDataObject* blockDO = output->GetBlock(blockNo);
+    vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
+
+    if (block)
+    {
+        return vtkDataSet::SafeDownCast(block->GetBlock(datasetNo));
+    }
+
+    return 0;
+}
+
+
+// ununsed at the moment
+Foam::label Foam::vtkPV3blockMesh::GetNumberOfDataSets
+(
+    vtkMultiBlockDataSet* output,
+    const partInfo& selector
+)
+{
+    const int blockNo = selector.block();
+
+    vtkDataObject* blockDO = output->GetBlock(blockNo);
+    vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
+    if (block)
+    {
+        return block->GetNumberOfBlocks();
+    }
+
+    return 0;
+}
+
+
+Foam::wordHashSet Foam::vtkPV3blockMesh::getSelected
+(
+    vtkDataArraySelection* select
+)
+{
+    int nElem = select->GetNumberOfArrays();
+    wordHashSet selections(2*nElem);
+
+    for (int elemI=0; elemI < nElem; ++elemI)
+    {
+        if (select->GetArraySetting(elemI))
+        {
+            selections.insert(getFirstWord(select->GetArrayName(elemI)));
+        }
+    }
+
+    return selections;
+}
+
+
+Foam::wordHashSet Foam::vtkPV3blockMesh::getSelected
+(
+    vtkDataArraySelection* select,
+    const partInfo& selector
+)
+{
+    int nElem = select->GetNumberOfArrays();
+    wordHashSet selections(2*nElem);
+
+    for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
+    {
+        if (select->GetArraySetting(elemI))
+        {
+            selections.insert(getFirstWord(select->GetArrayName(elemI)));
+        }
+    }
+
+    return selections;
+}
+
+
+Foam::stringList Foam::vtkPV3blockMesh::getSelectedArrayEntries
+(
+    vtkDataArraySelection* select
+)
+{
+    stringList selections(select->GetNumberOfArrays());
+    label nElem = 0;
+
+    forAll(selections, elemI)
+    {
+        if (select->GetArraySetting(elemI))
+        {
+            selections[nElem++] = select->GetArrayName(elemI);
+        }
+    }
+    selections.setSize(nElem);
+
+
+    if (debug)
+    {
+        label nElem = select->GetNumberOfArrays();
+        Info<< "available(";
+        for (int elemI = 0; elemI < nElem; ++elemI)
+        {
+            Info<< " \"" << select->GetArrayName(elemI) << "\"";
+        }
+        Info<< " )\nselected(";
+
+        forAll(selections, elemI)
+        {
+            Info<< " " << selections[elemI];
+        }
+        Info<< " )\n";
+    }
+
+    return selections;
+}
+
+
+Foam::stringList Foam::vtkPV3blockMesh::getSelectedArrayEntries
+(
+    vtkDataArraySelection* select,
+    const partInfo& selector
+)
+{
+    stringList selections(selector.size());
+    label nElem = 0;
+
+    for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
+    {
+        if (select->GetArraySetting(elemI))
+        {
+            selections[nElem++] = select->GetArrayName(elemI);
+        }
+    }
+    selections.setSize(nElem);
+
+
+    if (debug)
+    {
+        Info<< "available(";
+        for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
+        {
+            Info<< " \"" << select->GetArrayName(elemI) << "\"";
+        }
+        Info<< " )\nselected(";
+
+        forAll(selections, elemI)
+        {
+            Info<< " " << selections[elemI];
+        }
+        Info<< " )\n";
+    }
+
+    return selections;
+}
+
+
+void Foam::vtkPV3blockMesh::setSelectedArrayEntries
+(
+    vtkDataArraySelection* select,
+    const stringList& selections
+)
+{
+    const int nElem = select->GetNumberOfArrays();
+    select->DisableAllArrays();
+
+    // Loop through entries, setting values from selectedEntries
+    for (int elemI=0; elemI < nElem; ++elemI)
+    {
+        string arrayName(select->GetArrayName(elemI));
+
+        forAll(selections, elemI)
+        {
+            if (selections[elemI] == arrayName)
+            {
+                select->EnableArray(arrayName.c_str());
+                break;
+            }
+        }
+    }
+}
+
+
+void Foam::vtkPV3blockMesh::updateBoolListStatus
+(
+    boolList& status,
+    vtkDataArraySelection* selection
+)
+{
+    if (debug)
+    {
+        Info<< "<beg> Foam::vtkPV3blockMesh::updateBoolListStatus" << endl;
+    }
+
+    const label nElem = selection->GetNumberOfArrays();
+    if (status.size() != nElem)
+    {
+        status.setSize(nElem);
+        status = false;
+    }
+
+    forAll(status, elemI)
+    {
+        const int setting = selection->GetArraySetting(elemI);
+
+        status[elemI] = setting;
+
+        if (debug)
+        {
+            Info<< "  part[" << elemI << "] = "
+                << status[elemI]
+                << " : " << selection->GetArrayName(elemI) << endl;
+        }
+    }
+    if (debug)
+    {
+        Info<< "<end> Foam::vtkPV3blockMesh::updateBoolListStatus" << endl;
+    }
+}
+
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/miscellaneous/foamListTimes/Make/files b/applications/utilities/postProcessing/miscellaneous/foamListTimes/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..fe66ad822487d44cab4d6b56f3fc3013cb55aca7
--- /dev/null
+++ b/applications/utilities/postProcessing/miscellaneous/foamListTimes/Make/files
@@ -0,0 +1,3 @@
+foamListTimes.C
+
+EXE = $(FOAM_APPBIN)/foamListTimes
diff --git a/applications/utilities/postProcessing/miscellaneous/foamListTimes/Make/options b/applications/utilities/postProcessing/miscellaneous/foamListTimes/Make/options
new file mode 100644
index 0000000000000000000000000000000000000000..18e6fe47afacb902cddccf82632772447704fd88
--- /dev/null
+++ b/applications/utilities/postProcessing/miscellaneous/foamListTimes/Make/options
@@ -0,0 +1,2 @@
+/* EXE_INC = */
+/* EXE_LIBS = */
diff --git a/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C b/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C
new file mode 100644
index 0000000000000000000000000000000000000000..0a10a5744fa0eecbcc43217def17dff91e6998db
--- /dev/null
+++ b/applications/utilities/postProcessing/miscellaneous/foamListTimes/foamListTimes.C
@@ -0,0 +1,126 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Application
+    foamListTimes
+
+Description
+    List times using timeSelector
+
+Usage
+
+    - foamListTimes [OPTION]
+
+    @param -processor \n
+    List times from processor0 directory
+
+\*---------------------------------------------------------------------------*/
+
+#include "argList.H"
+#include "timeSelector.H"
+#include "Time.H"
+
+using namespace Foam;
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+int main(int argc, char *argv[])
+{
+    timeSelector::addOptions();  // -constant enabled
+    argList::noBanner();
+    argList::noParallel();
+    argList::validOptions.insert("processor", "");
+
+#   include "setRootCase.H"
+
+    label nProcs = 0;
+
+    // Create the processor databases
+    PtrList<Time> databases(1);
+
+    if (args.optionFound("processor"))
+    {
+        // determine the processor count directly
+        while (isDir(args.path()/(word("processor") + name(nProcs))))
+        {
+            ++nProcs;
+        }
+
+        if (!nProcs)
+        {
+            FatalErrorIn(args.executable())
+                << "No processor* directories found"
+                << exit(FatalError);
+        }
+
+        // Create the processor databases
+        databases.setSize(nProcs);
+
+        forAll(databases, procI)
+        {
+            databases.set
+            (
+                procI,
+                new Time
+                (
+                    Time::controlDictName,
+                    args.rootPath(),
+                    args.caseName()/fileName(word("processor") + name(procI))
+                )
+            );
+        }
+    }
+    else
+    {
+        databases.set
+        (
+            0,
+            new Time
+            (
+                Time::controlDictName,
+                args.rootPath(),
+                args.caseName()
+            )
+        );
+    }
+
+
+    // use the times list from the master processor
+    // and select a subset based on the command-line options
+    instantList timeDirs = timeSelector::select
+    (
+        databases[0].times(),
+        args
+    );
+
+    forAll(timeDirs, timeI)
+    {
+        Info<< timeDirs[timeI].name() << endl;
+    }
+
+    return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/bin/paraFoam b/bin/paraFoam
index 02cbf7a668fa7aa6af78dbd26e3af584add482b6..31d286fcc9fb2835091386548abdbe1587840fe3 100755
--- a/bin/paraFoam
+++ b/bin/paraFoam
@@ -29,6 +29,8 @@
 # Description
 #     start paraview with the OpenFOAM libraries
 #
+# Note
+#     combining -block and -region options yields undefined behaviour
 #------------------------------------------------------------------------------
 usage() {
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
@@ -38,6 +40,7 @@ usage: ${0##*/} [OPTION]
 options:
   -case   dir    specify alternative case directory
   -region name   specify mesh region name
+  -block         use blockMesh reader (and .blockMesh file)
   -touch         only create the .OpenFOAM file
 
 * start paraview $ParaView_VERSION with the OpenFOAM libraries
@@ -48,6 +51,9 @@ USAGE
 
 unset regionName touchOnly
 
+# reader extension
+reader=OpenFOAM
+
 # parse options
 while [ "$#" -gt 0 ]
 do
@@ -55,6 +61,10 @@ do
     -h | -help)
         usage
         ;;
+    -block | -blockMesh)
+        reader=blockMesh
+        shift
+        ;;
     -case)
         [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
         cd "$2" 2>/dev/null || usage "directory does not exist:  '$2'"
@@ -75,14 +85,14 @@ do
     esac
 done
 
-# get a sensible caseName
+# get a sensible caseName from the directory name
 caseName=${PWD##*/}
-caseFile="$caseName.OpenFOAM"
+caseFile="$caseName.$reader"
 fvControls="system"
 
 if [ -n "$regionName" ]
 then
-    caseFile="$caseName{$regionName}.OpenFOAM"
+    caseFile="$caseName{$regionName}.$reader"
     fvControls="$fvControls/$regionName"
 fi
 
@@ -99,12 +109,25 @@ case "$caseName" in
     *)          parentDir="."  ;;
 esac
 
+
+#
 # check existence of essential files
-for check in system/controlDict $fvControls/fvSchemes $fvControls/fvSolution
-do
-    [ -s "$parentDir/$check" ] || usage "file does not exist:  '$parentDir/$check'"
-done
+#
+case $reader in
+blockMesh)
+    for check in system/controlDict constant/polyMesh/blockMeshDict
+    do
+        [ -s "$parentDir/$check" ] || usage "file does not exist:  '$parentDir/$check'"
+    done
+    ;;
 
+OpenFOAM)
+    for check in system/controlDict $fvControls/fvSchemes $fvControls/fvSolution
+    do
+        [ -s "$parentDir/$check" ] || usage "file does not exist:  '$parentDir/$check'"
+    done
+    ;;
+esac
 
 case "$ParaView_VERSION" in
 2*)
diff --git a/src/Allwmake b/src/Allwmake
index ebef2d8d0d1f0a6915ceaa414c1792351e3e5624..2564ccf9e3e7d6ba8638f8832ce81817bdff0981 100755
--- a/src/Allwmake
+++ b/src/Allwmake
@@ -50,8 +50,8 @@ turbulenceModels/Allwmake
 lagrangian/Allwmake
 postProcessing/Allwmake
 conversion/Allwmake
+mesh/Allwmake
 
-wmake libso autoMesh
 wmake libso errorEstimation
 
 fvAgglomerationMethods/Allwmake
diff --git a/src/OpenFOAM/db/dictionary/functionEntries/removeEntry/removeEntry.C b/src/OpenFOAM/db/dictionary/functionEntries/removeEntry/removeEntry.C
index 223b251c435235dec871dbc96549dc3f15542d6c..34154cce481dd93c72b7ba02e55a513df07c18ae 100644
--- a/src/OpenFOAM/db/dictionary/functionEntries/removeEntry/removeEntry.C
+++ b/src/OpenFOAM/db/dictionary/functionEntries/removeEntry/removeEntry.C
@@ -66,7 +66,9 @@ bool Foam::functionEntries::removeEntry::execute
 )
 {
     wordList dictKeys = parentDict.toc();
-    labelList indices = findStrings<word>(readList<wordRe>(is), dictKeys);
+    wordReList patterns(is);
+
+    labelList indices = findStrings(patterns, dictKeys);
 
     forAll(indices, indexI)
     {
diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C
index 0d8b6b97e85ac07f84f7cd56cec98d54359234c1..eff7af933cabc52791bcf22958e3dbd29094c5c9 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C
@@ -450,7 +450,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
 
     const polyBoundaryMesh& bm = *this;
 
-    bool boundaryError = false;
+    bool hasError = false;
 
     // Collect non-proc patches and check proc patches are last.
     wordList names(bm.size());
@@ -464,8 +464,8 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
         {
             if (nonProcI != patchI)
             {
-                // There is processor patch inbetween normal patches.
-                boundaryError = true;
+                // There is processor patch in between normal patches.
+                hasError = true;
 
                 if (debug || report)
                 {
@@ -508,7 +508,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
          || (allTypes[procI] != allTypes[0])
         )
         {
-            boundaryError = true;
+            hasError = true;
 
             if (debug || (report && Pstream::master()))
             {
@@ -523,7 +523,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
         }
     }
 
-    return boundaryError;
+    return hasError;
 }
 
 
@@ -532,13 +532,13 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
     label nextPatchStart = mesh().nInternalFaces();
     const polyBoundaryMesh& bm = *this;
 
-    bool boundaryError = false;
+    bool hasError = false;
 
     forAll (bm, patchI)
     {
-        if (bm[patchI].start() != nextPatchStart && !boundaryError)
+        if (bm[patchI].start() != nextPatchStart && !hasError)
         {
-            boundaryError = true;
+            hasError = true;
 
             Info<< " ****Problem with boundary patch " << patchI
                 << " named " << bm[patchI].name()
@@ -553,26 +553,21 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
         nextPatchStart += bm[patchI].size();
     }
 
-    reduce(boundaryError, orOp<bool>());
+    reduce(hasError, orOp<bool>());
 
-    if (boundaryError)
+    if (debug || report)
     {
-        if (debug || report)
+        if (hasError)
         {
             Pout << " ***Boundary definition is in error." << endl;
         }
-
-        return true;
-    }
-    else
-    {
-        if (debug || report)
+        else
         {
             Info << "    Boundary definition OK." << endl;
         }
-
-        return false;
     }
+
+    return hasError;
 }
 
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C
index a7672104dab5bdd580848088442ebef2a279cd72..71eea20637d22b33badf8afcb10a72a1f2941334 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C
@@ -37,11 +37,11 @@ License
 namespace Foam
 {
     defineTypeNameAndDebug(cellZone, 0);
-
     defineRunTimeSelectionTable(cellZone, dictionary);
     addToRunTimeSelectionTable(cellZone, cellZone, dictionary);
 }
 
+const char * const Foam::cellZone::labelsName = "cellLabels";
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
@@ -79,7 +79,7 @@ Foam::cellZone::cellZone
     const cellZoneMesh& zm
 )
 :
-    zone("cell", name, dict, index),
+    zone(name, dict, this->labelsName, index),
     zoneMesh_(zm)
 {}
 
@@ -140,7 +140,7 @@ void Foam::cellZone::writeDict(Ostream& os) const
     os  << nl << name() << nl << token::BEGIN_BLOCK << nl
         << "    type " << type() << token::END_STATEMENT << nl;
 
-    writeEntry("cellLabels", os);
+    writeEntry(this->labelsName, os);
 
     os  << token::END_BLOCK << endl;
 }
@@ -148,10 +148,10 @@ void Foam::cellZone::writeDict(Ostream& os) const
 
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
-void Foam::cellZone::operator=(const cellZone& cz)
+void Foam::cellZone::operator=(const cellZone& zn)
 {
     clearAddressing();
-    labelList::operator=(cz);
+    labelList::operator=(zn);
 }
 
 
@@ -164,10 +164,10 @@ void Foam::cellZone::operator=(const labelList& addr)
 
 // * * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * //
 
-Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& cz)
+Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& zn)
 {
-    cz.write(os);
-    os.check("Ostream& operator<<(Ostream& os, const cellZone& cz");
+    zn.write(os);
+    os.check("Ostream& operator<<(Ostream&, const cellZone&");
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H
index 67c9c2f52f9331a81fbf72b609a41c77b01b593d..661e458a645b0b0241ea084f6eb78481eb6a95c4 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H
+++ b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H
@@ -81,6 +81,12 @@ protected:
 
 public:
 
+    // Static data members
+
+        //- The name associated with the zone-labels dictionary entry
+        static const char * const labelsName;
+
+
     //- Runtime type information
     TypeName("cellZone");
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C
index 796e1cc9101d1703c9598dde880273340ac7b14b..bf4ce6725503c42165164fe17fa2ceccea5d9b1a 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C
@@ -42,6 +42,8 @@ namespace Foam
     addToRunTimeSelectionTable(faceZone, faceZone, dictionary);
 }
 
+const char* const Foam::faceZone::labelsName = "faceLabels";
+
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 void Foam::faceZone::calcFaceZonePatch() const
@@ -226,7 +228,7 @@ Foam::faceZone::faceZone
     const faceZoneMesh& zm
 )
 :
-    zone("face", name, dict, index),
+    zone(name, dict, this->labelsName, index),
     flipMap_(dict.lookup("flipMap")),
     zoneMesh_(zm),
     patchPtr_(NULL),
@@ -442,7 +444,7 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
     const polyMesh& mesh = zoneMesh().mesh();
     const polyBoundaryMesh& bm = mesh.boundaryMesh();
 
-    bool boundaryError = false;
+    bool hasError = false;
 
 
     // Check that zone faces are synced
@@ -479,7 +481,7 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
                 // Check face in zone on both sides
                 if (myZoneFace[bFaceI] != neiZoneFace[bFaceI])
                 {
-                    boundaryError = true;
+                    hasError = true;
 
                     if (report)
                     {
@@ -491,12 +493,17 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
                             << " is not consistent with its coupled neighbour."
                             << endl;
                     }
+                    else
+                    {
+                        // w/o report - can stop checking now
+                        break;
+                    }
                 }
 
                 // Flip state should be opposite.
                 if (myZoneFlip[bFaceI] == neiZoneFlip[bFaceI])
                 {
-                    boundaryError = true;
+                    hasError = true;
 
                     if (report)
                     {
@@ -509,12 +516,17 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
                             << " across coupled faces."
                             << endl;
                     }
+                    else
+                    {
+                        // w/o report - can stop checking now
+                        break;
+                    }
                 }
             }
         }
     }
 
-    return returnReduce(boundaryError, orOp<bool>());
+    return returnReduce(hasError, orOp<bool>());
 }
 
 
@@ -539,7 +551,7 @@ void Foam::faceZone::writeDict(Ostream& os) const
     os  << nl << name() << nl << token::BEGIN_BLOCK << nl
         << "    type " << type() << token::END_STATEMENT << nl;
 
-    writeEntry("faceLabels", os);
+    writeEntry(this->labelsName, os);
     flipMap().writeEntry("flipMap", os);
 
     os  << token::END_BLOCK << endl;
@@ -548,10 +560,10 @@ void Foam::faceZone::writeDict(Ostream& os) const
 
 // * * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * //
 
-Foam::Ostream& Foam::operator<<(Ostream& os, const faceZone& fz)
+Foam::Ostream& Foam::operator<<(Ostream& os, const faceZone& zn)
 {
-    fz.write(os);
-    os.check("Ostream& operator<<(Ostream& os, const faceZone& fz");
+    zn.write(os);
+    os.check("Ostream& operator<<(Ostream&, const faceZone&");
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H
index 7b1b46d2c4d5edffebabcb161f5f46ef1dcfcb89..95e342e2f2037636f6423f8c8b6412a87ebab92c 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H
+++ b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H
@@ -60,13 +60,17 @@ Ostream& operator<<(Ostream&, const faceZone&);
 
 
 /*---------------------------------------------------------------------------*\
-                           Class faceZone Declaration
+                          Class faceZone Declaration
 \*---------------------------------------------------------------------------*/
 
 class faceZone
 :
     public zone
 {
+    // Private data
+
+        //- The name associated with the zone-labels dictionary entry
+        static const word labelsName_;
 
 protected:
 
@@ -118,6 +122,12 @@ protected:
 
 public:
 
+    // Static data members
+
+        //- The name associated with the zone-labels dictionary entry
+        static const char * const labelsName;
+
+
     //- Runtime type information
     TypeName("faceZone");
 
@@ -283,7 +293,7 @@ public:
         virtual void movePoints(const pointField&);
 
         //- Update for changes in topology
-        virtual void updateMesh(const mapPolyMesh& mpm);
+        virtual void updateMesh(const mapPolyMesh&);
 
         //- Write
         virtual void write(Ostream&) const;
@@ -291,7 +301,6 @@ public:
         //- Write dictionary
         virtual void writeDict(Ostream&) const;
 
-
     // I-O
 
         //- Ostream Operator
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C
index c6098a38a2f03ca15165f7bc3e6f18dbf98bd76d..d6f942cdd561cee4d156bc884430952aa5848327 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C
@@ -40,6 +40,7 @@ namespace Foam
     addToRunTimeSelectionTable(pointZone, pointZone, dictionary);
 }
 
+const char* const Foam::pointZone::labelsName = "pointLabels";
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
@@ -77,7 +78,7 @@ Foam::pointZone::pointZone
     const pointZoneMesh& zm
 )
 :
-    zone("point", name, dict, index),
+    zone(name, dict, this->labelsName, index),
     zoneMesh_(zm)
 {}
 
@@ -139,7 +140,7 @@ void Foam::pointZone::writeDict(Ostream& os) const
     os  << nl << name_ << nl << token::BEGIN_BLOCK << nl
         << "    type " << type() << token::END_STATEMENT << nl;
 
-    writeEntry("pointLabels", os);
+    writeEntry(this->labelsName, os);
 
     os  << token::END_BLOCK << endl;
 }
@@ -147,10 +148,10 @@ void Foam::pointZone::writeDict(Ostream& os) const
 
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
-void Foam::pointZone::operator=(const pointZone& pz)
+void Foam::pointZone::operator=(const pointZone& zn)
 {
     clearAddressing();
-    labelList::operator=(pz);
+    labelList::operator=(zn);
 }
 
 
@@ -163,10 +164,10 @@ void Foam::pointZone::operator=(const labelList& addr)
 
 // * * * * * * * * * * * * * * * Ostream Operator  * * * * * * * * * * * * * //
 
-Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& pz)
+Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& zn)
 {
-    pz.write(os);
-    os.check("Ostream& operator<<(Ostream& os, const pointZone& pz");
+    zn.write(os);
+    os.check("Ostream& operator<<(Ostream&, const pointZone&");
     return os;
 }
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H
index 89f8349461b4b4f052dba80c1bf4ecd691aa2a49..32433b968681106602a9e9808b6ce7acce4253a6 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H
+++ b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H
@@ -58,7 +58,7 @@ Ostream& operator<<(Ostream&, const pointZone&);
 
 
 /*---------------------------------------------------------------------------*\
-                           Class pointZone Declaration
+                          Class pointZone Declaration
 \*---------------------------------------------------------------------------*/
 
 class pointZone
@@ -68,20 +68,24 @@ class pointZone
 
 protected:
 
-    // Private data
+    // Protected data
 
         //- Reference to zone list
         const pointZoneMesh& zoneMesh_;
 
-
     // Private Member Functions
 
         //- Disallow default bitwise copy construct
         pointZone(const pointZone&);
 
-
 public:
 
+    // Static data members
+
+        //- The name associated with the zone-labels dictionary entry
+        static const char * const labelsName;
+
+
     //- Runtime type information
     TypeName("pointZone");
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C
index 20195888c57de05076d4a6d2f793b33e3d9b66fb..4f6f6d887a0c7417327ddfef80cac111b5ccbb1d 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C
@@ -115,13 +115,13 @@ Foam::zone::zone
 
 Foam::zone::zone
 (
-    const word& zoneType,
     const word& name,
     const dictionary& dict,
+    const word& labelsName,
     const label index
 )
 :
-    labelList(dict.lookup(zoneType + "Labels")),
+    labelList(dict.lookup(labelsName)),
     name_(name),
     index_(index),
     lookupMapPtr_(NULL)
@@ -193,13 +193,13 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
 {
     const labelList& addr = *this;
 
-    bool boundaryError = false;
+    bool hasError = false;
 
     forAll(addr, i)
     {
         if (addr[i] < 0 || addr[i] >= maxSize)
         {
-            boundaryError = true;
+            hasError = true;
 
             if (report)
             {
@@ -212,10 +212,15 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
                     << "Valid index labels are 0.."
                     << maxSize-1 << endl;
             }
+            else
+            {
+                // w/o report - can stop checking now
+                break;
+            }
         }
     }
 
-    return boundaryError;
+    return hasError;
 }
 
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.H b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.H
index fb5d2453e653867e92a7dde99eed2eacf52d7218..2bc9acc3497d4dd638e3213269bae7fd6d8654cc 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.H
+++ b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.H
@@ -117,9 +117,9 @@ public:
         //- Construct from dictionary
         zone
         (
-            const word& zoneType,
             const word& name,
             const dictionary&,
+            const word& labelsName,
             const label index
         );
 
diff --git a/src/OpenFOAM/primitives/Lists/stringListOps.H b/src/OpenFOAM/primitives/Lists/stringListOps.H
index 253a249c3df6efe6dd19948a107b631ae33283de..493a0cb3d3aaca214f1b9bc9886cb92072bc741e 100644
--- a/src/OpenFOAM/primitives/Lists/stringListOps.H
+++ b/src/OpenFOAM/primitives/Lists/stringListOps.H
@@ -36,54 +36,262 @@ SourceFiles
 #ifndef stringListOps_H
 #define stringListOps_H
 
+#include "regExp.H"
 #include "labelList.H"
 #include "stringList.H"
 #include "wordReList.H"
+#include "wordReListMatcher.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 namespace Foam
 {
+    // single-string matches:
+
+    //- Return true if string matches one of the regular expressions
+    inline bool findStrings
+    (
+        const wordReListMatcher& matcher,
+        const std::string& str
+    )
+    {
+        return matcher.match(str);
+    }
+
+    // multi-string matches:
+
+    //- Return list indices for matching strings
+    template<class Matcher, class StringType>
+    labelList findMatchingStrings
+    (
+        const Matcher&,
+        const UList<StringType>&,
+        const bool invert=false
+    );
+
     //- Return list indices for strings matching the regular expression
+    //  Template partial specialization of findMatchingStrings
     template<class StringType>
     labelList findStrings
     (
-        const char* regexpPattern,
-        const UList<StringType>&
-    );
+        const regExp& re,
+        const UList<StringType>& lst,
+        const bool invert=false
+    )
+    {
+        return findMatchingStrings(re, lst, invert);
+    }
 
     //- Return list indices for strings matching the regular expression
+    //  Template partial specialization of findMatchingStrings
     template<class StringType>
     labelList findStrings
     (
-        const std::string& regexpPattern,
-        const UList<StringType>&
-    );
+        const char* rePattern,
+        const UList<StringType>& lst,
+        const bool invert=false
+    )
+    {
+        return findStrings(regExp(rePattern), lst, invert);
+    }
 
     //- Return list indices for strings matching the regular expression
+    //  Template partial specialization of findMatchingStrings
     template<class StringType>
     labelList findStrings
     (
-        const wordRe&,
-        const UList<StringType>&
-    );
+        const std::string& rePattern,
+        const UList<StringType>& lst,
+        const bool invert=false
+    )
+    {
+        return findMatchingStrings(regExp(rePattern), lst, invert);
+    }
+
+    //- Return list indices for strings matching the regular expression
+    //  Template partial specialization of findMatchingStrings
+    template<class StringType>
+    labelList findStrings
+    (
+        const wordRe& wre,
+        const UList<StringType>& lst,
+        const bool invert=false
+    )
+    {
+        return findMatchingStrings(wre, lst, invert);
+    }
+
 
     //- Return list indices for strings matching one of the regular expression
+    //  Template partial specialization of findMatchingStrings
     template<class StringType>
     labelList findStrings
     (
-        const UList<wordRe>&,
-        const UList<StringType>&
+        const wordReListMatcher& matcher,
+        const UList<StringType>& lst,
+        const bool invert=false
+    )
+    {
+        return findMatchingStrings(matcher, lst, invert);
+    }
+
+    // subsetting multi-string matches (similar to ListOp):
+
+    //- Extract elements of StringList when regular expression matches
+    //  optionally invert the match
+    //  eg, to extract all selected elements:
+    //    subsetMatchingStrings<regExp, stringList>(myRegExp, lst);
+    template<class Matcher, class StringListType>
+    StringListType subsetMatchingStrings
+    (
+        const Matcher&,
+        const StringListType&,
+        const bool invert=false
     );
 
-    //- Return true if string matches one of the regular expressions
-    template<class StringType>
-    bool findStrings
+    //- Extract elements of StringList when regular expression matches
+    //  Template partial specialization of subsetMatchingStrings
+    template<class StringListType>
+    StringListType subsetStrings
     (
-        const UList<wordRe>&,
-        const StringType& str
+        const regExp& re,
+        const StringListType& lst,
+        const bool invert=false
+    )
+    {
+        return subsetMatchingStrings(re, lst, invert);
+    }
+
+    //- Extract elements of StringList when regular expression matches
+    //  Template partial specialization of subsetMatchingStrings
+    template<class StringListType>
+    StringListType subsetStrings
+    (
+        const char* rePattern,
+        const StringListType& lst,
+        const bool invert=false
+    )
+    {
+        return subsetMatchingStrings(regExp(rePattern), lst, invert);
+    }
+
+    //- Extract elements of StringList when regular expression matches
+    //  Template partial specialization of subsetMatchingStrings
+    template<class StringListType>
+    StringListType subsetStrings
+    (
+        const std::string& rePattern,
+        const StringListType& lst,
+        const bool invert=false
+    )
+    {
+        return subsetMatchingStrings(regExp(rePattern), lst, invert);
+    }
+
+    //- Extract elements of StringList when regular expression matches
+    //  Template partial specialization of subsetMatchingStrings
+    template<class StringListType>
+    StringListType subsetStrings
+    (
+        const wordRe& wre,
+        const StringListType& lst,
+        const bool invert=false
+    )
+    {
+        return subsetMatchingStrings(wre, lst, invert);
+    }
+
+    //- Extract elements of StringList when regular expression matches
+    //  Template partial specialization of subsetMatchingStrings
+    template<class StringListType>
+    StringListType subsetStrings
+    (
+        const wordReListMatcher& matcher,
+        const StringListType& lst,
+        const bool invert=false
+    )
+    {
+        return subsetMatchingStrings(matcher, lst, invert);
+    }
+
+
+    //- Inplace extract elements of StringList when regular expression matches
+    //  optionally invert the match
+    //  eg, to extract all selected elements:
+    //    inplaceSubsetMatchingStrings<regExp, stringList>(myRegExp, lst);
+    template<class Matcher, class StringListType>
+    void inplaceSubsetMatchingStrings
+    (
+        const Matcher&,
+        StringListType&,
+        const bool invert=false
     );
 
+    //- Inplace extract elements of StringList when regular expression matches
+    //  Template partial specialization of inplaceSubsetMatchingStrings
+    template<class StringListType>
+    void inplaceSubsetStrings
+    (
+        const regExp& re,
+        StringListType& lst,
+        const bool invert=false
+    )
+    {
+        inplaceSubsetMatchingStrings(re, lst, invert);
+    }
+
+    //- Inplace extract elements of StringList when regular expression matches
+    //  Template partial specialization of inplaceSubsetMatchingStrings
+    template<class StringListType>
+    void inplaceSubsetStrings
+    (
+        const char* rePattern,
+        StringListType& lst,
+        const bool invert=false
+    )
+    {
+        inplaceSubsetMatchingStrings(regExp(rePattern), lst, invert);
+    }
+
+    //- Inplace extract elements of StringList when regular expression matches
+    //  Template partial specialization of inplaceSubsetMatchingStrings
+    template<class StringListType>
+    void inplaceSubsetStrings
+    (
+        const std::string& rePattern,
+        StringListType& lst,
+        const bool invert=false
+    )
+    {
+        inplaceSubsetMatchingStrings(regExp(rePattern), lst, invert);
+    }
+
+    //- Inplace extract elements of StringList when regular expression matches
+    //  Template partial specialization of inplaceSubsetMatchingStrings
+    template<class StringListType>
+    void inplaceSubsetStrings
+    (
+        const wordRe& wre,
+        StringListType& lst,
+        const bool invert=false
+    )
+    {
+        inplaceSubsetMatchingStrings(wre, lst, invert);
+    }
+
+    //- Inplace extract elements of StringList when regular expression matches
+    //  Template partial specialization of inplaceSubsetMatchingStrings
+    template<class StringListType>
+    void inplaceSubsetStrings
+    (
+        const wordReListMatcher& matcher,
+        StringListType& lst,
+        const bool invert=false
+    )
+    {
+        inplaceSubsetMatchingStrings(matcher, lst, invert);
+    }
+
 }
 
 
diff --git a/src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C b/src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C
index 54f624d60a3d0bf5b8ca53dffec96b6304c3bc94..6489658d531ffad6edddee5974bc8c0672143e6d 100644
--- a/src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C
+++ b/src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C
@@ -24,126 +24,73 @@ License
 
 \*---------------------------------------------------------------------------*/
 
-#include "labelList.H"
-#include "regExp.H"
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-
-template<class StringType>
-Foam::labelList Foam::findStrings
-(
-    const char* pattern,
-    const UList<StringType>& lst
-)
-{
-    regExp re(pattern);
-    labelList matched(lst.size());
-
-    label matchI = 0;
-    forAll(lst, elemI)
-    {
-        if (re.match(lst[elemI]))
-        {
-            matched[matchI++] = elemI;
-        }
-    }
-    matched.setSize(matchI);
-
-    return matched;
-}
-
-
-template<class StringType>
-Foam::labelList Foam::findStrings
+template<class Matcher, class StringType>
+Foam::labelList Foam::findMatchingStrings
 (
-    const std::string& pattern,
-    const UList<StringType>& lst
+    const Matcher& matcher,
+    const UList<StringType>& lst,
+    const bool invert
 )
 {
-    regExp re(pattern);
-    labelList matched(lst.size());
+    labelList indices(lst.size());
 
-    label matchI = 0;
+    label nElem = 0;
     forAll(lst, elemI)
     {
-        if (re.match(lst[elemI]))
+        if (matcher.match(lst[elemI]) ? !invert : invert)
         {
-            matched[matchI++] = elemI;
+            indices[nElem++] = elemI;
         }
     }
-    matched.setSize(matchI);
+    indices.setSize(nElem);
 
-    return matched;
+    return indices;
 }
 
 
-template<class StringType>
-Foam::labelList Foam::findStrings
+template<class Matcher, class StringListType>
+StringListType Foam::subsetMatchingStrings
 (
-    const wordRe& wre,
-    const UList<StringType>& lst
+    const Matcher& matcher,
+    const StringListType& lst,
+    const bool invert
 )
 {
-    labelList matched(lst.size());
+    StringListType newLst(lst.size());
 
-    label matchI = 0;
+    label nElem = 0;
     forAll(lst, elemI)
     {
-        if (wre.match(lst[elemI]))
+        if (matcher.match(lst[elemI]) ? !invert : invert)
         {
-            matched[matchI++] = elemI;
+            newLst[nElem++] = lst[elemI];
         }
     }
-    matched.setSize(matchI);
+    newLst.setSize(nElem);
 
-    return matched;
+    return newLst;
 }
 
 
-template<class StringType>
-Foam::labelList Foam::findStrings
+template<class Matcher, class StringListType>
+void Foam::inplaceSubsetMatchingStrings
 (
-    const UList<wordRe>& wreLst,
-    const UList<StringType>& lst
+    const Matcher& matcher,
+    StringListType& lst,
+    const bool invert
 )
 {
-    labelList matched(lst.size());
-
-    label matchI = 0;
+    label nElem = 0;
     forAll(lst, elemI)
     {
-        forAll(wreLst, reI)
-        {
-            if (wreLst[reI].match(lst[elemI]))
-            {
-                matched[matchI++] = elemI;
-                break;
-            }
-        }
-    }
-    matched.setSize(matchI);
-
-    return matched;
-}
-
-
-template<class StringType>
-bool Foam::findStrings
-(
-    const UList<wordRe>& wreLst,
-    const StringType& str
-)
-{
-    forAll(wreLst, reI)
-    {
-        if (wreLst[reI].match(str))
+        if (matcher.match(lst[elemI]) ? !invert : invert)
         {
-            return true;
+            lst[nElem++] = lst[elemI];
         }
     }
-
-    return false;
+    lst.setSize(nElem);
 }
 
 
diff --git a/src/OpenFOAM/primitives/Lists/wordReListMatcher.H b/src/OpenFOAM/primitives/Lists/wordReListMatcher.H
new file mode 100644
index 0000000000000000000000000000000000000000..fa125048e52454e50cbb40e65387315162185ecd
--- /dev/null
+++ b/src/OpenFOAM/primitives/Lists/wordReListMatcher.H
@@ -0,0 +1,101 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Class
+    Foam::wordReListMatcher
+
+Description
+    A wrapper for matching a List of wordRe.
+
+Note
+    The constructor should remain non-explicit. This allows automatic
+    conversion from UList\<wordRe\> to wordReListMatcher in search
+    functions.
+
+SourceFiles
+    wordReListMatcherI.H
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef wordReListMatcher_H
+#define wordReListMatcher_H
+
+#include "wordReList.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                      Class wordReListMatcher Declaration
+\*---------------------------------------------------------------------------*/
+
+class wordReListMatcher
+{
+    // Private data
+
+        //- Reference to underlying list
+        const UList<wordRe>& reList_;
+
+public:
+
+    // Constructors
+
+        //- Construct from a List of wordRe
+        inline wordReListMatcher(const UList<wordRe>&);
+
+
+    // Member Functions
+
+        // Access
+
+            inline label size() const;
+            inline bool  empty() const;
+
+            //- Return underlying list of wordRe
+            inline const UList<wordRe>& operator()() const;
+
+
+    // Searching
+
+            //- Return true if string matches any of the regular expressions
+            //  Smart match as regular expression or as a string.
+            //  Optionally specify a literal match only.
+            inline bool match(const string&, bool literalMatch=false) const;
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "wordReListMatcherI.H"
+
+#endif
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/createBlockOffsets.C b/src/OpenFOAM/primitives/Lists/wordReListMatcherI.H
similarity index 61%
rename from applications/utilities/mesh/generation/blockMesh/createBlockOffsets.C
rename to src/OpenFOAM/primitives/Lists/wordReListMatcherI.H
index 214b96bf2658a5cab3ed1fccc82739ddf3995506..4b3774d2d486b651396a44fd7f2ac4608137f475 100644
--- a/applications/utilities/mesh/generation/blockMesh/createBlockOffsets.C
+++ b/src/OpenFOAM/primitives/Lists/wordReListMatcherI.H
@@ -22,39 +22,58 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-
 \*---------------------------------------------------------------------------*/
 
-#include "error.H"
-#include "blockMesh.H"
 
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+inline Foam::wordReListMatcher::wordReListMatcher
+(
+    const UList<wordRe>& lst
+)
+:
+    reList_(lst)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+inline Foam::label Foam::wordReListMatcher::size() const
+{
+    return reList_.size();
+}
+
 
-Foam::labelList Foam::blockMesh::createBlockOffsets()
+inline bool Foam::wordReListMatcher::empty() const
 {
-    Info<< nl << "Creating block offsets" << endl;
+    return reList_.empty();
+}
 
-    blockMesh& blocks = *this;
 
-    nPoints_ = blocks[0].points().size();
-    nCells_ = blocks[0].cells().size();
+inline const Foam::UList<Foam::wordRe>&
+Foam::wordReListMatcher::operator()() const
+{
+    return reList_;
+}
 
-    labelList BlockOffsets(blocks.size());
-    BlockOffsets[0] = 0;
 
-    label blockLabel;
-    for (blockLabel=1; blockLabel<blocks.size(); blockLabel++)
+inline bool Foam::wordReListMatcher::match
+(
+    const string& str,
+    bool literalMatch
+) const
+{
+    const label nElem = reList_.size();
+    for (label elemI = 0; elemI < nElem; ++elemI)
     {
-        nPoints_ += blocks[blockLabel].points().size();
-        nCells_ += blocks[blockLabel].cells().size();
-
-        BlockOffsets[blockLabel]
-            = BlockOffsets[blockLabel-1]
-            + blocks[blockLabel-1].points().size();
+        if (reList_[elemI].match(str, literalMatch))
+        {
+            return true;
+        }
     }
 
-    return BlockOffsets;
+    return false;
 }
 
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H
index d499998145a399b84571decbcfdf843190b9ea55..a0f6c550a1e10ec94dfc588a15c701ae354999fb 100644
--- a/src/OpenFOAM/primitives/strings/wordRe/wordRe.H
+++ b/src/OpenFOAM/primitives/strings/wordRe/wordRe.H
@@ -170,7 +170,7 @@ public:
 
         //- Smart match as regular expression or as a string
         //  Optionally specify a literal match only
-        inline bool match(const string&, bool literalMatch=false) const;
+        inline bool match(const std::string&, bool literalMatch=false) const;
 
     //- Miscellaneous
 
diff --git a/src/OpenFOAM/primitives/strings/wordRe/wordReI.H b/src/OpenFOAM/primitives/strings/wordRe/wordReI.H
index 7f242eb2c5ea7f98a936e0f257e52b5ccf923eb1..084fc9c4c8cb0e5a61b71772b2a185460e9a6721 100644
--- a/src/OpenFOAM/primitives/strings/wordRe/wordReI.H
+++ b/src/OpenFOAM/primitives/strings/wordRe/wordReI.H
@@ -176,12 +176,12 @@ inline void Foam::wordRe::clear()
 }
 
 
-inline bool Foam::wordRe::match(const string& str, bool literalMatch) const
+inline bool Foam::wordRe::match(const std::string& str, bool literalMatch) const
 {
     if (literalMatch || !re_.exists())
     {
         // check as string
-        return (*this == str);
+        return (str == *this);
     }
     else
     {
diff --git a/src/conversion/meshTables/boundaryRegion.C b/src/conversion/meshTables/boundaryRegion.C
index b5c278887fa3429bf4831fe25132b2a321e6c7b8..d933007c6e47c86c4ed4ae9fbadc068c1fc3ecfb 100644
--- a/src/conversion/meshTables/boundaryRegion.C
+++ b/src/conversion/meshTables/boundaryRegion.C
@@ -97,7 +97,7 @@ Foam::Map<Foam::word> Foam::boundaryRegion::names() const
 
 Foam::Map<Foam::word> Foam::boundaryRegion::names
 (
-    const List<wordRe>& patterns
+    const UList<wordRe>& patterns
 ) const
 {
     Map<word> lookup;
diff --git a/src/conversion/meshTables/boundaryRegion.H b/src/conversion/meshTables/boundaryRegion.H
index 91826b4d58cda4f0621fd15a837e3325f928b90a..32a0d7cba46c9285e3048f257321429db678ce3c 100644
--- a/src/conversion/meshTables/boundaryRegion.H
+++ b/src/conversion/meshTables/boundaryRegion.H
@@ -112,7 +112,7 @@ public:
         Map<word> names() const;
 
         //- Return a Map of (id => names) selected by patterns
-        Map<word> names(const List<wordRe>& patterns) const;
+        Map<word> names(const UList<wordRe>& patterns) const;
 
         //- Return a Map of (id => type)
         Map<word> boundaryTypes() const;
diff --git a/src/conversion/meshTables/cellTable.C b/src/conversion/meshTables/cellTable.C
index 2d640deb7e92b5f18fb8f4b02918b22310ac19c4..6369f98d9d58ea664675b173ae566296b8bc5a1e 100644
--- a/src/conversion/meshTables/cellTable.C
+++ b/src/conversion/meshTables/cellTable.C
@@ -169,7 +169,7 @@ Foam::Map<Foam::word> Foam::cellTable::names() const
 
 Foam::Map<Foam::word> Foam::cellTable::names
 (
-    const List<wordRe>& patterns
+    const UList<wordRe>& patterns
 ) const
 {
     Map<word> lookup;
diff --git a/src/conversion/meshTables/cellTable.H b/src/conversion/meshTables/cellTable.H
index 102a134b8cc458ee91929256cf8fbf88fd44d695..4d0079f032b8c248c8f30a2d743ad7fc5512dc37 100644
--- a/src/conversion/meshTables/cellTable.H
+++ b/src/conversion/meshTables/cellTable.H
@@ -139,7 +139,7 @@ public:
         Map<word> names() const;
 
         //- Return a Map of (id => names) selected by patterns
-        Map<word> names(const List<wordRe>& patterns) const;
+        Map<word> names(const UList<wordRe>& patterns) const;
 
         //- Return a Map of (id => name) for materialType (fluid | solid | shell)
         Map<word> selectType(const word& materialType) const;
diff --git a/src/mesh/Allwmake b/src/mesh/Allwmake
new file mode 100755
index 0000000000000000000000000000000000000000..f967335db3b92e201cc3f17fbc5053023da017c1
--- /dev/null
+++ b/src/mesh/Allwmake
@@ -0,0 +1,8 @@
+#!/bin/sh
+cd ${0%/*} || exit 1    # run from this directory
+set -x
+
+wmake libso autoMesh
+wmake libso blockMesh
+
+# ----------------------------------------------------------------- end-of-file
diff --git a/src/autoMesh/Make/files b/src/mesh/autoMesh/Make/files
similarity index 100%
rename from src/autoMesh/Make/files
rename to src/mesh/autoMesh/Make/files
diff --git a/src/autoMesh/Make/options b/src/mesh/autoMesh/Make/options
similarity index 100%
rename from src/autoMesh/Make/options
rename to src/mesh/autoMesh/Make/options
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.H
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverTemplates.C
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.H
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.H
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.H
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.C
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointData.H
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/pointData/pointDataI.H
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.H
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.H
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.C
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.C
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.H
rename to src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/snapParameters/snapParameters.H
diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H
rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H
diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C
rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C
diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C
rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C
diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C
rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C
diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C
rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C
diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C
rename to src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementTemplates.C
diff --git a/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C
rename to src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C
diff --git a/src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H
rename to src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H
diff --git a/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C b/src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C
rename to src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C
diff --git a/src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.H b/src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.H
rename to src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.H
diff --git a/src/autoMesh/autoHexMesh/trackedParticle/ExactParticle.C b/src/mesh/autoMesh/autoHexMesh/trackedParticle/ExactParticle.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/trackedParticle/ExactParticle.C
rename to src/mesh/autoMesh/autoHexMesh/trackedParticle/ExactParticle.C
diff --git a/src/autoMesh/autoHexMesh/trackedParticle/ExactParticle.H b/src/mesh/autoMesh/autoHexMesh/trackedParticle/ExactParticle.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/trackedParticle/ExactParticle.H
rename to src/mesh/autoMesh/autoHexMesh/trackedParticle/ExactParticle.H
diff --git a/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C
rename to src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C
diff --git a/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H
similarity index 100%
rename from src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H
rename to src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H
diff --git a/src/autoMesh/autoHexMesh/trackedParticle/trackedParticleCloud.C b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticleCloud.C
similarity index 100%
rename from src/autoMesh/autoHexMesh/trackedParticle/trackedParticleCloud.C
rename to src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticleCloud.C
diff --git a/src/mesh/blockMesh/Make/files b/src/mesh/blockMesh/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..cc7a1c1bb5fe8b9db96e92037ca0dced0fe89b86
--- /dev/null
+++ b/src/mesh/blockMesh/Make/files
@@ -0,0 +1,24 @@
+curvedEdges/curvedEdge.C
+curvedEdges/lineEdge.C
+curvedEdges/polyLine.C
+curvedEdges/polyLineEdge.C
+curvedEdges/arcEdge.C
+curvedEdges/spline.C
+curvedEdges/BSpline.C
+curvedEdges/simpleSplineEdge.C
+curvedEdges/polySplineEdge.C
+curvedEdges/lineDivide.C
+
+blockDescriptor/blockDescriptor.C
+blockDescriptor/blockDescriptorEdges.C
+
+block/block.C
+block/blockCreate.C
+
+blockMesh/blockMesh.C
+blockMesh/blockMeshCreate.C
+blockMesh/blockMeshTopology.C
+blockMesh/blockMeshCheck.C
+blockMesh/blockMeshMerge.C
+
+LIB = $(FOAM_LIBBIN)/libblockMesh
diff --git a/src/mesh/blockMesh/Make/options b/src/mesh/blockMesh/Make/options
new file mode 100644
index 0000000000000000000000000000000000000000..1618ab57ec2d869d439de31fd8ead10e6f2b8ae2
--- /dev/null
+++ b/src/mesh/blockMesh/Make/options
@@ -0,0 +1,7 @@
+EXE_INC = \
+    -I$(LIB_SRC)/meshTools/lnInclude \
+    -I$(LIB_SRC)/dynamicMesh/lnInclude
+
+LIB_LIBS = \
+    -lmeshTools \
+    -ldynamicMesh
diff --git a/applications/utilities/mesh/generation/blockMesh/block.C b/src/mesh/blockMesh/block/block.C
similarity index 57%
rename from applications/utilities/mesh/generation/blockMesh/block.C
rename to src/mesh/blockMesh/block/block.C
index 4ec1e67434e8074dd979cd7a65bd2f08bf3f584d..094b592bd5ec122ee7a4ead725d356e43952d5e4 100644
--- a/applications/utilities/mesh/generation/blockMesh/block.C
+++ b/src/mesh/blockMesh/block/block.C
@@ -22,93 +22,87 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-
 \*---------------------------------------------------------------------------*/
 
 #include "error.H"
 #include "block.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
-
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-label block::vtxLabel(label a, label b, label c)
-{
-    return (a + b*(blockDef_.n().x() + 1)
-            + c*(blockDef_.n().x() + 1)*(blockDef_.n().y() + 1));
-}
+Foam::block::block
+(
+    const pointField& blockPointField,
+    const curvedEdgeList& edges,
+    Istream& is
+)
+:
+    blockDescriptor(blockPointField, edges, is),
+    vertices_(0),
+    cells_(0),
+    boundaryPatches_(0)
+{}
 
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from description
-block::block(const blockDescriptor& definition)
+Foam::block::block(const blockDescriptor& blockDesc)
 :
-    blockDef_(definition),
-    vertices_
-    (
-        ((blockDef_.n().x() + 1)*(blockDef_.n().y() + 1)*(blockDef_.n().z() + 1))
-    ),
-    cells_
-    (
-        (blockDef_.n().x()*blockDef_.n().y()*blockDef_.n().z())
-    ),
-    boundaryPatches_(6)
-{
-    // create points
-    blockPoints();
+    blockDescriptor(blockDesc),
+    vertices_(0),
+    cells_(0),
+    boundaryPatches_(0)
+{}
 
-    // generate internal cells
-    blockCells();
 
-    // generate boundary patches
-    blockBoundary();
-}
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
+Foam::block::~block()
+{}
 
-// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-const blockDescriptor& block::blockDef() const
+const Foam::pointField& Foam::block::points() const
 {
-    return blockDef_;
-}
+    if (vertices_.empty())
+    {
+        createPoints();
+    }
 
-const pointField& block::points() const
-{
     return vertices_;
 }
 
-const labelListList& block::cells() const
+
+const Foam::labelListList& Foam::block::cells() const
 {
+    if (cells_.empty())
+    {
+        createCells();
+    }
+
     return cells_;
 }
 
-const labelListListList& block::boundaryPatches() const
+
+const Foam::labelListListList& Foam::block::boundaryPatches() const
 {
+    if (boundaryPatches_.empty())
+    {
+        createBoundary();
+    }
+
     return boundaryPatches_;
 }
 
 
 // * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //
 
-Ostream& operator<<(Ostream& os, const block& b)
+Foam::Ostream& Foam::operator<<(Ostream& os, const block& b)
 {
-    os << b.vertices_ << nl
-       << b.cells_ << nl
-       << b.boundaryPatches_ << endl;
+    os << b.points() << nl
+       << b.cells() << nl
+       << b.boundaryPatches() << endl;
 
     return os;
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
-
diff --git a/applications/utilities/mesh/generation/blockMesh/block.H b/src/mesh/blockMesh/block/block.H
similarity index 57%
rename from applications/utilities/mesh/generation/blockMesh/block.H
rename to src/mesh/blockMesh/block/block.H
index bbec4f081147cd2c2f6573eadb38c1c442c1a234..7d3f908b5e75c70b16ab9ecd6902c9b65c3f8e39 100644
--- a/applications/utilities/mesh/generation/blockMesh/block.H
+++ b/src/mesh/blockMesh/block/block.H
@@ -26,11 +26,15 @@ Class
     Foam::block
 
 Description
-    creates a single block of cells from point coordinates,
-    numbers of cells in each direction and expansion ratio
+    Creates a single block of cells from point coordinates, numbers of
+    cells in each direction and an expansion ratio.
+
+Note
+    The vertices and cells for filling the block are demand-driven.
 
 SourceFiles
     block.C
+    blockCreate.C
 
 \*---------------------------------------------------------------------------*/
 
@@ -50,43 +54,63 @@ namespace Foam
 class Istream;
 class Ostream;
 
+// Forward declaration of friend functions and operators
+class block;
+Ostream& operator<<(Ostream&, const block&);
+
 /*---------------------------------------------------------------------------*\
                            Class block Declaration
 \*---------------------------------------------------------------------------*/
 
 class block
+:
+    public blockDescriptor
 {
     // Private data
 
-        //- block definition
-        blockDescriptor blockDef_;
+        //- List of vertices
+        mutable pointField vertices_;
 
-        //- list of vertices
-        pointField vertices_;
+        //- List of cells
+        mutable labelListList cells_;
 
-        //- list of cells
-        labelListList cells_;
+        //- Boundary patches
+        mutable labelListListList boundaryPatches_;
 
-        //- boundary patches
-        labelListListList boundaryPatches_;
 
+    // Private Member Functions
 
-    // private member functions
+        //- Vertex label offset for a particular i,j,k position
+        label vtxLabel(label i, label j, label k) const;
 
-        label vtxLabel(label i, label j, label k);
+        //- Creates vertices for cells filling the block
+        void createPoints() const;
 
-        void blockPoints();
+        //- Creates cells for filling the block
+        void createCells() const;
 
-        void blockCells();
+        //- Creates boundary patch faces for the block
+        void createBoundary() const;
 
-        void blockBoundary();
+        //- Disallow default bitwise copy construct
+        block(const block&);
 
+        //- Disallow default bitwise assignment
+        void operator=(const block&);
 
 public:
 
     // Constructors
 
-        //- Construct from the block definition
+        //- Construct from components with Istream
+        block
+        (
+            const pointField& blockPointField,
+            const curvedEdgeList&,
+            Istream&
+        );
+
+        //- Construct from a block definition
         block(const blockDescriptor&);
 
         //- Clone
@@ -97,28 +121,41 @@ public:
         }
 
 
+    //- Destructor
+
+        ~block();
+
+
     // Member Functions
 
         // Access
 
-            const blockDescriptor& blockDef() const;
+            //- Return the block definition
+            inline const blockDescriptor& blockDef() const
+            {
+                return *this;
+            }
+
+            //- Return the points for filling the block
             const pointField& points() const;
+
+            //- Return the cells for filling the block
             const labelListList& cells() const;
+
+            //- Return the boundary patch faces for the block
             const labelListListList& boundaryPatches() const;
 
 
-    // Ostream Operator
+        // Edit
 
-        friend Ostream& operator<<(Ostream&, const block&);
-};
+            //- Clear geometry (internal points, cells, boundaryPatches)
+            void clearGeom();
 
 
-inline Istream& operator>>(Istream& is, block*)
-{
-    notImplemented("Istream& operator>>(Istream& is, block*)");
-    return is;
-}
+    // Ostream Operator
 
+        friend Ostream& operator<<(Ostream&, const block&);
+};
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/src/mesh/blockMesh/block/blockCreate.C b/src/mesh/blockMesh/block/blockCreate.C
new file mode 100644
index 0000000000000000000000000000000000000000..3f741fd587d7da95db74385bc9f2090b815fb720
--- /dev/null
+++ b/src/mesh/blockMesh/block/blockCreate.C
@@ -0,0 +1,478 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+\*---------------------------------------------------------------------------*/
+
+#include "error.H"
+#include "block.H"
+
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+Foam::label Foam::block::vtxLabel(label i, label j, label k) const
+{
+    return
+    (
+        i
+      + j * (meshDensity().x() + 1)
+      + k * (meshDensity().x() + 1) * (meshDensity().y() + 1)
+    );
+}
+
+
+void Foam::block::createPoints() const
+{
+    // set local variables for mesh specification
+    const label ni = meshDensity().x();
+    const label nj = meshDensity().y();
+    const label nk = meshDensity().z();
+
+    const point& p000 = blockPoint(0);
+    const point& p100 = blockPoint(1);
+    const point& p110 = blockPoint(2);
+    const point& p010 = blockPoint(3);
+
+    const point& p001 = blockPoint(4);
+    const point& p101 = blockPoint(5);
+    const point& p111 = blockPoint(6);
+    const point& p011 = blockPoint(7);
+
+
+    // list of edge point and weighting factors
+    const List< List<point> >& p = blockEdgePoints();
+    const scalarListList& w = blockEdgeWeights();
+
+    //
+    // generate vertices
+    //
+    vertices_.clear();
+    vertices_.setSize(nPoints());
+
+    for (label k = 0; k <= nk; k++)
+    {
+        for (label j = 0; j <= nj; j++)
+        {
+            for (label i = 0; i <= ni; i++)
+            {
+                const label vertexNo = vtxLabel(i, j, k);
+
+                // points on edges
+                vector edgex1 = p000 + (p100 - p000)*w[0][i];
+                vector edgex2 = p010 + (p110 - p010)*w[1][i];
+                vector edgex3 = p011 + (p111 - p011)*w[2][i];
+                vector edgex4 = p001 + (p101 - p001)*w[3][i];
+
+                vector edgey1 = p000 + (p010 - p000)*w[4][j];
+                vector edgey2 = p100 + (p110 - p100)*w[5][j];
+                vector edgey3 = p101 + (p111 - p101)*w[6][j];
+                vector edgey4 = p001 + (p011 - p001)*w[7][j];
+
+                vector edgez1 = p000 + (p001 - p000)*w[8][k];
+                vector edgez2 = p100 + (p101 - p100)*w[9][k];
+                vector edgez3 = p110 + (p111 - p110)*w[10][k];
+                vector edgez4 = p010 + (p011 - p010)*w[11][k];
+
+
+                // calculate the importance factors for all edges
+
+                // x-direction
+                scalar impx1 =
+                (
+                    (1.0 - w[0][i])*(1.0 - w[4][j])*(1.0 - w[8][k])
+                  + w[0][i]*(1.0 - w[5][j])*(1.0 - w[9][k])
+                );
+
+                scalar impx2 =
+                (
+                    (1.0 - w[1][i])*w[4][j]*(1.0 - w[11][k])
+                  + w[1][i]*w[5][j]*(1.0 - w[10][k])
+                );
+
+                scalar impx3 =
+                (
+                     (1.0 - w[2][i])*w[7][j]*w[11][k]
+                   + w[2][i]*w[6][j]*w[10][k]
+                );
+
+                scalar impx4 =
+                (
+                    (1.0 - w[3][i])*(1.0 - w[7][j])*w[8][k]
+                  + w[3][i]*(1.0 - w[6][j])*w[9][k]
+                );
+
+                scalar magImpx = impx1 + impx2 + impx3 + impx4;
+                impx1 /= magImpx;
+                impx2 /= magImpx;
+                impx3 /= magImpx;
+                impx4 /= magImpx;
+
+
+                // y-direction
+                scalar impy1 =
+                (
+                    (1.0 - w[4][j])*(1.0 - w[0][i])*(1.0 - w[8][k])
+                  + w[4][j]*(1.0 - w[1][i])*(1.0 - w[11][k])
+                );
+
+                scalar impy2 =
+                (
+                    (1.0 - w[5][j])*w[0][i]*(1.0 - w[9][k])
+                  + w[5][j]*w[1][i]*(1.0 - w[10][k])
+                );
+
+                scalar impy3 =
+                (
+                    (1.0 - w[6][j])*w[3][i]*w[9][k]
+                  + w[6][j]*w[2][i]*w[10][k]
+                );
+
+                scalar impy4 =
+                (
+                    (1.0 - w[7][j])*(1.0 - w[3][i])*w[8][k]
+                  + w[7][j]*(1.0 - w[2][i])*w[11][k]
+                );
+
+                scalar magImpy = impy1 + impy2 + impy3 + impy4;
+                impy1 /= magImpy;
+                impy2 /= magImpy;
+                impy3 /= magImpy;
+                impy4 /= magImpy;
+
+
+                // z-direction
+                scalar impz1 =
+                (
+                    (1.0 - w[8][k])*(1.0 - w[0][i])*(1.0 - w[4][j])
+                  + w[8][k]*(1.0 - w[3][i])*(1.0 - w[7][j])
+                );
+
+                scalar impz2 =
+                (
+                    (1.0 - w[9][k])*w[0][i]*(1.0 - w[5][j])
+                  + w[9][k]*w[3][i]*(1.0 - w[6][j])
+                );
+
+                scalar impz3 =
+                (
+                    (1.0 - w[10][k])*w[1][i]*w[5][j]
+                  + w[10][k]*w[2][i]*w[6][j]
+                );
+
+                scalar impz4 =
+                (
+                    (1.0 - w[11][k])*(1.0 - w[1][i])*w[4][j]
+                  + w[11][k]*(1.0 - w[2][i])*w[7][j]
+                );
+
+                scalar magImpz = impz1 + impz2 + impz3 + impz4;
+                impz1 /= magImpz;
+                impz2 /= magImpz;
+                impz3 /= magImpz;
+                impz4 /= magImpz;
+
+
+                // calculate the correction vectors
+                vector corx1 = impx1*(p[0][i] - edgex1);
+                vector corx2 = impx2*(p[1][i] - edgex2);
+                vector corx3 = impx3*(p[2][i] - edgex3);
+                vector corx4 = impx4*(p[3][i] - edgex4);
+
+                vector cory1 = impy1*(p[4][j] - edgey1);
+                vector cory2 = impy2*(p[5][j] - edgey2);
+                vector cory3 = impy3*(p[6][j] - edgey3);
+                vector cory4 = impy4*(p[7][j] - edgey4);
+
+                vector corz1 = impz1*(p[8][k] - edgez1);
+                vector corz2 = impz2*(p[9][k] - edgez2);
+                vector corz3 = impz3*(p[10][k] - edgez3);
+                vector corz4 = impz4*(p[11][k] - edgez4);
+
+
+                // multiply by the importance factor
+
+                // x-direction
+                edgex1 *= impx1;
+                edgex2 *= impx2;
+                edgex3 *= impx3;
+                edgex4 *= impx4;
+
+                // y-direction
+                edgey1 *= impy1;
+                edgey2 *= impy2;
+                edgey3 *= impy3;
+                edgey4 *= impy4;
+
+                // z-direction
+                edgez1 *= impz1;
+                edgez2 *= impz2;
+                edgez3 *= impz3;
+                edgez4 *= impz4;
+
+
+                // add the contributions
+                vertices_[vertexNo] =
+                (
+                    edgex1 + edgex2 + edgex3 + edgex4
+                  + edgey1 + edgey2 + edgey3 + edgey4
+                  + edgez1 + edgez2 + edgez3 + edgez4
+                ) / 3.0;
+
+                vertices_[vertexNo] +=
+                (
+                    corx1 + corx2 + corx3 + corx4
+                  + cory1 + cory2 + cory3 + cory4
+                  + corz1 + corz2 + corz3 + corz4
+                );
+            }
+        }
+    }
+}
+
+
+void Foam::block::createCells() const
+{
+    const label ni = meshDensity().x();
+    const label nj = meshDensity().y();
+    const label nk = meshDensity().z();
+
+    //
+    // generate cells
+    //
+    cells_.clear();
+    cells_.setSize(nCells());
+
+    label cellNo = 0;
+
+    for (label k = 0; k < nk; k++)
+    {
+        for (label j = 0; j < nj; j++)
+        {
+            for (label i = 0; i < ni; i++)
+            {
+                cells_[cellNo].setSize(8);
+
+                cells_[cellNo][0] =  vtxLabel(i, j, k);
+                cells_[cellNo][1] =  vtxLabel(i+1, j, k);
+                cells_[cellNo][2] =  vtxLabel(i+1, j+1, k);
+                cells_[cellNo][3] =  vtxLabel(i, j+1, k);
+                cells_[cellNo][4] =  vtxLabel(i, j, k+1);
+                cells_[cellNo][5] =  vtxLabel(i+1, j, k+1);
+                cells_[cellNo][6] =  vtxLabel(i+1, j+1, k+1);
+                cells_[cellNo][7] =  vtxLabel(i, j+1, k+1);
+                cellNo++;
+            }
+        }
+    }
+}
+
+
+void Foam::block::createBoundary() const
+{
+    const label ni = meshDensity().x();
+    const label nj = meshDensity().y();
+    const label nk = meshDensity().z();
+
+    //
+    // generate boundaries on each side of the hex
+    //
+    boundaryPatches_.clear();
+    boundaryPatches_.setSize(6);
+
+
+    // x-direction
+
+    label wallLabel = 0;
+    label wallCellLabel = 0;
+
+    // x-min
+    boundaryPatches_[wallLabel].setSize(nj*nk);
+    for (label k = 0; k < nk; k++)
+    {
+        for (label j = 0; j < nj; j++)
+        {
+            boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
+
+            // set the points
+            boundaryPatches_[wallLabel][wallCellLabel][0] =
+                vtxLabel(0, j, k);
+            boundaryPatches_[wallLabel][wallCellLabel][1] =
+                vtxLabel(0, j, k + 1);
+            boundaryPatches_[wallLabel][wallCellLabel][2] =
+                vtxLabel(0, j + 1, k + 1);
+            boundaryPatches_[wallLabel][wallCellLabel][3] =
+                vtxLabel(0, j + 1, k);
+
+            // update the counter
+            wallCellLabel++;
+        }
+    }
+
+    // x-max
+    wallLabel++;
+    wallCellLabel = 0;
+
+    boundaryPatches_[wallLabel].setSize(nj*nk);
+
+    for (label k = 0; k < nk; k++)
+    {
+        for (label j = 0; j < nj; j++)
+        {
+            boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
+
+            // set the points
+            boundaryPatches_[wallLabel][wallCellLabel][0] =
+                vtxLabel(ni, j, k);
+            boundaryPatches_[wallLabel][wallCellLabel][1] =
+                vtxLabel(ni, j+1, k);
+            boundaryPatches_[wallLabel][wallCellLabel][2] =
+                vtxLabel(ni, j+1, k+1);
+            boundaryPatches_[wallLabel][wallCellLabel][3] =
+                vtxLabel(ni, j, k+1);
+
+            // update the counter
+            wallCellLabel++;
+        }
+    }
+
+    // y-direction
+
+    // y-min
+    wallLabel++;
+    wallCellLabel = 0;
+
+    boundaryPatches_[wallLabel].setSize(ni*nk);
+    for (label i = 0; i < ni; i++)
+    {
+        for (label k = 0; k < nk; k++)
+        {
+            boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
+
+            // set the points
+            boundaryPatches_[wallLabel][wallCellLabel][0] =
+                vtxLabel(i, 0, k);
+            boundaryPatches_[wallLabel][wallCellLabel][1] =
+                vtxLabel(i + 1, 0, k);
+            boundaryPatches_[wallLabel][wallCellLabel][2] =
+                vtxLabel(i + 1, 0, k + 1);
+            boundaryPatches_[wallLabel][wallCellLabel][3] =
+                vtxLabel(i, 0, k + 1);
+
+            // update the counter
+            wallCellLabel++;
+        }
+    }
+
+    // y-max
+    wallLabel++;
+    wallCellLabel = 0;
+
+    boundaryPatches_[wallLabel].setSize(ni*nk);
+
+    for (label i = 0; i < ni; i++)
+    {
+        for (label k = 0; k < nk; k++)
+        {
+            boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
+
+            // set the points
+            boundaryPatches_[wallLabel][wallCellLabel][0] =
+                vtxLabel(i, nj, k);
+            boundaryPatches_[wallLabel][wallCellLabel][1] =
+                vtxLabel(i, nj, k + 1);
+            boundaryPatches_[wallLabel][wallCellLabel][2] =
+                vtxLabel(i + 1, nj, k + 1);
+            boundaryPatches_[wallLabel][wallCellLabel][3] =
+                vtxLabel(i + 1, nj, k);
+
+            // update the counter
+            wallCellLabel++;
+        }
+    }
+
+    // z-direction
+
+    // z-min
+    wallLabel++;
+    wallCellLabel = 0;
+
+    boundaryPatches_[wallLabel].setSize(ni*nj);
+
+    for (label i = 0; i < ni; i++)
+    {
+        for (label j = 0; j < nj; j++)
+        {
+            boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
+
+            // set the points
+            boundaryPatches_[wallLabel][wallCellLabel][0] =
+                vtxLabel(i, j, 0);
+            boundaryPatches_[wallLabel][wallCellLabel][1] =
+                vtxLabel(i, j + 1, 0);
+            boundaryPatches_[wallLabel][wallCellLabel][2] =
+                vtxLabel(i + 1, j + 1, 0);
+            boundaryPatches_[wallLabel][wallCellLabel][3] =
+                vtxLabel(i + 1, j, 0);
+
+            // update the counter
+            wallCellLabel++;
+        }
+    }
+
+    // z-max
+    wallLabel++;
+    wallCellLabel = 0;
+
+    boundaryPatches_[wallLabel].setSize(ni*nj);
+
+    for (label i = 0; i < ni; i++)
+    {
+        for (label j = 0; j < nj; j++)
+        {
+            boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
+
+            // set the points
+            boundaryPatches_[wallLabel][wallCellLabel][0] =
+                vtxLabel(i, j, nk);
+            boundaryPatches_[wallLabel][wallCellLabel][1] =
+                vtxLabel(i + 1, j, nk);
+            boundaryPatches_[wallLabel][wallCellLabel][2] =
+                vtxLabel(i + 1, j + 1, nk);
+            boundaryPatches_[wallLabel][wallCellLabel][3] =
+                vtxLabel(i, j + 1, nk);
+
+            // update the counter
+            wallCellLabel++;
+        }
+    }
+}
+
+
+void Foam::block::clearGeom()
+{
+    vertices_.clear();
+    cells_.clear();
+    boundaryPatches_.clear();
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/blockList.H b/src/mesh/blockMesh/block/blockList.H
similarity index 98%
rename from applications/utilities/mesh/generation/blockMesh/blockList.H
rename to src/mesh/blockMesh/block/blockList.H
index 7e6a49a24a1bb9d575166161e4239b5d1b762b01..e17f16db800ac4856bd8ba0ac642c25dcfdef29e 100644
--- a/applications/utilities/mesh/generation/blockMesh/blockList.H
+++ b/src/mesh/blockMesh/block/blockList.H
@@ -22,13 +22,11 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-InClass
+Typedef
     Foam::blockList
 
 Description
-
-SourceFiles
-    blockList.C
+    A PtrList of blocks
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C
new file mode 100644
index 0000000000000000000000000000000000000000..599a108c3cbffaf4ef996f89b8afc20e8711e45f
--- /dev/null
+++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C
@@ -0,0 +1,318 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+\*---------------------------------------------------------------------------*/
+
+#include "error.H"
+#include "blockDescriptor.H"
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::blockDescriptor::blockDescriptor
+(
+    const cellShape& bshape,
+    const pointField& blockPointField,
+    const curvedEdgeList& edges,
+    const Vector<label>& meshDensity,
+    const UList<scalar>& expand,
+    const word& zoneName
+)
+:
+    blockPointField_(blockPointField),
+    curvedEdges_(edges),
+    blockShape_(bshape),
+    meshDensity_(meshDensity),
+    edgePoints_(12),
+    edgeWeights_(12),
+    expand_(expand),
+    zoneName_(zoneName)
+{
+    if (expand_.size() != 12)
+    {
+        FatalErrorIn
+        (
+            "blockDescriptor::blockDescriptor"
+            "(const cellShape&, const pointField& blockPointField, "
+            "const curvedEdgeList&, const Vector<label>& meshDensity, "
+            "const scalarList& expand, const word& zoneName)"
+        )   << "Unknown definition of expansion ratios"
+            << exit(FatalError);
+    }
+
+    // create a list of edges
+    makeBlockEdges();
+}
+
+
+Foam::blockDescriptor::blockDescriptor
+(
+    const pointField& blockPointField,
+    const curvedEdgeList& edges,
+    Istream& is
+)
+:
+    blockPointField_(blockPointField),
+    curvedEdges_(edges),
+    blockShape_(is),
+    meshDensity_(),
+    edgePoints_(12),
+    edgeWeights_(12),
+    expand_(12, 1.0),
+    zoneName_()
+{
+    // Examine next token
+    token t(is);
+
+    // Optional zone name
+    if (t.isWord())
+    {
+        zoneName_ = t.wordToken();
+
+        // Get the next token
+        is >> t;
+    }
+    is.putBack(t);
+
+    if (t.isPunctuation())
+    {
+        // new-style: read a list of 3 values
+        if (t.pToken() == token::BEGIN_LIST)
+        {
+            is >> meshDensity_;
+        }
+        else
+        {
+            FatalIOErrorIn
+            (
+                "blockDescriptor::blockDescriptor"
+                "(const pointField&, const curvedEdgeList&, Istream&)",
+                is
+            )   << "incorrect token while reading n, expected '(', found "
+                << t.info()
+                << exit(FatalIOError);
+        }
+    }
+    else
+    {
+        // old-style: read three labels
+        is  >> meshDensity_.x()
+            >> meshDensity_.y()
+            >> meshDensity_.z();
+    }
+
+    is >> t;
+    if (!t.isWord())
+    {
+        is.putBack(t);
+    }
+
+    scalarList expRatios(is);
+
+    if (expRatios.size() == 3)
+    {
+        // x-direction
+        expand_[0]  = expRatios[0];
+        expand_[1]  = expRatios[0];
+        expand_[2]  = expRatios[0];
+        expand_[3]  = expRatios[0];
+
+        // y-direction
+        expand_[4]  = expRatios[1];
+        expand_[5]  = expRatios[1];
+        expand_[6]  = expRatios[1];
+        expand_[7]  = expRatios[1];
+
+        // z-direction
+        expand_[8]  = expRatios[2];
+        expand_[9]  = expRatios[2];
+        expand_[10] = expRatios[2];
+        expand_[11] = expRatios[2];
+    }
+    else if (expRatios.size() == 12)
+    {
+        expand_ = expRatios;
+    }
+    else
+    {
+        FatalErrorIn
+        (
+            "blockDescriptor::blockDescriptor"
+            "(const pointField&, const curvedEdgeList&, Istream&)"
+        )   << "Unknown definition of expansion ratios: " << expRatios
+            << exit(FatalError);
+    }
+
+    // create a list of edges
+    makeBlockEdges();
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::blockDescriptor::~blockDescriptor()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+const Foam::pointField& Foam::blockDescriptor::blockPointField() const
+{
+    return blockPointField_;
+}
+
+
+const Foam::cellShape& Foam::blockDescriptor::blockShape() const
+{
+    return blockShape_;
+}
+
+
+const Foam::List< Foam::List< Foam::point > >&
+Foam::blockDescriptor::blockEdgePoints() const
+{
+    return edgePoints_;
+}
+
+
+const Foam::scalarListList& Foam::blockDescriptor::blockEdgeWeights() const
+{
+    return edgeWeights_;
+}
+
+
+const Foam::Vector<Foam::label>& Foam::blockDescriptor::meshDensity() const
+{
+    return meshDensity_;
+}
+
+
+const Foam::word& Foam::blockDescriptor::zoneName() const
+{
+    return zoneName_;
+}
+
+
+Foam::label Foam::blockDescriptor::nPoints() const
+{
+    return
+    (
+        (meshDensity_.x() + 1)
+      * (meshDensity_.y() + 1)
+      * (meshDensity_.z() + 1)
+    );
+}
+
+
+Foam::label Foam::blockDescriptor::nCells() const
+{
+    return
+    (
+        meshDensity_.x()
+      * meshDensity_.y()
+      * meshDensity_.z()
+    );
+}
+
+
+const Foam::point& Foam::blockDescriptor::blockPoint(const label i) const
+{
+    return blockPointField_[blockShape_[i]];
+}
+
+
+// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
+
+Foam::Ostream& Foam::operator<<(Ostream& os, const blockDescriptor& bd)
+{
+    const cellShape& bshape = bd.blockShape();
+    const labelList& blockLabels = bshape;
+
+    os  << bshape.model().name() << " (";
+
+    forAll(blockLabels, labelI)
+    {
+        if (labelI)
+        {
+            os  << ' ';
+        }
+        os  << blockLabels[labelI];
+    }
+    os  << ')';
+
+    if (bd.zoneName().size())
+    {
+        os  << ' ' << bd.zoneName();
+    }
+
+    os  << ' '  << bd.meshDensity()
+        << " simpleGrading (";
+
+
+    const scalarList& expand = bd.expand_;
+
+    // can we use a compact notation?
+    if
+    (
+        // x-direction
+        (
+            expand[0] == expand[1]
+         && expand[0] == expand[2]
+         && expand[0] == expand[3]
+        )
+     && // y-direction
+        (
+            expand[4] == expand[5]
+         && expand[4] == expand[6]
+         && expand[4] == expand[7]
+        )
+     && // z-direction
+        (
+            expand[8] == expand[9]
+         && expand[8] == expand[10]
+         && expand[8] == expand[11]
+        )
+    )
+    {
+        os  << expand[0] << ' ' << expand[4] << ' ' << expand[8];
+    }
+    else
+    {
+        forAll(expand, edgeI)
+        {
+            if (edgeI)
+            {
+                os  << ' ';
+            }
+            os  << expand[edgeI];
+        }
+    }
+
+
+    os  << ")";
+
+    return os;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/blockDescriptor.H b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.H
similarity index 58%
rename from applications/utilities/mesh/generation/blockMesh/blockDescriptor.H
rename to src/mesh/blockMesh/blockDescriptor/blockDescriptor.H
index df07052afb1f4f93909e20ee1d669cf847f09e0d..4c6b0f526d9838a321fd2b588f14ec4bce141c2f 100644
--- a/applications/utilities/mesh/generation/blockMesh/blockDescriptor.H
+++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.H
@@ -26,22 +26,20 @@ Class
     Foam::blockDescriptor
 
 Description
-    block descriptor. Takes the description of the block and the list
-    of curved edges and creates a list of points on edges together
-    with the weighting factors
+    Takes the description of the block and the list of curved edges and
+    creates a list of points on edges together with the weighting factors
 
 SourceFiles
     blockDescriptor.C
+    blockDescriptorEdges.C
 
 \*---------------------------------------------------------------------------*/
 
 #ifndef blockDescriptor_H
 #define blockDescriptor_H
 
-#include "scalar.H"
-#include "label.H"
-#include "point.H"
 #include "cellShape.H"
+#include "pointField.H"
 #include "scalarList.H"
 #include "curvedEdgeList.H"
 
@@ -53,43 +51,56 @@ namespace Foam
 class Istream;
 class Ostream;
 
+// Forward declaration of friend functions and operators
+class blockMesh;
+class blockDescriptor;
+Ostream& operator<<(Ostream&, const blockDescriptor&);
+
 /*---------------------------------------------------------------------------*\
-                           Class blockDescriptor Declaration
+                       Class blockDescriptor Declaration
 \*---------------------------------------------------------------------------*/
 
 class blockDescriptor
 {
     // Private data
 
-        //- Block mesh points
-        const pointField& blockMeshPoints_;
+        //- Reference to point field defining the block mesh
+        const pointField& blockPointField_;
+
+        //- Reference to a list of curved edges
+        const curvedEdgeList& curvedEdges_;
 
-        //- block shape
+        //- Block shape
         cellShape blockShape_;
 
-        // reference to a list of curved edges
-        const curvedEdgeList& curvedEdges_;
+        //- The number of cells in the i,j,k directions
+        Vector<label> meshDensity_;
 
-        // block edge points
-        List<List<point> > edgePoints_;
+        //- Block edge points
+        List< List<point> > edgePoints_;
 
-        //- block edge weighting factors
+        //- Block edge weighting factors
         scalarListList edgeWeights_;
 
-        //- number of point in each direction
-        Vector<label> n_;
-
-        //- expansion ratios in all directions
+        //- Expansion ratios in all directions
         scalarList expand_;
 
-        //- name of the zone (empty string if none)
+        //- Name of the zone (empty string if none)
         word zoneName_;
 
-    // Private member functions
+    // Private Member Functions
 
+        //- Set the points/weights for all edges
         void makeBlockEdges();
 
-        void setEdge(label edge, label start, label end, label dim);
+        //- Set the edge points/weights
+        void setEdge(label edgeI, label start, label end, label dim);
+
+
+    // Private Member Functions
+
+        //- Disallow default bitwise assignment
+        void operator=(const blockDescriptor&);
 
 
 public:
@@ -100,19 +111,19 @@ public:
         blockDescriptor
         (
             const cellShape&,
-            const pointField& blockMeshPoints,
-            const curvedEdgeList& edges,
-            const Vector<label>& n,
-            const scalarList& expand,
+            const pointField& blockPointField,
+            const curvedEdgeList&,
+            const Vector<label>& meshDensity,
+            const UList<scalar>& expand,
             const word& zoneName = ""
         );
 
         //- Construct from Istream
         blockDescriptor
         (
-            const pointField& blockMeshPoints,
-            const curvedEdgeList& edges,
-            Istream& is
+            const pointField& blockPointField,
+            const curvedEdgeList&,
+            Istream&
         );
 
         //- Clone
@@ -123,25 +134,42 @@ public:
         }
 
 
+    // Destructor
+
+        ~blockDescriptor();
+
+
     // Member Functions
 
         // Access
 
-        const pointField& points() const;
+        //- Reference to point field defining the block mesh
+        const pointField& blockPointField() const;
 
+        //- Return the block shape
         const cellShape& blockShape() const;
 
-        const List<List<point> >& blockEdgePoints() const;
+        //- Return the block points along each edge
+        const List< List<point> >& blockEdgePoints() const;
 
+        //- Return the weightings along each edge
         const scalarListList& blockEdgeWeights() const;
 
-        const Vector<label>& n() const;
+        //- Return the mesh density (number of cells) in the i,j,k directions
+        const Vector<label>& meshDensity() const;
 
+        //- Return the (optional) zone name
         const word& zoneName() const;
 
-    // Member Operators
 
-        void operator=(const blockDescriptor&);
+        //- Return the number of points
+        label nPoints() const;
+
+        //- Return the number of cells
+        label nCells() const;
+
+        //- Return block point at local label i
+        const point& blockPoint(const label i) const;
 
 
     // IOstream Operators
@@ -150,13 +178,6 @@ public:
 };
 
 
-inline Istream& operator>>(Istream& is, blockDescriptor*)
-{
-    notImplemented("Istream& operator>>(Istream& is, blockDescriptor*)");
-    return is;
-}
-
-
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 } // End namespace Foam
diff --git a/applications/utilities/mesh/generation/blockMesh/setEdge.C b/src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C
similarity index 52%
rename from applications/utilities/mesh/generation/blockMesh/setEdge.C
rename to src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C
index bb8bd8c30506638466caf0c83369ffb25062b0a2..5fcf31f4218935aa34f52339ddc21214022f737b 100644
--- a/applications/utilities/mesh/generation/blockMesh/setEdge.C
+++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptorEdges.C
@@ -22,16 +22,11 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-    from the list of curved edges creates a list
-    of edges that are not curved. It is assumed
-    that all other edges are straight lines
-
 \*---------------------------------------------------------------------------*/
 
 #include "error.H"
-
 #include "blockDescriptor.H"
+
 #include "lineEdge.H"
 #include "lineDivide.H"
 
@@ -39,68 +34,91 @@ Description
 
 namespace Foam
 {
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-scalar calcGexp(const scalar expRatio, const label dim)
-{
-    if (dim == 1)
+    //! @cond fileScope
+    //  Calculate the geometric expension factor from the expansion ratio
+    inline scalar calcGexp(const scalar expRatio, const label dim)
     {
-        return 0.0;
+        return dim > 1 ? pow(expRatio, 1.0/(dim - 1)) : 0.0;
     }
-    else
-    {
-        return pow(expRatio, 1.0/(dim - 1));
-    }
-}
+    //! @endcond fileScope
+
+} // End namespace Foam
 
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-void blockDescriptor::setEdge(label edgeI, label start, label end, label dim)
+void Foam::blockDescriptor::makeBlockEdges()
 {
-    // for all edges check the list of curved edges. If the edge is curved,
-    // add it to the list. If the edge is not found, create is as a line
+    const label ni = meshDensity_.x();
+    const label nj = meshDensity_.y();
+    const label nk = meshDensity_.z();
+
+    // these edges correspond to the "hex" cellModel
+
+    // x-direction
+    setEdge(0,  0, 1, ni);
+    setEdge(1,  3, 2, ni);
+    setEdge(2,  7, 6, ni);
+    setEdge(3,  4, 5, ni);
+
+    // y-direction
+    setEdge(4,  0, 3, nj);
+    setEdge(5,  1, 2, nj);
+    setEdge(6,  5, 6, nj);
+    setEdge(7,  4, 7, nj);
+
+    // z-direction
+    setEdge(8,  0, 4, nk);
+    setEdge(9,  1, 5, nk);
+    setEdge(10, 2, 6, nk);
+    setEdge(11, 3, 7, nk);
+}
 
-    bool found = false;
 
+void Foam::blockDescriptor::setEdge
+(
+    label edgeI,
+    label start,
+    label end,
+    label dim
+)
+{
     // set reference to the list of labels defining the block
     const labelList& blockLabels = blockShape_;
 
     // set reference to global list of points
-    const pointField blockPoints = blockShape_.points(blockMeshPoints_);
+    const pointField blockPoints = blockShape_.points(blockPointField_);
+
+    // Set the edge points/weights
+    // The edge is a straight-line if it is not in the list of curvedEdges
 
-    // x1
-    found = false;
+    // calc geometric expension factor from the expansion ratio
+    const scalar gExp = calcGexp(expand_[edgeI], dim);
 
-    forAll (curvedEdges_, nCEI)
+    forAll(curvedEdges_, cedgeI)
     {
-        if (curvedEdges_[nCEI].compare(blockLabels[start], blockLabels[end]))
-        {
-            found = true;
+        const curvedEdge& cedge = curvedEdges_[cedgeI];
+
+        int cmp = cedge.compare(blockLabels[start], blockLabels[end]);
 
-            // check the orientation:
-            // if the starting point of the curve is the same as the starting
-            // point of the edge, do the parametrisation and pick up the points
-            if (blockLabels[start] == curvedEdges_[nCEI].start())
+        if (cmp)
+        {
+            if (cmp > 0)
             {
-                // calculate the geometric expension factor out of the
-                // expansion ratio
-                scalar gExp = calcGexp(expand_[edgeI], dim);
+                // curve has the same orientation
 
                 // divide the line
-                lineDivide divEdge(curvedEdges_[nCEI], dim, gExp);
+                lineDivide divEdge(cedge, dim, gExp);
 
-                edgePoints_[edgeI] = divEdge.points();
+                edgePoints_[edgeI]  = divEdge.points();
                 edgeWeights_[edgeI] = divEdge.lambdaDivisions();
             }
             else
             {
-                // the curve has got the opposite orientation
-                scalar gExp = calcGexp(expand_[edgeI], dim);
+                // curve has the opposite orientation
 
                 // divide the line
-                lineDivide divEdge(curvedEdges_[nCEI], dim, 1.0/(gExp+SMALL));
+                lineDivide divEdge(cedge, dim, 1.0/(gExp+SMALL));
 
                 pointField p = divEdge.points();
                 scalarList d = divEdge.lambdaDivisions();
@@ -109,38 +127,32 @@ void blockDescriptor::setEdge(label edgeI, label start, label end, label dim)
                 edgeWeights_[edgeI].setSize(d.size());
 
                 label pMax = p.size() - 1;
-                forAll (p, pI)
+                forAll(p, pI)
                 {
-                    edgePoints_[edgeI][pI] = p[pMax - pI];
+                    edgePoints_[edgeI][pI]  = p[pMax - pI];
                     edgeWeights_[edgeI][pI] = 1.0 - d[pMax - pI];
                 }
+
             }
 
-            break;
+            // found curved-edge: done
+            return;
         }
     }
 
-    if (!found)
-    {
-        // edge is a straight line
-        scalar gExp = calcGexp(expand_[edgeI], dim);
-
-        // divide the line
-        lineDivide divEdge
-        (
-            lineEdge(blockPoints, start, end),
-            dim,
-            gExp
-        );
-
-        edgePoints_[edgeI] = divEdge.points();
-        edgeWeights_[edgeI] = divEdge.lambdaDivisions();
-    }
-}
 
+    // not found: divide the edge as a straight line
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+    lineDivide divEdge
+    (
+        lineEdge(blockPoints, start, end),
+        dim,
+        gExp
+    );
+
+    edgePoints_[edgeI]  = divEdge.points();
+    edgeWeights_[edgeI] = divEdge.lambdaDivisions();
+}
 
-} // End namespace Foam
 
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.C b/src/mesh/blockMesh/blockMesh/blockMesh.C
similarity index 70%
rename from applications/utilities/mesh/generation/blockMesh/blockMesh.C
rename to src/mesh/blockMesh/blockMesh/blockMesh.C
index 640971ada099b069f25467cf1bb6f97a199bd754..4d499ea943229e5660ab8798f71640345cba17bd 100644
--- a/applications/utilities/mesh/generation/blockMesh/blockMesh.C
+++ b/src/mesh/blockMesh/blockMesh/blockMesh.C
@@ -22,29 +22,25 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Application
-    blockMesh
-
-Description
-    Mesh generator
-
 \*---------------------------------------------------------------------------*/
 
 #include "blockMesh.H"
 
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+bool Foam::blockMesh::blockMesh::verboseOutput(false);
+
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from IOdictionary
-Foam::blockMesh::blockMesh(IOdictionary& meshDescription)
+Foam::blockMesh::blockMesh(IOdictionary& dict)
 :
-    topologyPtr_(createTopology(meshDescription)),
-    blockOffsets_(createBlockOffsets()),
-    mergeList_(createMergeList()),
-    points_(createPoints(meshDescription)),
-    cells_(createCells()),
-    patches_(createPatches())
-{}
+    blockPointField_(dict.lookup("vertices")),
+    scaleFactor_(1.0),
+    topologyPtr_(createTopology(dict))
+{
+    calcMergeInfo();
+}
 
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
@@ -57,6 +53,18 @@ Foam::blockMesh::~blockMesh()
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
+void Foam::blockMesh::verbose(const bool on)
+{
+    verboseOutput = on;
+}
+
+
+const Foam::pointField& Foam::blockMesh::blockPointField() const
+{
+    return blockPointField_;
+}
+
+
 const Foam::polyMesh& Foam::blockMesh::topology() const
 {
     if (!topologyPtr_)
@@ -70,45 +78,54 @@ const Foam::polyMesh& Foam::blockMesh::topology() const
 }
 
 
-Foam::wordList Foam::blockMesh::patchNames() const
+const Foam::pointField& Foam::blockMesh::points() const
 {
-    const polyPatchList& patchTopologies = topology().boundaryMesh();
-    wordList names(patchTopologies.size());
-
-    forAll (names, patchI)
+    if (points_.empty())
     {
-        names[patchI] = patchTopologies[patchI].name();
+        createPoints();
     }
 
-    return names;
+    return points_;
 }
 
 
-Foam::wordList Foam::blockMesh::patchTypes() const
+const Foam::cellShapeList& Foam::blockMesh::cells() const
 {
-    const polyPatchList& patchTopologies = topology().boundaryMesh();
-    wordList types(patchTopologies.size());
-
-    forAll (types, patchI)
+    if (cells_.empty())
     {
-        types[patchI] = patchTopologies[patchI].type();
+        createCells();
     }
 
-    return types;
+    return cells_;
 }
 
 
-Foam::wordList Foam::blockMesh::patchPhysicalTypes() const
+const Foam::faceListList& Foam::blockMesh::patches() const
 {
-    const polyPatchList& patchTopologies = topology().boundaryMesh();
-    wordList physicalTypes(patchTopologies.size());
-
-    forAll (physicalTypes, patchI)
+    if (patches_.empty())
     {
-        physicalTypes[patchI] = patchTopologies[patchI].physicalType();
+        createPatches();
     }
 
-    return physicalTypes;
+    return patches_;
+}
+
+
+Foam::wordList Foam::blockMesh::patchNames() const
+{
+    return topology().boundaryMesh().names();
+}
+
+
+Foam::wordList Foam::blockMesh::patchTypes() const
+{
+    return topology().boundaryMesh().types();
+}
+
+
+Foam::wordList Foam::blockMesh::patchPhysicalTypes() const
+{
+    return topology().boundaryMesh().physicalTypes();
 }
 
 
@@ -118,7 +135,7 @@ Foam::label Foam::blockMesh::numZonedBlocks() const
 
     forAll(*this, blockI)
     {
-        if (operator[](blockI).blockDef().zoneName().size())
+        if (operator[](blockI).zoneName().size())
         {
             num++;
         }
diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.H b/src/mesh/blockMesh/blockMesh/blockMesh.H
similarity index 68%
rename from applications/utilities/mesh/generation/blockMesh/blockMesh.H
rename to src/mesh/blockMesh/blockMesh/blockMesh.H
index e6b6998c5883d57458a093c5157bebecb81ce9ab..6e67506a798f7d157a01f2c6ed63355e80bc5325 100644
--- a/applications/utilities/mesh/generation/blockMesh/blockMesh.H
+++ b/src/mesh/blockMesh/blockMesh/blockMesh.H
@@ -26,9 +26,17 @@ Class
     Foam::blockMesh
 
 Description
+    A multi-block mesh generator
+
+Note
+    The vertices, cells and patches for filling the blocks are demand-driven.
 
 SourceFiles
     blockMesh.C
+    blockMeshCheck.C
+    blockMeshCreate.C
+    blockMeshMerge.C
+    blockMeshTopology.C
 
 \*---------------------------------------------------------------------------*/
 
@@ -54,20 +62,36 @@ class blockMesh
     public blockList
 {
     // Private data
+        static bool verboseOutput;
 
-        label nPoints_;
-        label nCells_;
+        //- Point field defining the block mesh (corners)
+        pointField blockPointField_;
 
+        //- The list of curved edges
         curvedEdgeList edges_;
 
+        //- The scaling factor to convert to meters
+        scalar scaleFactor_;
+
+        //- The blocks themselves (the topology) as a polyMesh
         polyMesh* topologyPtr_;
 
+        label nPoints_;
+
+        //- The sum of all cells in each block
+        label nCells_;
+
+        //- The point offset added to each block
         labelList blockOffsets_;
+
+        //- The merge points information
         labelList mergeList_;
 
-        pointField points_;
-        cellShapeList cells_;
-        faceListList patches_;
+        mutable pointField points_;
+
+        mutable cellShapeList cells_;
+
+        mutable faceListList patches_;
 
 
     // Private Member Functions
@@ -77,26 +101,26 @@ class blockMesh
             const label blockLabel,
             const pointField& points,
             const cellShape& blockShape
-        );
+        ) const;
 
         bool patchLabelsOK
         (
             const label patchLabel,
             const pointField& points,
             const faceList& patchShapes
-        );
+        ) const;
 
         polyMesh* createTopology(IOdictionary&);
-        void checkBlockMesh(const polyMesh&);
+        void checkBlockMesh(const polyMesh&) const;
 
-        labelList createBlockOffsets();
-        labelList createMergeList();
+        //- Determine the merge info and the final number of cells/points
+        void calcMergeInfo();
 
-        pointField createPoints(const dictionary&);
-        cellShapeList createCells();
+        faceList createPatchFaces(const polyPatch& patchTopologyFaces) const;
 
-        faceList createPatchFaces(const polyPatch& patchTopologyFaces);
-        faceListList createPatches();
+        void createPoints() const;
+        void createCells() const;
+        void createPatches() const;
 
         //- as copy (not implemented)
         blockMesh(const blockMesh&);
@@ -119,6 +143,9 @@ public:
 
         // Access
 
+            //- Reference to point field defining the block mesh
+            const pointField& blockPointField() const;
+
             const polyMesh& topology() const;
 
             const curvedEdgeList& edges() const
@@ -126,20 +153,11 @@ public:
                 return edges_;
             }
 
-            const pointField& points() const
-            {
-                return points_;
-            }
+            const pointField& points() const;
 
-            const cellShapeList& cells() const
-            {
-                return cells_;
-            }
+            const cellShapeList& cells() const;
 
-            const faceListList& patches() const
-            {
-                return patches_;
-            }
+            const faceListList& patches() const;
 
             wordList patchNames() const;
 
@@ -151,6 +169,14 @@ public:
             label numZonedBlocks() const;
 
 
+        // Edit
+
+            //- Clear geometry (internal points, cells, boundaryPatches)
+            void clearGeom();
+
+            //- Enable/disable verbose information about the progress
+            static void verbose(const bool on=true);
+
         // Write
 
             //- Writes edges of blockMesh in OBJ format.
diff --git a/applications/utilities/mesh/generation/blockMesh/checkBlockMesh.C b/src/mesh/blockMesh/blockMesh/blockMeshCheck.C
similarity index 52%
rename from applications/utilities/mesh/generation/blockMesh/checkBlockMesh.C
rename to src/mesh/blockMesh/blockMesh/blockMeshCheck.C
index 3abb4a6c71fa83a68a620f52ac034baf16297447..228f41e43c86b3f521141b6aa0dc7d91f19e322c 100644
--- a/applications/utilities/mesh/generation/blockMesh/checkBlockMesh.C
+++ b/src/mesh/blockMesh/blockMesh/blockMeshCheck.C
@@ -22,8 +22,6 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-
 \*---------------------------------------------------------------------------*/
 
 #include "blockMesh.H"
@@ -31,18 +29,21 @@ Description
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 // Check the blockMesh topology
-void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
+void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const
 {
-    Info<< nl << "Check block mesh topology" << endl;
+    if (verboseOutput)
+    {
+        Info<< nl << "Check topology" << endl;
+    }
 
-    bool blockMeshOK = true;
+    bool ok = true;
 
     const pointField& points = bm.points();
     const faceList& faces = bm.faces();
     const cellList& cells = bm.cells();
     const polyPatchList& patches = bm.boundaryMesh();
 
-    label nBoundaryFaces=0;
+    label nBoundaryFaces = 0;
     forAll(cells, celli)
     {
         nBoundaryFaces += cells[celli].nFaces();
@@ -50,35 +51,34 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
 
     nBoundaryFaces -= 2*bm.nInternalFaces();
 
-    label nDefinedBoundaryFaces=0;
+    label nDefinedBoundaryFaces = 0;
     forAll(patches, patchi)
     {
         nDefinedBoundaryFaces += patches[patchi].size();
     }
 
 
-    Info<< nl << tab << "Basic statistics" << endl;
-
-    Info<< tab << tab << "Number of internal faces : "
-        << bm.nInternalFaces() << endl;
-
-    Info<< tab << tab << "Number of boundary faces : "
-        << nBoundaryFaces << endl;
-
-    Info<< tab << tab << "Number of defined boundary faces : "
-        << nDefinedBoundaryFaces << endl;
-
-    Info<< tab << tab << "Number of undefined boundary faces : "
-        << nBoundaryFaces - nDefinedBoundaryFaces << endl;
-
-    if ((nBoundaryFaces - nDefinedBoundaryFaces) > 0)
+    if (verboseOutput)
     {
-        Info<< tab << tab << tab
-            << "(Warning : only leave undefined the front and back planes "
-            << "of 2D planar geometries!)" << endl;
-    }
+        Info<< nl << tab << "Basic statistics" << nl
+            << tab << tab << "Number of internal faces : "
+            << bm.nInternalFaces() << nl
+            << tab << tab << "Number of boundary faces : "
+            << nBoundaryFaces << nl
+            << tab << tab << "Number of defined boundary faces : "
+            << nDefinedBoundaryFaces << nl
+            << tab << tab << "Number of undefined boundary faces : "
+            << nBoundaryFaces - nDefinedBoundaryFaces << nl;
+
+        if ((nBoundaryFaces - nDefinedBoundaryFaces) > 0)
+        {
+            Info<< tab << tab << tab
+                << "(Warning : only leave undefined the front and back planes "
+                << "of 2D planar geometries!)" << endl;
+        }
 
-    Info<< nl << tab << "Checking patch -> block consistency" << endl;
+        Info<< tab << "Checking patch -> block consistency" << endl;
+    }
 
 
     forAll(patches, patchi)
@@ -115,7 +115,7 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
                                 << " points inwards"
                                 << endl;
 
-                            blockMeshOK = false;
+                            ok = false;
                         }
                     }
                 }
@@ -129,12 +129,17 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
                     << " (" << patches[patchi].name() << ")"
                     << " does not match any block faces" << endl;
 
-                blockMeshOK = false;
+                ok = false;
             }
         }
     }
 
-    if (!blockMeshOK)
+    if (verboseOutput)
+    {
+        Info<< endl;
+    }
+
+    if (!ok)
     {
         FatalErrorIn("blockMesh::checkBlockMesh(const polyMesh& bm)")
             << "Block mesh topology incorrect, stopping mesh generation!"
@@ -142,4 +147,91 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
     }
 }
 
+
+bool Foam::blockMesh::blockLabelsOK
+(
+    const label blockLabel,
+    const pointField& points,
+    const cellShape& blockShape
+) const
+{
+    bool ok = true;
+
+    forAll(blockShape, blockI)
+    {
+        if (blockShape[blockI] < 0)
+        {
+            ok = false;
+
+            WarningIn
+            (
+                "bool Foam::blockMesh::blockLabelsOK(...)"
+            )   << "out-of-range point label " << blockShape[blockI]
+                << " (min = 0"
+                << ") in block " << blockLabel << endl;
+        }
+        else if (blockShape[blockI] >= points.size())
+        {
+            ok = false;
+
+            WarningIn
+            (
+                "bool Foam::blockMesh::blockLabelsOK(...)"
+            )   << "out-of-range point label " << blockShape[blockI]
+                << " (max = " << points.size() - 1
+                << ") in block " << blockLabel << endl;
+        }
+    }
+
+    return ok;
+}
+
+
+bool Foam::blockMesh::patchLabelsOK
+(
+    const label patchLabel,
+    const pointField& points,
+    const faceList& patchFaces
+) const
+{
+    bool ok = true;
+
+    forAll(patchFaces, faceI)
+    {
+        const labelList& f = patchFaces[faceI];
+
+        forAll(f, fp)
+        {
+            if (f[fp] < 0)
+            {
+                ok = false;
+
+                WarningIn
+                (
+                    "bool Foam::blockMesh::patchLabelsOK(...)"
+                )   << "out-of-range point label " << f[fp]
+                    << " (min = 0"
+                    << ") on patch " << patchLabel
+                    << ", face " << faceI << endl;
+            }
+            else if (f[fp] >= points.size())
+            {
+                ok = false;
+
+                WarningIn
+                (
+                    "bool Foam::blockMesh::patchLabelsOK(...)"
+                )   << "out-of-range point label " << f[fp]
+                    << " (max = " << points.size() - 1
+                    << ") on patch " << patchLabel
+                    << ", face " << faceI << endl;
+
+            }
+        }
+    }
+
+    return ok;
+}
+
+
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/createPatches.C b/src/mesh/blockMesh/blockMesh/blockMeshCreate.C
similarity index 59%
rename from applications/utilities/mesh/generation/blockMesh/createPatches.C
rename to src/mesh/blockMesh/blockMesh/blockMeshCreate.C
index 1a670c6578dd27d597b061a1956cc6176feda4db..c825469410b6353fe0c93f7daef8f75b1e28b948 100644
--- a/applications/utilities/mesh/generation/blockMesh/createPatches.C
+++ b/src/mesh/blockMesh/blockMesh/blockMeshCreate.C
@@ -22,34 +22,108 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-
-
 \*---------------------------------------------------------------------------*/
 
+#include "error.H"
 #include "blockMesh.H"
+#include "cellModeller.H"
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
+void Foam::blockMesh::createPoints() const
+{
+    const blockList& blocks = *this;
+
+    if (verboseOutput)
+    {
+        Info<< "Creating points with scale " << scaleFactor_ << endl;
+    }
+
+    //
+    // generate points
+    //
+    points_.clear();
+    points_.setSize(nPoints_);
+
+    forAll(blocks, blockI)
+    {
+        const pointField& blockPoints = blocks[blockI].points();
+
+        forAll(blockPoints, blockPointI)
+        {
+            points_
+            [
+                mergeList_
+                [
+                    blockOffsets_[blockI] + blockPointI
+                ]
+            ] = scaleFactor_ * blockPoints[blockPointI];
+        }
+    }
+}
+
+
+void Foam::blockMesh::createCells() const
+{
+    const blockList& blocks = *this;
+    const cellModel& hex = *(cellModeller::lookup("hex"));
+
+    if (verboseOutput)
+    {
+        Info<< "Creating cells" << endl;
+    }
+
+    //
+    // generate cells
+    //
+    cells_.clear();
+    cells_.setSize(nCells_);
+
+    label cellLabel = 0;
+
+    forAll(blocks, blockI)
+    {
+        const labelListList& blockCells = blocks[blockI].cells();
+
+        forAll(blockCells, blockCellI)
+        {
+            labelList cellPoints(blockCells[blockCellI].size());
+
+            forAll(cellPoints, cellPointI)
+            {
+                cellPoints[cellPointI] =
+                    mergeList_
+                    [
+                        blockCells[blockCellI][cellPointI]
+                      + blockOffsets_[blockI]
+                    ];
+            }
+
+            // Construct collapsed cell and add to list
+            cells_[cellLabel] = cellShape(hex, cellPoints, true);
+
+            cellLabel++;
+        }
+    }
+}
+
+
 Foam::faceList Foam::blockMesh::createPatchFaces
 (
     const polyPatch& patchTopologyFaces
-)
+) const
 {
-    blockMesh& blocks = *this;
+    const blockList& blocks = *this;
 
     labelList blockLabels = patchTopologyFaces.polyPatch::faceCells();
 
-    label nFaces=0;
+    label nFaces = 0;
 
     forAll(patchTopologyFaces, patchTopologyFaceLabel)
     {
-        label blockLabel = blockLabels[patchTopologyFaceLabel];
+        const label blockI = blockLabels[patchTopologyFaceLabel];
 
-        faceList blockFaces
-        (
-            blocks[blockLabel].blockDef().blockShape().faces()
-        );
+        faceList blockFaces = blocks[blockI].blockShape().faces();
 
         forAll(blockFaces, blockFaceLabel)
         {
@@ -60,7 +134,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces
             )
             {
                 nFaces +=
-                    blocks[blockLabel].boundaryPatches()[blockFaceLabel].size();
+                    blocks[blockI].boundaryPatches()[blockFaceLabel].size();
             }
         }
     }
@@ -72,12 +146,9 @@ Foam::faceList Foam::blockMesh::createPatchFaces
 
     forAll(patchTopologyFaces, patchTopologyFaceLabel)
     {
-        label blockLabel = blockLabels[patchTopologyFaceLabel];
+        const label blockI = blockLabels[patchTopologyFaceLabel];
 
-        faceList blockFaces
-        (
-            blocks[blockLabel].blockDef().blockShape().faces()
-        );
+        faceList blockFaces = blocks[blockI].blockShape().faces();
 
         forAll(blockFaces, blockFaceLabel)
         {
@@ -88,7 +159,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces
             )
             {
                 const labelListList& blockPatchFaces =
-                    blocks[blockLabel].boundaryPatches()[blockFaceLabel];
+                    blocks[blockI].boundaryPatches()[blockFaceLabel];
 
                 forAll(blockPatchFaces, blockFaceLabel)
                 {
@@ -99,7 +170,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces
                         mergeList_
                         [
                             blockPatchFaces[blockFaceLabel][0]
-                          + blockOffsets_[blockLabel]
+                          + blockOffsets_[blockI]
                         ];
 
                     label nUnique = 1;
@@ -115,7 +186,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces
                             mergeList_
                             [
                                 blockPatchFaces[blockFaceLabel][facePointLabel]
-                              + blockOffsets_[blockLabel]
+                              + blockOffsets_[blockI]
                             ];
 
                         if (quadFace[nUnique] != quadFace[nUnique-1])
@@ -152,20 +223,38 @@ Foam::faceList Foam::blockMesh::createPatchFaces
 }
 
 
-Foam::faceListList Foam::blockMesh::createPatches()
+void Foam::blockMesh::createPatches() const
 {
-    Info<< "\nCreating patches\n";
+    const polyPatchList& topoPatches = topology().boundaryMesh();
 
-    const polyPatchList& patchTopologies = topology().boundaryMesh();
-    faceListList patches(patchTopologies.size());
+    if (verboseOutput)
+    {
+        Info<< "Creating patches" << endl;
+    }
+
+    //
+    // generate points
+    //
 
-    forAll(patchTopologies, patchLabel)
+    patches_.clear();
+    patches_.setSize(topoPatches.size());
+
+    forAll(topoPatches, patchI)
     {
-        patches[patchLabel] =
-            createPatchFaces(patchTopologies[patchLabel]);
+        patches_[patchI] = createPatchFaces(topoPatches[patchI]);
     }
 
-    return patches;
+}
+
+
+void Foam::blockMesh::clearGeom()
+{
+    blockList& blocks = *this;
+
+    forAll(blocks, blockI)
+    {
+        blocks[blockI].clearGeom();
+    }
 }
 
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/createMergeList.C b/src/mesh/blockMesh/blockMesh/blockMeshMerge.C
similarity index 85%
rename from applications/utilities/mesh/generation/blockMesh/createMergeList.C
rename to src/mesh/blockMesh/blockMesh/blockMeshMerge.C
index b46317652dcd67df7216af89857591619bcd67b7..3c5ca4ca84fa0efce0a2515926bdaccbf4b19a4d 100644
--- a/applications/utilities/mesh/generation/blockMesh/createMergeList.C
+++ b/src/mesh/blockMesh/blockMesh/blockMeshMerge.C
@@ -28,13 +28,38 @@ License
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-Foam::labelList Foam::blockMesh::createMergeList()
+void Foam::blockMesh::calcMergeInfo()
 {
-    Info<< nl << "Creating merge list" << flush;
+    const blockList& blocks = *this;
 
-    labelList MergeList(nPoints_, -1);
+    if (verboseOutput)
+    {
+        Info<< "Creating block offsets" << endl;
+    }
+
+    blockOffsets_.setSize(blocks.size());
+
+    nPoints_ = 0;
+    nCells_  = 0;
+
+    forAll(blocks, blockI)
+    {
+        blockOffsets_[blockI] = nPoints_;
+
+        nPoints_ += blocks[blockI].nPoints();
+        nCells_  += blocks[blockI].nCells();
+    }
+
+
+    if (verboseOutput)
+    {
+        Info<< "Creating merge list " << flush;
+    }
+
+    // set unused to -1
+    mergeList_.setSize(nPoints_);
+    mergeList_ = -1;
 
-    blockMesh& blocks = *this;
 
     const pointField& blockPoints = topology().points();
     const cellList& blockCells = topology().cells();
@@ -46,6 +71,7 @@ Foam::labelList Foam::blockMesh::createMergeList()
 
     const labelList& faceNeighbourBlocks = topology().faceNeighbour();
 
+
     forAll(blockFaces, blockFaceLabel)
     {
         label blockPlabel = faceOwnerBlocks[blockFaceLabel];
@@ -74,7 +100,7 @@ Foam::labelList Foam::blockMesh::createMergeList()
 
         if (!foundFace)
         {
-            FatalErrorIn("blockMesh::createMergeList()")
+            FatalErrorIn("blockMesh::calcMergeInfo()")
                 << "Cannot find merge face for block " << blockPlabel
                 << exit(FatalError);
         };
@@ -130,17 +156,17 @@ Foam::labelList Foam::blockMesh::createMergeList()
 
                             label minPP2 = min(PpointLabel, PpointLabel2);
 
-                            if (MergeList[PpointLabel] != -1)
+                            if (mergeList_[PpointLabel] != -1)
                             {
-                                minPP2 = min(minPP2, MergeList[PpointLabel]);
+                                minPP2 = min(minPP2, mergeList_[PpointLabel]);
                             }
 
-                            if (MergeList[PpointLabel2] != -1)
+                            if (mergeList_[PpointLabel2] != -1)
                             {
-                                minPP2 = min(minPP2, MergeList[PpointLabel2]);
+                                minPP2 = min(minPP2, mergeList_[PpointLabel2]);
                             }
 
-                            MergeList[PpointLabel] = MergeList[PpointLabel2]
+                            mergeList_[PpointLabel] = mergeList_[PpointLabel2]
                                 = minPP2;
                         }
                         else
@@ -183,7 +209,7 @@ Foam::labelList Foam::blockMesh::createMergeList()
 
         if (!foundFace)
         {
-            FatalErrorIn("blockMesh::createMergeList()")
+            FatalErrorIn("blockMesh::calcMergeInfo()")
                 << "Cannot find merge face for block " << blockNlabel
                 << exit(FatalError);
         };
@@ -193,7 +219,7 @@ Foam::labelList Foam::blockMesh::createMergeList()
 
         if (blockPfaceFaces.size() != blockNfaceFaces.size())
         {
-            FatalErrorIn("blockMesh::createMergeList()")
+            FatalErrorIn("blockMesh::calcMergeInfo()")
                 << "Inconsistent number of faces between block pair "
                 << blockPlabel << " and " << blockNlabel
                 << exit(FatalError);
@@ -251,17 +277,17 @@ Foam::labelList Foam::blockMesh::createMergeList()
 
                             label minPN = min(PpointLabel, NpointLabel);
 
-                            if (MergeList[PpointLabel] != -1)
+                            if (mergeList_[PpointLabel] != -1)
                             {
-                                minPN = min(minPN, MergeList[PpointLabel]);
+                                minPN = min(minPN, mergeList_[PpointLabel]);
                             }
 
-                            if (MergeList[NpointLabel] != -1)
+                            if (mergeList_[NpointLabel] != -1)
                             {
-                                minPN = min(minPN, MergeList[NpointLabel]);
+                                minPN = min(minPN, mergeList_[NpointLabel]);
                             }
 
-                            MergeList[PpointLabel] = MergeList[NpointLabel]
+                            mergeList_[PpointLabel] = mergeList_[NpointLabel]
                                 = minPN;
                         }
                     }
@@ -271,7 +297,7 @@ Foam::labelList Foam::blockMesh::createMergeList()
             {
                 if (cp[blockPfaceFacePointLabel] == -1)
                 {
-                    FatalErrorIn("blockMesh::createMergeList()")
+                    FatalErrorIn("blockMesh::calcMergeInfo()")
                         << "Inconsistent point locations between block pair "
                         << blockPlabel << " and " << blockNlabel << nl
                         << "    probably due to inconsistent grading."
@@ -327,6 +353,8 @@ Foam::labelList Foam::blockMesh::createMergeList()
                 }
             }
 
+// FIXME? - there seems to be some logic missing here
+
             foundFace = false;
             label blockNfaceLabel;
             for
@@ -347,6 +375,9 @@ Foam::labelList Foam::blockMesh::createMergeList()
                 }
             }
 
+// FIXME? - there seems to be some logic missing here
+
+
             const labelListList& blockPfaceFaces =
                 blocks[blockPlabel].boundaryPatches()[blockPfaceLabel];
 
@@ -369,34 +400,41 @@ Foam::labelList Foam::blockMesh::createMergeList()
 
                     if
                     (
-                        MergeList[PpointLabel]
-                     != MergeList[NpointLabel]
+                        mergeList_[PpointLabel]
+                     != mergeList_[NpointLabel]
                     )
                     {
                         changedPointMerge = true;
 
-                        MergeList[PpointLabel]
-                      = MergeList[NpointLabel]
+                        mergeList_[PpointLabel]
+                      = mergeList_[NpointLabel]
                       = min
                         (
-                            MergeList[PpointLabel],
-                            MergeList[NpointLabel]
+                            mergeList_[PpointLabel],
+                            mergeList_[NpointLabel]
                         );
                     }
                 }
             }
         }
-        Info << "." << flush;
+        if (verboseOutput)
+        {
+            Info<< "." << flush;
+        }
 
         if (nPasses > 100)
         {
-            FatalErrorIn("blockMesh::createMergeList()")
+            FatalErrorIn("blockMesh::calcMergeInfo()")
                 << "Point merging failed after max number of passes."
                 << abort(FatalError);
         }
     }
     while (changedPointMerge);
-    Info << endl;
+
+    if (verboseOutput)
+    {
+        Info<< endl;
+    }
 
     forAll(blockInternalFaces, blockFaceLabel)
     {
@@ -431,7 +469,7 @@ Foam::labelList Foam::blockMesh::createMergeList()
 
         if (!foundFace)
         {
-            FatalErrorIn("blockMesh::createMergeList()")
+            FatalErrorIn("blockMesh::calcMergeInfo()")
                 << "Cannot find merge face for block " << blockPlabel
                 << exit(FatalError);
         };
@@ -458,7 +496,7 @@ Foam::labelList Foam::blockMesh::createMergeList()
 
         if (!foundFace)
         {
-            FatalErrorIn("blockMesh::createMergeList()")
+            FatalErrorIn("blockMesh::calcMergeInfo()")
                 << "Cannot find merge face for block " << blockNlabel
                 << exit(FatalError);
         };
@@ -480,9 +518,9 @@ Foam::labelList Foam::blockMesh::createMergeList()
                     blockPfaceFacePoints[blockPfaceFacePointLabel]
                   + blockOffsets_[blockPlabel];
 
-                if (MergeList[PpointLabel] == -1)
+                if (mergeList_[PpointLabel] == -1)
                 {
-                    FatalErrorIn("blockMesh::createMergeList()")
+                    FatalErrorIn("blockMesh::calcMergeInfo()")
                         << "Unable to merge point "
                         << blockPfaceFacePointLabel
                         << ' ' << blockPpoints[blockPfaceFacePointLabel]
@@ -506,9 +544,9 @@ Foam::labelList Foam::blockMesh::createMergeList()
                     blockNfaceFacePoints[blockNfaceFacePointLabel]
                   + blockOffsets_[blockNlabel];
 
-                if (MergeList[NpointLabel] == -1)
+                if (mergeList_[NpointLabel] == -1)
                 {
-                    FatalErrorIn("blockMesh::createMergeList()")
+                    FatalErrorIn("blockMesh::calcMergeInfo()")
                         << "unable to merge point "
                         << blockNfaceFacePointLabel
                         << ' ' << blockNpoints[blockNfaceFacePointLabel]
@@ -527,33 +565,31 @@ Foam::labelList Foam::blockMesh::createMergeList()
     // given old point label
     label newPointLabel = 0;
 
-    forAll(MergeList, pointLabel)
+    forAll(mergeList_, pointLabel)
     {
-        if (MergeList[pointLabel] > pointLabel)
+        if (mergeList_[pointLabel] > pointLabel)
         {
-            FatalErrorIn("blockMesh::createMergeList()")
+            FatalErrorIn("blockMesh::calcMergeInfo()")
                 << "ouch" << exit(FatalError);
         }
 
         if
         (
-            (MergeList[pointLabel] == -1)
-         || MergeList[pointLabel] == pointLabel
+            mergeList_[pointLabel] == -1
+         || mergeList_[pointLabel] == pointLabel
         )
         {
-            MergeList[pointLabel] = newPointLabel;
+            mergeList_[pointLabel] = newPointLabel;
             newPointLabel++;
         }
         else
         {
-            MergeList[pointLabel] = MergeList[MergeList[pointLabel]];
+            mergeList_[pointLabel] = mergeList_[mergeList_[pointLabel]];
         }
     }
 
     nPoints_ = newPointLabel;
 
-
-    return MergeList;
 }
 
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/createTopology.C b/src/mesh/blockMesh/blockMesh/blockMeshTopology.C
similarity index 51%
rename from applications/utilities/mesh/generation/blockMesh/createTopology.C
rename to src/mesh/blockMesh/blockMesh/blockMeshTopology.C
index 1593f08d343c89c1d037046b738a27b73d3ed6a8..97ad739d60af056510d09f83571f95a673cdd2f0 100644
--- a/applications/utilities/mesh/generation/blockMesh/createTopology.C
+++ b/src/mesh/blockMesh/blockMesh/blockMeshTopology.C
@@ -29,106 +29,14 @@ License
 #include "preservePatchTypes.H"
 #include "emptyPolyPatch.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-bool Foam::blockMesh::blockLabelsOK
-(
-    const label blockLabel,
-    const pointField& points,
-    const cellShape& blockShape
-)
-{
-    bool ok = true;
-
-    forAll(blockShape, blockI)
-    {
-        if (blockShape[blockI] < 0)
-        {
-            ok = false;
-
-            WarningIn
-            (
-                "bool Foam::blockMesh::blockLabelsOK"
-                "(const label blockLabel, const pointField& points, "
-                "const cellShape& blockShape)"
-            )   << "block " << blockLabel
-                << " point label " << blockShape[blockI]
-                << " less than zero" << endl;
-        }
-        else if (blockShape[blockI] >= points.size())
-        {
-            ok = false;
-
-            WarningIn
-            (
-                "bool Foam::blockMesh::blockLabelsOK"
-                "(const label blockLabel, const pointField& points, "
-                "const cellShape& blockShape)"
-            )   << "block " << blockLabel
-                << " point label " << blockShape[blockI]
-                << " larger than " << points.size() - 1
-                << " the largest defined point label" << endl;
-        }
-    }
-
-    return ok;
-}
-
-
-bool Foam::blockMesh::patchLabelsOK
-(
-    const label patchLabel,
-    const pointField& points,
-    const faceList& patchFaces
-)
-{
-    bool ok = true;
-
-    forAll(patchFaces, faceI)
-    {
-        const labelList& f = patchFaces[faceI];
-
-        forAll(f, fp)
-        {
-            if (f[fp] < 0)
-            {
-                ok = false;
-
-                WarningIn
-                (
-                    "bool Foam::blockMesh::patchLabelsOK(...)"
-                )   << "patch " << patchLabel
-                    << " face " << faceI
-                    << " point label " << f[fp]
-                    << " less than zero" << endl;
-            }
-            else if (f[fp] >= points.size())
-            {
-                ok = false;
-
-                WarningIn
-                (
-                    "bool Foam::blockMesh::patchLabelsOK(...)"
-                )   << "patch " << patchLabel
-                    << " face " << faceI
-                    << " point label " << f[fp]
-                    << " larger than " << points.size() - 1
-                    << " the largest defined point label" << endl;
-            }
-        }
-    }
-
-    return ok;
-}
-
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
+Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
 {
     bool topologyOK = true;
 
-    blockMesh& blocks = *this;
+    blockList& blocks = *this;
 
     word defaultPatchName = "defaultFaces";
     word defaultPatchType = emptyPolyPatch::typeName;
@@ -136,27 +44,35 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
     // get names/types for the unassigned patch faces
     // this is a bit heavy handed (and ugly), but there is currently
     // no easy way to rename polyMesh patches subsequently
-    if (const dictionary* dictPtr = meshDescription.subDictPtr("defaultPatch"))
+    if (const dictionary* dictPtr = dict.subDictPtr("defaultPatch"))
     {
         dictPtr->readIfPresent("name", defaultPatchName);
         dictPtr->readIfPresent("type", defaultPatchType);
     }
 
-    Info<< nl << "Creating blockCorners" << endl;
+    // optional 'convertToMeters' or 'scale'  scaling factor
+    if (!dict.readIfPresent("convertToMeters", scaleFactor_))
+    {
+        dict.readIfPresent("scale", scaleFactor_);
+    }
 
-    // create blockCorners
-    pointField tmpBlockPoints(meshDescription.lookup("vertices"));
 
-    if (meshDescription.found("edges"))
+    //
+    // get the non-linear edges in mesh
+    //
+    if (dict.found("edges"))
     {
-        // read number of non-linear edges in mesh
-        Info<< nl << "Creating curved edges" << endl;
+        if (verboseOutput)
+        {
+            Info<< "Creating curved edges" << endl;
+        }
 
-        ITstream& edgesStream(meshDescription.lookup("edges"));
+        ITstream& is(dict.lookup("edges"));
 
+        // read number of edges in mesh
         label nEdges = 0;
 
-        token firstToken(edgesStream);
+        token firstToken(is);
 
         if (firstToken.isLabel())
         {
@@ -165,20 +81,20 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
         }
         else
         {
-            edgesStream.putBack(firstToken);
+            is.putBack(firstToken);
         }
 
         // Read beginning of edges
-        edgesStream.readBegin("edges");
+        is.readBegin("edges");
 
         nEdges = 0;
 
-        token lastToken(edgesStream);
+        token lastToken(is);
         while
         (
-            !(
-                lastToken.isPunctuation()
-                && lastToken.pToken() == token::END_LIST
+           !(
+                 lastToken.isPunctuation()
+              && lastToken.pToken() == token::END_LIST
             )
         )
         {
@@ -187,37 +103,44 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
                 edges_.setSize(nEdges + 1);
             }
 
-            edgesStream.putBack(lastToken);
+            is.putBack(lastToken);
 
             edges_.set
             (
                 nEdges,
-                curvedEdge::New(tmpBlockPoints, edgesStream)
+                curvedEdge::New(blockPointField_, is)
             );
 
             nEdges++;
 
-            edgesStream >> lastToken;
+            is >> lastToken;
         }
-        edgesStream.putBack(lastToken);
+        is.putBack(lastToken);
 
         // Read end of edges
-        edgesStream.readEnd("edges");
+        is.readEnd("edges");
     }
-    else
+    else if (verboseOutput)
     {
-        Info<< nl << "There are no non-linear edges" << endl;
+        Info<< "No non-linear edges defined" << endl;
     }
 
 
-    Info<< nl << "Creating blocks" << endl;
+    //
+    // Create the blocks
+    //
+    if (verboseOutput)
     {
-        ITstream& blockDescriptorStream(meshDescription.lookup("blocks"));
+        Info<< "Creating topology blocks" << endl;
+    }
+
+    {
+        ITstream& is(dict.lookup("blocks"));
 
         // read number of blocks in mesh
         label nBlocks = 0;
 
-        token firstToken(blockDescriptorStream);
+        token firstToken(is);
 
         if (firstToken.isLabel())
         {
@@ -226,20 +149,20 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
         }
         else
         {
-            blockDescriptorStream.putBack(firstToken);
+            is.putBack(firstToken);
         }
 
         // Read beginning of blocks
-        blockDescriptorStream.readBegin("blocks");
+        is.readBegin("blocks");
 
         nBlocks = 0;
 
-        token lastToken(blockDescriptorStream);
+        token lastToken(is);
         while
         (
-            !(
-                lastToken.isPunctuation()
-                && lastToken.pToken() == token::END_LIST
+           !(
+                 lastToken.isPunctuation()
+              && lastToken.pToken() == token::END_LIST
             )
         )
         {
@@ -248,53 +171,56 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
                 blocks.setSize(nBlocks + 1);
             }
 
-            blockDescriptorStream.putBack(lastToken);
+            is.putBack(lastToken);
 
             blocks.set
             (
                 nBlocks,
                 new block
                 (
-                    blockDescriptor
-                    (
-                        tmpBlockPoints,
-                        edges_,
-                        blockDescriptorStream
-                    )
+                    blockPointField_,
+                    edges_,
+                    is
                 )
             );
 
             topologyOK = topologyOK && blockLabelsOK
             (
                 nBlocks,
-                tmpBlockPoints,
-                blocks[nBlocks].blockDef().blockShape()
+                blockPointField_,
+                blocks[nBlocks].blockShape()
             );
 
             nBlocks++;
 
-            blockDescriptorStream >> lastToken;
+            is >> lastToken;
         }
-        blockDescriptorStream.putBack(lastToken);
+        is.putBack(lastToken);
 
         // Read end of blocks
-        blockDescriptorStream.readEnd("blocks");
+        is.readEnd("blocks");
     }
 
 
-    Info<< nl << "Creating patches" << endl;
+    //
+    // Create the patches
+    //
+    if (verboseOutput)
+    {
+        Info<< "Creating topology patches" << endl;
+    }
 
     faceListList tmpBlocksPatches;
     wordList patchNames;
     wordList patchTypes;
 
     {
-        ITstream& patchStream(meshDescription.lookup("patches"));
+        ITstream& is(dict.lookup("patches"));
 
         // read number of patches in mesh
         label nPatches = 0;
 
-        token firstToken(patchStream);
+        token firstToken(is);
 
         if (firstToken.isLabel())
         {
@@ -306,21 +232,21 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
         }
         else
         {
-            patchStream.putBack(firstToken);
+            is.putBack(firstToken);
         }
 
         // Read beginning of blocks
-        patchStream.readBegin("patches");
+        is.readBegin("patches");
 
         nPatches = 0;
 
-        token lastToken(patchStream);
+        token lastToken(is);
         while
         (
             !(
-                lastToken.isPunctuation()
-                && lastToken.pToken() == token::END_LIST
-            )
+                 lastToken.isPunctuation()
+              && lastToken.pToken() == token::END_LIST
+             )
         )
         {
             if (tmpBlocksPatches.size() <= nPatches)
@@ -330,9 +256,9 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
                 patchTypes.setSize(nPatches + 1);
             }
 
-            patchStream.putBack(lastToken);
+            is.putBack(lastToken);
 
-            patchStream
+            is
                 >> patchTypes[nPatches]
                 >> patchNames[nPatches]
                 >> tmpBlocksPatches[nPatches];
@@ -347,7 +273,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
                     (
                         "blockMesh::createTopology(IOdictionary&)"
                     )   << "Duplicate patch " << patchNames[nPatches]
-                        << " at line " << patchStream.lineNumber()
+                        << " at line " << is.lineNumber()
                         << ". Exiting !" << nl
                         << exit(FatalError);
                 }
@@ -356,18 +282,18 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
             topologyOK = topologyOK && patchLabelsOK
             (
                 nPatches,
-                tmpBlockPoints,
+                blockPointField_,
                 tmpBlocksPatches[nPatches]
             );
 
             nPatches++;
 
-            patchStream >> lastToken;
+            is >> lastToken;
         }
-        patchStream.putBack(lastToken);
+        is.putBack(lastToken);
 
         // Read end of blocks
-        patchStream.readEnd("patches");
+        is.readEnd("patches");
     }
 
 
@@ -379,23 +305,29 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
     }
 
 
-    Info<< nl << "Creating block mesh topology" << endl;
+    //
+    // Create the topology
+    //
+    if (verboseOutput)
+    {
+        Info<< "Creating topology mesh" << endl;
+    }
 
-    PtrList<cellShape> tmpBlockCells(blocks.size());
-    forAll(blocks, blockLabel)
+    PtrList<cellShape> tmpBlockShapes(blocks.size());
+    forAll(blocks, blockI)
     {
-        tmpBlockCells.set
+        tmpBlockShapes.set
         (
-            blockLabel,
-            new cellShape(blocks[blockLabel].blockDef().blockShape())
+            blockI,
+            new cellShape(blocks[blockI].blockShape())
         );
 
-        if (tmpBlockCells[blockLabel].mag(tmpBlockPoints) < 0.0)
+        if (tmpBlockShapes[blockI].mag(blockPointField_) < 0.0)
         {
             WarningIn
             (
                 "blockMesh::createTopology(IOdictionary&)"
-            )   << "negative volume block : " << blockLabel
+            )   << "negative volume block : " << blockI
                 << ", probably defined inside-out" << endl;
         }
     }
@@ -404,8 +336,8 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
 
     preservePatchTypes
     (
-        meshDescription.time(),
-        meshDescription.time().constant(),
+        dict.time(),
+        dict.time().constant(),
         polyMesh::meshSubDir,
         patchNames,
         patchTypes,
@@ -414,19 +346,21 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
         patchPhysicalTypes
     );
 
+
+    // construct the topology as its own mesh
     polyMesh* blockMeshPtr = new polyMesh
     (
         IOobject
         (
             "blockMesh",
-            meshDescription.time().constant(),
-            meshDescription.time(),
+            dict.time().constant(),
+            dict.time(),
             IOobject::NO_READ,
             IOobject::NO_WRITE,
             false
         ),
-        xferMove(tmpBlockPoints),
-        tmpBlockCells,
+        xferCopy(blockPointField_),   // copy these points, do NOT move
+        tmpBlockShapes,
         tmpBlocksPatches,
         patchNames,
         patchTypes,
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/BSpline.C b/src/mesh/blockMesh/curvedEdges/BSpline.C
similarity index 83%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/BSpline.C
rename to src/mesh/blockMesh/curvedEdges/BSpline.C
index 2bb30daf0ea4f25728d461e6abcf65c55efbc06c..56e829eda523e433fa15861b86f67b647b70a828 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/BSpline.C
+++ b/src/mesh/blockMesh/curvedEdges/BSpline.C
@@ -22,9 +22,6 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-    BSpline : cubic spline going through all the knots
-
 \*---------------------------------------------------------------------------*/
 
 #include "error.H"
@@ -34,10 +31,7 @@ Description
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-namespace Foam
-{
-
-pointField BSpline::findKnots
+Foam::pointField Foam::BSpline::findKnots
 (
     const pointField& allknots,
     const vector& fstend,
@@ -106,15 +100,13 @@ pointField BSpline::findKnots
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from components
-BSpline::BSpline(const pointField& Knots)
+Foam::BSpline::BSpline(const pointField& Knots)
 :
     spline(findKnots(Knots))
 {}
 
 
-// Construct from components
-BSpline::BSpline
+Foam::BSpline::BSpline
 (
     const pointField& Knots,
     const vector& fstend,
@@ -127,32 +119,23 @@ BSpline::BSpline
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-//- Return the real position of a point on the curve given by
-//  the parameter 0 <= lambda <= 1
-vector BSpline::realPosition(scalar mu)
+Foam::vector Foam::BSpline::realPosition(const scalar mu) const
 {
     return spline::position(mu);
 }
 
 
-//- Return the position of a point on the curve given by
-//  the parameter 0 <= lambda <= 1
-vector BSpline::position(const scalar mu) const
+Foam::vector Foam::BSpline::position(const scalar mu) const
 {
     return spline::position((1.0/(nKnots() - 1))*(1.0 + mu*(nKnots() - 3)));
 }
 
 
-//- Return the length of the curve
-scalar BSpline::length() const
+Foam::scalar Foam::BSpline::length() const
 {
     notImplemented("BSpline::length() const");
     return 1.0;
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/BSpline.H b/src/mesh/blockMesh/curvedEdges/BSpline.H
similarity index 90%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/BSpline.H
rename to src/mesh/blockMesh/curvedEdges/BSpline.H
index b04f4d18e7ee670adc5411fea0773e6eca722b73..d906e05aa477e33923782889d9c20e2af3477f08 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/BSpline.H
+++ b/src/mesh/blockMesh/curvedEdges/BSpline.H
@@ -26,7 +26,7 @@ Class
     Foam::BSpline
 
 Description
-    BSpline : cubic spline going through all the knots
+    A cubic spline going through all the knots
 
 SourceFiles
     BSpline.C
@@ -51,9 +51,7 @@ class BSpline
 :
     public spline
 {
-    // Private member functions
-
-        scalar remap(const scalar&);
+    // Private Member Functions
 
         pointField findKnots
         (
@@ -62,6 +60,12 @@ class BSpline
             const vector& sndend = vector::zero
         );
 
+        //- Disallow default bitwise copy construct
+        BSpline(const BSpline&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const BSpline&);
+
 
 public:
 
@@ -83,7 +87,7 @@ public:
 
         //- Return the real position of a point on the curve given by
         //  the parameter 0 <= lambda <= 1
-        vector realPosition(scalar lambda);
+        vector realPosition(const scalar lambda) const;
 
         //- Return the position of a point on the curve given by
         //  the parameter 0 <= lambda <= 1
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.C b/src/mesh/blockMesh/curvedEdges/arcEdge.C
similarity index 87%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.C
rename to src/mesh/blockMesh/curvedEdges/arcEdge.C
index 4de0d7df350754ad542853681662e404a9f4c45b..514b63b918625348e4d5ec9658149df3f7807989 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.C
+++ b/src/mesh/blockMesh/curvedEdges/arcEdge.C
@@ -22,10 +22,6 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-    arcEdge class : defines the arcEdge of a circle in terms of 3 points on its
-    circumference
-
 \*---------------------------------------------------------------------------*/
 
 #include "arcEdge.H"
@@ -37,8 +33,6 @@ Description
 namespace Foam
 {
     defineTypeNameAndDebug(arcEdge, 0);
-
-    // Add the curvedEdge constructor functions to the hash tables
     addToRunTimeSelectionTable(curvedEdge, arcEdge, Istream);
 }
 
@@ -81,15 +75,21 @@ Foam::cylindricalCS Foam::arcEdge::calcAngle()
     angle_ = acos(tmp)*180.0/constant::mathematical::pi;
 
     // check if the vectors define an exterior or an interior arcEdge
-    if (((r1  ^ r2)&(r1 ^ r3)) < 0.0) angle_ = 360 - angle_;
+    if (((r1  ^ r2)&(r1 ^ r3)) < 0.0)
+    {
+        angle_ = 360 - angle_;
+    }
 
-    vector tempAxis(0.0,0.0,0.0);
+    vector tempAxis;
 
     if (angle_ <= 180.0)
     {
         tempAxis = r1 ^ r3;
 
-        if (mag(tempAxis)/(mag(r1)*mag(r3)) < 0.001) tempAxis = r1 ^ r2;
+        if (mag(tempAxis)/(mag(r1)*mag(r3)) < 0.001)
+        {
+            tempAxis = r1 ^ r2;
+        }
     }
     else
     {
@@ -105,24 +105,22 @@ Foam::cylindricalCS Foam::arcEdge::calcAngle()
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from components
 Foam::arcEdge::arcEdge
 (
     const pointField& points,
     const label start,
     const label end,
-    const vector& P2
+    const vector& pMid
 )
 :
     curvedEdge(points, start, end),
     p1_(points_[start_]),
-    p2_(P2),
+    p2_(pMid),
     p3_(points_[end_]),
     cs_(calcAngle())
 {}
 
 
-// Construct from Istream
 Foam::arcEdge::arcEdge(const pointField& points, Istream& is)
 :
     curvedEdge(points, is),
@@ -159,13 +157,10 @@ Foam::vector Foam::arcEdge::position(const scalar lambda) const
 }
 
 
-//- Return the length of the curve
 Foam::scalar Foam::arcEdge::length() const
 {
     return angle_*radius_*constant::mathematical::pi/180.0;
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.H b/src/mesh/blockMesh/curvedEdges/arcEdge.H
similarity index 89%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.H
rename to src/mesh/blockMesh/curvedEdges/arcEdge.H
index 3f8a49301e69c719e4900b0cef7f8338ee668dca..da96d150fc0803f0b6fecb6c50d31b072ff17a35 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.H
+++ b/src/mesh/blockMesh/curvedEdges/arcEdge.H
@@ -26,8 +26,7 @@ Class
     Foam::arcEdge
 
 Description
-    arcEdge class : defines the arcEdge of a circle in terms of 3 points on its
-    circumference
+    Defines the arcEdge of a circle in terms of 3 points on its circumference
 
 SourceFiles
     arcEdge.C
@@ -62,6 +61,14 @@ class arcEdge
 
         cylindricalCS calcAngle();
 
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        arcEdge(const arcEdge&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const arcEdge&);
+
 public:
 
     //- Runtime type information
@@ -75,7 +82,7 @@ public:
         (
             const pointField& points,
             const label start, const label end,
-            const vector&
+            const vector& pMid
         );
 
         //- Construct from Istream setting pointsList
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.C b/src/mesh/blockMesh/curvedEdges/curvedEdge.C
similarity index 66%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.C
rename to src/mesh/blockMesh/curvedEdges/curvedEdge.C
index 9329c33f6db948de38c13d8e548a334d8649f61e..4b80a221ddd16c78fead7a889344db6d4454b189 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.C
+++ b/src/mesh/blockMesh/curvedEdges/curvedEdge.C
@@ -22,32 +22,24 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-    library functions that will define a curvedEdge in space
-    parameterised for 0<lambda<1 from the beginning
-    point to the end point.
-
 \*---------------------------------------------------------------------------*/
 
 #include "error.H"
-
 #include "curvedEdge.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
 {
 
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-defineTypeNameAndDebug(curvedEdge, 0);
-defineRunTimeSelectionTable(curvedEdge, Istream);
+    defineTypeNameAndDebug(curvedEdge, 0);
+    defineRunTimeSelectionTable(curvedEdge, Istream);
+}
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from components
-curvedEdge::curvedEdge
+Foam::curvedEdge::curvedEdge
 (
     const pointField& points,
     const label start,
@@ -60,8 +52,7 @@ curvedEdge::curvedEdge
 {}
 
 
-// Construct from Istream
-curvedEdge::curvedEdge(const pointField& points, Istream& is)
+Foam::curvedEdge::curvedEdge(const pointField& points, Istream& is)
 :
     points_(points),
     start_(readLabel(is)),
@@ -69,8 +60,7 @@ curvedEdge::curvedEdge(const pointField& points, Istream& is)
 {}
 
 
-// Copy construct
-curvedEdge::curvedEdge(const curvedEdge& c)
+Foam::curvedEdge::curvedEdge(const curvedEdge& c)
 :
     points_(c.points_),
     start_(c.start_),
@@ -78,16 +68,18 @@ curvedEdge::curvedEdge(const curvedEdge& c)
 {}
 
 
-//- Clone function
-autoPtr<curvedEdge> curvedEdge::clone() const
+Foam::autoPtr<Foam::curvedEdge> Foam::curvedEdge::clone() const
 {
     notImplemented("curvedEdge::clone() const");
     return autoPtr<curvedEdge>(NULL);
 }
 
 
-//- New function which constructs and returns pointer to a curvedEdge
-autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is)
+Foam::autoPtr<Foam::curvedEdge> Foam::curvedEdge::New
+(
+    const pointField& points,
+    Istream& is
+)
 {
     if (debug)
     {
@@ -96,16 +88,15 @@ autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is)
             << endl;
     }
 
-    word curvedEdgeType(is);
+    word edgeType(is);
 
     IstreamConstructorTable::iterator cstrIter =
-        IstreamConstructorTablePtr_
-            ->find(curvedEdgeType);
+        IstreamConstructorTablePtr_->find(edgeType);
 
     if (cstrIter == IstreamConstructorTablePtr_->end())
     {
         FatalErrorIn("curvedEdge::New(const pointField&, Istream&)")
-            << "Unknown curvedEdge type " << curvedEdgeType << endl << endl
+            << "Unknown curvedEdge type " << edgeType << endl << endl
             << "Valid curvedEdge types are" << endl
             << IstreamConstructorTablePtr_->sortedToc()
             << abort(FatalError);
@@ -117,9 +108,7 @@ autoPtr<curvedEdge> curvedEdge::New(const pointField& points, Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-//- Return the complete knotList by adding the start and end points to the
-//  given list
-pointField knotlist
+Foam::pointField Foam::curvedEdge::knotlist
 (
     const pointField& points,
     const label start,
@@ -127,31 +116,31 @@ pointField knotlist
     const pointField& otherknots
 )
 {
-    label listsize(otherknots.size() + 2);
-    pointField tmp(listsize);
+    pointField newPoints(otherknots.size() + 2);
 
-    tmp[0] = points[start];
+    // start/end knots
+    newPoints[0] = points[start];
+    newPoints[otherknots.size() + 1] = points[end];
 
-    for (register label i=1; i<listsize-1; i++)
+    // intermediate knots
+    forAll(otherknots, knotI)
     {
-        tmp[i] = otherknots[i-1];
+        newPoints[knotI+1] = otherknots[knotI];
     }
 
-    tmp[listsize-1] = points[end];
-
-    return tmp;
+    return newPoints;
 }
 
 
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
-void curvedEdge::operator=(const curvedEdge&)
+void Foam::curvedEdge::operator=(const curvedEdge&)
 {
     notImplemented("void curvedEdge::operator=(const curvedEdge&)");
 }
 
 
-Ostream& operator<<(Ostream& os, const curvedEdge& p)
+Foam::Ostream& Foam::operator<<(Ostream& os, const curvedEdge& p)
 {
     os << p.start_ << tab << p.end_ << endl;
 
@@ -159,8 +148,4 @@ Ostream& operator<<(Ostream& os, const curvedEdge& p)
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.H b/src/mesh/blockMesh/curvedEdges/curvedEdge.H
similarity index 71%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.H
rename to src/mesh/blockMesh/curvedEdges/curvedEdge.H
index 5ecf489d38818e2030080246e02f1ca07f5cd919..49ad047e45a759603d41141e38ee6b010ccf9979 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/curvedEdge.H
+++ b/src/mesh/blockMesh/curvedEdges/curvedEdge.H
@@ -26,9 +26,8 @@ Class
     Foam::curvedEdge
 
 Description
-    curvedEdges : library functions that will define a curvedEdge in space
-    parameterised for 0<lambda<1 from the beginning point to the end point.
-    This file contains the abstract base class curvedEdge.
+    Define a curved edge in space that is parameterised for
+    0<lambda<1 from the beginning to the end point.
 
 SourceFiles
     curvedEdge.C
@@ -38,6 +37,7 @@ SourceFiles
 #ifndef curvedEdges_H
 #define curvedEdges_H
 
+#include "edge.H"
 #include "pointField.H"
 #include "typeInfo.H"
 #include "HashTable.H"
@@ -49,7 +49,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class curvedEdge Declaration
+                         Class curvedEdge Declaration
 \*---------------------------------------------------------------------------*/
 
 class curvedEdge
@@ -59,14 +59,14 @@ protected:
     // Protected data
 
         const pointField& points_;
-        const label start_, end_;
+        const label start_;
+        const label end_;
 
 public:
 
     //- Runtime type information
     TypeName("curvedEdge");
 
-
     // Declare run-time constructor selection tables
 
         declareRunTimeSelectionTable
@@ -113,26 +113,28 @@ public:
     // Member Functions
 
         //- Return label of start point
-        label start() const
-        {
-            return start_;
-        }
+        inline label start() const;
 
         //- Return label of end point
-        label end() const
-        {
-            return end_;
-        }
-
-        //- Compare the given start and end points with those of this curve
-        bool compare(const label start, const label end) const
-        {
-            return
-            (
-                (start_ == start && end_ == end)
-             || (start_ == end && end_ == start)
-            );
-        }
+        inline label end() const;
+
+        //- Compare the given start and end points with this curve
+        //  -  0: different
+        //  - +1: identical
+        //  - -1: same edge, but different orientation
+        inline int compare(const curvedEdge&) const;
+
+        //- Compare the given start and end points with this curve
+        //  -  0: different
+        //  - +1: identical
+        //  - -1: same edge, but different orientation
+        inline int compare(const edge&) const;
+
+        //- Compare the given start and end points with this curve
+        //  -  0: different
+        //  - +1: identical
+        //  - -1: same edge, but different orientation
+        inline int compare(const label start, const label end) const;
 
         //- Return the position of a point on the curve given by
         //  the parameter 0 <= lambda <= 1
@@ -141,6 +143,17 @@ public:
         //- Return the length of the curve
         virtual scalar length() const = 0;
 
+        //- Return a complete knotList by adding the start/end points
+        //  to the given list
+        static pointField knotlist
+        (
+            const pointField&,
+            const label start,
+            const label end,
+            const pointField& otherknots
+        );
+
+
     // Member operators
 
         void operator=(const curvedEdge&);
@@ -151,20 +164,13 @@ public:
 };
 
 
-//- Return the complete knotList by adding the start and end points to the
-//  given list
-pointField knotlist
-(
-    const pointField& points,
-    const label start,
-    const label end,
-    const pointField& otherknots
-);
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+} // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-} // End namespace Foam
+#include "curvedEdgeI.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
diff --git a/applications/utilities/mesh/generation/blockMesh/createPoints.C b/src/mesh/blockMesh/curvedEdges/curvedEdgeI.H
similarity index 56%
rename from applications/utilities/mesh/generation/blockMesh/createPoints.C
rename to src/mesh/blockMesh/curvedEdges/curvedEdgeI.H
index cd0d6010df5ae627040fe703b07352fe2e911a49..6d3de4e554009922cc29918ad31a41d5369a3e62 100644
--- a/applications/utilities/mesh/generation/blockMesh/createPoints.C
+++ b/src/mesh/blockMesh/curvedEdges/curvedEdgeI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2009-2009 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -22,50 +22,52 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-
-
 \*---------------------------------------------------------------------------*/
 
-#include "error.H"
-#include "blockMesh.H"
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+inline Foam::label Foam::curvedEdge::start() const
+{
+    return start_;
+}
 
-// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-Foam::pointField Foam::blockMesh::createPoints(const dictionary& dict)
+inline Foam::label Foam::curvedEdge::end() const
 {
-    blockMesh& blocks = *this;
+    return end_;
+}
 
-    scalar scaleFactor = 1.0;
 
-    // optional 'convertToMeters' (or 'scale'?)
-    if (!dict.readIfPresent("convertToMeters", scaleFactor))
+inline int Foam::curvedEdge::compare(const label start, const label end) const
+{
+    if (start_ == start && end_ == end)
+    {
+        return 1;
+    }
+    else if (start_ == end && end_ == start)
+    {
+        return -1;
+    }
+    else
     {
-        dict.readIfPresent("scale", scaleFactor);
+        return 0;
     }
+}
 
-    Info<< nl << "Creating points with scale " << scaleFactor << endl;
 
-    pointField points(nPoints_);
+inline int Foam::curvedEdge::compare(const curvedEdge& e) const
+{
+    return Foam::curvedEdge::compare(e.start(), e.end());
+}
 
-    forAll(blocks, blockLabel)
-    {
-        const pointField& blockPoints = blocks[blockLabel].points();
-
-        forAll(blockPoints, blockPointLabel)
-        {
-            points
-            [
-                mergeList_
-                [
-                    blockPointLabel
-                  + blockOffsets_[blockLabel]
-                ]
-            ] = scaleFactor * blockPoints[blockPointLabel];
-        }
-    }
 
-    return points;
+inline int Foam::curvedEdge::compare(const edge& e) const
+{
+    return Foam::curvedEdge::compare(e.start(), e.end());
 }
 
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdgeList.H b/src/mesh/blockMesh/curvedEdges/curvedEdgeList.H
similarity index 98%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdgeList.H
rename to src/mesh/blockMesh/curvedEdges/curvedEdgeList.H
index 3918dded609ac4a62d125d9cf79aae34cc171220..6111d535650046e5c52cc30c971bf82808e7fb55 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdgeList.H
+++ b/src/mesh/blockMesh/curvedEdges/curvedEdgeList.H
@@ -22,10 +22,11 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-InClass
+Typedef
     Foam::curvedEdgeList
 
 Description
+    A PtrList of curvedEdges
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineDivide.C b/src/mesh/blockMesh/curvedEdges/lineDivide.C
similarity index 60%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/lineDivide.C
rename to src/mesh/blockMesh/curvedEdges/lineDivide.C
index 728346542fb9b00bc4d0f36ea964b70900a9a166..ef47bff078f08c4c6d3dbee32286111c57a4f1ab 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineDivide.C
+++ b/src/mesh/blockMesh/curvedEdges/lineDivide.C
@@ -22,9 +22,6 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-    lineDivide class : divides a line into segments
-
 \*---------------------------------------------------------------------------*/
 
 #include "error.H"
@@ -32,66 +29,58 @@ Description
 #include "lineDivide.H"
 #include "curvedEdge.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from components
-lineDivide::lineDivide(const curvedEdge& bc, const label n, const scalar xratio)
+Foam::lineDivide::lineDivide
+(
+    const curvedEdge& cedge,
+    const label ndiv,
+    const scalar& xratio
+)
 :
-    points_(n + 1),
-    divisions_(n + 1),
-    noPoints_(n)
+    points_(ndiv + 1),
+    divisions_(ndiv + 1)
 {
-    scalar np(n);
-    scalar lambda(0.0);
+    divisions_[0]    = 0.0;
+    divisions_[ndiv] = 1.0;
 
+    // calculate the spacing
     if (xratio == 1.0)
     {
-        scalar y(1.0/np);
-        for (label i=0; i<=noPoints_; i++)
+        for (label i=1; i < ndiv; i++)
         {
-            lambda = scalar(i)/np;
-            points_[i] = bc.position(lambda);
-            divisions_[i] = y*i;
+            divisions_[i] = scalar(i)/ndiv;
         }
     }
     else
     {
-        points_[0] = bc.position(0.0);
-        divisions_[0] = 0.0;
-        scalar xrpower = 1.0;
-
-        for (label i=1; i<=noPoints_; i++)
+        for (label i=1; i < ndiv; i++)
         {
-            lambda = (1.0 - pow(xratio, i))/(1.0 - pow(xratio, np));
-            points_[i] = bc.position(lambda);
-            divisions_[i] = lambda;
-            xrpower *= xratio;
+            divisions_[i] = (1.0 - pow(xratio, i))/(1.0 - pow(xratio, ndiv));
         }
     }
+
+    // calculate the points
+    for (label i=0; i <= ndiv; i++)
+    {
+        points_[i] = cedge.position(divisions_[i]);
+    }
 }
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-const pointField& lineDivide::points() const
+const Foam::pointField& Foam::lineDivide::points() const
 {
     return points_;
 }
 
 
-const scalarList& lineDivide::lambdaDivisions() const
+const Foam::scalarList& Foam::lineDivide::lambdaDivisions() const
 {
     return divisions_;
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineDivide.H b/src/mesh/blockMesh/curvedEdges/lineDivide.H
similarity index 89%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/lineDivide.H
rename to src/mesh/blockMesh/curvedEdges/lineDivide.H
index a4a02d7d29d6f1e3e25a23ad6e907876d4e0a43e..8a4c052abab6236cf85129994dd4121df30ad728 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineDivide.H
+++ b/src/mesh/blockMesh/curvedEdges/lineDivide.H
@@ -26,7 +26,7 @@ Class
     Foam::lineDivide
 
 Description
-    lineDivide class : divides a line into segments
+    Divides a line into segments
 
 SourceFiles
     lineDivide.C
@@ -47,7 +47,7 @@ namespace Foam
 class curvedEdge;
 
 /*---------------------------------------------------------------------------*\
-                           Class lineDivide Declaration
+                         Class lineDivide Declaration
 \*---------------------------------------------------------------------------*/
 
 class lineDivide
@@ -56,15 +56,19 @@ class lineDivide
 
         pointField points_;
         scalarList divisions_;
-        label noPoints_;
-
 
 public:
 
     // Constructors
 
         //- Construct from components
-        lineDivide(const curvedEdge&, const label, const scalar = 1.0);
+        //  discretization and expansion ration
+        lineDivide
+        (
+            const curvedEdge&,
+            const label ndiv,
+            const scalar& xratio = 1.0
+        );
 
 
     // Member Functions
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineEdge.C b/src/mesh/blockMesh/curvedEdges/lineEdge.C
similarity index 75%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/lineEdge.C
rename to src/mesh/blockMesh/curvedEdges/lineEdge.C
index 5fc557de1f1fb750aa439695bb6fc0f187b14882..72e173ea2ce3e6b88d953b1006de372cc78a9b80 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineEdge.C
+++ b/src/mesh/blockMesh/curvedEdges/lineEdge.C
@@ -22,34 +22,24 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-    line class : defines a straight line between the start point and the
-    end point
-
 \*---------------------------------------------------------------------------*/
 
 #include "error.H"
-
 #include "lineEdge.H"
+#include "addToRunTimeSelectionTable.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
 {
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-defineTypeNameAndDebug(lineEdge, 0);
-
-// Add the curvedEdge constructor functions to the hash tables
-curvedEdge::addIstreamConstructorToTable<lineEdge>
-    addLineEdgeIstreamConstructorToTable_;
+    defineTypeNameAndDebug(lineEdge, 0);
+    addToRunTimeSelectionTable(curvedEdge, lineEdge, Istream);
+}
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from components
-lineEdge::lineEdge
+Foam::lineEdge::lineEdge
 (
     const pointField& points,
     const label start,
@@ -62,8 +52,7 @@ lineEdge::lineEdge
 {}
 
 
-// Construct from Istream
-lineEdge::lineEdge(const pointField& points, Istream& is)
+Foam::lineEdge::lineEdge(const pointField& points, Istream& is)
 :
     curvedEdge(points, is),
     startPoint_(points_[start_]),
@@ -73,7 +62,7 @@ lineEdge::lineEdge(const pointField& points, Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-vector lineEdge::position(const scalar lambda) const
+Foam::vector Foam::lineEdge::position(const scalar lambda) const
 {
     if (lambda < 0 || lambda > 1)
     {
@@ -86,15 +75,10 @@ vector lineEdge::position(const scalar lambda) const
 }
 
 
-//- Return the length of the curve
-scalar lineEdge::length() const
+Foam::scalar Foam::lineEdge::length() const
 {
     return mag(direction_);
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineEdge.H b/src/mesh/blockMesh/curvedEdges/lineEdge.H
similarity index 78%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/lineEdge.H
rename to src/mesh/blockMesh/curvedEdges/lineEdge.H
index a85b6a81c2225d61fcce7176755702ba76a15358..a601830f7f70e6449110a5949ef44cf41a734855 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/lineEdge.H
+++ b/src/mesh/blockMesh/curvedEdges/lineEdge.H
@@ -26,8 +26,7 @@ Class
     Foam::lineEdge
 
 Description
-    lineEdge class : defines a straight line between the start point and the
-    end point
+    Defines a straight line between the start point and the end point.
 
 SourceFiles
     lineEdge.C
@@ -45,7 +44,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class lineEdge Declaration
+                          Class lineEdge Declaration
 \*---------------------------------------------------------------------------*/
 
 
@@ -55,8 +54,19 @@ class lineEdge
 {
     // Private data
 
-        vector startPoint_;
-        vector direction_;
+        //- Avoid repetitive calculation of the start point
+        const vector startPoint_;
+
+        //- Avoid repetitive calculation of the direction (end - start)
+        const vector direction_;
+
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        lineEdge(const lineEdge&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const lineEdge&);
 
 
 public:
@@ -67,10 +77,10 @@ public:
     // Constructors
 
         //- Construct from components
-        lineEdge(const pointField& points, const label start, const label end);
+        lineEdge(const pointField&, const label start, const label end);
 
         //- Construct from Istream setting pointsList
-        lineEdge(const pointField& points, Istream&);
+        lineEdge(const pointField&, Istream&);
 
 
     // Destructor
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLine.C b/src/mesh/blockMesh/curvedEdges/polyLine.C
similarity index 75%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLine.C
rename to src/mesh/blockMesh/curvedEdges/polyLine.C
index a91ea793c4b76b301462c9642ff6795e380db72b..e8872de6a2b983bddc0fb2c99e9a6cc0ba9f60c7 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLine.C
+++ b/src/mesh/blockMesh/curvedEdges/polyLine.C
@@ -22,63 +22,60 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-    polyLineEdge class : defines a curvedEdge in terms of a series of
-    straight line segments
-
 \*---------------------------------------------------------------------------*/
 
 #include "error.H"
-
 #include "polyLine.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 // calcDistances generates the distances_ lookup table (cumulative
 // distance along the line) from the individual vectors to the points
 
-void polyLine::calcDistances()
+void Foam::polyLine::calcDistances()
 {
-    distances_[0] = 0.0;
+    distances_.setSize(controlPoints_.size());
 
-    for (label i=1; i<distances_.size(); i++)
+    if (distances_.size())
     {
-        distances_[i] =
-            mag(controlPoints_[i] - controlPoints_[i-1])
-          + distances_[i-1];
+        distances_[0] = 0.0;
+
+        for (label i=1; i<distances_.size(); i++)
+        {
+            distances_[i] = distances_[i-1] +
+                mag(controlPoints_[i] - controlPoints_[i-1]);
+        }
+
+        // normalize
+        lineLength_ = distances_[distances_.size()-1];
+        for (label i=1; i<distances_.size(); i++)
+        {
+            distances_[i] /= lineLength_;
+        }
     }
-
-    lineLength_ = distances_[distances_.size()-1];
-
-    for (label i=1; i<distances_.size(); i++)
+    else
     {
-        distances_[i] /= lineLength_;
+        lineLength_ = 0.0;
     }
 }
 
 
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-polyLine::polyLine(const pointField& ps)
+Foam::polyLine::polyLine(const pointField& ps)
 :
     controlPoints_(ps),
-    distances_(ps.size())
+    distances_(0),
+    lineLength_(0.0)
 {
-    if (ps.size())
-    {
-        calcDistances();
-    }
+    calcDistances();
 }
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-vector polyLine::position(const scalar lambda) const
+Foam::vector Foam::polyLine::position(const scalar lambda) const
 {
     // check range of lambda
 
@@ -124,14 +121,10 @@ vector polyLine::position(const scalar lambda) const
 }
 
 
-scalar polyLine::length() const
+Foam::scalar Foam::polyLine::length() const
 {
     return lineLength_;
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLine.H b/src/mesh/blockMesh/curvedEdges/polyLine.H
similarity index 83%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLine.H
rename to src/mesh/blockMesh/curvedEdges/polyLine.H
index 3d6d5fb140e354294017be74b5ed256f4e9e645c..4ef97f30525b6368e3f9a0f7ddb6a4ef5107bd5b 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLine.H
+++ b/src/mesh/blockMesh/curvedEdges/polyLine.H
@@ -26,9 +26,10 @@ Class
     Foam::polyLine
 
 Description
-    polyLine class : defines a curvedEdge in terms of a series of straight
-    line segments. This is the basic polyLine class which implements
-   just the line (no topology : its not derived from curvedEdge)
+    Defines a curvedEdge in terms of a series of straight line segments.
+
+    This is the basic polyLine class which implements just the line
+    (no topology - it is not derived from curvedEdge)
 
 SourceFiles
     polyLine.C
@@ -47,12 +48,19 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class polyLine Declaration
+                          Class polyLine Declaration
 \*---------------------------------------------------------------------------*/
 
 
 class polyLine
 {
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        polyLine(const polyLine&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const polyLine&);
 
 protected:
 
@@ -72,7 +80,7 @@ public:
     // Constructors
 
         //- Construct from components
-        polyLine(const pointField& ps);
+        polyLine(const pointField&);
 
 
     // Member Functions
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLineEdge.C b/src/mesh/blockMesh/curvedEdges/polyLineEdge.C
similarity index 70%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLineEdge.C
rename to src/mesh/blockMesh/curvedEdges/polyLineEdge.C
index f9ab4dabadebcc5296f3163fe2fc3a2aec8cacb4..89029d1af97726cf6895650b32e8baaa8e1bf971 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLineEdge.C
+++ b/src/mesh/blockMesh/curvedEdges/polyLineEdge.C
@@ -22,32 +22,24 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-
 \*---------------------------------------------------------------------------*/
 
 #include "error.H"
-
 #include "polyLineEdge.H"
+#include "addToRunTimeSelectionTable.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
 {
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-defineTypeNameAndDebug(polyLineEdge, 0);
-
-// Add the curvedEdge constructor functions to the hash tables
-curvedEdge::addIstreamConstructorToTable<polyLineEdge>
-    addPolyLineEdgeIstreamConstructorToTable_;
+    defineTypeNameAndDebug(polyLineEdge, 0);
+    addToRunTimeSelectionTable(curvedEdge, polyLineEdge, Istream);
+}
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from components
-polyLineEdge::polyLineEdge
+Foam::polyLineEdge::polyLineEdge
 (
     const pointField& ps,
     const label start,
@@ -56,12 +48,11 @@ polyLineEdge::polyLineEdge
 )
 :
     curvedEdge(ps, start, end),
-    polyLine(knotlist(ps,start,end,otherpoints))
+    polyLine(knotlist(ps, start, end, otherpoints))
 {}
 
 
-// Construct from Istream
-polyLineEdge::polyLineEdge(const pointField& ps, Istream& is)
+Foam::polyLineEdge::polyLineEdge(const pointField& ps, Istream& is)
 :
     curvedEdge(ps, is),
     polyLine(knotlist(ps, start_, end_, pointField(is)))
@@ -70,23 +61,16 @@ polyLineEdge::polyLineEdge(const pointField& ps, Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-//- Return the position of a point on the curve given by
-//  the parameter 0 <= lambda <= 1
-vector polyLineEdge::position(const scalar lambda) const
+Foam::vector Foam::polyLineEdge::position(const scalar lambda) const
 {
     return polyLine::position(lambda);
 }
 
 
-//- Return the length of the curve
-scalar polyLineEdge::length() const
+Foam::scalar Foam::polyLineEdge::length() const
 {
     return polyLine::lineLength_;
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLineEdge.H b/src/mesh/blockMesh/curvedEdges/polyLineEdge.H
similarity index 83%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLineEdge.H
rename to src/mesh/blockMesh/curvedEdges/polyLineEdge.H
index 238dffa9f022e1de307b46acad3f07711326bd84..532a91ad5d50c265ca3b42c76033a0d04fc4725c 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polyLineEdge.H
+++ b/src/mesh/blockMesh/curvedEdges/polyLineEdge.H
@@ -26,8 +26,8 @@ Class
     Foam::polyLineEdge
 
 Description
-    polyLineEdge class : defines a curvedEdge in terms of a series of straight
-    line segments. This is the public face of polyLine
+    Defines a curvedEdge in terms of a series of straight line segments.
+    This is the public face of polyLine
 
 SourceFiles
     polyLineEdge.C
@@ -46,7 +46,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class polyLineEdge Declaration
+                        Class polyLineEdge Declaration
 \*---------------------------------------------------------------------------*/
 
 class polyLineEdge
@@ -54,6 +54,14 @@ class polyLineEdge
     public curvedEdge,
     public polyLine
 {
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        polyLineEdge(const polyLineEdge&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const polyLineEdge&);
+
 
 public:
 
@@ -66,14 +74,14 @@ public:
         //- Construct from components
         polyLineEdge
         (
-            const pointField& ps,
+            const pointField&,
             const label start,
             const label end,
-            const pointField& otherpoints
+            const pointField& otherPoints
         );
 
         //- Construct from Istream
-        polyLineEdge(const pointField& ps, Istream&);
+        polyLineEdge(const pointField&, Istream&);
 
 
     // Destructor
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.C b/src/mesh/blockMesh/curvedEdges/polySplineEdge.C
similarity index 83%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.C
rename to src/mesh/blockMesh/curvedEdges/polySplineEdge.C
index 7263f7184362126d8bb094cfe6cafa205d3e3d2d..841f6f986a2cdce4b406872b40a4215f5f7fbd38 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.C
+++ b/src/mesh/blockMesh/curvedEdges/polySplineEdge.C
@@ -33,16 +33,27 @@ License
 namespace Foam
 {
     defineTypeNameAndDebug(polySplineEdge, 0);
-
-    // Add the curvedEdge constructor functions to the hash tables
     addToRunTimeSelectionTable(curvedEdge, polySplineEdge, Istream);
 }
 
 
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    //! @cond fileScope
+    inline label nsize(const label otherKnotsSize, const label nBetweenKnots)
+    {
+        return otherKnotsSize*(1 + nBetweenKnots) + nBetweenKnots + 2;
+    }
+    //! @endcond fileScope
+}
+
+
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 // intervening : returns a list of the points making up the polyLineEdge
-// which describes the spline. nbetweenKnots is the number of points
+// which describes the spline. nBetweenKnots is the number of points
 // placed between each knot : this ensures that the knot locations
 // are retained as a subset of the polyLine points.
 
@@ -52,14 +63,14 @@ namespace Foam
 Foam::pointField Foam::polySplineEdge::intervening
 (
     const pointField& otherknots,
-    const label nbetweenKnots,
+    const label nBetweenKnots,
     const vector& fstend,
     const vector& sndend
 )
 {
     BSpline spl(knotlist(points_, start_, end_, otherknots), fstend, sndend);
 
-    label nSize(nsize(otherknots.size(), nbetweenKnots));
+    label nSize(nsize(otherknots.size(), nBetweenKnots));
 
     pointField ans(nSize);
 
@@ -67,7 +78,7 @@ Foam::pointField Foam::polySplineEdge::intervening
     scalar init = 1.0/(N - 1);
     scalar interval = (N - scalar(3))/N;
     interval /= otherknots.size() + 1;
-    interval /= nbetweenKnots + 1;
+    interval /= nBetweenKnots + 1;
 
     ans[0] = points_[start_];
 
@@ -125,11 +136,16 @@ Foam::polySplineEdge::polySplineEdge
     vector sndend(is);
 
     controlPoints_.setSize(nsize(otherKnots_.size(), nInterKnots));
+    // why does this need to be here (to avoid a crash)?
+    // 'intervening' uses BSpline to solve the new points
+    // it seems to be going badly there
     distances_.setSize(controlPoints_.size());
 
     controlPoints_ = intervening(otherKnots_, nInterKnots, fstend, sndend);
     calcDistances();
-    Info<< polyLine::controlPoints_ << endl;
+
+    // Info<< "polyLine[" << start_ << " " << end_
+    //     << "] controlPoints " << controlPoints_ << endl;
 }
 
 
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.H b/src/mesh/blockMesh/curvedEdges/polySplineEdge.H
similarity index 83%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.H
rename to src/mesh/blockMesh/curvedEdges/polySplineEdge.H
index 1f59d5bf8e71ebf77603ff69d9e0764073648896..b133b9e45dd15de1f261e118593993bb8b2ca02c 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/polySplineEdge.H
+++ b/src/mesh/blockMesh/curvedEdges/polySplineEdge.H
@@ -26,7 +26,7 @@ Class
     Foam::polySplineEdge
 
 Description
-    polySplineEdge class : representation of a spline via a polyLine
+    A spline representation via a polyLine
 
 SourceFiles
     polySplineEdge.C
@@ -45,7 +45,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class polySplineEdge Declaration
+                       Class polySplineEdge Declaration
 \*---------------------------------------------------------------------------*/
 
 class polySplineEdge
@@ -62,17 +62,12 @@ class polySplineEdge
 
         pointField intervening
         (
-            const pointField& otherknots,
-             const label nbetweenKnots,
-            const vector&, const vector&
+            const pointField& otherKnots,
+            const label nBetweenKnots,
+            const vector&,
+            const vector&
         );
 
-        label nsize(const label otherknotsSize, const label nbetweenKnots)
-        {
-            return otherknotsSize*(1 + nbetweenKnots) + nbetweenKnots + 2;
-        }
-
-
 public:
 
     //- Runtime type information
@@ -84,15 +79,15 @@ public:
         //- Construct from components
         polySplineEdge
         (
-            const pointField& ps,
+            const pointField&,
             const label start,
             const label end,
-            const pointField& otherknots,
+            const pointField& otherKnots,
             const label nInterKnots = 20
         );
 
         //- Construct from Istream setting pointsList
-        polySplineEdge(const pointField& points, Istream& is);
+        polySplineEdge(const pointField&, Istream&);
 
 
     // Destructor
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.C b/src/mesh/blockMesh/curvedEdges/simpleSplineEdge.C
similarity index 73%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.C
rename to src/mesh/blockMesh/curvedEdges/simpleSplineEdge.C
index b45f0ea3c29a68a63573a4838e74fba7456731aa..3132a1f7eaff97f24178dc84aef9d1f774ab12e9 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.C
+++ b/src/mesh/blockMesh/curvedEdges/simpleSplineEdge.C
@@ -22,29 +22,24 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-    simpleSplineEdge : the actual access class for Bspline
-
 \*---------------------------------------------------------------------------*/
 
 #include "simpleSplineEdge.H"
 #include "addToRunTimeSelectionTable.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-defineTypeNameAndDebug(simpleSplineEdge, 0);
-addToRunTimeSelectionTable(curvedEdge, simpleSplineEdge, Istream);
+namespace Foam
+{
+    defineTypeNameAndDebug(simpleSplineEdge, 0);
+    addToRunTimeSelectionTable(curvedEdge, simpleSplineEdge, Istream);
+}
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from components
-simpleSplineEdge::simpleSplineEdge
+Foam::simpleSplineEdge::simpleSplineEdge
 (
     const pointField& points,
     const label start,
@@ -57,8 +52,7 @@ simpleSplineEdge::simpleSplineEdge
 {}
 
 
-// Construct from components
-simpleSplineEdge::simpleSplineEdge
+Foam::simpleSplineEdge::simpleSplineEdge
 (
     const pointField& points,
     const label start,
@@ -73,8 +67,7 @@ simpleSplineEdge::simpleSplineEdge
 {}
 
 
-// Construct from Istream
-simpleSplineEdge::simpleSplineEdge(const pointField& points, Istream& is)
+Foam::simpleSplineEdge::simpleSplineEdge(const pointField& points, Istream& is)
 :
     curvedEdge(points, is),
     BSpline(knotlist(points, start_, end_, pointField(is)))
@@ -83,24 +76,17 @@ simpleSplineEdge::simpleSplineEdge(const pointField& points, Istream& is)
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-//- Return the position of a point on the simple spline curve given by
-//  the parameter 0 <= lambda <= 1
-vector simpleSplineEdge::position(const scalar mu) const
+Foam::vector Foam::simpleSplineEdge::position(const scalar mu) const
 {
     return BSpline::position(mu);
 }
 
 
-//- Return the length of the simple spline curve
-scalar simpleSplineEdge::length() const
+Foam::scalar Foam::simpleSplineEdge::length() const
 {
     notImplemented("simpleSplineEdge::length() const");
     return 1.0;
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.H b/src/mesh/blockMesh/curvedEdges/simpleSplineEdge.H
similarity index 84%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.H
rename to src/mesh/blockMesh/curvedEdges/simpleSplineEdge.H
index 14c5b8d0e447c4181d9c8bbe70914164b4c4fc48..4c6df2a5095a3893f0a609cb8f4c4134b204b4b8 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/simpleSplineEdge.H
+++ b/src/mesh/blockMesh/curvedEdges/simpleSplineEdge.H
@@ -26,7 +26,7 @@ Class
     Foam::simpleSplineEdge
 
 Description
-    simpleSplineEdge : the actual access class for Bspline
+    The actual access class for Bspline
 
 SourceFiles
     simpleSplineEdge.C
@@ -45,7 +45,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                           Class simpleSplineEdge Declaration
+                      Class simpleSplineEdge Declaration
 \*---------------------------------------------------------------------------*/
 
 class simpleSplineEdge
@@ -53,6 +53,14 @@ class simpleSplineEdge
     public curvedEdge,
     public BSpline
 {
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        simpleSplineEdge(const simpleSplineEdge&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const simpleSplineEdge&);
+
 
 public:
 
@@ -65,19 +73,19 @@ public:
         //- Construct from components
         simpleSplineEdge
         (
-            const pointField& ps,
+            const pointField&,
             const label start,
             const label end,
-            const pointField& otherknots
+            const pointField& otherKnots
         );
 
         //- Construct from components
         simpleSplineEdge
         (
-            const pointField& points,
+            const pointField&,
             const label start,
             const label end,
-            const pointField& otherknots,
+            const pointField& otherKnots,
             const vector& fstend,
             const vector& sndend
         );
@@ -88,7 +96,8 @@ public:
 
     // Destructor
 
-        virtual ~simpleSplineEdge(){}
+        virtual ~simpleSplineEdge()
+        {}
 
 
     // Member Functions
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/spline.C b/src/mesh/blockMesh/curvedEdges/spline.C
similarity index 57%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/spline.C
rename to src/mesh/blockMesh/curvedEdges/spline.C
index 1702c585da9dacefc6cb379b3303c3d35b156289..871c7f7db4007acde385443347701e32e3b83426 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/spline.C
+++ b/src/mesh/blockMesh/curvedEdges/spline.C
@@ -22,96 +22,72 @@ License
     along with OpenFOAM; if not, write to the Free Software Foundation,
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-Description
-    spline class : define a basic spline on nKnots knots - this
-    does not go anywhere near these knots (will act as a base type for
-    various splines that will have real uses)
-
 \*---------------------------------------------------------------------------*/
 
 #include "spline.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from components
-spline::spline(const pointField& a)
+Foam::spline::spline(const pointField& knotPoints)
 :
-    knots_(a)
+    knots_(knotPoints)
 {}
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-// function B : this is the blending function for constructing the
-// spline
-
-scalar spline::B(const scalar& tau) const
+Foam::scalar Foam::spline::B(const scalar& tau) const
 {
-    scalar value = 0.0;
-
-    if (tau>=2.0 || tau<=-2.0)
+    if (tau <= -2.0 || tau >= 2.0)
     {
-        value = 0.0;
+        return 0.0;
     }
-    else if (tau<=-1.0)
+    else if (tau <= -1.0)
     {
-        value = pow((2.0 + tau),3.0)/6.0;
+        return pow((2.0 + tau),3.0)/6.0;
     }
-    else if (tau<=0.0)
+    else if (tau <= 0.0)
     {
-        value = (4.0 - 6.0*tau*tau - 3.0*tau*tau*tau)/6.0;
+        return (4.0 - 6.0*tau*tau - 3.0*tau*tau*tau)/6.0;
     }
-    else if (tau<=1.0)
+    else if (tau <= 1.0)
     {
-        value = (4.0 - 6.0*tau*tau + 3.0*tau*tau*tau)/6.0;
+        return (4.0 - 6.0*tau*tau + 3.0*tau*tau*tau)/6.0;
     }
-    else if (tau<=2.0)
+    else if (tau <= 2.0)
     {
-        value = pow((2.0 - tau),3.0)/6.0;
+        return pow((2.0 - tau),3.0)/6.0;
     }
     else
     {
         FatalErrorIn("spline::B(const scalar&)")
-            << "How the hell did we get here???, "
+            << "Programming error???, "
             << "tau = " << tau
             << abort(FatalError);
     }
 
-    return value;
+    return 0.0;
 }
 
 
-// position : returns the position along the spline corresponding to the
-// variable mu1
-
-vector spline::position(const scalar mu1) const
+Foam::vector Foam::spline::position(const scalar mu1) const
 {
-    vector tmp(vector::zero);
+    vector loc(vector::zero);
 
     for (register label i=0; i<knots_.size(); i++)
     {
-        tmp += B((knots_.size() - 1)*mu1 - i)*knots_[i];
+        loc += B((knots_.size() - 1)*mu1 - i)*knots_[i];
     }
 
-    return tmp;
+    return loc;
 }
 
 
-//- Return the length of the spline curve
-scalar spline::length() const
+Foam::scalar Foam::spline::length() const
 {
     notImplemented("spline::length() const");
     return 1.0;
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/spline.H b/src/mesh/blockMesh/curvedEdges/spline.H
similarity index 87%
rename from applications/utilities/mesh/generation/blockMesh/curvedEdges/spline.H
rename to src/mesh/blockMesh/curvedEdges/spline.H
index b5c050f3696ab36a6b38bb8db5576d5635c30ead..580877068219ab89c22431ae12699b3d1ce294c4 100644
--- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/spline.H
+++ b/src/mesh/blockMesh/curvedEdges/spline.H
@@ -26,9 +26,9 @@ Class
     Foam::spline
 
 Description
-    spline class : define a basic spline on nKnots knots - this
-    does not go anywhere near these knots (will act as a base type for
-    various splines that will have real uses)
+    Define a basic spline on nKnots knots.
+    The spline does not go anywhere near these knots
+    (will act as a base type for various splines that will have real uses)
 
 SourceFiles
     spline.C
@@ -56,12 +56,17 @@ class spline
         //- The knots defining the spline
         pointField knots_;
 
-
-    // Private member functions
+    // Private Member Functions
 
         //- Blending function for constructing spline
         scalar B(const scalar&) const;
 
+        //- Disallow default bitwise copy construct
+        spline(const spline&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const spline&);
+
 
 public:
 
diff --git a/tutorials/mesh/snappyHexMesh/Allrun b/tutorials/mesh/snappyHexMesh/Allrun
index 13813aeae70925c9dd2eaf0e2a50272fbbf1ce7d..90979fcb05013ab6b317c207cd1dee788860bb93 100755
--- a/tutorials/mesh/snappyHexMesh/Allrun
+++ b/tutorials/mesh/snappyHexMesh/Allrun
@@ -1,2 +1,9 @@
-# These cases are links to solver test cases and are run when the Allrun scripts of those solvers are run.
-# This empty Allrun script avoids the meshing of theses cases to be run twice.
+#!/bin/sh
+
+exit 0
+
+# These cases are links to solver test cases and are run when the Allrun
+# scripts of those solvers are run.
+
+# This dummy Allrun script avoids meshing these cases twice.
+