OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

Pstream Class Reference

Inter-processor communications stream. More...

Inheritance diagram for Pstream:
Collaboration diagram for Pstream:

List of all members.


Classes

class  commsStruct
 Structure for communicating between processors. More...

Public Types

enum  commsTypes { blocking, scheduled, nonBlocking }
 Types of communications. More...

Public Member Functions

 ClassName ("Pstream")
 Pstream (const commsTypes commsType, const label bufSize=0)
 Construct given optional buffer size.
commsTypes commsType () const
 Get the communications type of the stream.
commsTypes commsType (const commsTypes ct)
 Set the communications type of the stream.

Static Public Member Functions

static void addValidParOptions (HashTable< string > &validParOptions)
 Add the valid option this type of communications library.
static bool init (int &argc, char **&argv)
 Initialisation function called from main.
static bool parRun ()
 Is this a parallel run?
static label nProcs ()
 Number of processes in parallel run.
static bool master ()
 Am I the master process.
static int masterNo ()
 Process index of the master.
static int myProcNo ()
 Number of this process (starting from masterNo() = 0).
static const List< int > & procIDs ()
 Process IDs.
static int procID (int procNo)
 Process ID of given process index.
static int firstSlave ()
 Process index of first slave.
static int lastSlave ()
 Process index of last slave.
static const List< commsStruct > & linearCommunication ()
 Communication schedule for linear all-to-master (proc 0).
static const List< commsStruct > & treeCommunication ()
 Communication schedule for tree all-to-master (proc 0).
static int msgType ()
 Message tag of standard messages.
static void exit (int errnum=1)
 Exit program.
static void abort ()
 Abort program.
template<class T , class BinaryOp >
static void gather (const List< commsStruct > &comms, T &Value, const BinaryOp &bop)
 Gather data. Apply bop to combine Value.
template<class T , class BinaryOp >
static void gather (T &Value, const BinaryOp &bop)
 Like above but switches between linear/tree communication.
template<class T >
static void scatter (const List< commsStruct > &comms, T &Value)
 Scatter data. Distribute without modification. Reverse of gather.
template<class T >
static void scatter (T &Value)
 Like above but switches between linear/tree communication.
template<class T , class CombineOp >
static void combineGather (const List< commsStruct > &comms, T &Value, const CombineOp &cop)
template<class T , class CombineOp >
static void combineGather (T &Value, const CombineOp &cop)
 Like above but switches between linear/tree communication.
template<class T >
static void combineScatter (const List< commsStruct > &comms, T &Value)
 Scatter data. Reverse of combineGather.
template<class T >
static void combineScatter (T &Value)
 Like above but switches between linear/tree communication.
template<class T , class CombineOp >
static void listCombineGather (const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop)
template<class T , class CombineOp >
static void listCombineGather (List< T > &Value, const CombineOp &cop)
 Like above but switches between linear/tree communication.
template<class T >
static void listCombineScatter (const List< commsStruct > &comms, List< T > &Value)
 Scatter data. Reverse of combineGather.
template<class T >
static void listCombineScatter (List< T > &Value)
 Like above but switches between linear/tree communication.
template<class Container , class CombineOp >
static void mapCombineGather (const List< commsStruct > &comms, Container &Values, const CombineOp &cop)
template<class Container , class CombineOp >
static void mapCombineGather (Container &Values, const CombineOp &cop)
 Like above but switches between linear/tree communication.
template<class Container >
static void mapCombineScatter (const List< commsStruct > &comms, Container &Values)
 Scatter data. Reverse of combineGather.
template<class Container >
static void mapCombineScatter (Container &Values)
 Like above but switches between linear/tree communication.
template<class T >
static void gatherList (const List< commsStruct > &comms, List< T > &Values)
 Gather data but keep individual values separate.
template<class T >
static void gatherList (List< T > &Values)
 Like above but switches between linear/tree communication.
template<class T >
static void scatterList (const List< commsStruct > &comms, List< T > &Values)
 Scatter data. Reverse of gatherList.
template<class T >
static void scatterList (List< T > &Values)
 Like above but switches between linear/tree communication.

Static Public Attributes

static const NamedEnum
< commsTypes, 3 > 
commsTypeNames
static bool floatTransfer
 Should compact transfer be used in which floats replace doubles.
static int nProcsSimpleSum
 Number of processors at which the sum algorithm changes from linear.
static commsTypes defaultCommsType
 Default commsType.

Protected Member Functions

void enlargeBuffer (size_t count)
 Increase the size of the transfer buffer.

Protected Attributes

commsTypes commsType_
 Communications type of this stream.
List< char > buf_
 Transfer buffer.
int bufPosition_
 Current buffer read/write location.

Detailed Description

Inter-processor communications stream.

Source files

Definition at line 53 of file Pstream.H.


Member Enumeration Documentation

enum commsTypes

Types of communications.

Enumerator:
blocking 
scheduled 
nonBlocking 

Definition at line 59 of file Pstream.H.


