33template<
typename Type>
34Type Foam::zoneDistribute::getLocalValue
36 const VolumeField<Type>&
phi,
45 return faceValue(
phi,localIdx);
49template<
typename Type>
50Type Foam::zoneDistribute::faceValue
52 const VolumeField<Type>&
phi,
56 const label faceI = localIdx + mesh_.nInternalFaces() - mesh_.nCells();
58 const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
61 const label patchI = pbm.whichPatch(faceI);
63 if (patchI < 0 || patchI >= pbm.size())
66 <<
"Cannot find patch for face " << faceI
70 const polyPatch& pp = pbm[patchI];
72 const label patchFaceI = pp.whichFace(faceI);
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>
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;
142template<
typename Type>
153 <<
"size of phi:" <<
phi.
size()
154 <<
"do not match. Did the mesh change?"
164 if (sendConnections_.empty())
167 <<
"The send/recv connections not initialized - "
168 <<
"likely that setUpCommforZone() was not called"
183 Map<Type> sendValues(2*send_[proci].size());
185 for (
const label sendIdx : send_[proci])
190 getLocalValue(
phi, globalNumbering_.toLocal(sendIdx))
195 toProc << sendValues;
199 pBufs.
finishedSends(sendConnections_, sendProcs_, recvProcs_);
201 for (
const int proci : pBufs.
allProcs())
208 neiValues += tmpValues;
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.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
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 HashTable to objects of type <T> with a label key.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
UPstream::rangeType allProcs() const noexcept
Range of ranks indices associated with PstreamBuffers.
label recvDataCount(const label proci) const
void finishedSends(const bool wait=true)
Mark sends as done.
void size(const label n)
Older name for setAddressableSize.
@ nonBlocking
"nonBlocking"
static bool & parRun() noexcept
Test if this a parallel run.
label nCells() const noexcept
Number of mesh cells.
int myProcNo() const noexcept
Return processor number.
Map< Type > getDatafromOtherProc(const boolList &zone, const VolumeField< Type > &phi)
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.
Base class for mesh zones.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define forAll(list, i)
Loop across all elements in list.