33template<
typename Type>
34Type Foam::zoneDistribute::getLocalValue
36 const VolumeField<Type>&
phi,
40 if (localIdx <
mesh_.nCells())
45 return faceValue(
phi,localIdx);
49template<
typename Type>
50Type Foam::zoneDistribute::faceValue
56 const label faceI = localIdx + mesh_.nInternalFaces() - mesh_.nCells();
63 if (patchI < 0 || patchI >=
pbm.
size())
66 <<
"Cannot find patch for face " << faceI
72 const label patchFaceI =
pp.whichFace(faceI);
74 return phi.boundaryField()[patchI][patchFaceI];
78template<
typename Type>
86 if (globalNumbering_.isLocal(gblIdx))
88 const label localIdx = globalNumbering_.toLocal(gblIdx);
89 return getLocalValue(
phi,localIdx);
94 return valuesFromOtherProc[gblIdx];
99template<
typename Type>
106 if (zone.size() !=
phi.size())
109 <<
"size of zone: " << zone.size()
110 <<
"size of phi:" <<
phi.size()
111 <<
"do not match. Did the mesh change?"
129 for (
const label gblIdx : stencil_[celli])
131 tmpField.append(getValue(
phi, neiValues, gblIdx));
134 stencilWithValues.emplace(celli, tmpField);
138 return stencilWithValues;
141template<
typename Type>
146 const bool& checkTransformation
153 <<
"size of phi:" <<
phi.size()
154 <<
"do not match. Did the mesh change?"
172 for (
const label gblIdx : stencil_[celli])
175 if(checkTransformation)
177 cyclicPatches = getCyclicPatches
181 getValue(
phi, neiValues, gblIdx)
187 getPosition(
phi, neiValues, gblIdx, cyclicPatches)
191 stencilWithValues.emplace(celli, tmpField);
195 return stencilWithValues;
199template<
typename Type>
206 if (zone.size() !=
phi.size())
209 <<
"size of zone: " << zone.size()
210 <<
"size of phi:" <<
phi.size()
211 <<
"do not match. Did the mesh change?"
221 if (sendConnections_.empty())
224 <<
"The send/recv connections not initialized - "
225 <<
"likely that setUpCommforZone() was not called"
235 for (
const int proci : pBufs_.allProcs())
237 const auto& indices = send_[proci];
244 for (
const label sendIdx : indices)
249 getLocalValue(
phi, globalNumbering_.toLocal(sendIdx))
254 toProc << sendValues;
258 pBufs_.finishedSends(sendConnections_, sendProcs_, recvProcs_);
260 for (
const int proci : pBufs_.allProcs())
267 neiValues += tmpValues;
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyBoundaryMesh & pbm
Dynamically sized Field. Similar to DynamicList, but inheriting from a Field instead of a List.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void append(const T &val)
Append an element at the end of the list.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
bool emplace(const Key &key, Args &&... args)
Emplace insert a new entry, not overwriting existing entries.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A HashTable to objects of type <T> with a label key.
Input inter-processor communications stream using MPI send/recv etc. - operating on external buffer.
void size(const label n)
Older name for setAddressableSize.
Output inter-processor communications stream using MPI send/recv etc. - operating on external buffer.
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.
label size() const noexcept
The number of entries in the list.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
label whichPatch(const label meshFacei) const
Return patch index for a given mesh face index. Uses binary search.
A patch is a list of labels that address the faces in the global face list.
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.
Type getValue(const VolumeField< Type > &phi, const Map< Type > &valuesFromOtherProc, const label gblIdx) const
Gives patchNumber and patchFaceNumber for a given Geometric volume field.
Map< Type > getDatafromOtherProc(const boolList &zone, const VolumeField< Type > &phi)
Returns stencil and provides a Map with globalNumbering.
Map< Field< Type > > getPositionFields(const boolList &zone, const VolumeField< Type > &phi, const bool &checkTransformation=false)
Returns stencil and provides a Map with globalNumbering.
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 FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
GeometricField< Type, fvPatchField, volMesh > VolumeField
A volume field for a given type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
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...
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define forAll(list, i)
Loop across all elements in list.