Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Pstream Class Reference

Inter-processor communications stream. More...

Inheritance diagram for Pstream:
Inheritance graph
[legend]
Collaboration diagram for Pstream:
Collaboration graph
[legend]

Public Member Functions

 ClassName ("Pstream")
 
 Pstream (const commsTypes commsType, const label bufSize=0)
 Construct given optional buffer size. More...
 
- Public Member Functions inherited from UPstream
 ClassName ("UPstream")
 
 UPstream (const commsTypes commsType)
 Construct given optional buffer size. More...
 
commsTypes commsType () const
 Get the communications type of the stream. More...
 
commsTypes commsType (const commsTypes ct)
 Set the communications type of the stream. More...
 

Static Public Member Functions

template<class T , class BinaryOp >
static void gather (const List< commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
 Gather data. Apply bop to combine Value. More...
 
template<class T , class BinaryOp >
static void gather (T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=Pstream::worldComm)
 Like above but switches between linear/tree communication. More...
 
template<class T >
static void scatter (const List< commsStruct > &comms, T &Value, const int tag, const label comm)
 Scatter data. Distribute without modification. Reverse of gather. More...
 
template<class T >
static void scatter (T &Value, const int tag=Pstream::msgType(), const label comm=Pstream::worldComm)
 Like above but switches between linear/tree communication. More...
 
template<class T , class CombineOp >
static void combineGather (const List< commsStruct > &comms, T &Value, const CombineOp &cop, const int tag, const label comm)
 
template<class T , class CombineOp >
static void combineGather (T &Value, const CombineOp &cop, const int tag=Pstream::msgType(), const label comm=Pstream::worldComm)
 Like above but switches between linear/tree communication. More...
 
template<class T >
static void combineScatter (const List< commsStruct > &comms, T &Value, const int tag, const label comm)
 Scatter data. Reverse of combineGather. More...
 
template<class T >
static void combineScatter (T &Value, const int tag=Pstream::msgType(), const label comm=Pstream::worldComm)
 Like above but switches between linear/tree communication. More...
 
template<class T , class CombineOp >
static void listCombineGather (const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
 
template<class T , class CombineOp >
static void listCombineGather (List< T > &Value, const CombineOp &cop, const int tag=Pstream::msgType(), const label comm=Pstream::worldComm)
 Like above but switches between linear/tree communication. More...
 
template<class T >
static void listCombineScatter (const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
 Scatter data. Reverse of combineGather. More...
 
template<class T >
static void listCombineScatter (List< T > &Value, const int tag=Pstream::msgType(), const label comm=Pstream::worldComm)
 Like above but switches between linear/tree communication. More...
 
template<class Container , class CombineOp >
static void mapCombineGather (const List< commsStruct > &comms, Container &Values, const CombineOp &cop, const int tag, const label comm)
 
template<class Container , class CombineOp >
static void mapCombineGather (Container &Values, const CombineOp &cop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
 Like above but switches between linear/tree communication. More...
 
template<class Container >
static void mapCombineScatter (const List< commsStruct > &comms, Container &Values, const int tag, const label comm)
 Scatter data. Reverse of combineGather. More...
 
template<class Container >
static void mapCombineScatter (Container &Values, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
 Like above but switches between linear/tree communication. More...
 
template<class T >
static void gatherList (const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
 Gather data but keep individual values separate. More...
 
template<class T >
static void gatherList (List< T > &Values, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
 Like above but switches between linear/tree communication. More...
 
template<class T >
static void scatterList (const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
 Scatter data. Reverse of gatherList. More...
 
template<class T >
static void scatterList (List< T > &Values, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
 Like above but switches between linear/tree communication. More...
 
template<class Container , class T >
static void exchange (const List< Container > &, List< Container > &, labelListList &sizes, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, const bool block=true)
 Exchange data. Sends sendData, receives into recvData, sets. More...
 
- Static Public Member Functions inherited from UPstream
static label allocateCommunicator (const label parent, const labelList &subRanks, const bool doPstream=true)
 Allocate a new communicator. More...
 
static void freeCommunicator (const label communicator, const bool doPstream=true)
 Free a previously allocated communicator. More...
 
static void freeCommunicators (const bool doPstream)
 Free all communicators. More...
 
static int baseProcNo (const label myComm, const int procID)
 Return physical processor number (i.e. processor number in. More...
 
static label procNo (const label comm, const int baseProcID)
 Return processor number in communicator (given physical processor. More...
 
static label procNo (const label myComm, const label currentComm, const int currentProcID)
 Return processor number in communicator (given processor number. More...
 
static void addValidParOptions (HashTable< string > &validParOptions)
 Add the valid option this type of communications library. More...
 
static bool init (int &argc, char **&argv)
 Initialisation function called from main. More...
 
static label nRequests ()
 Get number of outstanding requests. More...
 
static void resetRequests (const label sz)
 Truncate number of outstanding requests. More...
 
static void waitRequests (const label start=0)
 Wait until all requests (from start onwards) have finished. More...
 
static void waitRequest (const label i)
 Wait until request i has finished. More...
 
static bool finishedRequest (const label i)
 Non-blocking comms: has request i finished? More...
 
static int allocateTag (const char *)
 
static int allocateTag (const word &)
 
static void freeTag (const char *, const int tag)
 
static void freeTag (const word &, const int tag)
 
static bool & parRun ()
 Is this a parallel run? More...
 
static label nProcs (const label communicator=0)
 Number of processes in parallel run. More...
 
static int masterNo ()
 Process index of the master. More...
 
static bool master (const label communicator=0)
 Am I the master process. More...
 
static int myProcNo (const label communicator=0)
 Number of this process (starting from masterNo() = 0) More...
 
static label parent (const label communicator)
 
static List< int > & procID (label communicator)
 Process ID of given process index. More...
 
static int firstSlave ()
 Process index of first slave. More...
 
static int lastSlave (const label communicator=0)
 Process index of last slave. More...
 
static const List< commsStruct > & linearCommunication (const label communicator=0)
 Communication schedule for linear all-to-master (proc 0) More...
 
static const List< commsStruct > & treeCommunication (const label communicator=0)
 Communication schedule for tree all-to-master (proc 0) More...
 
static int & msgType ()
 Message tag of standard messages. More...
 
static void exit (int errnum=1)
 Exit program. More...
 
static void abort ()
 Abort program. More...
 

Protected Attributes

DynamicList< char > buf_
 Transfer buffer. More...
 
- Protected Attributes inherited from UPstream
commsTypes commsType_
 Communications type of this stream. More...
 

Additional Inherited Members

- Public Types inherited from UPstream
enum  commsTypes { blocking, scheduled, nonBlocking }
 Types of communications. More...
 
- Static Public Attributes inherited from UPstream
static const NamedEnum< commsTypes, 3 > commsTypeNames
 
static bool floatTransfer
 Should compact transfer be used in which floats replace doubles. More...
 
static int nProcsSimpleSum
 Number of processors at which the sum algorithm changes from linear. More...
 
static commsTypes defaultCommsType
 Default commsType. More...
 
static int nPollProcInterfaces
 Number of polling cycles in processor updates. More...
 
static label worldComm
 Default communicator (all processors) More...
 
static label warnComm
 Debugging: warn for use of any communicator differing from warnComm. More...
 

Detailed Description

Inter-processor communications stream.

Source files

Definition at line 53 of file Pstream.H.

Constructor & Destructor Documentation

Pstream ( const commsTypes  commsType,
const label  bufSize = 0 
)
inline

Member Function Documentation

ClassName ( "Pstream"  )
void gather ( const List< commsStruct > &  comms,
T Value,
const BinaryOp &  bop,
const int  tag,
const label  comm 
)
static

Gather data. Apply bop to combine Value.

from different processors

Definition at line 47 of file gatherScatter.C.

References UPstream::commsStruct::above(), UPstream::commsStruct::below(), forAll, UPstream::myProcNo(), UPstream::nProcs(), UIPstream::read(), UPstream::scheduled, Foam::T(), and UOPstream::write().

Referenced by Pstream::Pstream(), and Foam::reduce().

Here is the call graph for this function:

Here is the caller graph for this function:

void gather ( T Value,
const BinaryOp &  bop,
const int  tag = Pstream::msgType(),
const label  comm = Pstream::worldComm 
)
static

Like above but switches between linear/tree communication.

Definition at line 127 of file gatherScatter.C.

References UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, Pstream::scatter(), and UPstream::treeCommunication().

Here is the call graph for this function:

void scatter ( const List< commsStruct > &  comms,
T Value,
const int  tag,
const label  comm 
)
static
void scatter ( T Value,
const int  tag = Pstream::msgType(),
const label  comm = Pstream::worldComm 
)
static

Like above but switches between linear/tree communication.

Definition at line 221 of file gatherScatter.C.

References UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, Pstream::scatter(), and UPstream::treeCommunication().

Here is the call graph for this function:

void combineGather ( const List< commsStruct > &  comms,
T Value,
const CombineOp &  cop,
const int  tag,
const label  comm 
)
static

Definition at line 50 of file combineGatherScatter.C.

References UPstream::commsStruct::above(), UPstream::commsStruct::below(), Foam::endl(), forAll, UPstream::myProcNo(), UPstream::nProcs(), Foam::Pout, UIPstream::read(), UPstream::scheduled, Foam::T(), and UOPstream::write().

Referenced by Foam::combineReduce(), and Pstream::Pstream().

Here is the call graph for this function:

Here is the caller graph for this function:

void combineGather ( T Value,
const CombineOp &  cop,
const int  tag = Pstream::msgType(),
const label  comm = Pstream::worldComm 
)
static

Like above but switches between linear/tree communication.

Definition at line 144 of file combineGatherScatter.C.

References Pstream::combineScatter(), UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().

Here is the call graph for this function:

void combineScatter ( const List< commsStruct > &  comms,
T Value,
const int  tag,
const label  comm 
)
static

Scatter data. Reverse of combineGather.

Definition at line 178 of file combineGatherScatter.C.

References UPstream::commsStruct::above(), UPstream::commsStruct::below(), Foam::endl(), forAll, UPstream::myProcNo(), UPstream::nProcs(), Foam::Pout, UIPstream::read(), UPstream::scheduled, Foam::T(), and UOPstream::write().

Referenced by Pstream::combineGather(), Foam::combineReduce(), and Pstream::Pstream().

Here is the call graph for this function:

Here is the caller graph for this function:

void combineScatter ( T Value,
const int  tag = Pstream::msgType(),
const label  comm = Pstream::worldComm 
)
static

Like above but switches between linear/tree communication.

Definition at line 259 of file combineGatherScatter.C.

References UPstream::linearCommunication(), Pstream::listCombineGather(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().

Here is the call graph for this function:

void listCombineGather ( const List< commsStruct > &  comms,
List< T > &  Value,
const CombineOp &  cop,
const int  tag,
const label  comm 
)
static
void listCombineGather ( List< T > &  Value,
const CombineOp &  cop,
const int  tag = Pstream::msgType(),
const label  comm = Pstream::worldComm 
)
static

Like above but switches between linear/tree communication.

Definition at line 383 of file combineGatherScatter.C.

References UPstream::linearCommunication(), Pstream::listCombineScatter(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().

Here is the call graph for this function:

void listCombineScatter ( const List< commsStruct > &  comms,
List< T > &  Value,
const int  tag,
const label  comm 
)
static
void listCombineScatter ( List< T > &  Value,
const int  tag = Pstream::msgType(),
const label  comm = Pstream::worldComm 
)
static

Like above but switches between linear/tree communication.

Definition at line 498 of file combineGatherScatter.C.

References UPstream::linearCommunication(), Pstream::mapCombineGather(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().

Here is the call graph for this function:

void mapCombineGather ( const List< commsStruct > &  comms,
Container &  Values,
const CombineOp &  cop,
const int  tag,
const label  comm 
)
static
void mapCombineGather ( Container &  Values,
const CombineOp &  cop,
const int  tag = Pstream::msgType(),
const label  comm = UPstream::worldComm 
)
static

Like above but switches between linear/tree communication.

Definition at line 602 of file combineGatherScatter.C.

References UPstream::linearCommunication(), Pstream::mapCombineScatter(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().

Here is the call graph for this function:

void mapCombineScatter ( const List< commsStruct > &  comms,
Container &  Values,
const int  tag,
const label  comm 
)
static

Scatter data. Reverse of combineGather.

Definition at line 636 of file combineGatherScatter.C.

References UPstream::commsStruct::above(), UPstream::commsStruct::below(), Foam::endl(), forAll, UPstream::myProcNo(), UPstream::nProcs(), Foam::Pout, and UPstream::scheduled.

Referenced by extrudePatchMesh::extrudePatchMesh(), Pstream::mapCombineGather(), ListPlusEqOp< T, Size >::operator()(), Pstream::Pstream(), and meshRefinement::zonify().

Here is the call graph for this function:

Here is the caller graph for this function:

void mapCombineScatter ( Container &  Values,
const int  tag = Pstream::msgType(),
const label  comm = UPstream::worldComm 
)
static

Like above but switches between linear/tree communication.

Definition at line 687 of file combineGatherScatter.C.

References UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().

Here is the call graph for this function:

void gatherList ( const List< commsStruct > &  comms,
List< T > &  Values,
const int  tag,
const label  comm 
)
static
void gatherList ( List< T > &  Values,
const int  tag = Pstream::msgType(),
const label  comm = UPstream::worldComm 
)
static

Like above but switches between linear/tree communication.

Definition at line 193 of file gatherScatterList.C.

References Pstream::gatherList(), UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, Pstream::scatterList(), and UPstream::treeCommunication().

Here is the call graph for this function:

void scatterList ( const List< commsStruct > &  comms,
List< T > &  Values,
const int  tag,
const label  comm 
)
static
void scatterList ( List< T > &  Values,
const int  tag = Pstream::msgType(),
const label  comm = UPstream::worldComm 
)
static

Like above but switches between linear/tree communication.

Definition at line 331 of file gatherScatterList.C.

References UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, Pstream::scatterList(), and UPstream::treeCommunication().

Here is the call graph for this function:

void exchange ( const List< Container > &  sendBufs,
List< Container > &  recvBufs,
labelListList sizes,
const int  tag = UPstream::msgType(),
const label  comm = UPstream::worldComm,
const bool  block = true 
)
static

Exchange data. Sends sendData, receives into recvData, sets.

sizes (not bytes). sizes[p0][p1] is what processor p0 has sent to p1. Continuous data only. If block=true will wait for all transfers to finish.

Definition at line 38 of file exchange.C.

References Foam::abort(), Foam::combineReduce(), Foam::FatalError, FatalErrorIn, forAll, Foam::read(), List< T >::setSize(), List< T >::size(), T, and write().

Referenced by Pstream::Pstream().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

DynamicList<char> buf_
protected

Transfer buffer.

Definition at line 63 of file Pstream.H.


The documentation for this class was generated from the following files: