diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/files b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/files
index 217ec9d12e939f51c72fc6c3423b738f3d9c004a..3974c7df757b19c9230a6a904fcc6760435e3ad5 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/files
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/files
@@ -15,13 +15,23 @@ backgroundMeshDecomposition/backgroundMeshDecomposition.C
 
 cellSizeControlSurfaces/cellSizeControlSurfaces.C
 
-cellSiseFunctions = cellSizeControlSurfaces/cellSizeFunction
-$(cellSiseFunctions)/cellSizeFunction/cellSizeFunction.C
-$(cellSiseFunctions)/uniform/uniform.C
-$(cellSiseFunctions)/uniformDistance/uniformDistance.C
-$(cellSiseFunctions)/linearDistance/linearDistance.C
-$(cellSiseFunctions)/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C
-$(cellSiseFunctions)/linearSpatial/linearSpatial.C
+cellSizeFunctions = cellSizeControlSurfaces/cellSizeFunction
+$(cellSizeFunctions)/cellSizeFunction/cellSizeFunction.C
+$(cellSizeFunctions)/uniform/uniform.C
+$(cellSizeFunctions)/uniformDistance/uniformDistance.C
+$(cellSizeFunctions)/linearDistance/linearDistance.C
+$(cellSizeFunctions)/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C
+$(cellSizeFunctions)/linearSpatial/linearSpatial.C
+
+surfaceCellSizeFunctions = cellSizeControlSurfaces/surfaceCellSizeFunction
+$(surfaceCellSizeFunctions)/surfaceCellSizeFunction/surfaceCellSizeFunction.C
+$(surfaceCellSizeFunctions)/uniformValue/uniformValue.C
+$(surfaceCellSizeFunctions)/nonUniformField/nonUniformField.C
+
+cellSizeCalculationType = $(surfaceCellSizeFunctions)/cellSizeCalculationType
+$(cellSizeCalculationType)/cellSizeCalculationType/cellSizeCalculationType.C
+$(cellSizeCalculationType)/fieldFromFile/fieldFromFile.C
+$(cellSizeCalculationType)/automatic/automatic.C
 
 initialPointsMethod/initialPointsMethod/initialPointsMethod.C
 initialPointsMethod/uniformGrid/uniformGrid.C
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.C
index 0fa17fc86aeabf8e950ea5c791a7e17e178e0da1..92cf26b0c477e300a9d232040751570557f62d84 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -337,5 +337,21 @@ Foam::scalarField Foam::cellSizeControlSurfaces::cellSize
 }
 
 
+void Foam::cellSizeControlSurfaces::setCellSizes
+(
+    const pointField& pts
+)
+{
+    if (cellSizeFunctions_.size())
+    {
+        forAll(cellSizeFunctions_, i)
+        {
+            cellSizeFunction& cSF = cellSizeFunctions_[i];
+
+            cSF.setCellSize(pts);
+        }
+    }
+}
+
 
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.H
index c813b9fe513e409e14f481ecee01caff978240a7..9f522f0dfcf2d2121f15a5b02127bd6f0e72549b 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.H
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -133,6 +133,11 @@ public:
 
             //- Return the cell size at the given locations
             scalarField cellSize(const pointField& pts) const;
+
+        // Edit
+
+            //- Set the cell sizes for each point
+            void setCellSizes(const pointField& pts);
 };
 
 
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfacesI.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfacesI.H
index 973638d003ac681c43207ccd57557c848bff9736..f59a9cbdc00b34b930288b2b73bc323461585fb6 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfacesI.H
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfacesI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.C
index 37d6c7825ae74b4df60a6e540f9332a443efc41a..127613362347607caaed2a085ec3c9c305918d3f 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -30,18 +30,15 @@ License
 
 namespace Foam
 {
+    defineTypeNameAndDebug(cellSizeFunction, 0);
+    defineRunTimeSelectionTable(cellSizeFunction, dictionary);
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-defineTypeNameAndDebug(cellSizeFunction, 0);
-defineRunTimeSelectionTable(cellSizeFunction, dictionary);
-
-scalar cellSizeFunction::snapToSurfaceTol_ = 1e-10;
-
+    scalar cellSizeFunction::snapToSurfaceTol_ = 1e-10;
+}
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-cellSizeFunction::cellSizeFunction
+Foam::cellSizeFunction::cellSizeFunction
 (
     const word& type,
     const dictionary& cellSizeFunctionDict,
@@ -50,6 +47,14 @@ cellSizeFunction::cellSizeFunction
 :
     dictionary(cellSizeFunctionDict),
     surface_(surface),
+    surfaceCellSizeFunction_
+    (
+        surfaceCellSizeFunction::New
+        (
+            cellSizeFunctionDict,
+            surface
+        )
+    ),
     coeffsDict_(subDict(type + "Coeffs")),
     sideMode_(),
     priority_(readLabel(cellSizeFunctionDict.lookup("priority")))
@@ -94,7 +99,7 @@ cellSizeFunction::cellSizeFunction
 
 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
 
-autoPtr<cellSizeFunction> cellSizeFunction::New
+Foam::autoPtr<Foam::cellSizeFunction> Foam::cellSizeFunction::New
 (
     const dictionary& cellSizeFunctionDict,
     const searchableSurface& surface
@@ -134,12 +139,8 @@ autoPtr<cellSizeFunction> cellSizeFunction::New
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
-cellSizeFunction::~cellSizeFunction()
+Foam::cellSizeFunction::~cellSizeFunction()
 {}
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
 // ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.H
index 6b33ec7ca7714c676d04e39a636f439e29da817a..209140ecadd6a8f4a65e066256a93b5264eb8695 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.H
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -41,6 +41,7 @@ SourceFiles
 #include "dictionary.H"
 #include "autoPtr.H"
 #include "runTimeSelectionTables.H"
+#include "surfaceCellSizeFunction.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -85,6 +86,11 @@ protected:
         //  relates to
         const searchableSurface& surface_;
 
+        //- Cell size at the surface
+        scalarField surfaceCellSize_;
+
+        autoPtr<surfaceCellSizeFunction> surfaceCellSizeFunction_;
+
         //- Method details dictionary
         dictionary coeffsDict_;
 
@@ -170,6 +176,18 @@ public:
             const point& pt,
             scalar& size
         ) const = 0;
+
+
+        virtual bool setCellSize
+        (
+            const pointField& pts
+        )
+        {
+            WarningIn("cellSizeFunction::setCellSize(const point&, const scalar)")
+                << "Not overloaded."
+                << endl;
+            return false;
+        }
 };
 
 
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearDistance/linearDistance.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearDistance/linearDistance.C
index 0874d9fc8231a9745f923ff4039aac41139cd4bc..fc4c4223ef754f7c4fdec46b1256b9e2ac25b294 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearDistance/linearDistance.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearDistance/linearDistance.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,6 +25,8 @@ License
 
 #include "linearDistance.H"
 #include "addToRunTimeSelectionTable.H"
