Go to the documentation of this file.
33 template<
class Container,
class Type>
38 const Container& procIDs,
45 if (Pstream::myProcNo(comm) == procIDs[0])
54 commsType == Pstream::commsTypes::scheduled
55 || commsType == Pstream::commsTypes::blocking
58 for (label i = 1; i < procIDs.size(); ++i)
68 reinterpret_cast<char*
>(procSlot.data()),
84 fromSlave >> procSlot;
95 <<
"nonBlocking not supported for non-contiguous data"
99 label startOfRequests = Pstream::nRequests();
102 for (label i = 1; i < procIDs.size(); ++i)
110 reinterpret_cast<char*
>(procSlot.data()),
118 Pstream::waitRequests(startOfRequests);
125 commsType == Pstream::commsTypes::scheduled
126 || commsType == Pstream::commsTypes::blocking
135 reinterpret_cast<const char*
>(
fld.cdata()),
161 <<
"nonBlocking not supported for non-contiguous data"
165 label startOfRequests = Pstream::nRequests();
172 reinterpret_cast<const char*
>(
fld.cdata()),
179 Pstream::waitRequests(startOfRequests);
197 UPstream::procID(UPstream::worldComm),
219 template<
class Container,
class Type>
224 const Container& procIDs,
232 gather(off, comm, procIDs,
fld, allFld, tag, commsType);
234 if (Pstream::myProcNo(comm) == procIDs[0])
236 fld.transfer(allFld);
254 UPstream::procID(UPstream::worldComm),
261 if (Pstream::master(UPstream::worldComm))
263 fld.transfer(allFld);
284 template<
class Container,
class Type>
289 const Container& procIDs,
296 if (Pstream::myProcNo(comm) == procIDs[0])
302 commsType == Pstream::commsTypes::scheduled
303 || commsType == Pstream::commsTypes::blocking
306 for (label i = 1; i < procIDs.size(); ++i)
321 reinterpret_cast<const char*
>(procSlot.cdata()),
348 <<
"nonBlocking not supported for non-contiguous data"
352 label startOfRequests = Pstream::nRequests();
355 for (label i = 1; i < procIDs.size(); ++i)
368 reinterpret_cast<const char*
>(procSlot.cdata()),
376 Pstream::waitRequests(startOfRequests);
383 commsType == Pstream::commsTypes::scheduled
384 || commsType == Pstream::commsTypes::blocking
393 reinterpret_cast<char*
>(
fld.data()),
419 <<
"nonBlocking not supported for non-contiguous data"
423 label startOfRequests = Pstream::nRequests();
430 reinterpret_cast<char*
>(
fld.data()),
437 Pstream::waitRequests(startOfRequests);
456 UPstream::procID(UPstream::worldComm),
465 template<
class Type,
class CombineOp>
470 const CombineOp& cop,
476 if (globalIds.
size())
492 PstreamBuffers sendBufs(Pstream::commsTypes::nonBlocking, tag, comm);
494 for (
const auto proci : validBins)
501 localIDs[i] = toLocal(proci, es[i]);
511 PstreamBuffers returnBufs(Pstream::commsTypes::nonBlocking, tag, comm);
515 if (recvSizes[proci])
531 for (
const auto proci : validBins)
533 label start = bins.
offsets()[proci];
const List< label > & offsets() const
Return the offset table (= size()+1)
Output inter-processor communications stream operating on external buffer.
Output inter-processor communications stream.
A List obtained as a section of another List.
A packed storage unstructured matrix of objects of type <T> using an offset table for access.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
#define forAll(list, i)
Loop across all elements in list.
T & last()
Return the last element of the list.
static void gatherOp(const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking)
Collect data in processor order on master.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void get(List< Type > &allFld, const labelUList &globalIds, const CombineOp &cop, const label comm=Pstream::worldComm, const int tag=UPstream::msgType()) const
Get (potentially remote) data. Elements required given as.
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
static void scatter(const labelUList &offsets, const label comm, const Container &procIDs, const UList< Type > &allFld, UList< Type > &fld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking)
Distribute data in processor order. Requires fld to be sized!
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
errorManipArg< error, int > exit(error &err, const int errNo=1)
commsTypes
Types of communications.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
A List with indirect addressing.
Input inter-processor communications stream.
Input inter-processor communications stream operating on external buffer.
void setSize(const label newSize)
Alias for resize(const label)
A template class to specify that a data type can be considered as being contiguous in memory.
static void gather(const labelUList &offsets, const label comm, const Container &procIDs, const UList< Type > &fld, List< Type > &allFld, const int tag=UPstream::msgType(), const Pstream::commsTypes commsType=Pstream::commsTypes::nonBlocking)
Collect data in processor order on master (== procIDs[0]).