diff --git a/src/finiteVolume/fvMesh/zoneDistribute/zoneDistribute.C b/src/finiteVolume/fvMesh/zoneDistribute/zoneDistribute.C index 0aa301237d..b52943570c 100644 --- a/src/finiteVolume/fvMesh/zoneDistribute/zoneDistribute.C +++ b/src/finiteVolume/fvMesh/zoneDistribute/zoneDistribute.C @@ -27,6 +27,7 @@ License \*---------------------------------------------------------------------------*/ #include "zoneDistribute.H" +#include "processorPolyPatch.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -44,10 +45,48 @@ Foam::zoneDistribute::zoneDistribute(const fvMesh& mesh) stencil_(zoneCPCStencil::New(mesh)), globalNumbering_(stencil_.globalNumbering()), send_(UPstream::nProcs()), - pBufs_(UPstream::commsTypes::nonBlocking) + pBufs_(UPstream::commsTypes::nonBlocking), + cyclicBoundaryCells_(mesh.nCells(), false) { // Don't clear storage on persistent buffer pBufs_.allowClearRecv(false); + + // Loop over boundary patches and store cells with a face on a cyclic patch + bool hasCyclicPatches = false; + forAll(mesh.boundaryMesh(), patchi) + { + const cyclicPolyPatch* cpp = + isA(mesh.boundaryMesh()[patchi]); + + if (cpp) + { + cyclicBoundaryCells_.set(cpp->faceCells()); + hasCyclicPatches = true; + } + } + + // Populate cyclicCentres_ + if(hasCyclicPatches) + { + // Make a boolList from the bitSet + boolList isCyclicCell(mesh.nCells(), false); + + forAll(cyclicBoundaryCells_, celli) + { + if (cyclicBoundaryCells_.test(celli)) + { + isCyclicCell[celli] = true; + } + } + + // Use getFields to get map of cell centres across processor boundaries + setUpCommforZone(isCyclicCell, true); + + cyclicCentres_.reset + ( + new Map(getFields(isCyclicCell, mesh_.C())) + ); + } } @@ -141,5 +180,226 @@ void Foam::zoneDistribute::setUpCommforZone } } +Foam::List Foam::zoneDistribute::getCyclicPatches +( + const label celli, + const label globalIdx +) const +{ + // Initialise cyclic patch label list + List