From c3519f5b4a4f47297f53a025b94db8d7a99e30e1 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Tue, 29 Sep 2009 22:53:17 +0100
Subject: [PATCH] patch decomposition through mapping

---
 .../decomposePar/domainDecomposition.C        | 20 ++++++++++-
 .../basic/coupled/coupledPolyPatch.C          | 13 +++++++
 .../basic/coupled/coupledPolyPatch.H          | 10 ++++++
 .../basic/generic/genericPolyPatch.C          | 15 ++++++++
 .../basic/generic/genericPolyPatch.H          | 26 ++++++++++++++
 .../constraint/cyclic/cyclicPolyPatch.C       | 20 +++++++++++
 .../constraint/cyclic/cyclicPolyPatch.H       | 26 ++++++++++++++
 .../constraint/empty/emptyPolyPatch.C         | 13 +++++++
 .../constraint/empty/emptyPolyPatch.H         | 26 ++++++++++++++
 .../constraint/processor/processorPolyPatch.C | 20 +++++++++++
 .../constraint/processor/processorPolyPatch.H | 35 ++++++++++++++++++-
 .../constraint/symmetry/symmetryPolyPatch.C   | 13 +++++++
 .../constraint/symmetry/symmetryPolyPatch.H   | 26 ++++++++++++++
 .../constraint/wedge/wedgePolyPatch.C         | 15 ++++++++
 .../constraint/wedge/wedgePolyPatch.H         | 26 ++++++++++++++
 .../polyPatches/derived/wall/wallPolyPatch.C  | 13 +++++++
 .../polyPatches/derived/wall/wallPolyPatch.H  | 26 ++++++++++++++
 .../polyPatches/polyPatch/polyPatch.C         | 27 ++++++++++++++
 .../polyPatches/polyPatch/polyPatch.H         | 26 ++++++++++++++
 .../directMappedPatchBase.C                   | 19 ++++++++++
 .../directMappedPatchBase.H                   |  8 +++++
 .../directMappedPolyPatch.C                   | 14 ++++++++
 .../directMappedPolyPatch.H                   | 33 +++++++++++++++++
 .../directMappedWallPolyPatch.C               | 14 ++++++++
 .../directMappedWallPolyPatch.H               | 33 +++++++++++++++++
 25 files changed, 515 insertions(+), 2 deletions(-)

diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C
index e310cc758f0..d3b9bd04924 100644
--- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C
+++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C
@@ -34,6 +34,7 @@ License
 #include "Map.H"
 #include "globalMeshData.H"
 #include "DynamicList.H"
+#include "fvFieldDecomposer.H"
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
@@ -306,12 +307,29 @@ bool domainDecomposition::writeDecomposition()
 
         forAll (curPatchSizes, patchi)
         {
+            // Get the face labels consistent with the field mapping
+            // (reuse the patch field mappers)
+            const polyPatch& meshPatch =
+                meshPatches[curBoundaryAddressing[patchi]];
+
+            fvFieldDecomposer::patchFieldDecomposer patchMapper
+            (
+                SubList<label>
+                (
+                    curFaceLabels,
+                    curPatchSizes[patchi],
+                    curPatchStarts[patchi]
+                ),
+                meshPatch.start()
+            );
+
+            // Map existing patches
             procPatches[nPatches] =
                 meshPatches[curBoundaryAddressing[patchi]].clone
                 (
                     procMesh.boundaryMesh(),
                     nPatches,
-                    curPatchSizes[patchi],
+                    patchMapper.directAddressing(),
                     curPatchStarts[patchi]
                 ).ptr();
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C
index f471fe1b6e8..ee2d966836c 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C
@@ -445,6 +445,19 @@ Foam::coupledPolyPatch::coupledPolyPatch
 {}
 
 
+Foam::coupledPolyPatch::coupledPolyPatch
+(
+    const coupledPolyPatch& pp,
+    const polyBoundaryMesh& bm,
+    const label index,
+    const unallocLabelList& mapAddressing,
+    const label newStart
+)
+:
+    polyPatch(pp, bm, index, mapAddressing, newStart)
+{}
+
+
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 Foam::coupledPolyPatch::~coupledPolyPatch()
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H
index de1d9cc9f98..f823148d3a4 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H
@@ -221,6 +221,16 @@ public:
             const label newStart
         );
 
+        //- Construct given the original patch and a map
+        coupledPolyPatch
+        (
+            const coupledPolyPatch& pp,
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        );
+
 
     // Destructor
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.C
index 47730b06deb..fc15b4ebed8 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.C
@@ -94,6 +94,21 @@ Foam::genericPolyPatch::genericPolyPatch
 {}
 
 
+Foam::genericPolyPatch::genericPolyPatch
+(
+    const genericPolyPatch& pp,
+    const polyBoundaryMesh& bm,
+    const label index,
+    const unallocLabelList& mapAddressing,
+    const label newStart
+)
+:
+    polyPatch(pp, bm, index, mapAddressing, newStart),
+    actualTypeName_(pp.actualTypeName_),
+    dict_(pp.dict_)
+{}
+
+
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 Foam::genericPolyPatch::~genericPolyPatch()
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H
index 53bde568734..ae8f7cbedb0 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/generic/genericPolyPatch.H
@@ -106,6 +106,16 @@ public:
             const label newStart
         );
 
+        //- Construct given the original patch and a map
+        genericPolyPatch
+        (
+            const genericPolyPatch& pp,
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        );
+
         //- Construct and return a clone, resetting the boundary mesh
         virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
         {
@@ -128,6 +138,22 @@ public:
             );
         }
 
+        //- Construct and return a clone, resetting the face list
+        //  and boundary mesh
+        virtual autoPtr<polyPatch> clone
+        (
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        ) const
+        {
+            return autoPtr<polyPatch>
+            (
+                new genericPolyPatch(*this, bm, index, mapAddressing, newStart)
+            );
+        }
+
 
     // Destructor
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C
index 265b61cc4bd..8c6b2020791 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C
@@ -826,6 +826,26 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
 {}
 
 
+Foam::cyclicPolyPatch::cyclicPolyPatch
+(
+    const cyclicPolyPatch& pp,
+    const polyBoundaryMesh& bm,
+    const label index,
+    const unallocLabelList& mapAddressing,
+    const label newStart
+)
+:
+    coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
+    coupledPointsPtr_(NULL),
+    coupledEdgesPtr_(NULL),
+    featureCos_(pp.featureCos_),
+    transform_(pp.transform_),
+    rotationAxis_(pp.rotationAxis_),
+    rotationCentre_(pp.rotationCentre_),
+    separationVector_(pp.separationVector_)
+{}
+
+
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 Foam::cyclicPolyPatch::~cyclicPolyPatch()
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H
index 8bd2bff42f2..ea673488919 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H
@@ -234,6 +234,16 @@ public:
             const label newStart
         );
 
+        //- Construct given the original patch and a map
+        cyclicPolyPatch
+        (
+            const cyclicPolyPatch& pp,
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        );
+
         //- Construct and return a clone, resetting the boundary mesh
         virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
         {
@@ -256,6 +266,22 @@ public:
             );
         }
 
+        //- Construct and return a clone, resetting the face list
+        //  and boundary mesh
+        virtual autoPtr<polyPatch> clone
+        (
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        ) const
+        {
+            return autoPtr<polyPatch>
+            (
+                new cyclicPolyPatch(*this, bm, index, mapAddressing, newStart)
+            );
+        }
+
 
     // Destructor
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/empty/emptyPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/empty/emptyPolyPatch.C
index 01288857583..a4cf9749e45 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/empty/emptyPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/empty/emptyPolyPatch.C
@@ -87,4 +87,17 @@ Foam::emptyPolyPatch::emptyPolyPatch
 {}
 
 
+Foam::emptyPolyPatch::emptyPolyPatch
+(
+    const emptyPolyPatch& pp,
+    const polyBoundaryMesh& bm,
+    const label index,
+    const unallocLabelList& mapAddressing,
+    const label newStart
+)
+:
+    polyPatch(pp, bm, index, mapAddressing, newStart)
+{}
+
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/empty/emptyPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/empty/emptyPolyPatch.H
index 0525e14f89a..286e9eeb492 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/empty/emptyPolyPatch.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/empty/emptyPolyPatch.H
@@ -92,6 +92,16 @@ public:
             const label newStart
         );
 
+        //- Construct given the original patch and a map
+        emptyPolyPatch
+        (
+            const emptyPolyPatch& pp,
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        );
+
         //- Construct and return a clone, resetting the boundary mesh
         virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
         {
@@ -113,6 +123,22 @@ public:
                 new emptyPolyPatch(*this, bm, index, newSize, newStart)
             );
         }
+
+        //- Construct and return a clone, resetting the face list
+        //  and boundary mesh
+        virtual autoPtr<polyPatch> clone
+        (
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        ) const
+        {
+            return autoPtr<polyPatch>
+            (
+                new emptyPolyPatch(*this, bm, index, mapAddressing, newStart)
+            );
+        }
 };
 
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C
index 70eafc70a88..6e4df9f4e5c 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C
@@ -124,6 +124,26 @@ Foam::processorPolyPatch::processorPolyPatch
 {}
 
 
+Foam::processorPolyPatch::processorPolyPatch
+(
+    const processorPolyPatch& pp,
+    const polyBoundaryMesh& bm,
+    const label index,
+     const unallocLabelList& mapAddressing,
+    const label newStart
+)
+:
+    coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
+    myProcNo_(pp.myProcNo_),
+    neighbProcNo_(pp.neighbProcNo_),
+    neighbFaceCentres_(),
+    neighbFaceAreas_(),
+    neighbFaceCellCentres_(),
+    neighbPointsPtr_(NULL),
+    neighbEdgesPtr_(NULL)
+{}
+
+
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 Foam::processorPolyPatch::~processorPolyPatch()
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H
index 246f0e466ab..a8948fee437 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H
@@ -158,6 +158,16 @@ public:
             const label newStart
         );
 
+        //- Construct given the original patch and a map
+        processorPolyPatch
+        (
+            const processorPolyPatch& pp,
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        );
+
         //- Construct and return a clone, resetting the boundary mesh
         virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
         {
@@ -178,7 +188,7 @@ public:
             (
                 new processorPolyPatch
                 (
-                    refCast<const processorPolyPatch>(*this),
+                    *this,
                     bm,
                     index,
                     newSize,
@@ -187,6 +197,29 @@ public:
             );
         }
 
+        //- Construct and return a clone, resetting the face list
+        //  and boundary mesh
+        virtual autoPtr<polyPatch> clone
+        (
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        ) const
+        {
+            return autoPtr<polyPatch>
+            (
+                new processorPolyPatch
+                (
+                    *this,
+                    bm,
+                    index,
+                    mapAddressing,
+                    newStart
+                )
+            );
+        }
+
 
     // Destructor
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetry/symmetryPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetry/symmetryPolyPatch.C
index 99468ea4776..ebcd04f113a 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetry/symmetryPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetry/symmetryPolyPatch.C
@@ -87,4 +87,17 @@ Foam::symmetryPolyPatch::symmetryPolyPatch
 {}
 
 
+Foam::symmetryPolyPatch::symmetryPolyPatch
+(
+    const symmetryPolyPatch& pp,
+    const polyBoundaryMesh& bm,
+    const label index,
+    const unallocLabelList& mapAddressing,
+    const label newStart
+)
+:
+    polyPatch(pp, bm, index, mapAddressing, newStart)
+{}
+
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetry/symmetryPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetry/symmetryPolyPatch.H
index b078076bb97..bb826d86476 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetry/symmetryPolyPatch.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/symmetry/symmetryPolyPatch.H
@@ -92,6 +92,16 @@ public:
             const label newStart
         );
 
+        //- Construct given the original patch and a map
+        symmetryPolyPatch
+        (
+            const symmetryPolyPatch& pp,
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        );
+
         //- Construct and return a clone, resetting the boundary mesh
         virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
         {
@@ -113,6 +123,22 @@ public:
                 new symmetryPolyPatch(*this, bm, index, newSize, newStart)
             );
         }
+
+        //- Construct and return a clone, resetting the face list
+        //  and boundary mesh
+        virtual autoPtr<polyPatch> clone
+        (
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        ) const
+        {
+            return autoPtr<polyPatch>
+            (
+                new symmetryPolyPatch(*this, bm, index, mapAddressing, newStart)
+            );
+        }
 };
 
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C
index 9795b3d3328..78a78490670 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C
@@ -157,4 +157,19 @@ Foam::wedgePolyPatch::wedgePolyPatch
 }
 
 
+Foam::wedgePolyPatch::wedgePolyPatch
+(
+    const wedgePolyPatch& pp,
+    const polyBoundaryMesh& bm,
+    const label index,
+    const unallocLabelList& mapAddressing,
+    const label newStart
+)
+:
+    polyPatch(pp, bm, index, mapAddressing, newStart)
+{
+    initTransforms();
+}
+
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.H
index f513037ec7e..c4ca6add0de 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.H
@@ -113,6 +113,16 @@ public:
             const label newStart
         );
 
+        //- Construct given the original patch and a map
+        wedgePolyPatch
+        (
+            const wedgePolyPatch& pp,
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        );
+
         //- Construct and return a clone, resetting the boundary mesh
         virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
         {
@@ -135,6 +145,22 @@ public:
             );
         }
 
+        //- Construct and return a clone, resetting the face list
+        //  and boundary mesh
+        virtual autoPtr<polyPatch> clone
+        (
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        ) const
+        {
+            return autoPtr<polyPatch>
+            (
+                new wedgePolyPatch(*this, bm, index, mapAddressing, newStart)
+            );
+        }
+
 
     // Member functions
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/derived/wall/wallPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/derived/wall/wallPolyPatch.C
index 13197c86dde..930759df7e6 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/derived/wall/wallPolyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/derived/wall/wallPolyPatch.C
@@ -87,4 +87,17 @@ Foam::wallPolyPatch::wallPolyPatch
 {}
 
 
+Foam::wallPolyPatch::wallPolyPatch
+(
+    const wallPolyPatch& pp,
+    const polyBoundaryMesh& bm,
+    const label index,
+    const unallocLabelList& mapAddressing,
+    const label newStart
+)
+:
+    polyPatch(pp, bm, index, mapAddressing, newStart)
+{}
+
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/derived/wall/wallPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/derived/wall/wallPolyPatch.H
index 7950eee150d..d5af8724418 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/derived/wall/wallPolyPatch.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/derived/wall/wallPolyPatch.H
@@ -92,6 +92,16 @@ public:
             const label newStart
         );
 
+        //- Construct given the original patch and a map
+        wallPolyPatch
+        (
+            const wallPolyPatch& pp,
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        );
+
         //- Construct and return a clone, resetting the boundary mesh
         virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
         {
@@ -113,6 +123,22 @@ public:
                 new wallPolyPatch(*this, bm, index, newSize, newStart)
             );
         }
+
+        //- Construct and return a clone, resetting the face list
+        //  and boundary mesh
+        virtual autoPtr<polyPatch> clone
+        (
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        ) const
+        {
+            return autoPtr<polyPatch>
+            (
+                new wallPolyPatch(*this, bm, index, mapAddressing, newStart)
+            );
+        }
 };
 
 
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C
index 7c3d206db46..be0aa378a67 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C
@@ -167,6 +167,33 @@ Foam::polyPatch::polyPatch
 {}
 
 
+Foam::polyPatch::polyPatch
+(
+    const polyPatch& pp,
+    const polyBoundaryMesh& bm,
+    const label index,
+    const unallocLabelList& mapAddressing,
+    const label newStart
+)
+:
+    patchIdentifier(pp, index),
+    primitivePatch
+    (
+        faceSubList
+        (
+            bm.mesh().faces(),
+            mapAddressing.size(),
+            newStart
+        ),
+        bm.mesh().points()
+    ),
+    start_(newStart),
+    boundaryMesh_(bm),
+    faceCellsPtr_(NULL),
+    mePtr_(NULL)
+{}
+
+
 Foam::polyPatch::polyPatch(const polyPatch& p)
 :
     patchIdentifier(p),
diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H
index b43e4db9ff5..f8c8fa72e72 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H
@@ -199,6 +199,16 @@ public:
             const label newStart
         );
 
+        //- Construct given the original patch and a map
+        polyPatch
+        (
+            const polyPatch& pp,
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        );
+
         //- Construct as copy
         polyPatch(const polyPatch&);
 
@@ -224,6 +234,22 @@ public:
             );
         }
 
+        //- Construct and return a clone, resetting the face list
+        //  and boundary mesh
+        virtual autoPtr<polyPatch> clone
+        (
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        ) const
+        {
+            return autoPtr<polyPatch>
+            (
+                new polyPatch(*this, bm, index, mapAddressing, newStart)
+            );
+        }
+
 
     // Selectors
 
diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C
index c54e6bd693b..899203b5405 100644
--- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C
+++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C
@@ -676,6 +676,25 @@ Foam::directMappedPatchBase::directMappedPatchBase
 {}
 
 