Constructor & Destructor Documentation

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

Construct given optional buffer size.

Definition at line 246 of file Pstream.H.

References Pstream::buf_, and List< T >::setSize().

Here is the call graph for this function:


Member Function Documentation

void enlargeBuffer ( size_t  count  )  [inline, protected]

Increase the size of the transfer buffer.

Definition at line 511 of file Pstream.H.

ClassName ( "Pstream"   ) 

void addValidParOptions ( HashTable< string > &  validParOptions  )  [static]

Add the valid option this type of communications library.

adds/requires on the command line

Definition at line 25 of file Pstream.C.

Referenced by Foam::handler().

Here is the caller graph for this function:

bool init ( int &  argc,
char **&  argv 
) [static]

Initialisation function called from main.

Spawns slave processes and initialises inter-communication

Definition at line 29 of file Pstream.C.

Referenced by Foam::handler().

Here is the caller graph for this function:

static label nProcs (  )  [inline, static]

Number of processes in parallel run.

Definition at line 282 of file Pstream.H.

Referenced by mapDistribute::distribute(), Pstream::gatherList(), globalIndex::globalIndex(), meshRefinement::refineCandidates(), mapDistribute::schedule(), and globalIndex::toGlobal().

Here is the caller graph for this function:

static bool master (  )  [inline, static]

Am I the master process.

Definition at line 288 of file Pstream.H.

Referenced by fieldMinMax::calcMinMaxFields(), Foam::handler(), mapDistribute::schedule(), fvMatrix< Type >::setComponentReference(), Foam::setRefCell(), and LUscalarMatrix::solve().

Here is the caller graph for this function:

static int masterNo (  )  [inline, static]

Process index of the master.

Definition at line 294 of file Pstream.H.

Referenced by Foam::handler(), mapDistribute::schedule(), and LUscalarMatrix::solve().

Here is the caller graph for this function:

static int myProcNo (  )  [inline, static]

static const List<int>& procIDs (  )  [inline, static]

Process IDs.

Definition at line 306 of file Pstream.H.

static int procID ( int  procNo  )  [inline, static]

Process ID of given process index.

Definition at line 312 of file Pstream.H.

static int firstSlave (  )  [inline, static]

Process index of first slave.

Definition at line 318 of file Pstream.H.

Referenced by Foam::handler(), mapDistribute::schedule(), and LUscalarMatrix::solve().

Here is the caller graph for this function:

static int lastSlave (  )  [inline, static]

Process index of last slave.

Definition at line 324 of file Pstream.H.

Referenced by Foam::handler(), mapDistribute::schedule(), and LUscalarMatrix::solve().

Here is the caller graph for this function:

static const List<commsStruct>& linearCommunication (  )  [inline, static]

Communication schedule for linear all-to-master (proc 0).

Definition at line 330 of file Pstream.H.

static const List<commsStruct>& treeCommunication (  )  [inline, static]

Communication schedule for tree all-to-master (proc 0).

Definition at line 336 of file Pstream.H.

Referenced by Pstream::combineScatter(), Pstream::listCombineScatter(), Pstream::mapCombineScatter(), Foam::returnReduce(), Pstream::scatter(), and Pstream::scatterList().

Here is the caller graph for this function:

static int msgType (  )  [inline, static]

Message tag of standard messages.

Definition at line 342 of file Pstream.H.

commsTypes commsType (  )  const [inline]

Get the communications type of the stream.

Definition at line 348 of file Pstream.H.

commsTypes commsType ( const commsTypes  ct  )  [inline]

Set the communications type of the stream.

Definition at line 354 of file Pstream.H.

void exit ( int  errnum = 1  )  [static]

Exit program.

Definition at line 40 of file Pstream.C.

Referenced by Foam::handler().

Here is the caller graph for this function:

void abort (  )  [static]

Abort program.

Definition at line 46 of file Pstream.C.

Referenced by Pstream::gatherList(), Foam::handler(), and commsStruct::operator==().

Here is the caller graph for this function:

void gather ( const List< commsStruct > &  comms,
T &  Value,
const BinaryOp &  bop 
) [inline, static]

Gather data. Apply bop to combine Value.

from different processors

Definition at line 38 of file gatherScatter.C.

References commsStruct::above(), commsStruct::below(), forAll, Pstream::myProcNo(), Pstream::parRun(), IPstream::read(), Pstream::scheduled, Foam::T(), and OPstream::write().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void gather ( T &  Value,
const BinaryOp &  bop 
) [inline, static]

Like above but switches between linear/tree communication.

Definition at line 97 of file gatherScatter.C.

void scatter ( const List< commsStruct > &  comms,
T &  Value 
) [inline, static]

Scatter data. Distribute without modification. Reverse of gather.

Definition at line 111 of file gatherScatter.C.

References Pstream::gather(), and Pstream::treeCommunication().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void scatter ( T &  Value  )  [inline, static]

Like above but switches between linear/tree communication.

