Go to the documentation of this file.
38 template<
class Container,
class T>
39 void Foam::Pstream::exchangeContainer
41 const UList<Container>& sendBufs,
43 List<Container>& recvBufs,
62 recvBufs[proci].data_bytes(),
63 recvSizes[proci]*
sizeof(
T),
84 sendBufs[proci].cdata_bytes(),
85 sendBufs[proci].size_bytes(),
92 <<
"Cannot send outgoing message. "
93 <<
"to:" << proci <<
" nBytes:"
94 << label(sendBufs[proci].size()*
sizeof(
T))
112 void Foam::Pstream::exchangeBuf
115 const UList<const char*>& sendBufs,
117 List<char*>& recvBufs,
137 recvSizes[proci]*
sizeof(
T),
159 sendSizes[proci]*
sizeof(
T),
166 <<
"Cannot send outgoing message. "
167 <<
"to:" << proci <<
" nBytes:"
168 << label(sendSizes[proci]*
sizeof(
T))
185 template<
class Container,
class T>
206 <<
"Size of list " << sendBufs.
size()
207 <<
" does not equal the number of processors "
219 const label nRecv = recvSizes[proci];
223 recvBufs[proci].
setSize(nRecv);
230 exchangeContainer<Container, T>
252 maxNSend =
max(maxNSend, sendBufs[proci].size());
256 const label maxNBytes =
sizeof(
T)*maxNSend;
286 for (label iter = 0; iter < nIter; iter++)
293 sendBufs[proci].size()-startSend[proci]
295 charSendBufs[proci] =
298 ?
reinterpret_cast<const char*
>
300 &(sendBufs[proci][startSend[proci]])
308 recvBufs[proci].size()-startRecv[proci]
311 charRecvBufs[proci] =
314 ?
reinterpret_cast<char*
>
316 &(recvBufs[proci][startRecv[proci]])
335 startSend[proci] += nSend[proci];
336 startRecv[proci] += nRecv[proci];
347 template<
class Container>
350 const Container& sendBufs,
358 <<
"Size of container " << sendBufs.size()
359 <<
" does not equal the number of processors "
367 sendSizes[proci] = sendBufs[proci].size();
369 recvSizes.
setSize(sendSizes.size());
370 allToAll(sendSizes, recvSizes, comm);
374 template<
class Container,
class T>
385 exchangeSizes(sendBufs, recvSizes, comm);
387 exchange<Container, T>(sendBufs, recvSizes, recvBufs, tag, comm,
block);
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
static bool write(const commsTypes commsType, const int toProcNo, const char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=UPstream::worldComm)
Write given buffer to given processor.
static constexpr const zero Zero
Global zero (0)
static void exchangeSizes(const Container &sendData, labelList &sizes, const label comm=UPstream::worldComm)
Helper: exchange sizes of sendData. sendData is the data per.
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
static label read(const commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=UPstream::worldComm)
Read into given buffer from given processor.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
#define forAll(list, i)
Loop across all elements in list.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
void setSize(const label n)
Alias for resize()
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
static void exchange(const UList< Container > &sendData, const labelUList &recvSizes, List< Container > &recvData, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, const bool block=true)
Helper: exchange contiguous data. Sends sendData, receives into.
errorManip< error > abort(error &err)
Inter-processor communication reduction functions.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static label nRequests()
Get number of outstanding requests.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
static int maxCommsSize
Optional maximum message size (bytes)
static bool & parRun() noexcept
Test if this a parallel run.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
UList< label > labelUList
A UList of labels.
static label nProcs(const label communicator=worldComm)
Number of processes in parallel run, and 1 for serial run.
A template class to specify that a data type can be considered as being contiguous in memory.