44 MeshObject_type(
mesh),
46 globalNumbering_(stencil_.globalNumbering()),
48 pBufs_(
UPstream::commsTypes::nonBlocking),
49 cyclicBoundaryCells_(
mesh.nCells(), false)
55 bool hasCyclicPatches =
false;
64 hasCyclicPatches =
true;
74 forAll(cyclicBoundaryCells_, celli)
76 if (cyclicBoundaryCells_.test(celli))
78 isCyclicCell[celli] =
true;
97 auto* ptr =
mesh.thisDb().getObjectPtr<zoneDistribute>(
"zoneDistribute");
101 ptr =
new zoneDistribute(
mesh);
135 for (
const label celli : stencil.
needsComm())
139 for (
const label gblIdx : stencil_[celli])
141 const label proci = globalNumbering_.whichProcID(gblIdx);
145 needed[proci].insert(gblIdx);
156 for (
const int proci : pBufs_.allProcs())
158 const auto& indices = needed[proci];
164 toProc << indices.sortedToc();
168 pBufs_.finishedSends(sendConnections_, sendProcs_, recvProcs_);
170 for (
const int proci : pBufs_.allProcs())
172 send_[proci].clear();
177 fromProc >> send_[proci];
186 const label globalIdx,
187 const vector globalIdxCellCentre
194 if (!cyclicBoundaryCells_.test(celli))
212 celliCyclicPatches.append(patchi);
219 if (globalNumbering_.isLocal(globalIdx))
224 const labelList& cellPoints = mesh_.cellPoints()[celli];
226 for (
const label cellPoint : cellPoints)
228 const labelList& pointKCells = mesh_.pointCells()[cellPoint];
230 for (
const label pointKCell : pointKCells)
232 if (!localPointNeiCells.found(pointKCell))
234 localPointNeiCells.append(pointKCell);
242 const label localIdx = globalNumbering_.toLocal(globalIdx);
243 if (!localPointNeiCells.found(localIdx))
245 for (
const label patchi : celliCyclicPatches)
275 forAll(celliCyclicPatches, cID)
277 cyclicID[cID] = celliCyclicPatches[cID];
279 const label& patchI = celliCyclicPatches[cID];
286 <<
"Rotational cyclic patches are not supported in parallel.\n"
287 <<
"Try to decompose the domain so that the rotational cyclic patch "
288 <<
"is not split in between processors."
294 for(
int i = 0; i < 2; i++)
296 for(
int j = 0; j < 2; j++)
298 for(
int k = 0;
k < 2;
k++)
300 vector separation = i*separationVectors[0]
301 + j*separationVectors[1]
302 +
k*separationVectors[2];
304 scalar testDistance =
mag
306 (globalIdxCellCentre - separation)
322 for(
int n = 0;
n < 3;
n++)
324 if(cyclicID[
n] != -1 && applyCyclic[
n] == 1)
333 Info <<
"cpp.name() " << cpp.name() <<
endl;
357 vector position(getValue(positions, valuesFromOtherProc, gblIdx));
363 const label patchi = cyclicPatchID[i];
373 cpp.neighbPatch().transformPosition(position, 0);
375 else if (globalNumbering_.isLocal(gblIdx))
377 const label localIdx = globalNumbering_.toLocal(gblIdx);
379 for (
const label facei : mesh_.cells()[localIdx])
381 if (mesh_.boundaryMesh().whichPatch(facei) == cyclicPatchID[i])
383 cpp.neighbPatch().transformPosition(position, facei);
391 <<
"Rotational cyclic patches are not supported in parallel.\n"
392 <<
"Try to decompose the domain so that the rotational cyclic"
393 <<
"patch is not split in between processors."
const Mesh & mesh() const noexcept
Return const reference to mesh.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &val)
Append an element at the end of the list.
A HashTable to objects of type <T> with a label key.
const fvMesh & mesh() const noexcept
bool allowClearRecv() const noexcept
Is clearStorage of individual receive buffer by external hooks allowed? (default: true).
void append(autoPtr< T > &ptr)
Move append an element to the end of the list.
Input inter-processor communications stream using MPI send/recv etc. - operating on external buffer.
bool found(const T &val, label pos=0) const
Same as contains().
Output inter-processor communications stream using MPI send/recv etc. - operating on external buffer.
Inter-processor communications stream.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
static bool & parRun() noexcept
Test if this a parallel run.
void set(const bitSet &bitset)
Set specified bits from another bitset.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
virtual transformType transform() const
Type of transform.
const cyclicPolyPatch & neighbPatch() const
virtual void transformPosition(pointField &l) const
Transform a patch-based position from other side to this side.
virtual label neighbPatchID() const
Neighbour patchID.
Smooth ATC in cells next to a set of patches supplied by type.
Mesh data needed to do the Finite Volume discretisation.
const word & name() const noexcept
The patch name.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
const labelUList & faceCells() const
Return face-cell addressing.
bool store()
Register object with its registry and transfer ownership to the registry.
computes a cell point cell stencil in a narrow band. resizes in case of topological change
static zoneCPCStencil & New(const fvMesh &)
const labelHashSet & needsComm() noexcept
void updateStencil(const boolList &zone)
Class for parallel communication in a narrow band. It either provides a Map with the neighbouring val...
const globalIndex & globalNumbering() const noexcept
Addressing reference.
List< label > getCyclicPatches(const label celli, const label globalIdx, const vector globalIdxCellCentre) const
Finds and returns list of all cyclic patch labels to which celli's.
void updateStencil(const boolList &zone)
Updates stencil with boolList the size has to match mesh nCells.
void setUpCommforZone(const boolList &zone, bool updateStencil=true)
Update stencil with boolList the size has to match mesh nCells.
Type getValue(const VolumeField< Type > &phi, const Map< Type > &valuesFromOtherProc, const label gblIdx) const
Gives patchNumber and patchFaceNumber for a given Geometric volume field.
zoneDistribute(const fvMesh &)
Construct from fvMesh.
static zoneDistribute & New(const fvMesh &)
Selector.
Map< Field< Type > > getFields(const boolList &zone, const VolumeField< Type > &phi)
Returns stencil and provides a Map with globalNumbering.
vector getPosition(const VolumeField< vector > &positions, const Map< vector > &valuesFromOtherProc, const label gblIdx, const List< label > cyclicPatchID=List< label >()) const
Base class for mesh zones.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Namespace for handling debugging switches.
scalar distance(const vector &p1, const vector &p2)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
GeometricField< Type, fvPatchField, volMesh > VolumeField
A volume field for a given type.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
List< bool > boolList
A List of bools.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
PrimitivePatch< List< face >, const pointField > bMesh
Holder of faceList and points. (v.s. e.g. primitivePatch which references points).
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define forAll(list, i)
Loop across all elements in list.