+#include "triSurfaceMesh.H"
+#include "triSurfaceFields.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -46,29 +48,37 @@ linearDistance::linearDistance
 )
 :
     cellSizeFunction(typeName, initialPointsDict, surface),
-    surfaceCellSize_(readScalar(coeffsDict().lookup("surfaceCellSize"))),
     distanceCellSize_(readScalar(coeffsDict().lookup("distanceCellSize"))),
     distance_(readScalar(coeffsDict().lookup("distance"))),
-    distanceSqr_(sqr(distance_)),
-    gradient_((distanceCellSize_ - surfaceCellSize_)/distance_)
+    distanceSqr_(sqr(distance_))
 {}
 
 
 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
 
-scalar linearDistance::sizeFunction(scalar d) const
+scalar linearDistance::sizeFunction
+(
+    const point& pt,
+    scalar d,
+    label index
+) const
 {
-    return gradient_*d + surfaceCellSize_;
+    const scalar interpolatedSize
+        = surfaceCellSizeFunction_().interpolate(pt, index);
+
+    scalar gradient
+        = (distanceCellSize_ - interpolatedSize)
+          /distance_;
+
+    scalar size = gradient*d + interpolatedSize;
+
+    return size;
 }
 
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-bool linearDistance::cellSize
-(
-    const point& pt,
-    scalar& size
-) const
+bool linearDistance::cellSize(const point& pt, scalar& size) const
 {
     size = 0;
 
@@ -85,18 +95,23 @@ bool linearDistance::cellSize
 
     if (hitInfo.hit())
     {
+        const point& hitPt = hitInfo.hitPoint();
+        const label hitIndex = hitInfo.index();
+
+        const scalar dist = mag(pt - hitPt);
+
         if (sideMode_ == rmBothsides)
         {
-            size = sizeFunction(mag(pt - hitInfo.hitPoint()));
+            size = sizeFunction(hitPt, dist, hitIndex);
 
             return true;
         }
 
         // If the nearest point is essentially on the surface, do not do a
         // getVolumeType calculation, as it will be prone to error.
-        if (mag(pt  - hitInfo.hitPoint()) < snapToSurfaceTol_)
+        if (dist < snapToSurfaceTol_)
         {
-            size = sizeFunction(0);
+            size = sizeFunction(hitPt, 0, hitIndex);
 
             return true;
         }
@@ -114,7 +129,7 @@ bool linearDistance::cellSize
          && vTL[0] == searchableSurface::INSIDE
         )
         {
-            size = sizeFunction(mag(pt - hitInfo.hitPoint()));
+            size = sizeFunction(hitPt, dist, hitIndex);
 
             functionApplied = true;
         }
@@ -124,7 +139,7 @@ bool linearDistance::cellSize
          && vTL[0] == searchableSurface::OUTSIDE
         )
         {
-            size = sizeFunction(mag(pt - hitInfo.hitPoint()));
+            size = sizeFunction(hitPt, dist, hitIndex);
 
             functionApplied = true;
         }
@@ -136,6 +151,48 @@ bool linearDistance::cellSize
 }
 
 
+bool linearDistance::setCellSize(const pointField& pts)
+{
+    labelHashSet surfaceAlreadyHit(surfaceCellSize_.size());
+
+    forAll(pts, ptI)
+    {
+        const Foam::point& pt = pts[ptI];
+
+        List<pointIndexHit> hits;
+
+        surface_.findNearest
+        (
+            pointField(1, pt),
+            scalarField(1, distanceSqr_),
+            hits
+        );
+
+        const label surfHitI = hits[0].index();
+
+        if
+        (
+            hits[0].hit()
+         && !surfaceAlreadyHit.found(surfHitI)
+        )
+        {
+            // Halving cell size is arbitrary
+            surfaceCellSizeFunction_().refineSurfaceSize(surfHitI);
+
+            surfaceAlreadyHit.insert(surfHitI);
+        }
+    }
+
+    // Force recalculation of the interpolation
+    if (!pts.empty())
+    {
+        surfaceCellSizeFunction_().recalculateInterpolation();
+    }
+
+    return true;
+}
+
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 } // End namespace Foam
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearDistance/linearDistance.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearDistance/linearDistance.H
index 0906680150b6e0d9a61d92c4164e5f248fb42dc2..d30a6a8045991d02255f782b954e4f7af9ae1386 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearDistance/linearDistance.H
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearDistance/linearDistance.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -54,9 +54,6 @@ private:
 
     // Private data
 
-        //- cell size at the surface
-        scalar surfaceCellSize_;
-
         //- cell size at distance_ from the surface
         scalar distanceCellSize_;
 
@@ -66,14 +63,11 @@ private:
         //- distance squared
         scalar distanceSqr_;
 
-        //- storing gradient for linear function
-        scalar gradient_;
-
 
     // Private Member Functions
 
         //- Calculate the cell size as a function of the given distance
-        scalar sizeFunction(scalar d) const;
+        scalar sizeFunction(const point& pt, scalar d, label index) const;
 
 
 public:
@@ -107,6 +101,12 @@ public:
             const point& pt,
             scalar& size
         ) const;
+
+        //- Adapt local cell size. Return true if anything changed.
+        virtual bool setCellSize
+        (
+            const pointField& pts
+        );
 };
 
 
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearSpatial/linearSpatial.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearSpatial/linearSpatial.C
index d877ffee64504a81848c7e3fe019415a977871f4..5f41979bc764d14260e803b74f646219630a9529 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearSpatial/linearSpatial.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearSpatial/linearSpatial.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearSpatial/linearSpatial.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearSpatial/linearSpatial.H
index faf4d52359422eba3afd2bd94d86fba0d687f90f..0f413b289a950c40ba3bb2b068c9bea97b92c272 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearSpatial/linearSpatial.H
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/linearSpatial/linearSpatial.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C
index bb7ffa6a9a11417c097897ca35701f6ad76de1f1..2a711f3e0b6f66958c9cfae41b8e9b0cd343d659 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -50,13 +50,10 @@ surfaceOffsetLinearDistance::surfaceOffsetLinearDistance
 )
 :
     cellSizeFunction(typeName, initialPointsDict, surface),
-    surfaceCellSize_(readScalar(coeffsDict().lookup("surfaceCellSize"))),
     distanceCellSize_(readScalar(coeffsDict().lookup("distanceCellSize"))),
     surfaceOffset_(readScalar(coeffsDict().lookup("surfaceOffset"))),
     totalDistance_(),
-    totalDistanceSqr_(),
-    gradient_(),
-    intercept_()
+    totalDistanceSqr_()
 {
     if
     (
@@ -111,25 +108,33 @@ surfaceOffsetLinearDistance::surfaceOffsetLinearDistance
     }
 
     totalDistanceSqr_ = sqr(totalDistance_);
-
-    gradient_ =
-        (distanceCellSize_ - surfaceCellSize_)
-       /(totalDistance_ - surfaceOffset_);
-
-    intercept_ = surfaceCellSize_ - gradient_*surfaceOffset_;
 }
 
 
 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
 