Definition at line 162 of file gatherScatter.C.

void combineGather ( const List< commsStruct > &  comms,
T &  Value,
const CombineOp &  cop 
) [inline, static]

Definition at line 43 of file combineGatherScatter.C.

References commsStruct::above(), commsStruct::below(), Foam::endl(), forAll, Pstream::myProcNo(), Pstream::parRun(), Foam::Pout, IPstream::read(), Pstream::scheduled, Foam::T(), and OPstream::write().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void combineGather ( T &  Value,
const CombineOp &  cop 
) [inline, static]

Like above but switches between linear/tree communication.

Definition at line 123 of file combineGatherScatter.C.

void combineScatter ( const List< commsStruct > &  comms,
T &  Value 
) [inline, static]

Scatter data. Reverse of combineGather.

Definition at line 137 of file combineGatherScatter.C.

References Pstream::combineGather(), and Pstream::treeCommunication().

Referenced by Foam::combineReduce().

Here is the call graph for this function:

Here is the caller graph for this function:

void combineScatter ( T &  Value  )  [inline, static]

Like above but switches between linear/tree communication.

Definition at line 201 of file combineGatherScatter.C.

void listCombineGather ( const List< commsStruct > &  comms,
List< T > &  Value,
const CombineOp &  cop 
) [inline, static]

void listCombineGather ( List< T > &  Value,
const CombineOp &  cop 
) [inline, static]

Like above but switches between linear/tree communication.

Definition at line 307 of file combineGatherScatter.C.

void listCombineScatter ( const List< commsStruct > &  comms,
List< T > &  Value 
) [inline, static]

Scatter data. Reverse of combineGather.

Definition at line 322 of file combineGatherScatter.C.

References Pstream::listCombineGather(), and Pstream::treeCommunication().

Referenced by syncTools::syncEdgeList(), and syncTools::syncPointList().

Here is the call graph for this function:

Here is the caller graph for this function:

void listCombineScatter ( List< T > &  Value  )  [inline, static]

Like above but switches between linear/tree communication.

Definition at line 389 of file combineGatherScatter.C.

void mapCombineGather ( const List< commsStruct > &  comms,
Container &  Values,
const CombineOp &  cop 
) [inline, static]

Definition at line 410 of file combineGatherScatter.C.

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

Referenced by Pstream::mapCombineScatter().

Here is the call graph for this function:

Here is the caller graph for this function:

void mapCombineGather ( Container &  Values,
const CombineOp &  cop 
) [inline, static]

Like above but switches between linear/tree communication.

Definition at line 474 of file combineGatherScatter.C.

void mapCombineScatter ( const List< commsStruct > &  comms,
Container &  Values 
) [inline, static]

Scatter data. Reverse of combineGather.

Definition at line 489 of file combineGatherScatter.C.

References Pstream::mapCombineGather(), and Pstream::treeCommunication().

Here is the call graph for this function:

void mapCombineScatter ( Container &  Values  )  [inline, static]

Like above but switches between linear/tree communication.

Definition at line 530 of file combineGatherScatter.C.

void gatherList ( const List< commsStruct > &  comms,
List< T > &  Values 
) [inline, static]

void gatherList ( List< T > &  Values  )  [inline, static]

Like above but switches between linear/tree communication.

Definition at line 173 of file gatherScatterList.C.

void scatterList ( const List< commsStruct > &  comms,
List< T > &  Values 
) [inline, static]

Scatter data. Reverse of gatherList.

Definition at line 188 of file gatherScatterList.C.

References Pstream::gatherList(), and Pstream::treeCommunication().

Referenced by globalIndex::globalIndex().

Here is the call graph for this function:

Here is the caller graph for this function:

void scatterList ( List< T > &  Values  )  [inline, static]

Like above but switches between linear/tree communication.

Definition at line 298 of file gatherScatterList.C.


Member Data Documentation

Definition at line 66 of file Pstream.H.

commsTypes commsType_ [protected]

Communications type of this stream.

Definition at line 202 of file Pstream.H.

List<char> buf_ [protected]

Transfer buffer.

Definition at line 205 of file Pstream.H.

Referenced by Pstream::Pstream(), IPstream::read(), and OPstream::write().

int bufPosition_ [protected]

Current buffer read/write location.

Definition at line 208 of file Pstream.H.

Referenced by IPstream::read().

bool floatTransfer [static]

Should compact transfer be used in which floats replace doubles.

reducing the bandwidth requirement at the expense of some loss in accuracy

Definition at line 230 of file Pstream.H.

Referenced by Foam::handler().

int nProcsSimpleSum [static]

Number of processors at which the sum algorithm changes from linear.

to tree

Definition at line 236 of file Pstream.H.

Referenced by Foam::handler().

Default commsType.

Definition at line 239 of file Pstream.H.

Referenced by lduMatrix::initMatrixInterfaces().


The documentation for this class was generated from the following files:
Copyright © 2000-2009 OpenCFD Ltd