diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C index db392d9137..bc9794e06a 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C @@ -169,7 +169,7 @@ Foam::PackedList<1> Foam::syncTools::getMasterPoints(const polyMesh& mesh) else { FatalErrorIn("syncTools::getMasterPoints(const polyMesh&)") - << "Cannot handle patch " << patches[patchI].name() + << "Cannot handle coupled patch " << patches[patchI].name() << " of type " << patches[patchI].type() << abort(FatalError); } @@ -290,7 +290,7 @@ Foam::PackedList<1> Foam::syncTools::getMasterEdges(const polyMesh& mesh) else { FatalErrorIn("syncTools::getMasterEdges(const polyMesh&)") - << "Cannot handle patch " << patches[patchI].name() + << "Cannot handle coupled patch " << patches[patchI].name() << " of type " << patches[patchI].type() << abort(FatalError); } @@ -314,6 +314,54 @@ Foam::PackedList<1> Foam::syncTools::getMasterEdges(const polyMesh& mesh) } +// Determines for every face whether it is coupled and if so sets only one. +Foam::PackedList<1> Foam::syncTools::getMasterFaces(const polyMesh& mesh) +{ + PackedList<1> isMasterFace(mesh.nFaces(), 1); + + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + forAll(patches, patchI) + { + if (patches[patchI].coupled()) + { + if (Pstream::parRun() && isA(patches[patchI])) + { + const processorPolyPatch& pp = + refCast(patches[patchI]); + + if (!pp.owner()) + { + forAll(pp, i) + { + isMasterFace.set(pp.start()+i, 0); + } + } + } + else if (isA(patches[patchI])) + { + const cyclicPolyPatch& pp = + refCast(patches[patchI]); + + for (label i = pp.size()/2; i < pp.size(); i++) + { + isMasterFace.set(pp.start()+i, 0); + } + } + else + { + FatalErrorIn("syncTools::getMasterFaces(const polyMesh&)") + << "Cannot handle coupled patch " << patches[patchI].name() + << " of type " << patches[patchI].type() + << abort(FatalError); + } + } + } + + return isMasterFace; +} + + template <> void Foam::syncTools::separateList ( diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H index 608d3bd2ba..7312e08e55 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H @@ -226,9 +226,12 @@ public: //- Get per point whether is it master (of a coupled set of points) static PackedList<1> getMasterPoints(const polyMesh&); - //- Get per edge whether is it master (of a coupled set of edge) + //- Get per edge whether is it master (of a coupled set of edges) static PackedList<1> getMasterEdges(const polyMesh&); + //- Get per face whether is it master (of a coupled set of faces) + static PackedList<1> getMasterFaces(const polyMesh&); + };