-scalar surfaceOffsetLinearDistance::sizeFunction(scalar d) const
+scalar surfaceOffsetLinearDistance::sizeFunction
+(
+    const point& pt,
+    scalar d,
+    label index
+) const
 {
+    const scalar interpolatedSize
+        = surfaceCellSizeFunction_().interpolate(pt, index);
+
     if (d <= surfaceOffset_)
     {
-        return surfaceCellSize_;
+        return interpolatedSize;
     }
 
-    return gradient_*d + intercept_;
+    scalar gradient =
+        (distanceCellSize_ - interpolatedSize)
+       /(totalDistance_ - surfaceOffset_);
+
+    scalar intercept = interpolatedSize - gradient*surfaceOffset_;
+
+    return gradient*d + intercept;
 }
 
 
@@ -156,9 +161,14 @@ bool surfaceOffsetLinearDistance::cellSize
 
     if (hitInfo.hit())
     {
+        const point& hitPt = hitInfo.hitPoint();
+        const label hitIndex = hitInfo.index();
+
+        const scalar dist = mag(pt - hitPt);
+
         if (sideMode_ == rmBothsides)
         {
-            size = sizeFunction(mag(pt - hitInfo.hitPoint()));
+            size = sizeFunction(hitPt, dist, hitIndex);
 
             return true;
         }
@@ -167,7 +177,7 @@ bool surfaceOffsetLinearDistance::cellSize
         // getVolumeType calculation, as it will be prone to error.
         if (mag(pt  - hitInfo.hitPoint()) < snapToSurfaceTol_)
         {
-            size = sizeFunction(0);
+            size = sizeFunction(hitPt, 0, hitIndex);
 
             return true;
         }
@@ -185,7 +195,7 @@ bool surfaceOffsetLinearDistance::cellSize
          && vTL[0] == searchableSurface::INSIDE
         )
         {
-            size = sizeFunction(mag(pt - hitInfo.hitPoint()));
+            size = sizeFunction(hitPt, dist, hitIndex);
 
             functionApplied = true;
         }
@@ -195,7 +205,7 @@ bool surfaceOffsetLinearDistance::cellSize
          && vTL[0] == searchableSurface::OUTSIDE
         )
         {
-            size = sizeFunction(mag(pt - hitInfo.hitPoint()));
+            size = sizeFunction(hitPt, dist, hitIndex);
 
             functionApplied = true;
         }
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.H
index 2b1d3a6f0e293dbbccf86cca27fabf8f721a9c61..520435237fbbf9d0fc700c6d9f22c2bdee0168d0 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.H
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/surfaceOffsetLinearDistance/surfaceOffsetLinearDistance.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -54,9 +54,6 @@ private:
 
     // Private data
 
-        //- cell size at the surface
-        scalar surfaceCellSize_;
-
         //- cell size at distance_ from the surface
         scalar distanceCellSize_;
 
@@ -70,17 +67,11 @@ private:
         //- totalDistance squared
         scalar totalDistanceSqr_;
 
-        //- storing gradient for linear function
-        scalar gradient_;
-
-        //- storing intercept for linear function
-        scalar intercept_;
-
 
     // Private Member Functions
 
         //- Calculate the cell size as a function of the given distance
-        scalar sizeFunction(scalar d) const;
+        scalar sizeFunction(const point& pt, scalar d, label index) const;
 
 
 public:
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniform/uniform.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniform/uniform.C
index e9a06786b48e28d65f2909c23f93062b6a7d997d..e2744eeb2fe544aad3e715bf774d619402a5ee0d 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniform/uniform.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniform/uniform.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -44,8 +44,7 @@ uniform::uniform
     const searchableSurface& surface
 )
 :
-    cellSizeFunction(typeName, initialPointsDict, surface),
-    cellSize_(readScalar(coeffsDict().lookup("cellSize")))
+    cellSizeFunction(typeName, initialPointsDict, surface)
 {}
 
 
@@ -57,64 +56,115 @@ bool uniform::cellSize
     scalar& size
 ) const
 {
-    if (sideMode_ == rmBothsides)
-    {
-        size = cellSize_;
-
-        return true;
-    }
-
-    size = 0;
-
     List<pointIndexHit> hits;
 
     surface_.findNearest
     (
         pointField(1, pt),
-        scalarField(1, sqr(snapToSurfaceTol_)),
+        scalarField(1, sqr(GREAT)),
         hits
     );
 
     const pointIndexHit& hitInfo = hits[0];
 
-    // If the nearest point is essentially on the surface, do not do a
-    // getVolumeType calculation, as it will be prone to error.
     if (hitInfo.hit())
     {
-        size = cellSize_;
+        const point& hitPt = hitInfo.hitPoint();
+        const label index = hitInfo.index();
 
-        return true;
-    }
+        if (sideMode_ == rmBothsides)
+        {
+            size = surfaceCellSizeFunction_().interpolate(hitPt, index);
 
-    pointField ptF(1, pt);
-    List<searchableSurface::volumeType> vTL(1);
+            return true;
+        }
 
-    surface_.getVolumeType(ptF, vTL);
+        size = 0;
 
-    bool functionApplied = false;
+        List<pointIndexHit> closeToSurfaceHits;
 
-    if
-    (
-        sideMode_ == smInside
-     && vTL[0] == searchableSurface::INSIDE
-    )
-    {
-        size = cellSize_;
+        surface_.findNearest
+        (
+            pointField(1, pt),
+            scalarField(1, sqr(snapToSurfaceTol_)),
+            closeToSurfaceHits
+        );
 
-        functionApplied = true;
-    }
-    else if
-    (
-        sideMode_ == smOutside
-     && vTL[0] == searchableSurface::OUTSIDE
-    )
-    {
-        size = cellSize_;
+        const pointIndexHit& closeToSurface = closeToSurfaceHits[0];
+
+        // If the nearest point is essentially on the surface, do not do a
+        // getVolumeType calculation, as it will be prone to error.
+        if (closeToSurface.hit())
+        {
+            size = surfaceCellSizeFunction_().interpolate(hitPt, index);
+
+            return true;
+        }
 
-        functionApplied = true;
+        pointField ptF(1, pt);
+        List<searchableSurface::volumeType> vTL(1);
+
+        surface_.getVolumeType(ptF, vTL);
+
+        bool functionApplied = false;
+
+        if
+        (
+            sideMode_ == smInside
+         && vTL[0] == searchableSurface::INSIDE
+        )
+        {
+            size = surfaceCellSizeFunction_().interpolate(hitPt, index);
+
+            functionApplied = true;
+        }
+        else if
+        (
+            sideMode_ == smOutside
+         && vTL[0] == searchableSurface::OUTSIDE
+        )
+        {
+            size = surfaceCellSizeFunction_().interpolate(hitPt, index);
+
+            functionApplied = true;
+        }
+
+        return functionApplied;
     }
 
-    return functionApplied;
+    return false;
+}
+
+
+bool uniform::setCellSize
+(
+    const pointField& pts
+)
+{
+//    labelHashSet surfaceAlreadyHit(cellSize_.size());
+//
+//    forAll(pts, ptI)
+//    {
+//        const Foam::point& pt = pts[ptI];
+//
+//        List<pointIndexHit> hits;
+//
+//        surface_.findNearest
+//        (
+//            pointField(1, pt),
+//            scalarField(1, sqr(GREAT)),
+//            hits
+//        );
+//
+//        if (hits[0].hit() && !surfaceAlreadyHit.found(hits[0].index()))
+//        {
+//            surfaceCellSizeFunction_().refineCellSize(hits[0].index());
+//
+//            surfaceAlreadyHit.insert(hits[0].index());
+//        }
+//    }
+
+    return true;
 }
 
 
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniform/uniform.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniform/uniform.H
index ea3031aad1aa6f45742a3a9a7e77200282467773..726d506992e3dfe3436da05c2bf730d7b73a19b5 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniform/uniform.H
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniform/uniform.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -54,9 +54,6 @@ private:
 
     // Private data
 
