FreeFOAM The Cross-Platform CFD Toolkit
IPstream Class Reference

Input inter-processor communications stream. More...

#include <OpenFOAM/IPstream.H>


Detailed Description

Input inter-processor communications stream.

Source files

Definition at line 53 of file IPstream.H.

+ Inheritance diagram for IPstream:
+ Collaboration diagram for IPstream:

List of all members.

Public Member Functions

 IPstream (const commsTypes commsType, const int fromProcNo, const label bufSize=0, streamFormat format=BINARY, versionNumber version=currentVersion)
 Construct given process index to read from and optional buffer size,.
 ~IPstream ()
ios_base::fmtflags flags () const
 Return flags of output stream.
Istreamread (token &)
 Return next token from stream.
Istreamread (char &)
 Read a character.
Istreamread (word &)
 Read a word.
Istreamread (string &)
Istreamread (label &)
 Read a label.
Istreamread (floatScalar &)
 Read a floatScalar.
Istreamread (doubleScalar &)
 Read a doubleScalar.
Istreamread (char *, std::streamsize)
 Read binary block.
Istreamrewind ()
 Rewind and return the stream so that it may be read again.
ios_base::fmtflags flags (const ios_base::fmtflags)
 Set flags of stream.
void print (Ostream &) const
 Print description of IOstream to Ostream.
- Public Member Functions inherited from Pstream
 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 ()
- Public Member Functions inherited from Istream
 Istream (streamFormat format=ASCII, versionNumber version=currentVersion, compressionType compression=UNCOMPRESSED)
 Set stream status.
virtual ~Istream ()
void putBack (const token &)
 Put back token.
bool getBack (token &)
 Get the put back token.
IstreamreadBegin (const char *funcName)
IstreamreadEnd (const char *funcName)
IstreamreadEndBegin (const char *funcName)
char readBeginList (const char *funcName)
char readEndList (const char *funcName)
Istreamoperator() () const
 Return a non-const reference to const Istream.
- Public Member Functions inherited from IOstream
 IOstream (streamFormat format, versionNumber version, compressionType compression=UNCOMPRESSED)
 Construct setting format and version.
virtual ~IOstream ()
virtual const fileNamename () const
 Return the name of the stream.
virtual fileNamename ()
 Return non-const access to the name of the stream.
virtual bool check (const char *operation) const
 Check IOstream status for given operation.
void fatalCheck (const char *operation) const
 Check IOstream status for given operation.
bool opened () const
 Return true if stream has been opened.
bool closed () const
 Return true if stream is closed.
bool good () const
 Return true if next operation might succeed.
bool eof () const
 Return true if end of input seen.
bool fail () const
 Return true if next operation will fail.
bool bad () const
 Return true if stream is corrupted.
 operator void * () const
 Return non-zero if the stream has not failed.
bool operator! () const
 Return true if the stream has failed.
streamFormat format () const
 Return current stream format.
streamFormat format (const streamFormat fmt)
 Set the stream format.
streamFormat format (const word &fmt)
 Set the stream format from word.
versionNumber version () const
 Return the stream version.
versionNumber version (const versionNumber ver)
 Set the stream version.
compressionType compression () const
 Return the stream compression.
compressionType compression (const compressionType cmp)
 Set the stream compression.
compressionType compression (const word &cmp)
 Set the stream compression from word.
label lineNumber () const
 Return current stream line number.
label & lineNumber ()
 Return current stream line number.
label lineNumber (const label ln)
 Set the stream line number.
void setEof ()
 Set stream to have reached eof.
void setFail ()
 Set stream to have failed.
void setBad ()
 Set stream to be bad.
virtual ios::fmtflags flags (const ios::fmtflags f)=0
 Set flags of stream.
ios::fmtflags setf (const ios::fmtflags f)
 Set flags of stream.
ios::fmtflags setf (const ios::fmtflags f, const ios::fmtflags mask)
 Set flags of given field of stream.
void unsetf (const ios::fmtflags uf)
 Unset flags of stream.
void print (Ostream &, const int streamState) const
 Check given stream state bits.
InfoProxy< IOstreaminfo () const
 Return info proxy.

Static Public Member Functions

static label read (const commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize)
 Read into given buffer from given processor and return the.
static void waitRequests ()
 Non-blocking receives: wait until all have finished.
static bool finishedRequest (const label i)
 Non-blocking receives: has request i finished?
- Static Public Member Functions inherited from Pstream
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.

Additional Inherited Members

- Static Public Attributes inherited from Pstream
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 inherited from Pstream
void enlargeBuffer (size_t count)
 Increase the size of the transfer buffer.
- Protected Attributes inherited from Pstream
commsTypes commsType_
 Communications type of this stream.
List< char > buf_
 Transfer buffer.
int bufPosition_
 Current buffer read/write location.

Constructor & Destructor Documentation

IPstream ( const commsTypes  commsType,
const int  fromProcNo,
const label  bufSize = 0,
streamFormat  format = BINARY,
versionNumber  version = currentVersion 
)

Construct given process index to read from and optional buffer size,.

read format and IO version

Definition at line 39 of file IPstream.C.

~IPstream ( )

Definition at line 105 of file IPstream.C.


Member Function Documentation

ios_base::fmtflags flags ( ) const
inlinevirtual

Return flags of output stream.

Implements IOstream.

Definition at line 114 of file IPstream.H.

static label read ( const commsTypes  commsType,
const int  fromProcNo,
char *  buf,
const std::streamsize  bufSize 
)
inlinestatic
static void waitRequests ( )
inlinestatic

Non-blocking receives: wait until all have finished.

Definition at line 136 of file IPstream.H.

References IPstreamImpl::waitRequests().

Referenced by mapDistribute::compact(), and GeometricField< Type, PatchField, GeoMesh >::GeometricBoundaryField::evaluate().

static bool finishedRequest ( const label  i)
inlinestatic

Non-blocking receives: has request i finished?

Definition at line 142 of file IPstream.H.

References IPstreamImpl::finishedRequest().

Foam::Istream & read ( char &  c)
virtual

Read a character.

Implements Istream.

Definition at line 258 of file IPstream.C.

Foam::Istream & read ( word str)
virtual

Read a word.

Implements Istream.

Definition at line 267 of file IPstream.C.

Foam::Istream & read ( string str)
virtual

Implements Istream.

Definition at line 278 of file IPstream.C.

Foam::Istream & read ( label &  val)
virtual

Read a label.

Implements Istream.

Definition at line 289 of file IPstream.C.

Foam::Istream & read ( floatScalar val)
virtual

Read a floatScalar.

Implements Istream.

Definition at line 296 of file IPstream.C.

Foam::Istream & read ( doubleScalar val)
virtual

Read a doubleScalar.

Implements Istream.

Definition at line 303 of file IPstream.C.

Foam::Istream & read ( char *  data,
std::streamsize  count 
)
virtual

Read binary block.

Implements Istream.

Definition at line 310 of file IPstream.C.

References Foam::abort(), Foam::FatalError, FatalErrorIn, and format().

Foam::Istream & rewind ( )
virtual

Rewind and return the stream so that it may be read again.

Implements Istream.

Definition at line 324 of file IPstream.C.

ios_base::fmtflags flags ( const ios_base::fmtflags  )
inline

Set flags of stream.

Definition at line 178 of file IPstream.H.

void print ( Ostream os) const
virtual

Print description of IOstream to Ostream.

Reimplemented from IOstream.

Definition at line 34 of file PstreamsPrint.C.

References Foam::endl(), and Pstream::myProcNo().


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