46template<
class T,
class CombineOp>
62 for (
const label belowID : myComm.
below())
72 reinterpret_cast<char*
>(&received),
80 Pout<<
" received from "
81 << belowID <<
" data:" << received <<
endl;
96 T received(fromBelow);
100 Pout<<
" received from "
101 << belowID <<
" data:" << received <<
endl;
104 cop(value, received);
109 if (myComm.
above() != -1)
114 <<
" data:" << value <<
endl;
123 reinterpret_cast<const char*
>(&value),
155 #ifndef Foam_Pstream_scatter_nobroadcast
164 if (myComm.
above() != -1)
172 reinterpret_cast<char*
>(&value),
188 value =
T(fromAbove);
195 const label belowID = myComm.
below()[belowI];
203 reinterpret_cast<const char*
>(&value),
227template<
class T,
class CombineOp>
231 const CombineOp& cop,
255 #ifndef Foam_Pstream_scatter_nobroadcast
263template<
class T,
class CombineOp>
268 const CombineOp& cop,
278template<
class T,
class CombineOp>
282 const CombineOp& cop,
299template<
class T,
class CombineOp>
304 const CombineOp& cop,
315 for (
const label belowID : myComm.
below())
319 List<T> received(values.size());
333 Pout<<
" received from "
334 << belowID <<
" data:" << received <<
endl;
339 cop(values[i], received[i]);
356 Pout<<
" received from "
357 << belowID <<
" data:" << received <<
endl;
362 cop(values[i], received[i]);
368 if (myComm.
above() != -1)
373 <<
" data:" << values <<
endl;
382 values.cdata_bytes(),
414 #ifndef Foam_Pstream_scatter_nobroadcast
423 if (myComm.
above() != -1)
454 const label belowID = myComm.
below()[belowI];
462 values.cdata_bytes(),
486template<
class T,
class CombineOp>
490 const CombineOp& cop,
514 #ifndef Foam_Pstream_scatter_nobroadcast
528template<
class T,
class CombineOp>
533 const CombineOp& cop,
543template<
class T,
class CombineOp>
547 const CombineOp& cop,
564template<
class Container,
class CombineOp>
569 const CombineOp& cop,
580 for (
const label belowID : myComm.
below())
592 Container received(fromBelow);
596 Pout<<
" received from "
597 << belowID <<
" data:" << received <<
endl;
602 auto recvIter = received.cbegin();
603 recvIter != received.cend();
607 auto masterIter = values.find(recvIter.key());
609 if (masterIter != values.end())
612 cop(masterIter.val(), recvIter.val());
617 values.insert(recvIter.key(), recvIter.val());
623 if (myComm.
above() != -1)
628 <<
" data:" << values <<
endl;
645template<
class Container>
654 #ifndef Foam_Pstream_scatter_nobroadcast
663 if (myComm.
above() != -1)
677 Pout<<
" received from "
678 << myComm.
above() <<
" data:" << values <<
endl;
685 const label belowID = myComm.
below()[belowI];
689 Pout<<
" sending to " << belowID <<
" data:" << values <<
endl;
707template<
class Container,
class CombineOp>
711 const CombineOp& cop,
727template<
class Container>
735 #ifndef Foam_Pstream_scatter_nobroadcast
749template<
class Container,
class CombineOp>
754 const CombineOp& cop,
764template<
class Container,
class CombineOp>
768 const CombineOp& cop,
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Input inter-processor communications stream.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Output inter-processor communications stream.
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
static void listCombineAllGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
After completion all processors have the same data.
static void combineGather(const List< commsStruct > &comms, T &value, const CombineOp &cop, const int tag, const label comm)
static void combineScatter(const List< commsStruct > &comms, T &value, const int tag, const label comm)
Broadcast data: Distribute without modification.
static void combineAllGather(const List< commsStruct > &comms, T &value, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &value, const int tag, const label comm)
Broadcast data: Distribute without modification.
static void mapCombineScatter(const List< commsStruct > &comms, Container &values, const int tag, const label comm)
Broadcast data: Distribute without modification.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
static void mapCombineGather(const List< commsStruct > &comms, Container &values, const CombineOp &cop, const int tag, const label comm)
static void listCombineGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
static void mapCombineAllGather(const List< commsStruct > &comms, Container &values, const CombineOp &cop, const int tag, const label comm)
After completion all processors have the same data.
virtual bool read()
Re-read model coefficients if they have changed.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
std::streamsize size_bytes() const noexcept
Number of contiguous bytes for the List data.
Structure for communicating between processors.
const labelList & below() const noexcept
The procIDs of all processors directly below.
label above() const noexcept
The procID of the processor directly above.
static const List< commsStruct > & whichCommunication(const label communicator=worldComm)
static bool & parRun() noexcept
Test if this a parallel run.
virtual bool write()
Write the output fields.
int myProcNo() const noexcept
Return processor number.
Ostream & endl(Ostream &os)
Add newline and flush stream.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
#define forAll(list, i)
Loop across all elements in list.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
A template class to specify that a data type can be considered as being contiguous in memory.