-        //- Cell size
-        scalar cellSize_;
-
 
 public:
 
@@ -89,6 +86,12 @@ public:
             const point& pt,
             scalar& size
         ) const;
+
+        //- Adapt local cell size. Return true if anything changed.
+        virtual bool setCellSize
+        (
+            const pointField& pts
+        );
 };
 
 
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniformDistance/uniformDistance.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniformDistance/uniformDistance.C
index e67eceaa8cd331c8009c5ccd98306de7d11196cf..47e8ecfe43db2a6fbf62c68431066c11e6538e03 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniformDistance/uniformDistance.C
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniformDistance/uniformDistance.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -25,6 +25,7 @@ License
 
 #include "uniformDistance.H"
 #include "addToRunTimeSelectionTable.H"
+#include "dimensionSet.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -45,7 +46,6 @@ uniformDistance::uniformDistance
 )
 :
     cellSizeFunction(typeName, initialPointsDict, surface),
-    cellSize_(readScalar(coeffsDict().lookup("cellSize"))),
     distance_(readScalar(coeffsDict().lookup("distance"))),
     distanceSqr_(sqr(distance_))
 {}
@@ -76,7 +76,7 @@ bool uniformDistance::cellSize
     {
         if (sideMode_ == rmBothsides)
         {
-            size = cellSize_;
+            size = surfaceCellSizeFunction_().surfaceSize(hitInfo.index());
 
             return true;
         }
@@ -85,7 +85,7 @@ bool uniformDistance::cellSize
         // getVolumeType calculation, as it will be prone to error.
         if (mag(pt  - hitInfo.hitPoint()) < snapToSurfaceTol_)
         {
-            size = cellSize_;
+            size = surfaceCellSizeFunction_().surfaceSize(hitInfo.index());
 
             return true;
         }
@@ -103,7 +103,7 @@ bool uniformDistance::cellSize
          && vTL[0] == searchableSurface::INSIDE
         )
         {
-            size = cellSize_;
+            size = surfaceCellSizeFunction_().surfaceSize(hitInfo.index());
 
             functionApplied = true;
         }
@@ -113,7 +113,7 @@ bool uniformDistance::cellSize
          && vTL[0] == searchableSurface::OUTSIDE
         )
         {
-            size = cellSize_;
+            size = surfaceCellSizeFunction_().surfaceSize(hitInfo.index());
 
             functionApplied = true;
         }
@@ -125,6 +125,38 @@ bool uniformDistance::cellSize
 }
 
 
+bool uniformDistance::setCellSize
+(
+    const pointField& pts
+)
+{
+    labelHashSet surfaceAlreadyHit(surface_.size());
+
+    forAll(pts, ptI)
+    {
+        const Foam::point& pt = pts[ptI];
+
+        List<pointIndexHit> hits;
+
+        surface_.findNearest
+        (
+            pointField(1, pt),
+            scalarField(1, distanceSqr_),
+            hits
+        );
+
+        if (hits[0].hit() && !surfaceAlreadyHit.found(hits[0].index()))
+        {
+            surfaceCellSizeFunction_().refineSurfaceSize(hits[0].index());
+
+            surfaceAlreadyHit.insert(hits[0].index());
+        }
+    }
+
+    return true;
+}
+
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 } // End namespace Foam
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniformDistance/uniformDistance.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniformDistance/uniformDistance.H
index bbd87fd548cf4f7713607e27b612731772f30962..0ffe679e1b310b55b03b39b3132482a2191b0442 100644
--- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniformDistance/uniformDistance.H
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/uniformDistance/uniformDistance.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -54,9 +54,6 @@ private:
 
     // Private data
 
-        //- Cell size
-        scalar cellSize_;
-
         //- Distance
         scalar distance_;
 
@@ -95,6 +92,12 @@ public:
             const point& pt,
             scalar& size
         ) const;
