diff --git a/src/finiteArea/faMesh/faMesh.C b/src/finiteArea/faMesh/faMesh.C index cbd79c183..959447b31 100644 --- a/src/finiteArea/faMesh/faMesh.C +++ b/src/finiteArea/faMesh/faMesh.C @@ -38,6 +38,7 @@ Description #include "faMeshLduAddressing.H" #include "wedgeFaPatch.H" #include "faPatchData.H" +#include "SortableList.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -577,12 +578,155 @@ Foam::faMesh::faMesh if (tmpList.size() > 0) { - label pI = faPatches.size()-1; + // Check for processor edges + labelList allUndefEdges = tmpList; + labelList ngbPolyPatch(allUndefEdges.size(), -1); + forAll(ngbPolyPatch, edgeI) + { + label curEdge = allUndefEdges[edgeI]; - faPatches[pI].name_ = "undefined"; - faPatches[pI].type_ = "patch"; - faPatches[pI].edgeLabels_ = tmpList; + label curPMeshEdge = meshEdges[curEdge]; + + forAll(edgeFaces[curPMeshEdge], faceI) + { + label curFace = edgeFaces[curPMeshEdge][faceI]; + + if (findIndex(faceLabels_, curFace) == -1) + { + label polyPatchID = + m.boundaryMesh().whichPatch(curFace); + + if (polyPatchID != -1) + { + ngbPolyPatch[edgeI] = polyPatchID; + } + } + } + } + + //Count ngb processorPolyPatch-es + labelHashSet processorPatchSet; + forAll(ngbPolyPatch, edgeI) + { + if (ngbPolyPatch[edgeI] != -1) + { + if + ( + m.boundaryMesh()[ngbPolyPatch[edgeI]].type() + == processorPolyPatch::typeName + ) + { + if(!processorPatchSet.found(ngbPolyPatch[edgeI])) + { + processorPatchSet.insert(ngbPolyPatch[edgeI]); + } + } + } + } + labelList processorPatches(processorPatchSet.toc()); + faPatches.setSize(faPatches.size() + processorPatches.size()); + + for(label i=0; i tmpLst; + + forAll (ngbPolyPatch, eI) + { + if (ngbPolyPatch[eI] == processorPatches[i]) + { + tmpLst.append(allUndefEdges[eI]); + } + } + + faPatches[faPatchNames.size() + i].edgeLabels_ = tmpLst; + faPatches[faPatchNames.size() + i].name_ = + m.boundaryMesh()[processorPatches[i]].name(); + faPatches[faPatchNames.size() + i].type_ = + processorFaPatch::typeName; + faPatches[faPatchNames.size() + i].ngbPolyPatchID_ = + processorPatches[i]; + } + + // Remaining undefined edges + SLList