diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C index 83f621363e..e519da59d9 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPolyPatch.C @@ -29,6 +29,8 @@ License #include "ListListOps.H" #include "meshSearch.H" #include "mapDistribute.H" +#include "meshTools.H" +#include "OFstream.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,16 +49,18 @@ void Foam::directMappedPolyPatch::collectSamples ( pointField& samples, labelList& patchFaceProcs, - labelList& patchFaces + labelList& patchFaces, + pointField& patchFc ) const { - const vectorField::subField fc = this->faceCentres(); // Collect all sample points and the faces they come from. + List globalFc(Pstream::nProcs()); List globalSamples(Pstream::nProcs()); labelListList globalFaces(Pstream::nProcs()); - globalSamples[Pstream::myProcNo()] = fc+offset_; + globalFc[Pstream::myProcNo()] = this->faceCentres(); + globalSamples[Pstream::myProcNo()] = globalFc[Pstream::myProcNo()]+offset_; globalFaces[Pstream::myProcNo()] = identity(size()); // Distribute to all processors @@ -64,6 +68,8 @@ void Foam::directMappedPolyPatch::collectSamples Pstream::scatterList(globalSamples); Pstream::gatherList(globalFaces); Pstream::scatterList(globalFaces); + Pstream::gatherList(globalFc); + Pstream::scatterList(globalFc); // Rework into straight list samples = ListListOps::combine @@ -76,6 +82,11 @@ void Foam::directMappedPolyPatch::collectSamples globalFaces, accessOp() ); + patchFc = ListListOps::combine + ( + globalFc, + accessOp() + ); patchFaceProcs.setSize(patchFaces.size()); labelList nPerProc @@ -103,11 +114,14 @@ void Foam::directMappedPolyPatch::findSamples ( const pointField& samples, labelList& sampleCellProcs, - labelList& sampleCells + labelList& sampleCells, + pointField& sampleCc ) const { sampleCellProcs.setSize(samples.size()); sampleCells.setSize(samples.size()); + sampleCc.setSize(samples.size()); + sampleCc = point(-GREAT, -GREAT, -GREAT); { // Octree based search engine @@ -124,6 +138,8 @@ void Foam::directMappedPolyPatch::findSamples else { sampleCellProcs[sampleI] = Pstream::myProcNo(); + sampleCc[sampleI] = + boundaryMesh().mesh().cellCentres()[sampleCells[sampleI]]; } } } @@ -136,6 +152,9 @@ void Foam::directMappedPolyPatch::findSamples Pstream::listCombineGather(sampleCellProcs, maxEqOp