Input inter-processor communications stream. More...
#include <OpenFOAM/IPstream.H>
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. | |
Istream & | read (token &) |
Return next token from stream. | |
Istream & | read (char &) |
Read a character. | |
Istream & | read (word &) |
Read a word. | |
Istream & | read (string &) |
Istream & | read (label &) |
Read a label. | |
Istream & | read (floatScalar &) |
Read a floatScalar. | |
Istream & | read (doubleScalar &) |
Read a doubleScalar. | |
Istream & | read (char *, std::streamsize) |
Read binary block. | |
Istream & | rewind () |
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. | |
![]() | |
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 () |
![]() | |
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. | |
Istream & | readBegin (const char *funcName) |
Istream & | readEnd (const char *funcName) |
Istream & | readEndBegin (const char *funcName) |
char | readBeginList (const char *funcName) |
char | readEndList (const char *funcName) |
Istream & | operator() () const |
Return a non-const reference to const Istream. | |
![]() | |
IOstream (streamFormat format, versionNumber version, compressionType compression=UNCOMPRESSED) | |
Construct setting format and version. | |
virtual | ~IOstream () |
virtual const fileName & | name () const |
Return the name of the stream. | |
virtual fileName & | name () |
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< IOstream > | info () 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 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 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. | |
![]() | |
void | enlargeBuffer (size_t count) |
Increase the size of the transfer buffer. | |
![]() | |
commsTypes | commsType_ |
Communications type of this stream. | |
List< char > | buf_ |
Transfer buffer. | |
int | bufPosition_ |
Current buffer read/write location. |
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.
|
inlinevirtual |
|
inlinestatic |
Read into given buffer from given processor and return the.
message size
Definition at line 125 of file IPstream.H.
References IPstreamImpl::read().
Referenced by Pstream::combineGather(), Pstream::combineScatter(), mapDistribute::compact(), Pstream::gather(), Pstream::gatherList(), Pstream::listCombineGather(), Pstream::listCombineScatter(), Pstream::scatter(), Pstream::scatterList(), LUscalarMatrix::solve(), processorPointPatchField< Type >::swapAdd(), and syncTools::syncBoundaryFaceList().
|
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().
|
inlinestatic |
Non-blocking receives: has request i finished?
Definition at line 142 of file IPstream.H.
References IPstreamImpl::finishedRequest().
|
virtual |
Return next token from stream.
Implements Istream.
Definition at line 112 of file IPstream.C.
References token::ADD, token::ASSIGN, token::BEGIN_BLOCK, token::BEGIN_LIST, token::BEGIN_SQR, token::COLON, token::COMMA, token::DIVIDE, token::DOUBLE_SCALAR, token::END_BLOCK, token::END_LIST, token::END_SQR, token::END_STATEMENT, token::FLOAT_SCALAR, Istream::getBack(), token::compound::isCompound(), token::LABEL, token::lineNumber(), token::MULTIPLY, token::compound::New(), token::setBad(), token::STRING, token::SUBTRACT, and token::WORD.
|
virtual |
|
virtual |
|
virtual |
Implements Istream.
Definition at line 278 of file IPstream.C.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Read binary block.
Implements Istream.
Definition at line 310 of file IPstream.C.
References Foam::abort(), Foam::FatalError, FatalErrorIn, and format().
|
virtual |
Rewind and return the stream so that it may be read again.
Implements Istream.
Definition at line 324 of file IPstream.C.
|
inline |
Set flags of stream.
Definition at line 178 of file IPstream.H.
|
virtual |
Print description of IOstream to Ostream.
Reimplemented from IOstream.
Definition at line 34 of file PstreamsPrint.C.
References Foam::endl(), and Pstream::myProcNo().