+Foam::directMappedPatchBase::directMappedPatchBase
+(
+    const polyPatch& pp,
+    const directMappedPatchBase& dmp,
+    const unallocLabelList& mapAddressing
+)
+:
+    patch_(pp),
+    sampleRegion_(dmp.sampleRegion_),
+    mode_(dmp.mode_),
+    samplePatch_(dmp.samplePatch_),
+    uniformOffset_(dmp.uniformOffset_),
+    offset_(dmp.offset_),
+    offsets_(dmp.offsets_, mapAddressing),
+    sameRegion_(dmp.sameRegion_),
+    mapPtr_(NULL)
+{}
+
+
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 Foam::directMappedPatchBase::~directMappedPatchBase()
diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.H b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.H
index 99761bd4deb..3d6c0724290 100644
--- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.H
+++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.H
@@ -163,6 +163,14 @@ public:
         //- Construct as copy, resetting patch
         directMappedPatchBase(const polyPatch&, const directMappedPatchBase&);
 
+        //- Construct as copy, resetting patch, map original data
+        directMappedPatchBase
+        (
+            const polyPatch&,
+            const directMappedPatchBase&,
+            const unallocLabelList& mapAddressing
+        );
+
 
     //- Destructor
     virtual ~directMappedPatchBase();
diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C
index 814ff7a25db..e16b8204f7c 100644
--- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C
+++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C
@@ -120,6 +120,20 @@ Foam::directMappedPolyPatch::directMappedPolyPatch
 {}
 
 
+Foam::directMappedPolyPatch::directMappedPolyPatch
+(
+    const directMappedPolyPatch& pp,
+    const polyBoundaryMesh& bm,
+    const label index,
+    const unallocLabelList& mapAddressing,
+    const label newStart
+)
+:
+    polyPatch(pp, bm, index, mapAddressing, newStart),
+    directMappedPatchBase(*this, pp, mapAddressing)
+{}
+
+
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 Foam::directMappedPolyPatch::~directMappedPolyPatch()
diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.H b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.H
index bfdbae72571..8cb5907c951 100644
--- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.H
+++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.H
@@ -142,6 +142,16 @@ public:
             const label newStart
         );
 
+        //- Construct given the original patch and a map
+        directMappedPolyPatch
+        (
+            const directMappedPolyPatch& pp,
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        );
+
         //- Construct and return a clone, resetting the boundary mesh
         virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
         {
@@ -164,6 +174,29 @@ public:
             );
         }
 
+        //- Construct and return a clone, resetting the face list
+        //  and boundary mesh
+        virtual autoPtr<polyPatch> clone
+        (
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        ) const
+        {
+            return autoPtr<polyPatch>
+            (
+                new directMappedPolyPatch
+                (
+                    *this,
+                    bm,
+                    index,
+                    mapAddressing,
+                    newStart
+                )
+            );
+        }
+
 
     //- Destructor
     virtual ~directMappedPolyPatch();
diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.C b/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.C
index 30558f61c1d..6d6038430d2 100644
--- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.C
+++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.C
@@ -125,6 +125,20 @@ Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
 {}
 
 
+Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
+(
+    const directMappedWallPolyPatch& pp,
+    const polyBoundaryMesh& bm,
+    const label index,
+    const unallocLabelList& mapAddressing,
+    const label newStart
+)
+:
+    wallPolyPatch(pp, bm, index, mapAddressing, newStart),
+    directMappedPatchBase(*this, pp, mapAddressing)
+{}
+
+
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 Foam::directMappedWallPolyPatch::~directMappedWallPolyPatch()
diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.H b/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.H
index b7de43c0ada..0a2f5bdfd37 100644
--- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.H
+++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedWallPolyPatch.H
@@ -142,6 +142,16 @@ public:
             const label newStart
         );
 
+        //- Construct given the original patch and a map
+        directMappedWallPolyPatch
+        (
+            const directMappedWallPolyPatch& pp,
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        );
+
         //- Construct and return a clone, resetting the boundary mesh
         virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
         {
@@ -171,6 +181,29 @@ public:
             );
         }
 
+        //- Construct and return a clone, resetting the face list
+        //  and boundary mesh
+        virtual autoPtr<polyPatch> clone
+        (
+            const polyBoundaryMesh& bm,
+            const label index,
+            const unallocLabelList& mapAddressing,
+            const label newStart
+        ) const
+        {
+            return autoPtr<polyPatch>
+            (
+                new directMappedWallPolyPatch
+                (
+                    *this,
+                    bm,
+                    index,
+                    mapAddressing,
+                    newStart
+                )
+            );
+        }
+
 
     //- Destructor
     virtual ~directMappedWallPolyPatch();
-- 
GitLab