diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files
index cf77d4f80b..ab78000ffc 100644
--- a/src/meshTools/Make/files
+++ b/src/meshTools/Make/files
@@ -43,6 +43,9 @@ patchWave = $(algorithms)/PatchEdgeFaceWave
$(patchWave)/PatchEdgeFaceWaveName.C
$(patchWave)/patchEdgeFaceInfo.C
$(patchWave)/patchPatchDist.C
+$(patchWave)/patchEdgeFaceRegion.C
+$(patchWave)/patchEdgeFaceRegions.C
+
meshWave = $(algorithms)/MeshWave
$(meshWave)/MeshWaveName.C
@@ -113,7 +116,6 @@ $(faceSources)/boundaryToFace/boundaryToFace.C
$(faceSources)/zoneToFace/zoneToFace.C
$(faceSources)/boxToFace/boxToFace.C
$(faceSources)/regionToFace/regionToFace.C
-$(faceSources)/regionToFace/patchEdgeFaceRegion.C
pointSources = sets/pointSources
$(pointSources)/labelToPoint/labelToPoint.C
diff --git a/src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegion.C b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.C
similarity index 95%
rename from src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegion.C
rename to src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.C
index 91e9b4c331..eaac9a864a 100644
--- a/src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegion.C
+++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
diff --git a/src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegion.H b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.H
similarity index 98%
rename from src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegion.H
rename to src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.H
index 6c0b65f2d7..48ced2899b 100644
--- a/src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegion.H
+++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegion.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
diff --git a/src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegionI.H b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegionI.H
similarity index 100%
rename from src/meshTools/sets/faceSources/regionToFace/patchEdgeFaceRegionI.H
rename to src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegionI.H
diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.C b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.C
new file mode 100644
index 0000000000..72050034aa
--- /dev/null
+++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.C
@@ -0,0 +1,50 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2012-2013 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 "patchEdgeFaceRegions.H"
+
+// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
+
+Foam::Ostream& Foam::operator<<
+(
+ Foam::Ostream& os,
+ const Foam::patchEdgeFaceRegions& wDist
+)
+{
+ return os << wDist.regions_;
+}
+
+
+Foam::Istream& Foam::operator>>
+(
+ Foam::Istream& is,
+ Foam::patchEdgeFaceRegions& wDist
+)
+{
+ return is >> wDist.regions_;
+}
+
+
+// ************************************************************************* //
diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.H b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.H
new file mode 100644
index 0000000000..a60a38ce45
--- /dev/null
+++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegions.H
@@ -0,0 +1,173 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2013 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::patchEdgeFaceRegions
+
+Description
+ Transport of regions for use in PatchEdgeFaceWave.
+
+ Set element to -1 to denote blocked.
+
+SourceFiles
+ patchEdgeFaceRegionsI.H
+ patchEdgeFaceRegions.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef patchEdgeFaceRegions_H
+#define patchEdgeFaceRegions_H
+
+#include "labelList.H"
+#include "scalar.H"
+#include "tensor.H"
+#include "labelPair.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of classes
+class polyMesh;
+
+/*---------------------------------------------------------------------------*\
+ Class patchEdgeFaceRegions Declaration
+\*---------------------------------------------------------------------------*/
+
+class patchEdgeFaceRegions
+{
+ // Private data
+
+ //- region per point
+ labelList regions_;
+
+public:
+
+ // Constructors
+
+ //- Construct null
+ inline patchEdgeFaceRegions();
+
+ //- Construct from regions
+ inline patchEdgeFaceRegions(const labelList&);
+
+ //- Construct from regions (on edge)
+ inline patchEdgeFaceRegions(const labelPair&);
+
+
+ // Member Functions
+
+ // Access
+
+ inline const labelList& regions() const;
+
+
+ // Needed by meshWave
+
+ //- Check whether origin has been changed at all or
+ // still contains original (invalid) value.
+ template
+ inline bool valid(TrackingData& td) const;
+
+ //- Apply rotation matrix
+ template
+ inline void transform
+ (
+ const polyMesh& mesh,
+ const Patch& patch,
+ const tensor& rotTensor,
+ const scalar tol,
+ TrackingData& td
+ );
+
+ //- Influence of face on edge
+ template
+ inline bool updateEdge
+ (
+ const polyMesh& mesh,
+ const Patch& patch,
+ const label edgeI,
+ const label faceI,
+ const patchEdgeFaceRegions& faceInfo,
+ const scalar tol,
+ TrackingData& td
+ );
+
+ //- New information for edge (from e.g. coupled edge)
+ template
+ inline bool updateEdge
+ (
+ const polyMesh& mesh,
+ const Patch& patch,
+ const patchEdgeFaceRegions& edgeInfo,
+ const bool sameOrientation,
+ const scalar tol,
+ TrackingData& td
+ );
+
+ //- Influence of edge on face.
+ template
+ inline bool updateFace
+ (
+ const polyMesh& mesh,
+ const Patch& patch,
+ const label faceI,
+ const label edgeI,
+ const patchEdgeFaceRegions& edgeInfo,
+ const scalar tol,
+ TrackingData& td
+ );
+
+ //- Same (like operator==)
+ template
+ inline bool equal(const patchEdgeFaceRegions&, TrackingData&) const;
+
+
+ // Member Operators
+
+ // Needed for List IO
+ inline bool operator==(const patchEdgeFaceRegions&) const;
+ inline bool operator!=(const patchEdgeFaceRegions&) const;
+
+
+ // IOstream Operators
+
+ friend Ostream& operator<<(Ostream&, const patchEdgeFaceRegions&);
+ friend Istream& operator>>(Istream&, patchEdgeFaceRegions&);
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "patchEdgeFaceRegionsI.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegionsI.H b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegionsI.H
new file mode 100644
index 0000000000..f39488a018
--- /dev/null
+++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchEdgeFaceRegionsI.H
@@ -0,0 +1,282 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2013 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 "polyMesh.H"
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+inline Foam::patchEdgeFaceRegions::patchEdgeFaceRegions()
+{}
+
+
+inline Foam::patchEdgeFaceRegions::patchEdgeFaceRegions
+(
+ const labelList& regions
+)
+:
+ regions_(regions)
+{}
+
+
+inline Foam::patchEdgeFaceRegions::patchEdgeFaceRegions
+(
+ const labelPair& regions
+)
+:
+ regions_(2)
+{
+ regions_[0] = regions[0];
+ regions_[1] = regions[1];
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+inline const Foam::labelList& Foam::patchEdgeFaceRegions::regions() const
+{
+ return regions_;
+}
+
+
+template
+inline bool Foam::patchEdgeFaceRegions::valid(TrackingData& td) const
+{
+ return regions_.size() && (findIndex(regions_, labelMax) == -1);
+}
+
+
+template
+inline void Foam::patchEdgeFaceRegions::transform
+(
+ const polyMesh& mesh,
+ const Patch& patch,
+ const tensor& rotTensor,
+ const scalar tol,
+ TrackingData& td
+)
+{}
+
+
+template
+inline bool Foam::patchEdgeFaceRegions::updateEdge
+(
+ const polyMesh& mesh,
+ const Patch& patch,
+ const label edgeI,
+ const label faceI,
+ const patchEdgeFaceRegions& faceInfo,
+ const scalar tol,
+ TrackingData& td
+)
+{
+ const face& f = patch.localFaces()[faceI];
+ const edge& e = patch.edges()[edgeI];
+
+ label index = findIndex(patch.faceEdges()[faceI], edgeI);
+ bool sameOrientation = (f[index] == e.start());
+
+ // Get information in edge-order
+ edge orientedInfo
+ (
+ faceInfo.regions_[index],
+ faceInfo.regions_[f.fcIndex(index)]
+ );
+ if (!sameOrientation)
+ {
+ orientedInfo.flip();
+ }
+
+ if (!faceInfo.valid(td))
+ {
+ FatalErrorIn("patchEdgeFaceRegions::updateEdge(..)")
+ << "problem." << abort(FatalError);
+ }
+
+ if ((findIndex(orientedInfo, -1) != -1) || (findIndex(regions_, -1) != -1))
+ {
+ // Blocked edge/face
+ return false;
+ }
+
+
+ bool changed = false;
+
+ regions_.setSize(orientedInfo.size(), labelMax);
+ forAll(orientedInfo, i)
+ {
+ if (orientedInfo[i] != -1 && orientedInfo[i] < regions_[i])
+ {
+ regions_[i] = orientedInfo[i];
+ changed = true;
+ }
+ }
+ return changed;
+}
+
+
+template
+inline bool Foam::patchEdgeFaceRegions::updateEdge
+(
+ const polyMesh& mesh,
+ const Patch& patch,
+ const patchEdgeFaceRegions& edgeInfo,
+ const bool sameOrientation,
+ const scalar tol,
+ TrackingData& td
+)
+{
+ // Get information in edge-order
+ edge orientedInfo(edgeInfo.regions_[0], edgeInfo.regions_[1]);
+ if (!sameOrientation)
+ {
+ orientedInfo.flip();
+ }
+
+
+ if (!edgeInfo.valid(td))
+ {
+ FatalErrorIn("patchEdgeFaceRegions::updateEdge(..)")
+ << "problem." << abort(FatalError);
+ }
+
+ if ((findIndex(orientedInfo, -1) != -1) || (findIndex(regions_, -1) != -1))
+ {
+ // Blocked edge/face
+ return false;
+ }
+
+
+ bool changed = false;
+
+ regions_.setSize(orientedInfo.size(), labelMax);
+ forAll(orientedInfo, i)
+ {
+ if (orientedInfo[i] != -1 && orientedInfo[i] < regions_[i])
+ {
+ regions_[i] = orientedInfo[i];
+ changed = true;
+ }
+ }
+ return changed;
+}
+
+
+template
+inline bool Foam::patchEdgeFaceRegions::updateFace
+(
+ const polyMesh& mesh,
+ const Patch& patch,
+ const label faceI,
+ const label edgeI,
+ const patchEdgeFaceRegions& edgeInfo,
+ const scalar tol,
+ TrackingData& td
+)
+{
+ const face& f = patch.localFaces()[faceI];
+ const edge& e = patch.edges()[edgeI];
+
+ // Find starting point of edge on face.
+ label index0 = findIndex(patch.faceEdges()[faceI], edgeI);
+ label index1 = f.fcIndex(index0);
+ bool sameOrientation = (f[index0] == e.start());
+
+
+ // Get information in face-order
+ edge orientedInfo
+ (
+ edgeInfo.regions_[0],
+ edgeInfo.regions_[1]
+ );
+ if (!sameOrientation)
+ {
+ orientedInfo.flip();
+ }
+
+ if (!edgeInfo.valid(td))
+ {
+ FatalErrorIn("patchEdgeFaceRegions::updateFace(..)")
+ << "problem." << abort(FatalError);
+ }
+
+ if ((findIndex(orientedInfo, -1) != -1) || (findIndex(regions_, -1) != -1))
+ {
+ // Blocked edge/face
+ return false;
+ }
+
+
+ bool changed = false;
+
+ // Scale if needed
+ regions_.setSize(f.size(), labelMax);
+
+ if (orientedInfo[0] < regions_[index0])
+ {
+ regions_[index0] = orientedInfo[0];
+ changed = true;
+ }
+ if (orientedInfo[1] < regions_[index1])
+ {
+ regions_[index1] = orientedInfo[1];
+ changed = true;
+ }
+
+ return changed;
+}
+
+
+template
+inline bool Foam::patchEdgeFaceRegions::equal
+(
+ const patchEdgeFaceRegions& rhs,
+ TrackingData& td
+) const
+{
+ return operator==(rhs);
+}
+
+
+// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
+
+inline bool Foam::patchEdgeFaceRegions::operator==
+(
+ const Foam::patchEdgeFaceRegions& rhs
+) const
+{
+ return regions() == rhs.regions();
+}
+
+
+inline bool Foam::patchEdgeFaceRegions::operator!=
+(
+ const Foam::patchEdgeFaceRegions& rhs
+) const
+{
+ return !(*this == rhs);
+}
+
+
+// ************************************************************************* //