Public Member Functions | Static Public Member Functions | List of all members
UOPstream Class Reference

Output inter-processor communications stream operating on external buffer. More...

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

Public Member Functions

 UOPstream (const commsTypes commsType, const int toProcNo, DynamicList< char > &sendBuf, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, const bool sendAtDestruct=true, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
 
 UOPstream (const int toProcNo, PstreamBuffers &buffers)
 
 ~UOPstream ()
 
virtual ios_base::fmtflags flags () const
 
virtual bool write (const token &tok)
 
virtual Ostreamwrite (const char c)
 
virtual Ostreamwrite (const char *str)
 
virtual Ostreamwrite (const word &str)
 
virtual Ostreamwrite (const string &str)
 
virtual OstreamwriteQuoted (const std::string &str, const bool quoted=true)
 
virtual Ostreamwrite (const int32_t val)
 
virtual Ostreamwrite (const int64_t val)
 
virtual Ostreamwrite (const floatScalar val)
 
virtual Ostreamwrite (const doubleScalar val)
 
virtual Ostreamwrite (const char *data, std::streamsize count)
 
virtual OstreamwriteRaw (const char *data, std::streamsize count)
 
virtual bool beginRawWrite (std::streamsize count)
 
virtual bool endRawWrite ()
 
virtual void indent ()
 
virtual void flush ()
 
virtual void endl ()
 
virtual char fill () const
 
virtual char fill (const char)
 
virtual int width () const
 
virtual int width (const int)
 
virtual int precision () const
 
virtual int precision (const int)
 
ios_base::fmtflags flags (const ios_base::fmtflags)
 
void print (Ostream &os) const
 
- Public Member Functions inherited from UPstream
 ClassName ("UPstream")
 
 UPstream (const commsTypes commsType)
 
commsTypes commsType () const noexcept
 
commsTypes commsType (const commsTypes ct) noexcept
 
template<class T >
Foam::List< TlistGatherValues (const T &localValue, const label comm)
 
- Public Member Functions inherited from Ostream
 Ostream (const Ostream &)=default
 
virtual ~Ostream ()=default
 
 Ostream (IOstreamOption streamOpt=IOstreamOption())
 
 Ostream (IOstreamOption::streamFormat fmt, IOstreamOption::versionNumber ver=IOstreamOption::currentVersion, IOstreamOption::compressionType cmp=IOstreamOption::UNCOMPRESSED)
 
virtual Ostreamwrite (const keyType &kw)
 
unsigned short indentSize () const noexcept
 
unsigned short indentSize (unsigned short val) noexcept
 
unsigned short indentLevel () const noexcept
 
unsigned short indentLevel (unsigned short val) noexcept
 
void incrIndent () noexcept
 
void decrIndent ()
 
virtual OstreamwriteKeyword (const keyType &kw)
 
virtual OstreambeginBlock (const keyType &kw)
 
virtual OstreambeginBlock ()
 
virtual OstreamendBlock ()
 
virtual OstreamendEntry ()
 
template<class T >
OstreamwriteEntry (const keyType &key, const T &value)
 
template<class T >
OstreamwriteEntryIfDifferent (const word &key, const T &value1, const T &value2)
 
Ostreamoperator() () const
 
unsigned short & indentLevel () noexcept
 
unsigned short & indentSize () noexcept
 
- Public Member Functions inherited from IOstream
 IOstream (const IOstream &)=default
 
virtual ~IOstream ()=default
 
 IOstream (IOstreamOption streamOpt=IOstreamOption())
 
 IOstream (IOstreamOption::streamFormat fmt, IOstreamOption::versionNumber ver, IOstreamOption::compressionType cmp=IOstreamOption::UNCOMPRESSED)
 
virtual const fileNamename () const
 
virtual fileNamename ()
 
fileName relativeName () const
 
virtual bool check (const char *operation) const
 
bool fatalCheck (const char *operation) const
 
bool opened () const noexcept
 
bool closed () const noexcept
 
bool good () const noexcept
 
bool eof () const noexcept
 
bool fail () const noexcept
 
bool bad () const noexcept
 
 operator bool () const noexcept
 
bool operator! () const noexcept
 
unsigned labelByteSize () const noexcept
 
unsigned scalarByteSize () const noexcept
 
void setLabelByteSize (unsigned nbytes) noexcept
 
void setScalarByteSize (unsigned nbytes) noexcept
 
template<class T = label>
std::enable_if< std::is_integral< T >::value, bool >::type checkLabelSize () const noexcept
 
template<class T = scalar>
std::enable_if< std::is_floating_point< T >::value, bool >::type checkScalarSize () const noexcept
 
label lineNumber () const noexcept
 
label & lineNumber () noexcept
 
label lineNumber (const label num) noexcept
 
void setEof () noexcept
 
void setFail () noexcept
 
void setBad ()
 
ios_base::fmtflags setf (const ios_base::fmtflags f)
 
ios_base::fmtflags setf (const ios_base::fmtflags f, const ios_base::fmtflags mask)
 
void unsetf (const ios_base::fmtflags f)
 
void print (Ostream &os, const int streamState) const
 
InfoProxy< IOstreaminfo () const
 
- Public Member Functions inherited from IOstreamOption
constexpr IOstreamOption (streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
 
constexpr IOstreamOption (streamFormat fmt, compressionType comp, versionNumber ver) noexcept
 
constexpr IOstreamOption (streamFormat fmt, versionNumber ver, compressionType comp=compressionType::UNCOMPRESSED) noexcept
 
 IOstreamOption (const IOstreamOption &opt, streamFormat fmt) noexcept
 
streamFormat format () const noexcept
 
streamFormat format (const streamFormat fmt) noexcept
 
streamFormat format (const word &formatName)
 
compressionType compression () const noexcept
 
compressionType compression (const compressionType comp) noexcept
 
compressionType compression (const word &compName)
 
versionNumber version () const noexcept
 
versionNumber version (const versionNumber ver) noexcept
 
versionNumber version (const token &tok)
 

Static Public Member Functions

static bool write (const commsTypes commsType, const int toProcNo, const char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=UPstream::worldComm)
 
- Static Public Member Functions inherited from UPstream
static label allocateCommunicator (const label parent, const labelList &subRanks, const bool doPstream=true)
 
static void freeCommunicator (const label communicator, const bool doPstream=true)
 
static void freeCommunicators (const bool doPstream)
 
static int baseProcNo (const label myComm, const int procID)
 
static label procNo (const label comm, const int baseProcID)
 
static label procNo (const label myComm, const label currentComm, const int currentProcID)
 
static void addValidParOptions (HashTable< string > &validParOptions)
 
static bool init (int &argc, char **&argv, const bool needsThread)
 
static bool initNull ()
 
static label nRequests ()
 
static void resetRequests (const label sz)
 
static void waitRequests (const label start=0)
 
static void waitRequest (const label i)
 
static bool finishedRequest (const label i)
 
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 (const bool on) noexcept
 
static boolparRun () noexcept
 
static bool haveThreads () noexcept
 
static label nProcs (const label communicator=worldComm)
 
static constexpr int masterNo () noexcept
 
static bool master (const label communicator=worldComm)
 
static int myProcNo (const label communicator=worldComm)
 
static label parent (const label communicator)
 
static List< int > & procID (label communicator)
 
static const wordListallWorlds () noexcept
 
static const labelListworldIDs () noexcept
 
static label myWorldID ()
 
static const wordmyWorld ()
 
static rangeType allProcs (const label communicator=worldComm)
 
static rangeType subProcs (const label communicator=worldComm)
 
static const List< commsStruct > & linearCommunication (const label communicator=worldComm)
 
static const List< commsStruct > & treeCommunication (const label communicator=worldComm)
 
static int & msgType () noexcept
 
static void shutdown (int errNo=0)
 
static void abort ()
 
static void exit (int errNo=1)
 
static void allToAll (const labelUList &sendData, labelUList &recvData, const label communicator=worldComm)
 
static void allToAll (const char *sendData, const UList< int > &sendSizes, const UList< int > &sendOffsets, char *recvData, const UList< int > &recvSizes, const UList< int > &recvOffsets, const label communicator=worldComm)
 
static void mpiGather (const char *sendData, int sendSize, char *recvData, int recvSize, const label communicator=worldComm)
 
static void mpiScatter (const char *sendData, int sendSize, char *recvData, int recvSize, const label communicator=worldComm)
 
static void gather (const char *sendData, int sendSize, char *recvData, const UList< int > &recvSizes, const UList< int > &recvOffsets, const label communicator=worldComm)
 
static void scatter (const char *sendData, const UList< int > &sendSizes, const UList< int > &sendOffsets, char *recvData, int recvSize, const label communicator=worldComm)
 
template<class T >
static List< TlistGatherValues (const T &localValue, const label communicator=worldComm)
 
template<class T >
static T listScatterValues (const UList< T > &allValues, const label communicator=worldComm)
 
static constexpr int firstSlave () noexcept
 
static int lastSlave (const label communicator=worldComm)
 
- Static Public Member Functions inherited from IOstream
static unsigned int defaultPrecision () noexcept
 
static unsigned int defaultPrecision (unsigned int prec) noexcept
 
- Static Public Member Functions inherited from IOstreamOption
static streamFormat formatEnum (const word &formatName, const streamFormat deflt=streamFormat::ASCII)
 
static streamFormat formatEnum (const word &key, const dictionary &dict, const streamFormat deflt=streamFormat::ASCII)
 
static compressionType compressionEnum (const word &compName, const compressionType deflt=compressionType::UNCOMPRESSED)
 
static compressionType compressionEnum (const word &key, const dictionary &dict, const compressionType deflt=compressionType::UNCOMPRESSED)
 

Additional Inherited Members

- Public Types inherited from UPstream
enum  commsTypes : char { blocking, scheduled, nonBlocking }
 
typedef IntRange< int > rangeType
 
- Public Types inherited from IOstream
enum  streamAccess : char { CLOSED = 0, OPENED }
 
- Public Types inherited from IOstreamOption
enum  streamFormat : char { ASCII = 0, BINARY }
 
enum  compressionType : char { UNCOMPRESSED = 0, COMPRESSED }
 
- Static Public Attributes inherited from UPstream
static const Enum< commsTypescommsTypeNames
 
static bool floatTransfer
 
static int nProcsSimpleSum
 
static commsTypes defaultCommsType
 
static int nPollProcInterfaces
 
static int maxCommsSize
 
static const int mpiBufferSize
 
static label worldComm
 
static label warnComm
 
- Static Public Attributes inherited from IOstream
static unsigned int precision_
 
- Static Public Attributes inherited from IOstreamOption
static const Enum< streamFormatformatNames
 
static const versionNumber currentVersion
 
- Protected Member Functions inherited from IOstream
void setOpened () noexcept
 
void setClosed () noexcept
 
void setState (std::ios_base::iostate state) noexcept
 
void setGood () noexcept
 
- Protected Attributes inherited from UPstream
commsTypes commsType_
 
- Protected Attributes inherited from Ostream
unsigned short indentSize_ = 4
 
unsigned short indentLevel_ = 0
 
- Protected Attributes inherited from IOstream
std::ios_base::iostate ioState_
 
streamAccess openClosed_
 
unsigned char sizeofLabel_
 
unsigned char sizeofScalar_
 
label lineNumber_
 
- Static Protected Attributes inherited from Ostream
static constexpr const unsigned short entryIndentation_ = 16
 
- Static Protected Attributes inherited from IOstream
static fileName staticName_
 

Detailed Description

Output inter-processor communications stream operating on external buffer.

Source files

Definition at line 53 of file UOPstream.H.

Constructor & Destructor Documentation

◆ UOPstream() [1/2]

UOPstream ( const commsTypes  commsType,
const int  toProcNo,
DynamicList< char > &  sendBuf,
const int  tag = UPstream::msgType(),
const label  comm = UPstream::worldComm,
const bool  sendAtDestruct = true,
IOstreamOption::streamFormat  fmt = IOstreamOption::BINARY 
)

Definition at line 128 of file UOPstream.C.

◆ UOPstream() [2/2]

UOPstream ( const int  toProcNo,
PstreamBuffers buffers 
)

Definition at line 151 of file UOPstream.C.

References IOstream::setGood(), and IOstream::setOpened().

Here is the call graph for this function:

◆ ~UOPstream()

~UOPstream ( )

Definition at line 168 of file UOPstream.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and UOPstream::write().

Here is the call graph for this function:

Member Function Documentation

◆ flags() [1/2]

virtual ios_base::fmtflags flags ( ) const
inlinevirtual

Implements IOstream.

Definition at line 129 of file UOPstream.H.

◆ write() [1/11]

bool write ( const commsTypes  commsType,
const int  toProcNo,
const char *  buf,
const std::streamsize  bufSize,
const int  tag = UPstream::msgType(),
const label  communicator = UPstream::worldComm 
)
static

◆ write() [2/11]

bool write ( const token tok)
virtual

Implements Ostream.

Definition at line 196 of file UOPstream.C.

References token::flagToken(), token::stringToken(), token::type(), and token::wordToken().

Here is the call graph for this function:

◆ write() [3/11]

Foam::Ostream & write ( const char  c)
virtual

Implements Ostream.

Definition at line 240 of file UOPstream.C.

References Foam::constant::universal::c, and Foam::isspace().

Here is the call graph for this function:

◆ write() [4/11]

Foam::Ostream & write ( const char *  str)
virtual

Implements Ostream.

Definition at line 251 of file UOPstream.C.

References Foam::vtk::write().

Here is the call graph for this function:

◆ write() [5/11]

Foam::Ostream & write ( const word str)
virtual

Implements Ostream.

Definition at line 268 of file UOPstream.C.

◆ write() [6/11]

Foam::Ostream & write ( const string str)
virtual

Implements Ostream.

Definition at line 277 of file UOPstream.C.

◆ writeQuoted()

Foam::Ostream & writeQuoted ( const std::string &  str,
const bool  quoted = true 
)
virtual

Implements Ostream.

Definition at line 287 of file UOPstream.C.

◆ write() [7/11]

Foam::Ostream & write ( const int32_t  val)
virtual

Implements Ostream.

Definition at line 306 of file UOPstream.C.

◆ write() [8/11]

Foam::Ostream & write ( const int64_t  val)
virtual

Implements Ostream.

Definition at line 314 of file UOPstream.C.

◆ write() [9/11]

Foam::Ostream & write ( const floatScalar  val)
virtual

Implements Ostream.

Definition at line 322 of file UOPstream.C.

◆ write() [10/11]

Foam::Ostream & write ( const doubleScalar  val)
virtual

Implements Ostream.

Definition at line 330 of file UOPstream.C.

◆ write() [11/11]

Foam::Ostream & write ( const char *  data,
std::streamsize  count 
)
virtual

Implements Ostream.

Definition at line 338 of file UOPstream.C.

References Foam::abort(), Foam::BitOps::count(), Foam::FatalError, FatalErrorInFunction, and format().

Here is the call graph for this function:

◆ writeRaw()

Foam::Ostream & writeRaw ( const char *  data,
std::streamsize  count 
)
virtual

Implements Ostream.

Definition at line 355 of file UOPstream.C.

References Foam::BitOps::count().

Here is the call graph for this function:

◆ beginRawWrite()

bool beginRawWrite ( std::streamsize  count)
virtual

Implements Ostream.

Definition at line 370 of file UOPstream.C.

References Foam::abort(), Foam::BitOps::count(), Foam::FatalError, FatalErrorInFunction, and format().

Here is the call graph for this function:

◆ endRawWrite()

virtual bool endRawWrite ( )
inlinevirtual

Implements Ostream.

Definition at line 197 of file UOPstream.H.

◆ indent()

virtual void indent ( )
inlinevirtual

Implements Ostream.

Definition at line 203 of file UOPstream.H.

◆ flush()

virtual void flush ( )
inlinevirtual

Implements Ostream.

Definition at line 210 of file UOPstream.H.

◆ endl()

virtual void endl ( )
inlinevirtual

Implements Ostream.

Definition at line 214 of file UOPstream.H.

◆ fill() [1/2]

virtual char fill ( ) const
inlinevirtual

Implements Ostream.

Definition at line 219 of file UOPstream.H.

◆ fill() [2/2]

virtual char fill ( const char  )
inlinevirtual

Implements Ostream.

Definition at line 225 of file UOPstream.H.

◆ width() [1/2]

virtual int width ( ) const
inlinevirtual

Implements Ostream.

Definition at line 231 of file UOPstream.H.

◆ width() [2/2]

virtual int width ( const int  )
inlinevirtual

Implements Ostream.

Definition at line 238 of file UOPstream.H.

◆ precision() [1/2]

virtual int precision ( ) const
inlinevirtual

Implements Ostream.

Definition at line 244 of file UOPstream.H.

◆ precision() [2/2]

virtual int precision ( const int  )
inlinevirtual

Implements Ostream.

Definition at line 251 of file UOPstream.H.

◆ flags() [2/2]

ios_base::fmtflags flags ( const ios_base::fmtflags  )
inlinevirtual

Implements IOstream.

Definition at line 260 of file UOPstream.H.

◆ print()

void print ( Ostream os) const
virtual

Reimplemented from IOstream.

Definition at line 387 of file UOPstream.C.

References Foam::endl(), and os().

Here is the call graph for this function:

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