36 template<
class Container,
class T>
53 if (sendBufs.
size() != UPstream::nProcs(comm))
56 <<
"Size of list " << sendBufs.
size()
57 <<
" does not equal the number of processors " 58 << UPstream::nProcs(comm)
64 if (UPstream::parRun() && UPstream::nProcs(comm) > 1)
66 label startOfRequests = Pstream::nRequests();
73 label nRecv = recvSizes[proci];
75 if (proci != Pstream::myProcNo(comm) && nRecv > 0)
80 UPstream::commsTypes::nonBlocking,
82 reinterpret_cast<char*>(recvBufs[proci].begin()),
96 if (proci != Pstream::myProcNo(comm) && sendBufs[proci].size() > 0)
102 UPstream::commsTypes::nonBlocking,
104 reinterpret_cast<const char*>(sendBufs[proci].begin()),
105 sendBufs[proci].size()*
sizeof(
T),
112 <<
"Cannot send outgoing message. " 113 <<
"to:" << proci <<
" nBytes:" 114 <<
label(sendBufs[proci].size()*
sizeof(
T))
126 Pstream::waitRequests(startOfRequests);
131 recvBufs[Pstream::myProcNo(comm)] = sendBufs[Pstream::myProcNo(comm)];
135 template<
class Container>
138 const Container& sendBufs,
143 if (sendBufs.size() != UPstream::nProcs(comm))
146 <<
"Size of container " << sendBufs.size()
147 <<
" does not equal the number of processors " 148 << UPstream::nProcs(comm)
155 sendSizes[proci] = sendBufs[proci].size();
157 recvSizes.
setSize(sendSizes.size());
158 allToAll(sendSizes, recvSizes, comm);
162 template<
class Container,
class T>
173 exchangeSizes(sendBufs, recvSizes, comm);
175 exchange<Container, T>(sendBufs, recvSizes, recvBufs, tag, comm, block);
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Template function to specify if the data of a type are contiguous.
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.
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
static void exchangeSizes(const Container &sendData, labelList &sizes, const label comm=UPstream::worldComm)
Helper: exchange sizes of sendData. sendData is the data per.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
errorManip< error > abort(error &err)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void setSize(const label)
Reset size of List.
label size() const
Return the number of elements in the UList.