43 template<
class T,
class CombineOp>
53 if (UPstream::parRun() && UPstream::nProcs(comm) > 1)
56 const commsStruct& myComm = comms[UPstream::myProcNo(comm)];
68 UPstream::commsTypes::scheduled,
70 reinterpret_cast<char*>(&value),
78 Pout<<
" received from " 79 << belowID <<
" data:" << value <<
endl;
88 UPstream::commsTypes::scheduled,
98 Pout<<
" received from " 99 << belowID <<
" data:" << value <<
endl;
107 if (myComm.
above() != -1)
112 <<
" data:" << Value <<
endl;
119 UPstream::commsTypes::scheduled,
121 reinterpret_cast<const char*
>(&Value),
131 UPstream::commsTypes::scheduled,
144 template<
class T,
class CombineOp>
148 const CombineOp& cop,
153 if (UPstream::nProcs(comm) < UPstream::nProcsSimpleSum)
157 UPstream::linearCommunication(comm),
168 UPstream::treeCommunication(comm),
187 if (UPstream::parRun() && UPstream::nProcs(comm) > 1)
193 if (myComm.
above() != -1)
199 UPstream::commsTypes::scheduled,
201 reinterpret_cast<char*
>(&Value),
211 UPstream::commsTypes::scheduled,
217 Value =
T(fromAbove);
222 Pout<<
" received from " 223 << myComm.
above() <<
" data:" << Value <<
endl;
234 Pout<<
" sending to " << belowID <<
" data:" << Value <<
endl;
241 UPstream::commsTypes::scheduled,
243 reinterpret_cast<const char*>(&Value),
253 UPstream::commsTypes::scheduled,
274 if (UPstream::nProcs(comm) < UPstream::nProcsSimpleSum)
276 combineScatter(UPstream::linearCommunication(comm), Value, tag, comm);
280 combineScatter(UPstream::treeCommunication(comm), Value, tag, comm);
285 template<
class T,
class CombineOp>
290 const CombineOp& cop,
295 if (UPstream::parRun() && UPstream::nProcs(comm) > 1)
298 const commsStruct& myComm = comms[UPstream::myProcNo(comm)];
311 UPstream::commsTypes::scheduled,
313 reinterpret_cast<char*>(receivedValues.begin()),
314 receivedValues.byteSize(),
321 Pout<<
" received from " 322 << belowID <<
" data:" << receivedValues <<
endl;
327 cop(Values[i], receivedValues[i]);
334 UPstream::commsTypes::scheduled,
340 List<T> receivedValues(fromBelow);
344 Pout<<
" received from " 345 << belowID <<
" data:" << receivedValues <<
endl;
350 cop(Values[i], receivedValues[i]);
356 if (myComm.
above() != -1)
361 <<
" data:" << Values <<
endl;
368 UPstream::commsTypes::scheduled,
370 reinterpret_cast<const char*
>(Values.
begin()),
380 UPstream::commsTypes::scheduled,
393 template<
class T,
class CombineOp>
397 const CombineOp& cop,
402 if (UPstream::nProcs(comm) < UPstream::nProcsSimpleSum)
406 UPstream::linearCommunication(comm),
417 UPstream::treeCommunication(comm),
436 if (UPstream::parRun() && UPstream::nProcs(comm) > 1)
442 if (myComm.
above() != -1)
448 UPstream::commsTypes::scheduled,
450 reinterpret_cast<char*
>(Values.
begin()),
460 UPstream::commsTypes::scheduled,
471 Pout<<
" received from " 472 << myComm.
above() <<
" data:" << Values <<
endl;
483 Pout<<
" sending to " << belowID <<
" data:" << Values <<
endl;
490 UPstream::commsTypes::scheduled,
492 reinterpret_cast<const char*>(Values.
begin()),
502 UPstream::commsTypes::scheduled,
523 if (UPstream::nProcs(comm) < UPstream::nProcsSimpleSum)
527 UPstream::linearCommunication(comm),
537 UPstream::treeCommunication(comm),
546 template<
class Container,
class CombineOp>
551 const CombineOp& cop,
556 if (UPstream::parRun() && UPstream::nProcs(comm) > 1)
559 const commsStruct& myComm = comms[UPstream::myProcNo(comm)];
568 UPstream::commsTypes::scheduled,
574 Container receivedValues(fromBelow);
578 Pout<<
" received from " 579 << belowID <<
" data:" << receivedValues <<
endl;
584 typename Container::const_iterator slaveIter =
585 receivedValues.begin();
586 slaveIter != receivedValues.end();
590 typename Container::iterator
591 masterIter = Values.find(slaveIter.key());
593 if (masterIter != Values.end())
595 cop(masterIter(), slaveIter());
599 Values.insert(slaveIter.key(), slaveIter());
605 if (myComm.
above() != -1)
610 <<
" data:" << Values <<
endl;
615 UPstream::commsTypes::scheduled,
627 template<
class Container,
class CombineOp>
631 const CombineOp& cop,
636 if (UPstream::nProcs(comm) < UPstream::nProcsSimpleSum)
640 UPstream::linearCommunication(comm),
651 UPstream::treeCommunication(comm),
661 template<
class Container>
670 if (UPstream::parRun() && UPstream::nProcs(comm) > 1)
676 if (myComm.
above() != -1)
680 UPstream::commsTypes::scheduled,
690 Pout<<
" received from " 691 << myComm.
above() <<
" data:" << Values <<
endl;
702 Pout<<
" sending to " << belowID <<
" data:" << Values <<
endl;
707 UPstream::commsTypes::scheduled,
719 template<
class Container>
727 if (UPstream::nProcs(comm) < UPstream::nProcsSimpleSum)
731 UPstream::linearCommunication(comm),
741 UPstream::treeCommunication(comm),
const labelList & below() const
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Template function to specify if the data of a type are contiguous.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void mapCombineScatter(const List< commsStruct > &comms, Container &Values, const int tag, const label comm)
Scatter data. Reverse of combineGather.
Input inter-processor communications stream.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
iterator begin()
Return an iterator to begin traversing the UList.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
static void combineGather(const List< commsStruct > &comms, T &Value, const CombineOp &cop, const int tag, const label comm)
static void mapCombineGather(const List< commsStruct > &comms, Container &Values, const CombineOp &cop, const int tag, const label comm)
Structure for communicating between processors.
Output inter-processor communications stream.
std::streamsize byteSize() const
Return the binary size in number of characters of the UList.
prefixOSstream Pout(cout, "Pout")
static void combineScatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.