46 template<
class T,
class CombineOp>
63 for (
const label belowID : myComm.below())
73 reinterpret_cast<char*>(&received),
81 Perr<<
" received from " 82 << belowID <<
" data:" << received <<
endl;
97 T received(fromBelow);
101 Perr<<
" received from " 102 << belowID <<
" data:" << received <<
endl;
105 cop(value, received);
110 if (myComm.above() >= 0)
114 Perr<<
" sending to " << myComm.above()
115 <<
" data:" << value <<
endl;
124 reinterpret_cast<const char*
>(&value),
139 template<
class T,
class CombineOp>
143 const CombineOp& cop,
158 template<
class T,
class CombineOp>
162 const CombineOp& cop,
175 for (
const label belowID : myComm.below())
185 received.data_bytes(),
186 received.size_bytes(),
193 Perr<<
" received from " 194 << belowID <<
" data:" << received <<
endl;
199 cop(
values[i], received[i]);
216 Perr<<
" received from " 217 << belowID <<
" data:" << received <<
endl;
222 cop(
values[i], received[i]);
228 if (myComm.above() >= 0)
232 Perr<<
" sending to " << myComm.above()
257 template<
class T,
class CombineOp>
261 const CombineOp& cop,
276 template<
class Container,
class CombineOp>
280 const CombineOp& cop,
293 for (
const label belowID : myComm.below())
305 Container received(fromBelow);
309 Perr<<
" received from " 310 << belowID <<
" data:" << received <<
endl;
315 auto recvIter = received.cbegin();
316 recvIter != received.cend();
320 auto masterIter =
values.find(recvIter.key());
322 if (masterIter.good())
325 cop(masterIter.val(), recvIter.val());
330 values.insert(recvIter.key(), recvIter.val());
336 if (myComm.above() >= 0)
340 Perr<<
" sending to " << myComm.above()
350 template<
class Container,
class CombineOp>
354 const CombineOp& cop,
static void listCombineGather(UList< T > &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Combines List elements.
prefixOSstream Perr
OSstream wrapped stderr (std::cerr) with parallel prefix.
static void mapCombineGather(Container &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Combine Map elements.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const List< commsStruct > & whichCommunication(const label communicator=worldComm)
Communication schedule for all-to-master (proc 0) as linear/tree/none with switching based on UPstrea...
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
#define forAll(list, i)
Loop across all elements in list.
Input inter-processor communications stream.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
"scheduled" (MPI standard) : (MPI_Send, MPI_Recv)
static void combineReduce(T &value, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) applying cop to inplace combine value from different processors...
static void combineGather(T &value, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Gather data, applying cop to inplace combine value from different processors.
static bool is_parallel(const label communicator=worldComm)
True if parallel algorithm or exchange is required.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
int debug
Static debugging option.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
A template class to specify that a data type can be considered as being contiguous in memory...
static bool write(const UPstream::commsTypes commsType, const int toProcNo, const char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, UPstream::Request *req=nullptr, const UPstream::sendModes sendMode=UPstream::sendModes::normal)
Write buffer contents to given processor.
static void mapCombineReduce(Container &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) applying cop to inplace combine map values from different processo...
bool send()
Send buffer contents now and not in destructor [advanced usage]. Returns true on success.
static std::streamsize read(const UPstream::commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, UPstream::Request *req=nullptr)
Read buffer contents from given processor.
static void listCombineReduce(List< T > &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Combines List elements. After completion all processors have the same data.