94 transferBuf_.setCapacity(bufferSize + 2*
sizeof(scalar) + 1);
117 template<
class Type,
unsigned N>
126 template<
class Type,
class... Args>
138 template<
class ListType>
150 template<
class T,
class BinaryOp,
bool InplaceMode>
164 template<
class T,
class BinaryOp,
bool InplaceMode>
180 template<
class T,
class BinaryOp,
bool InplaceMode=false>
222 template<
class T,
class CombineOp>
235 template<
class T,
class CombineOp>
246 template<
class T,
class CombineOp>
264 template<
class T,
class BinaryOp,
bool InplaceMode>
278 template<
class T,
class BinaryOp,
bool InplaceMode>
293 template<
class T,
class BinaryOp,
bool InplaceMode=false>
304 template<
class T,
class CombineOp>
319 template<
class T,
class BinaryOp,
bool InplaceMode=false>
330 template<
class T,
class CombineOp>
341 template<
class T,
class CombineOp>
359 template<
class Container,
class BinaryOp,
bool InplaceMode>
366 const int communicator
372 template<
class Container,
class BinaryOp,
bool InplaceMode>
386 template<
class Container,
class BinaryOp,
bool InplaceMode=false>
397 template<
class Container,
class CombineOp>
413 template<
class Container,
class BinaryOp,
bool InplaceMode=false>
424 template<
class Container,
class CombineOp>
435 template<
class Container,
class CombineOp>
514 template<
class Container>
519 const Container& sendBufs,
526 template<
class Container>
530 const Container& sendBufs,
541 template<
class Container>
544 const Container& sendBufs,
561 template<
class Container>
574 template<
class Container,
class Type>
582 const bool wait =
true
590 template<
class Container,
class Type>
598 const bool wait =
true
605 template<
class Container,
class Type>
612 const bool wait =
true
619 template<
class Container,
class Type>
626 const bool wait =
true
640 template<
class Container,
class Type>
647 const bool wait =
true
662 template<
class Container,
class Type>
669 const bool wait =
true
679 template<
class Container,
class Type>
685 const bool wait =
true
731 template<
class Container>
748 static
void scatterList
777 #include "PstreamBroadcast.txx"
778 #include "PstreamGather.txx"
779 #include "PstreamGatherList.txx"
780 #include "PstreamExchange.txx"
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
A 1D vector of objects of type <T> with a fixed length <N>.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A HashTable to objects of type <T> with a label key.
static void exchangeSizes(const labelUList &neighProcs, const Container &sendBufs, labelList &sizes, const int tag=UPstream::msgType(), const int comm=UPstream::worldComm)
Helper: exchange sizes of sendBufs for specified neighbour ranks.
DynamicList< char > transferBuf_
Allocated transfer buffer (can be used for send or receive).
static void listGather(UList< T > &values, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather (reduce) list elements, applying bop to each list element.
static bool gatherList_topo_algorithm(UList< T > &values, const int tag, const int communicator)
Gather data, keeping individual values separate.
static void exchange(const UList< Container > &sendBufs, const labelUList &recvSizes, List< Container > &recvBufs, const int tag=UPstream::msgType(), const int comm=UPstream::worldComm, const bool wait=true)
Helper: exchange contiguous data. Sends sendBufs, receives into recvBufs using predetermined receive ...
static void combineGather(T &value, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Forwards to Pstream::gather with an in-place cop.
static void combineReduce(T &value, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) applying cop to inplace combine value from different processors.
static void exchangeConsensus(const Map< Container > &sendBufs, Map< Container > &recvBufs, const int tag, const int comm, const bool wait=true)
Exchange contiguous data using non-blocking consensus (NBX) Sends sendData, receives into recvData.
static void exchangeSizes(const labelUList &sendProcs, const labelUList &recvProcs, const Container &sendBufs, labelList &sizes, const int tag=UPstream::msgType(), const int comm=UPstream::worldComm)
Helper: exchange sizes of sendBufs for specified send/recv ranks.
static void exchangeConsensus(const UList< Container > &sendBufs, List< Container > &recvBufs, const int tag, const int comm, const bool wait=true)
Exchange contiguous data using non-blocking consensus (NBX) Sends sendData, receives into recvData.
static void listCombineAllGather(UList< T > &values, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Same as Pstream::listCombineReduce.
static void listCombineGather(UList< T > &values, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Forwards to Pstream::listGather with an in-place cop.
ClassName("Pstream")
Declare name of the class and its debug switch.
static List< T > listGatherValues(const T &localValue, const int communicator=UPstream::worldComm, const int tag=UPstream::msgType())
Gather individual values into list locations.
static void listCombineScatter(List< T > &value, const int tag=UPstream::msgType(), const int comm=UPstream::worldComm)
Pstream(const UPstream::commsTypes commsType, int bufferSize)
Construct for communication type with given buffer size.
static void mapCombineReduce(Container &values, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Forwards to Pstream::mapReduce with an in-place cop.
static bool listGather_topo_algorithm(UList< T > &values, BinaryOp bop, const int tag, const int communicator)
Implementation: gather (reduce) list element data onto UPstream::masterNo() using a topo algorithm.
static void allGatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual communication.
static void mapCombineGather(Container &values, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Forwards to Pstream::mapGather with an in-place cop.
static Map< Container > exchangeConsensus(const Map< Container > &sendBufs, const int tag, const int comm, const bool wait=true)
Exchange contiguous data using non-blocking consensus (NBX) Sends sendData returns receive informatio...
Pstream(const UPstream::commsTypes commsType) noexcept
Construct for communication type with empty buffer.
static void gatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate.
static void broadcast(Type &value, const int communicator=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
static void mapGather(Container &values, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather (reduce) Map/HashTable containers, applying bop to combine entries from different processors.
static void listCombineReduce(UList< T > &values, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Forwards to Pstream::listReduce with an in-place cop.
static void exchange(const Map< Container > &sendBufs, const Map< label > &recvSizes, Map< Container > &recvBufs, const int tag=UPstream::msgType(), const int comm=UPstream::worldComm, const bool wait=true)
Exchange contiguous data. Sends sendBufs, receives into recvBufs.
static void gather(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather (reduce) data, applying bop to combine value from different processors. The basis for Foam::re...
static void broadcast(FixedList< Type, N > &list, const int communicator=UPstream::worldComm)
Broadcast fixed-list content (contiguous or non-contiguous) to all communicator ranks....
static void mapCombineAllGather(Container &values, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Same as Pstream::mapCombineReduce.
static void combineScatter(T &value, const int tag=UPstream::msgType(), const int comm=UPstream::worldComm)
static void broadcastList(ListType &list, const int communicator=UPstream::worldComm)
Broadcast list content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-...
static void exchange(const UList< Container > &sendBufs, List< Container > &recvBufs, const int tag=UPstream::msgType(), const int comm=UPstream::worldComm, const bool wait=true)
Exchange contiguous data. Sends sendBufs, receives into recvBufs. Determines sizes to receive.
static void listReduce(UList< T > &values, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce list elements (list must be equal size on all ranks), applying bop to each list element.
static T listScatterValues(const UList< T > &allValues, const int communicator=UPstream::worldComm, const int tag=UPstream::msgType())
Scatter individual values from list locations.
static void listGather_algorithm(const UPstream::commsStructList &comms, UList< T > &values, BinaryOp bop, const int tag, const int communicator)
Implementation: gather (reduce) list element data onto UPstream::masterNo().
static bool gather_topo_algorithm(T &value, BinaryOp bop, const int tag, const int communicator)
Implementation: gather (reduce) single element data onto UPstream::masterNo() using a topo algorithm.
static void combineAllGather(T &value, CombineOp cop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Same as Pstream::combineReduce.
static bool mapGather_topo_algorithm(Container &values, BinaryOp bop, const int tag, const int communicator)
Implementation: gather (reduce) Map/HashTable containers onto UPstream::masterNo() using a topo algor...
static void mapGather_algorithm(const UPstream::commsStructList &comms, Container &values, BinaryOp bop, const int tag, const int communicator)
Implementation: gather (reduce) Map/HashTable containers onto UPstream::masterNo().
static void exchangeSizes(const Map< Container > &sendBufs, Map< label > &recvSizes, const int tag=UPstream::msgType(), const int comm=UPstream::worldComm)
Exchange the non-zero sizes of sendBufs entries (sparse map) with other ranks in the communicator usi...
static void gatherList_algorithm(const UPstream::commsStructList &comms, UList< T > &values, const int tag, const int communicator)
Implementation: gather data, keeping individual values separate. Output is only valid (consistent) on...
static void mapReduce(Container &values, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) applying bop to combine map values from different processors....
static void scatterList_algorithm(const UPstream::commsStructList &comms, UList< T > &values, const int tag, const int communicator)
Implementation: inverse of gatherList_algorithm.
static void gather_algorithm(const UPstream::commsStructList &comms, T &value, BinaryOp bop, const int tag, const int communicator)
Implementation: gather (reduce) single element data onto UPstream::masterNo().
FOAM_DEPRECATED_FOR(2025-03, "broadcast() or broadcastList()") static void scatterList(UList< T > &values
The inverse of gatherList, but when combined with gatherList it effectively acts like a partial broad...
static void exchange(const Map< Container > &sendBufs, Map< Container > &recvBufs, const int tag=UPstream::msgType(), const int comm=UPstream::worldComm, const bool wait=true)
Exchange contiguous data. Sends sendBufs, receives into recvBufs. Determines sizes to receive.
static void exchangeSizes(const Container &sendBufs, labelList &recvSizes, const int comm=UPstream::worldComm)
Helper: exchange sizes of sendBufs. The sendBufs is the data per processor (in the communicator).
static void mapCombineScatter(Container &values, const int tag=UPstream::msgType(), const int comm=UPstream::worldComm)
static void broadcasts(const int communicator, Type &value, Args &&... values)
Broadcast multiple items to all communicator ranks. Does nothing in non-parallel.
static void scatter(T &value, const int tag=UPstream::msgType(), const int comm=UPstream::worldComm)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Collection of communication structures.
Wrapper for internally indexed communicator label. Always invokes UPstream::allocateCommunicatorCompo...
Inter-processor communications stream.
static const commsStructList & whichCommunication(const int communicator, bool linear=false)
Communication schedule for all-to-master (proc 0) as linear/tree/none with switching based on UPstrea...
commsTypes
Communications types.
static int & msgType() noexcept
Message tag of standard messages.
static bool broadcast(Type *buffer, std::streamsize count, const int communicator, const int root=UPstream::masterNo())
Broadcast buffer contents (contiguous types) to all ranks (default: from rank=0). The sizes must matc...
static bool is_parallel(const label communicator=worldComm)
True if parallel algorithm or exchange is required.
commsTypes commsType() const noexcept
Get the communications type of the stream.
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
UPstream(const commsTypes commsType) noexcept
Construct for given communication type.
@ broadcast
broadcast [MPI]
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
List< label > labelList
A List of labels.
UList< label > labelUList
A UList of labels.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
#define FOAM_DEPRECATED_FOR(since, replacement)