+
+        //- Adapt local cell size. Return true if anything changed.
+        virtual bool setCellSize
+        (
+            const pointField& pts
+        );
 };
 
 
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C
new file mode 100644
index 0000000000000000000000000000000000000000..d30cc2a5ffebe0efc12b7b8e36c7c6f68dcf1847
--- /dev/null
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C
@@ -0,0 +1,213 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "automatic.H"
+#include "addToRunTimeSelectionTable.H"
+#include "triSurfaceMesh.H"
+#include "Time.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(automatic, 0);
+    addToRunTimeSelectionTable(cellSizeCalculationType, automatic, dictionary);
+}
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::automatic::automatic
+(
+    const dictionary& cellSizeCalcTypeDict,
+    const triSurfaceMesh& surface
+)
+:
+    cellSizeCalculationType(typeName, cellSizeCalcTypeDict, surface),
+    coeffsDict_(cellSizeCalcTypeDict.subDict(typeName + "Coeffs")),
+    surface_(surface),
+    surfaceName_(surface.searchableSurface::name()),
+    readCurvature_(Switch(coeffsDict_.lookup("curvature"))),
+    curvatureFile_(coeffsDict_.lookup("curvatureFile")),
+    readFeatureProximity_(Switch(coeffsDict_.lookup("featureProximity"))),
+    featureProximityFile_(coeffsDict_.lookup("featureProximityFile")),
+    readInternalCloseness_(Switch(coeffsDict_.lookup("internalCloseness"))),
+    internalClosenessFile_(coeffsDict_.lookup("internalClosenessFile")),
+    curvatureCellSizeFactor_
+    (
+        readScalar(coeffsDict_.lookup("curvatureCellSizeFactor"))
+    ),
+    maximumCellSize_
+    (
+        readScalar(coeffsDict_.lookup("maximumCellSize"))
+    )
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+Foam::triSurfaceScalarField Foam::automatic::load()
+{
+    Info<< indent << "Calculating cell size on surface: "
+        << surfaceName_ << endl;
+
+    triSurfaceScalarField surfaceCellSize
+    (
+        IOobject
+        (
+            surfaceName_ + ".cellSize",
+            surface_.searchableSurface::time().constant(),
+            "triSurface",
+            surface_.searchableSurface::time(),
+            IOobject::NO_READ,
+            IOobject::NO_WRITE
+        ),
+        surface_,
+        dimLength,
+        scalarField(surface_.size(), maximumCellSize_)
+    );
+
+    if (readCurvature_)
+    {
+        Info<< indent << "Reading curvature: " << curvatureFile_ << endl;
+
+        triSurfacePointScalarField curvature
+        (
+            IOobject
+            (
+                curvatureFile_,
+                surface_.searchableSurface::time().constant(),
+                "triSurface",
+                surface_.searchableSurface::time(),
+                IOobject::MUST_READ,
+                IOobject::NO_WRITE
+            ),
+            surface_,
+            dimLength,
+            true
+        );
+
+        const List<labelledTri>& localFaces = surface_.localFaces();
+        const labelList& meshPoints = surface_.meshPoints();
+
+        forAll(surfaceCellSize, fI)
+        {
+            const labelList& facePoints = localFaces[fI].triFaceFace();
+
+            scalar interpolatedCurvatureToFace = 0.0;
+
+            forAll(facePoints, fpI)
+            {
+                interpolatedCurvatureToFace
+                    += curvature[meshPoints[facePoints[fpI]]];
+            }
+
+            interpolatedCurvatureToFace /= facePoints.size();
+
+            surfaceCellSize[fI] =
+                min
+                (
+                    1.0
+                   /max
+                    (
+                        (1.0/curvatureCellSizeFactor_)
+                       *interpolatedCurvatureToFace,
+                        1.0/maximumCellSize_
+                    ),
+                    surfaceCellSize[fI]
+                );
+        }
+    }
+
+    if (readInternalCloseness_)
+    {
+        Info<< indent << "Reading internal closeness: "
+            << internalClosenessFile_ << endl;
+
+        triSurfaceScalarField internalCloseness
+        (
+            IOobject
+            (
+                internalClosenessFile_,
+                surface_.searchableSurface::time().constant(),
+                "triSurface",
+                surface_.searchableSurface::time(),
+                IOobject::MUST_READ,
+                IOobject::NO_WRITE
+            ),
+            surface_,
+            dimLength,
+            true
+        );
+
+        forAll(surfaceCellSize, fI)
+        {
+            surfaceCellSize[fI] =
+                min
+                (
+                    internalCloseness[fI],
+                    surfaceCellSize[fI]
+                );
+        }
+    }
+
+    if (readFeatureProximity_)
+    {
+        Info<< indent << "Reading feature proximity: "
+            << featureProximityFile_ << endl;
+
+        triSurfaceScalarField featureProximity
+        (
+            IOobject
+            (
+                featureProximityFile_,
+                surface_.searchableSurface::time().constant(),
+                "triSurface",
+                surface_.searchableSurface::time(),
+                IOobject::MUST_READ,
+                IOobject::NO_WRITE
+            ),
+            surface_,
+            dimLength,
+            true
+        );
+
+        forAll(surfaceCellSize, fI)
+        {
+            surfaceCellSize[fI] =
+                min
+                (
+                    featureProximity[fI],
+                    surfaceCellSize[fI]
+                );
+        }
+    }
+
+    surfaceCellSize.write();
+
+    return surfaceCellSize;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H
new file mode 100644
index 0000000000000000000000000000000000000000..04d8ed7ddb28c14730ac9c2bea77b0f0612c8fe9
--- /dev/null
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H
@@ -0,0 +1,124 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::automatic
+
+Description
+
+SourceFiles
+    automatic.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef automatic_H
+#define automatic_H
+
+#include "cellSizeCalculationType.H"
+#include "triSurfaceFields.H"
+#include "PrimitivePatchInterpolation.H"
+#include "Switch.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class triSurfaceMesh;
+
+/*---------------------------------------------------------------------------*\
+                         Class automatic Declaration
+\*---------------------------------------------------------------------------*/
+
+class automatic
+:
+    public cellSizeCalculationType
+{
+
+private:
+
+    // Private data
+
+        //- Dictionary of coefficients for automatic cell sizing
+        const dictionary& coeffsDict_;
+
+        //- Reference to the triSurfaceMesh
+        const triSurfaceMesh& surface_;
+
+        //- Name of the surface. Used to write the cell size field
+        const word surfaceName_;
+
+        const Switch readCurvature_;
+        const word curvatureFile_;
+
+        const Switch readFeatureProximity_;
+        const word featureProximityFile_;
+
+        const Switch readInternalCloseness_;
+        const word internalClosenessFile_;
+
+        //- The curvature values are multiplied by the inverse of this value to
+        //  get the cell size
+        const scalar curvatureCellSizeFactor_;
+
+        //- The maximum allowable sell size
+        const scalar maximumCellSize_;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("automatic");
+
+
+    // Constructors
+
+        //- Construct from components
+        automatic
+        (
+            const dictionary& cellSizeCalcTypeDict,
+            const triSurfaceMesh& surface
+        );
+
+
+    //- Destructor
+    virtual ~automatic()
+    {}
+
+
+    // Member Functions
+
+        //- Load the cell size field
+        virtual triSurfaceScalarField load();
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/cellSizeCalculationType/cellSizeCalculationType.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/cellSizeCalculationType/cellSizeCalculationType.C
new file mode 100644
index 0000000000000000000000000000000000000000..b449d46fc66b71d794d69ffa5aeae526f47ea9d8
--- /dev/null
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/cellSizeCalculationType/cellSizeCalculationType.C
@@ -0,0 +1,97 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "cellSizeCalculationType.H"
+#include "addToRunTimeSelectionTable.H"
+#include "triSurfaceMesh.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(cellSizeCalculationType, 0);
+    defineRunTimeSelectionTable(cellSizeCalculationType, dictionary);
+}
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::cellSizeCalculationType::cellSizeCalculationType
+(
+    const word& type,
+    const dictionary& cellSizeCalculationTypeDict,
+    const triSurfaceMesh& surface
+)
+:
+    cellSizeCalculationTypeDict_(cellSizeCalculationTypeDict)
+{}
+
+
+// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
+
+Foam::autoPtr<Foam::cellSizeCalculationType> Foam::cellSizeCalculationType::New
+(
+    const dictionary& cellSizeCalculationTypeDict,
+    const triSurfaceMesh& surface
+)
+{
+    word cellSizeCalculationTypeTypeName
+    (
+        cellSizeCalculationTypeDict.lookup("cellSizeCalculationType")
+    );
+
+    Info<< "    Selecting cellSizeCalculationType "
+        << cellSizeCalculationTypeTypeName << endl;
+
+    dictionaryConstructorTable::iterator cstrIter =
+        dictionaryConstructorTablePtr_->find(cellSizeCalculationTypeTypeName);
+
+    if (cstrIter == dictionaryConstructorTablePtr_->end())
+    {
+        FatalErrorIn
+        (
+            "cellSizeCalculationType::New(dictionary&, "
+            "const conformalVoronoiMesh&, const searchableSurface&)"
+        )   << "Unknown cellSizeCalculationType type "
+            << cellSizeCalculationTypeTypeName
+            << endl << endl
+            << "Valid cellSizeCalculationType types are :" << endl
+            << dictionaryConstructorTablePtr_->toc()
+            << exit(FatalError);
+    }
+
+    return autoPtr<cellSizeCalculationType>
+    (
+        cstrIter()(cellSizeCalculationTypeDict, surface)
+    );
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::cellSizeCalculationType::~cellSizeCalculationType()
+{}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/cellSizeCalculationType/cellSizeCalculationType.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/cellSizeCalculationType/cellSizeCalculationType.H
new file mode 100644
index 0000000000000000000000000000000000000000..4d59f5c7189906a57d1a3d0fd429b86645647917
--- /dev/null
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/cellSizeCalculationType/cellSizeCalculationType.H
@@ -0,0 +1,134 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::cellSizeCalculationType
+
+Description
+    Abstract base class for specifying target cell sizes
+
+SourceFiles
+    cellSizeCalculationType.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef cellSizeCalculationType_H
+#define cellSizeCalculationType_H
+
+#include "searchableSurface.H"
+#include "autoPtr.H"
+#include "runTimeSelectionTables.H"
+#include "triSurfaceFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class triSurfaceMesh;
+
+/*---------------------------------------------------------------------------*\
+                     Class cellSizeCalculationType Declaration
+\*---------------------------------------------------------------------------*/
+
+class cellSizeCalculationType
+{
+
+protected:
+
+        const dictionary& cellSizeCalculationTypeDict_;
+
+
+private:
+
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        cellSizeCalculationType(const cellSizeCalculationType&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const cellSizeCalculationType&);
+
+
+public:
+
+    //- Runtime type information
+    TypeName("cellSizeCalculationType");
+
+
+    // Declare run-time constructor selection table
+
+        declareRunTimeSelectionTable
+        (
+            autoPtr,
+            cellSizeCalculationType,
+            dictionary,
+            (
+                const dictionary& cellSizeCalculationTypeDict,
+                const triSurfaceMesh& surface
+            ),
+            (cellSizeCalculationTypeDict, surface)
+        );
+
+
+    // Constructors
+
+        //- Construct from components
+        cellSizeCalculationType
+        (
+            const word& type,
+            const dictionary& cellSizeCalculationTypeDict,
+            const triSurfaceMesh& surface
+        );
+
+
+    // Selectors
+
+        //- Return a reference to the selected cellSizeCalculationType
+        static autoPtr<cellSizeCalculationType> New
+        (
+            const dictionary& cellSizeCalculationTypeDict,
+            const triSurfaceMesh& surface
+        );
+
+
+    //- Destructor
+    virtual ~cellSizeCalculationType();
+
+
+    // Member Functions
+
+        //- Load the cell size
+        virtual triSurfaceScalarField load() = 0;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/fieldFromFile/fieldFromFile.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/fieldFromFile/fieldFromFile.C
new file mode 100644
index 0000000000000000000000000000000000000000..d40427abf7e5fa9bb6f60945b9b66a57a13f3133
--- /dev/null
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/fieldFromFile/fieldFromFile.C
@@ -0,0 +1,88 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "fieldFromFile.H"
+#include "addToRunTimeSelectionTable.H"
+#include "triSurfaceMesh.H"
+#include "triSurfaceFields.H"
+#include "Time.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(fieldFromFile, 0);
+    addToRunTimeSelectionTable
+    (
+        cellSizeCalculationType,
+        fieldFromFile,
+        dictionary
+    );
+}
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::fieldFromFile::fieldFromFile
+(
+    const dictionary& cellSizeCalcTypeDict,
+    const triSurfaceMesh& surface
+)
+:
+    cellSizeCalculationType(typeName, cellSizeCalcTypeDict, surface),
+    surface_(surface),
+    fileName_
+    (
+        cellSizeCalcTypeDict.subDict(typeName + "Coeffs").lookup("fieldFile")
+    )
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+Foam::triSurfaceScalarField Foam::fieldFromFile::load()
+{
+    Info<< "Loading: " << fileName_ << endl;
+
+    triSurfaceScalarField surfaceCellSize
+    (
+        IOobject
+        (
+            fileName_,
+            surface_.searchableSurface::time().constant(),
+            "triSurface",
+            surface_.searchableSurface::time(),
+            IOobject::MUST_READ,
+            IOobject::NO_WRITE
+        ),
+        surface_,
+        dimLength,
+        true
+    );
+
+    return surfaceCellSize;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/fieldFromFile/fieldFromFile.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/fieldFromFile/fieldFromFile.H
new file mode 100644
index 0000000000000000000000000000000000000000..ed99b5edd0f583d4aaa872b582ad1c1fc7ce5967
--- /dev/null
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/fieldFromFile/fieldFromFile.H
@@ -0,0 +1,105 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::fieldFromFile
+
+Description
+
+SourceFiles
+    fieldFromFile.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef fieldFromFile_H
+#define fieldFromFile_H
+
+#include "cellSizeCalculationType.H"
+#include "triSurfaceFields.H"
+#include "PrimitivePatchInterpolation.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class triSurfaceMesh;
+
+/*---------------------------------------------------------------------------*\
+                       Class fieldFromFile Declaration
+\*---------------------------------------------------------------------------*/
+
+class fieldFromFile
+:
+    public cellSizeCalculationType
+{
+
+private:
+
+    // Private data
+
+        //- Reference to the triSurfaceMesh
+        const triSurfaceMesh& surface_;
+
+        //- Name of the triSurfaceScalarField file to load in. Must be in
+        //  constant/triSurface
+        const word fileName_;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("fieldFromFile");
+
+
+    // Constructors
+
+        //- Construct from components
+        fieldFromFile
+        (
+            const dictionary& cellSizeCalcTypeDict,
+            const triSurfaceMesh& surface
+        );
+
+
+    //- Destructor
+    virtual ~fieldFromFile()
+    {}
+
+
+    // Member Functions
+
+        //- Load the cell size field
+        virtual triSurfaceScalarField load();
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.C
new file mode 100644
index 0000000000000000000000000000000000000000..5e2d032d91e1c66979f1c646bc836845620dd4d7
--- /dev/null
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.C
@@ -0,0 +1,167 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "nonUniformField.H"
+#include "triSurfaceMesh.H"
+#include "searchableSurface.H"
+#include "addToRunTimeSelectionTable.H"
+#include "Time.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(nonUniformField, 0);
+    addToRunTimeSelectionTable
+    (
+        surfaceCellSizeFunction,
+        nonUniformField,
+        dictionary
+    );
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::nonUniformField::nonUniformField
+(
+    const dictionary& cellSizeFunctionDict,
+    const searchableSurface& surface
+)
+:
+    surfaceCellSizeFunction(typeName, cellSizeFunctionDict, surface),
+    surfaceTriMesh_(refCast<const triSurfaceMesh>(surface)),
+    surfaceCellSize_
+    (
+        IOobject
+        (
+            "surfaceCellSize.cellSize",
+            surface.time().constant(),
+            "triSurface",
+            surface.time(),
+            IOobject::NO_READ,
+            IOobject::NO_WRITE
+        ),
+        surfaceTriMesh_,
+        dimLength,
+        false
+    ),
+    cellSizeCalculationType_
+    (
+        cellSizeCalculationType::New(coeffsDict(), surfaceTriMesh_)
+    ),
+    pointCellSize_(),
+    patch_()
+{
+    Info<< incrIndent << incrIndent;
+
+    surfaceCellSize_ = cellSizeCalculationType_().load();
+
+    Info<< decrIndent;
+
+    Info<< indent << "Cell size field statistics:" << nl
+        << indent << "   Minimum: " << min(surfaceCellSize_).value() << nl
+        << indent << "   Average: " << average(surfaceCellSize_).value() << nl
+        << indent << "   Maximum: " << max(surfaceCellSize_).value() << endl;
+
+    Info<< decrIndent;
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+const Foam::scalar& Foam::nonUniformField::surfaceSize(const label index) const
+{
+    return surfaceCellSize_[index];
+}
+
+
+const Foam::scalar& Foam::nonUniformField::refineSurfaceSize(const label index)
+{
+    surfaceCellSize_[index] *= refinementFactor_;
+
+    return surfaceCellSize_[index];
+}
+
+
+Foam::scalar Foam::nonUniformField::interpolate
+(
+    const point& pt,
+    const label index
+) const
+{
+    if (patch_.empty())
+    {
+        recalculateInterpolation();
+    }
+
+    const face& faceHitByPt = surfaceTriMesh_.triSurface::operator[](index);
+
+    const pointField& pts = surfaceTriMesh_.points();
+    const Map<label>& pMap = surfaceTriMesh_.meshPointMap();
+
+    triPointRef tri
+    (
+        pts[faceHitByPt[0]],
+        pts[faceHitByPt[1]],
+        pts[faceHitByPt[2]]
+    );
+
+    scalarList bary(3, 0.0);
+
+    tri.barycentric(pt, bary);
+
+    return pointCellSize_()[pMap[faceHitByPt[0]]]*bary[0]
+         + pointCellSize_()[pMap[faceHitByPt[1]]]*bary[1]
+         + pointCellSize_()[pMap[faceHitByPt[2]]]*bary[2];
+}
+
+
+void Foam::nonUniformField::recalculateInterpolation() const
+{
+    patch_.reset(new primitivePatchInterpolation(surfaceTriMesh_));
+
+    pointCellSize_.reset
+    (
+        new triSurfacePointScalarField
+        (
+            IOobject
+            (
+                "pointCellSize.cellSize",
+                surfaceTriMesh_.searchableSurface::time().constant(),
+                "triSurface",
+                surfaceTriMesh_.searchableSurface::time(),
+                IOobject::NO_READ,
+                IOobject::NO_WRITE
+            ),
+            surfaceTriMesh_,
+            dimLength,
+            patch_().faceToPointInterpolate(surfaceCellSize_)
+        )
+    );
+}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.H
new file mode 100644
index 0000000000000000000000000000000000000000..039fd0fedbd8130d5ccbf6d1526419eebc3fed73
--- /dev/null
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/nonUniformField/nonUniformField.H
@@ -0,0 +1,123 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::nonUniformField
+
+Description
+
+SourceFiles
+    nonUniformField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef nonUniformField_H
+#define nonUniformField_H
+
+#include "triSurfaceFields.H"
+#include "PrimitivePatchInterpolation.H"
+#include "surfaceCellSizeFunction.H"
+#include "cellSizeCalculationType.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class triSurfaceMesh;
+class searchableSurface;
+
+/*---------------------------------------------------------------------------*\
+                           Class nonUniformField Declaration
+\*---------------------------------------------------------------------------*/
+
+class nonUniformField
+:
+    public surfaceCellSizeFunction
+{
+
+protected:
+
+    // Private typedef
+
+        typedef PrimitivePatchInterpolation
+        <
+            PrimitivePatch<labelledTri, List, pointField, point>
+        >   primitivePatchInterpolation;
+
+
+    // Private data
+
+        const triSurfaceMesh& surfaceTriMesh_;
+
+        triSurfaceScalarField surfaceCellSize_;
+
+        autoPtr<cellSizeCalculationType> cellSizeCalculationType_;
+
+        mutable autoPtr<triSurfacePointScalarField> pointCellSize_;
+
+        mutable autoPtr<primitivePatchInterpolation> patch_;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("nonUniformField");
+
+
+    // Constructors
+
+        //- Construct from components
+        nonUniformField
+        (
+            const dictionary& cellSizeFunctionDict,
+            const searchableSurface& surface
+        );
+
+
+    //- Destructor
+    virtual ~nonUniformField()
+    {}
+
+
+    // Member Functions
+
+        virtual const scalar& surfaceSize(const label index) const;
+
+        virtual const scalar& refineSurfaceSize(const label index);
+
+        virtual scalar interpolate(const point& pt, const label index) const;
+
+        virtual void recalculateInterpolation() const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/surfaceCellSizeFunction/surfaceCellSizeFunction.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/surfaceCellSizeFunction/surfaceCellSizeFunction.C
new file mode 100644
index 0000000000000000000000000000000000000000..7022511c4c2dbdf594ecc6666cf4c6fa5712a833
--- /dev/null
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/surfaceCellSizeFunction/surfaceCellSizeFunction.C
@@ -0,0 +1,99 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "surfaceCellSizeFunction.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(surfaceCellSizeFunction, 0);
+    defineRunTimeSelectionTable(surfaceCellSizeFunction, dictionary);
+}
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::surfaceCellSizeFunction::surfaceCellSizeFunction
+(
+    const word& type,
+    const dictionary& surfaceCellSizeFunctionDict,
+    const searchableSurface& surface
+)
+:
+    dictionary(surfaceCellSizeFunctionDict),
+    surface_(surface),
+    coeffsDict_(subDict(type + "Coeffs")),
+    refinementFactor_(readScalar(lookup("refinementFactor")))
+{}
+
+
+// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
+
+Foam::autoPtr<Foam::surfaceCellSizeFunction> Foam::surfaceCellSizeFunction::New
+(
+    const dictionary& surfaceCellSizeFunctionDict,
+    const searchableSurface& surface
+)
+{
+    word surfaceCellSizeFunctionTypeName
+    (
+        surfaceCellSizeFunctionDict.lookup("surfaceCellSizeFunction")
+    );
+
+    Info<< "    Selecting surfaceCellSizeFunction "
+        << surfaceCellSizeFunctionTypeName << endl;
+
+    dictionaryConstructorTable::iterator cstrIter =
+        dictionaryConstructorTablePtr_->find(surfaceCellSizeFunctionTypeName);
+
+    if (cstrIter == dictionaryConstructorTablePtr_->end())
+    {
+        FatalErrorIn
+        (
+            "surfaceCellSizeFunction::New(dictionary&, "
+            "const conformalVoronoiMesh&, const searchableSurface&)"
+        )   << "Unknown surfaceCellSizeFunction type "
+            << surfaceCellSizeFunctionTypeName
+            << endl << endl
+            << "Valid surfaceCellSizeFunction types are :" << endl
+            << dictionaryConstructorTablePtr_->toc()
+            << exit(FatalError);
+    }
+
+    return autoPtr<surfaceCellSizeFunction>
+    (
+        cstrIter()(surfaceCellSizeFunctionDict, surface)
+    );
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
+
+Foam::surfaceCellSizeFunction::~surfaceCellSizeFunction()
+{}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/surfaceCellSizeFunction/surfaceCellSizeFunction.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/surfaceCellSizeFunction/surfaceCellSizeFunction.H
new file mode 100644
index 0000000000000000000000000000000000000000..5c798c3be1176c6d2044d85b4299975eed0f0ecb
--- /dev/null
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/surfaceCellSizeFunction/surfaceCellSizeFunction.H
@@ -0,0 +1,159 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::surfaceCellSizeFunction
+
+Description
+    Abstract base class for specifying target cell sizes
+
+SourceFiles
+    surfaceCellSizeFunction.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef surfaceCellSizeFunction_H
+#define surfaceCellSizeFunction_H
+
+#include "searchableSurface.H"
+#include "dictionary.H"
+#include "autoPtr.H"
+#include "runTimeSelectionTables.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                     Class surfaceCellSizeFunction Declaration
+\*---------------------------------------------------------------------------*/
+
+class surfaceCellSizeFunction
+:
+    public dictionary
+{
+
+protected:
+
+    // Protected data
+
+        //- Reference to the searchableSurface that surfaceCellSizeFunction
+        //  relates to
+        const searchableSurface& surface_;
+
+        const dictionary coeffsDict_;
+
+        //- If cell resizing is allowed, this is the factor of the old cell size
+        //  to get the new cell size
+        scalar refinementFactor_;
+
+
+private:
+
+    // Private Member Functions
+
+        //- Disallow default bitwise copy construct
+        surfaceCellSizeFunction(const surfaceCellSizeFunction&);
+
+        //- Disallow default bitwise assignment
+        void operator=(const surfaceCellSizeFunction&);
+
+
+public:
+
+    //- Runtime type information
+    TypeName("surfaceCellSizeFunction");
+
+
+    // Declare run-time constructor selection table
+
+        declareRunTimeSelectionTable
+        (
+            autoPtr,
+            surfaceCellSizeFunction,
+            dictionary,
+            (
+                const dictionary& surfaceCellSizeFunctionDict,
+                const searchableSurface& surface
+            ),
+            (surfaceCellSizeFunctionDict, surface)
+        );
+
+
+    // Constructors
+
+        //- Construct from components
+        surfaceCellSizeFunction
+        (
+            const word& type,
+            const dictionary& surfaceCellSizeFunctionDict,
+            const searchableSurface& surface
+        );
+
+
+    // Selectors
+
+        //- Return a reference to the selected surfaceCellSizeFunction
+        static autoPtr<surfaceCellSizeFunction> New
+        (
+            const dictionary& surfaceCellSizeFunctionDict,
+            const searchableSurface& surface
+        );
+
+
+    //- Destructor
+    virtual ~surfaceCellSizeFunction();
+
+
+    // Member Functions
+
+        //- Const access to the details dictionary
+        inline const dictionary& coeffsDict() const
+        {
+            return coeffsDict_;
+        }
+
+        virtual const scalar& surfaceSize(const label index) const = 0;
+
+        virtual const scalar& refineSurfaceSize(const label index) = 0;
+
+        virtual scalar interpolate
+        (
+            const point& pt,
+            const label index
+        ) const = 0;
+
+        virtual void recalculateInterpolation() const = 0;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/uniformValue/uniformValue.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/uniformValue/uniformValue.C
new file mode 100644
index 0000000000000000000000000000000000000000..e68a5ab3cac8a03f5d4b64663437d6c0875d035a
--- /dev/null
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/uniformValue/uniformValue.C
@@ -0,0 +1,86 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+\*---------------------------------------------------------------------------*/
+
+#include "uniformValue.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+    defineTypeNameAndDebug(uniformValue, 0);
+    addToRunTimeSelectionTable
+    (
+        surfaceCellSizeFunction,
+        uniformValue,
+        dictionary
+    );
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
+
+Foam::uniformValue::uniformValue
+(
+    const dictionary& cellSizeFunctionDict,
+    const searchableSurface& surface
+)
+:
+    surfaceCellSizeFunction(typeName, cellSizeFunctionDict, surface),
+    surfaceCellSize_(readScalar(coeffsDict().lookup("surfaceCellSize")))
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+const Foam::scalar& Foam::uniformValue::surfaceSize(const label index) const
+{
+    return surfaceCellSize_;
+}
+
+
+const Foam::scalar& Foam::uniformValue::refineSurfaceSize(const label index)
+{
+    surfaceCellSize_ *= refinementFactor_;
+
+    return surfaceCellSize_;
+}
+
+
+Foam::scalar Foam::uniformValue::interpolate
+(
+    const point& pt,
+    const label index
+) const
+{
+    return surfaceCellSize_;
+}
+
+
+void Foam::uniformValue::recalculateInterpolation() const
+{}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/uniformValue/uniformValue.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/uniformValue/uniformValue.H
new file mode 100644
index 0000000000000000000000000000000000000000..9e54e86b48af51f1e6b5dfa8ed8a7ef2bef177a5
--- /dev/null
+++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/uniformValue/uniformValue.H
@@ -0,0 +1,105 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation 
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Class
+    Foam::uniformValue
+
+Description
+
+SourceFiles
+    uniformValue.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef uniformValue_H
+#define uniformValue_H
+
+#include "surfaceCellSizeFunction.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+                           Class uniformValue Declaration
+\*---------------------------------------------------------------------------*/
+
+class uniformValue
+:
+    public surfaceCellSizeFunction
+{
+
+private:
+
+    // Private data
+
+        scalar surfaceCellSize_;
+
+
+public:
+
+    //- Runtime type information
+    TypeName("uniformValue");
+
+
+    // Constructors
+
+        //- Construct from components
+        uniformValue
+        (
+            const dictionary& cellSizeFunctionDict,
+            const searchableSurface& surface
+        );
+
+
+    //- Destructor
+    virtual ~uniformValue()
+    {}
+
+
+    // Member Functions
+
+        virtual const scalar& surfaceSize(const label index) const;
+
+        virtual const scalar& refineSurfaceSize(const label index);
+
+        virtual scalar interpolate
+        (
+            const point& pt,
+            const label index
+        ) const;
+
+        virtual void recalculateInterpolation() const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //