diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMeshDict b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMeshDict
index 0728864488..d3018d209d 100644
--- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMeshDict
+++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMeshDict
@@ -63,6 +63,10 @@ extrudeModel wedge;
//- Extrudes into sphere with grading according to pressure (atmospherics)
//extrudeModel sigmaRadial;
+//- Extrudes by interpolating along path inbetween two (topologically identical)
+// surfaces (e.g. one is an offsetted version of the other)
+//extrudeModel offsetSurface;
+
nLayers 10;
expansionRatio 1.0;
@@ -105,6 +109,16 @@ sigmaRadialCoeffs
pStrat 1;
}
+offsetSurfaceCoeffs
+{
+ // Surface that mesh has been meshed to
+ baseSurface "$FOAM_CASE/constant/triSurface/DTC-scaled-inflated.obj";
+
+ // Surface to fill in to
+ offsetSurface "$FOAM_CASE/constant/triSurface/DTC-scaled.obj";
+}
+
+
// Do front and back need to be merged? Usually only makes sense for 360
// degree wedges.
mergeFaces false;
diff --git a/src/mesh/extrudeModel/offsetSurface/offsetSurface.C b/src/mesh/extrudeModel/offsetSurface/offsetSurface.C
new file mode 100644
index 0000000000..1b2872279f
--- /dev/null
+++ b/src/mesh/extrudeModel/offsetSurface/offsetSurface.C
@@ -0,0 +1,165 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2014 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 .
+
+\*---------------------------------------------------------------------------*/
+
+#include "offsetSurface.H"
+#include "addToRunTimeSelectionTable.H"
+#include "triSurface.H"
+#include "triSurfaceSearch.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace extrudeModels
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+defineTypeNameAndDebug(offsetSurface, 0);
+
+addToRunTimeSelectionTable(extrudeModel, offsetSurface, dictionary);
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+offsetSurface::offsetSurface(const dictionary& dict)
+:
+ extrudeModel(typeName, dict),
+ project_(coeffDict_.lookupOrDefault("project", false))
+{
+ // Read surface
+ fileName baseName(coeffDict_.lookup("baseSurface"));
+ baseName.expand();
+ baseSurfPtr_.reset(new triSurface(baseName));
+
+ // Construct search engine
+ baseSearchPtr_.reset(new triSurfaceSearch(baseSurfPtr_()));
+
+ // Read offsetted surface
+ fileName offsetName(coeffDict_.lookup("offsetSurface"));
+ offsetName.expand();
+ offsetSurfPtr_.reset(new triSurface(offsetName));
+
+ // Construct search engine
+ offsetSearchPtr_.reset(new triSurfaceSearch(offsetSurfPtr_()));
+
+
+ const triSurface& b = baseSurfPtr_();
+ const triSurface& o = offsetSurfPtr_();
+
+ if
+ (
+ b.size() != o.size()
+ || b.nPoints() != o.nPoints()
+ || b.nEdges() != o.nEdges()
+ )
+ {
+ FatalIOErrorIn("offsetSurface::offsetSurface(const dictionary&)", dict)
+ << "offsetSurface " << offsetName
+ << " should have exactly the same topology as the baseSurface "
+ << baseName << exit(FatalIOError);
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+offsetSurface::~offsetSurface()
+{}
+
+
+// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
+
+point offsetSurface::operator()
+(
+ const point& surfacePoint,
+ const vector& surfaceNormal,
+ const label layer
+) const
+{
+ if (layer == 0)
+ {
+ return surfacePoint;
+ }
+ else
+ {
+ pointField samples(1, surfacePoint);
+ scalarField nearestDistSqr(1, GREAT);
+ List info;
+ baseSearchPtr_().findNearest(samples, nearestDistSqr, info);
+
+ label triI = info[0].index();
+
+
+ const triSurface& base = baseSurfPtr_();
+ const triPointRef baseTri(base[triI].tri(base.points()));
+
+ List bary;
+ baseTri.barycentric(surfacePoint, bary);
+
+ const triSurface& offset = offsetSurfPtr_();
+ const triPointRef offsetTri(offset[triI].tri(offset.points()));
+
+ const point offsetPoint
+ (
+ bary[0]*offsetTri.a()
+ +bary[1]*offsetTri.b()
+ +bary[2]*offsetTri.c()
+ );
+
+ point interpolatedPoint
+ (
+ surfacePoint + sumThickness(layer)*(offsetPoint-surfacePoint)
+ );
+
+
+ //- Either return interpolatedPoint or re-project onto surface (since
+ // snapping might not have do so exactly)
+
+ if (project_)
+ {
+ // Re-project onto surface
+ offsetSearchPtr_().findNearest
+ (
+ pointField(1, interpolatedPoint),
+ scalarField(1, GREAT),
+ info
+ );
+ return info[0].hitPoint();
+ }
+ else
+ {
+ return interpolatedPoint;
+ }
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace extrudeModels
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/mesh/extrudeModel/offsetSurface/offsetSurface.H b/src/mesh/extrudeModel/offsetSurface/offsetSurface.H
new file mode 100644
index 0000000000..f5df55cfd8
--- /dev/null
+++ b/src/mesh/extrudeModel/offsetSurface/offsetSurface.H
@@ -0,0 +1,114 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2014 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 .
+
+Class
+ Foam::extrudeModels::offsetSurface
+
+Description
+ Extrudes by interpolating points from one surface to the other. Surfaces
+ have to be topologically identical i.e. one has to be an offsetted version
+ of the other.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef offsetSurface_H
+#define offsetSurface_H
+
+#include "point.H"
+#include "extrudeModel.H"
+#include "Switch.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+class triSurface;
+class triSurfaceSearch;
+
+
+namespace extrudeModels
+{
+
+/*---------------------------------------------------------------------------*\
+ Class offsetSurface Declaration
+\*---------------------------------------------------------------------------*/
+
+class offsetSurface
+:
+ public extrudeModel
+{
+ // Private data
+
+ //- surface
+ autoPtr baseSurfPtr_;
+
+ //- search engine
+ autoPtr baseSearchPtr_;
+
+ //- offsets
+ autoPtr offsetSurfPtr_;
+
+ //- search engine
+ autoPtr offsetSearchPtr_;
+
+ // Whether to re-project onto offsetted surface
+ const Switch project_;
+
+public:
+
+ //- Runtime type information
+ TypeName("offsetSurface");
+
+ // Constructors
+
+ //- Construct from dictionary
+ offsetSurface(const dictionary& dict);
+
+
+ //- Destructor
+ virtual ~offsetSurface();
+
+
+ // Member Operators
+
+ //- Return point
+ point operator()
+ (
+ const point& surfacePoint,
+ const vector& surfaceNormal,
+ const label layer
+ ) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace extrudeModels
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //