FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

Inter-processor communications stream. More...

#include <OpenFOAM/Pstream.H>


Detailed Description

Inter-processor communications stream.

Source files

Definition at line 59 of file Pstream.H.

Inheritance diagram for Pstream:
Collaboration diagram for Pstream:

List of all members.

Classes

class  commsStruct
 Structure for communicating between processors. 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.
friend  void::Foam::reduce (scalar &Value, const sumOp< scalar > &bop)
friend  void::Foam::PstreamImpl::initCommunicationSchedule ()

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.

Constructor & Destructor Documentation

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

Construct given optional buffer size.

Definition at line 247 of file Pstream.H.

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


Member Function Documentation

void enlargeBuffer ( size_t   count  ) [inline, protected]

Increase the size of the transfer buffer.

Definition at line 524 of file Pstream.H.

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

ClassName ( "Pstream"    )
static void addValidParOptions ( HashTable< string > &   validParOptions  ) [inline, static]

Add the valid option this type of communications library.

adds/requires on the command line

Definition at line 266 of file Pstream.H.

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

Initialisation function called from main.

Spawns slave processes and initialises inter-communication

Definition at line 273 of file Pstream.H.

Referenced by ParRunControl::runPar().

static bool parRun (  ) [inline, static]

Is this a parallel run?

Definition at line 279 of file Pstream.H.

Referenced by IOerror::abort(), error::abort(), autoLayerDriver::addLayers(), autoHexMeshDriver::autoHexMeshDriver(), meshRefinement::balance(), processorPolyPatch::calcGeometry(), probes::checkFieldTypes(), polyBoundaryMesh::checkParallelSync(), Pstream::combineGather(), Pstream::combineScatter(), globalPointPatch::coupled(), processorPointPatch::coupled(), processorPointPatchField< Type >::coupled(), processorFvPatch::coupled(), processorFvsPatchField< Type >::coupled(), processorFvPatchField< Type >::coupled(), processorFvPatch::delta(), refinementHistory::distribute(), fvMeshDistribute::distribute(), autoLayerDriver::doLayers(), autoRefineDriver::doRefine(), processorFvPatchField< Type >::evaluate(), IOerror::exit(), error::exit(), sampledSurfaces::expire(), distributedTriSurfaceMesh::findNearest(), Pstream::gather(), Pstream::gatherList(), distributedTriSurfaceMesh::getField(), syncTools::getMasterEdges(), syncTools::getMasterFaces(), syncTools::getMasterPoints(), distributedTriSurfaceMesh::getNormal(), distributedTriSurfaceMesh::getRegion(), processorFvPatchField< Type >::initEvaluate(), processorPolyPatch::initGeometry(), processorPolyPatch::initOrder(), processorPointPatchField< Type >::initSwapAdd(), processorPolyPatch::initUpdateMesh(), Pstream::listCombineGather(), Pstream::listCombineScatter(), LUscalarMatrix::LUscalarMatrix(), processorFvPatch::makeDeltaCoeffs(), forces::makeFile(), fieldValue::makeFile(), fieldMinMax::makeFile(), processorFvPatch::makeWeights(), Pstream::mapCombineGather(), Pstream::mapCombineScatter(), polyBoundaryMesh::neighbourEdges(), processorPolyPatch::order(), sampledSurfaces::read(), regIOobject::readIfModified(), Time::readModifiedObjects(), mpiPstreamImpl::reduce(), referredCellList::referMolecules(), sampledSets::sampledSets(), sampledSurfaces::sampledSurfaces(), Pstream::scatter(), Pstream::scatterList(), Time::setControls(), fvMeshSubset::setLargeCellSubset(), LUscalarMatrix::solve(), processorPointPatchField< Type >::swapAdd(), faceSet::sync(), syncTools::syncBoundaryFaceList(), syncTools::syncEdgeList(), syncTools::syncEdgeMap(), syncTools::syncFaceList(), syncTools::syncPointList(), syncTools::syncPointMap(), sampledSurfaces::update(), processorPolyPatch::updateMesh(), and globalMeshData::updateMesh().

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

Process IDs.

Definition at line 309 of file Pstream.H.

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

Process ID of given process index.

Definition at line 315 of file Pstream.H.

Referenced by mpiPstreamImpl::reduce().

static int firstSlave (  ) [inline, static]
static int lastSlave (  ) [inline, static]
static int msgType (  ) [inline, static]

Message tag of standard messages.

Definition at line 345 of file Pstream.H.

Referenced by mpiPstreamImpl::reduce().

commsTypes commsType (  ) const [inline]

Get the communications type of the stream.

Definition at line 351 of file Pstream.H.

References Pstream::commsType_.

commsTypes commsType ( const commsTypes   ct  ) [inline]

Set the communications type of the stream.

Definition at line 357 of file Pstream.H.

References Pstream::commsType_.

static void exit ( int   errnum = 1  ) [inline, static]

Exit program.

Definition at line 365 of file Pstream.H.

Referenced by IOerror::exit(), and error::exit().

static void abort (  ) [inline, static]

Abort program.

Definition at line 371 of file Pstream.H.

Referenced by IOerror::abort(), error::abort(), and Pstream::commsStruct::commsStruct().

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

Gather data. Apply bop to combine Value.

from different processors

Definition at line 45 of file gatherScatter.C.

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

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

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

Like above but switches between linear/tree communication.

Definition at line 104 of file gatherScatter.C.

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

void scatter ( T &   Value  ) [static]

Like above but switches between linear/tree communication.

Definition at line 169 of file gatherScatter.C.

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

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

Like above but switches between linear/tree communication.

Definition at line 130 of file combineGatherScatter.C.

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

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

Like above but switches between linear/tree communication.

Definition at line 208 of file combineGatherScatter.C.

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

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

Like above but switches between linear/tree communication.

Definition at line 314 of file combineGatherScatter.C.

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

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

Like above but switches between linear/tree communication.

Definition at line 396 of file combineGatherScatter.C.

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

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

Like above but switches between linear/tree communication.

Definition at line 481 of file combineGatherScatter.C.

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

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

Like above but switches between linear/tree communication.

Definition at line 537 of file combineGatherScatter.C.

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

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

Like above but switches between linear/tree communication.

Definition at line 180 of file gatherScatterList.C.

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

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

Like above but switches between linear/tree communication.

Definition at line 305 of file gatherScatterList.C.

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

void::Foam::reduce ( scalar &   Value,
const sumOp< scalar > &   bop  
)
void::Foam::PstreamImpl::initCommunicationSchedule (  )

Member Data Documentation

commsTypes commsType_ [protected]

Communications type of this stream.

Definition at line 207 of file Pstream.H.

Referenced by Pstream::commsType().

List<char> buf_ [protected]

Transfer buffer.

Definition at line 210 of file Pstream.H.

Referenced by Pstream::enlargeBuffer(), and Pstream::Pstream().

int bufPosition_ [protected]

Current buffer read/write location.

Definition at line 213 of file Pstream.H.

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 233 of file Pstream.H.

Referenced by argList::argList().


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