35 inline void Foam::UOPstream::writeToBuffer(
const T& t)
37 writeToBuffer(&t,
sizeof(
T),
sizeof(
T));
41 inline void Foam::UOPstream::writeToBuffer(
const char& c)
51 inline void Foam::UOPstream::writeToBuffer
68 alignedPos = align + ((sendBuf_.
size() - 1) & ~(align - 1));
72 sendBuf_.
setSize(alignedPos + count);
74 const char* dataPtr =
reinterpret_cast<const char*
>(data);
76 while (i--) sendBuf_[alignedPos++] = *dataPtr++;
90 const bool sendAtDestruct,
101 sendAtDestruct_(sendAtDestruct)
111 Ostream(buffers.format_, buffers.version_),
113 sendBuf_(buffers.sendBuf_[toProcNo]),
115 comm_(buffers.comm_),
143 <<
"Failed sending outgoing message of size " << sendBuf_.
size()
144 <<
" to processor " << toProcNo_
188 word nonWhiteChars(string::validate<word>(str));
190 if (nonWhiteChars.size() == 1)
192 return write(nonWhiteChars[0]);
194 else if (nonWhiteChars.size())
196 return write(nonWhiteChars);
209 size_t len = str.size();
211 writeToBuffer(str.c_str(), len + 1, 1);
221 size_t len = str.size();
223 writeToBuffer(str.c_str(), len + 1, 1);
231 const std::string& str,
244 size_t len = str.size();
246 writeToBuffer(str.c_str(), len + 1, 1);
297 <<
"stream format not binary" 301 writeToBuffer(data, count, 8);
309 os <<
"Writing from processor " << toProcNo_
310 <<
" to processor " <<
myProcNo() <<
" in communicator " << comm_
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
commsTypes
Types of communications.
Ostream(streamFormat format=ASCII, versionNumber version=currentVersion, compressionType compression=UNCOMPRESSED)
Set stream status.
void setGood()
Set stream to be good.
commsTypes commsType_
Communications type of this stream.
void size(const label)
Override size to be inconsistent with allocated storage.
A token holds items read from Istream.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & writeQuoted(const std::string &, const bool quoted=true)
Write std::string surrounded by quotes.
void setBad()
Set stream to be bad.
void setSize(const label)
Alter the addressed list size.
A class for handling words, derived from string.
float floatScalar
Float precision floating point scalar type.
void setCapacity(const label)
Alter the size of the underlying storage.
iterator begin()
Return an iterator to begin traversing the UList.
streamFormat
Enumeration for the format of data in the stream.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
double doubleScalar
Double precision floating point scalar type.
streamFormat format() const
Return current stream format.
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
static bool write(const commsTypes commsType, const int toProcNo, const char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=0)
Write given buffer to given processor.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
const string & stringToken() const
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
long double longDoubleScalar
Lang double precision floating point scalar type.
void setOpened()
Set stream opened.
UPstream(const commsTypes commsType)
Construct given optional buffer size.
UOPstream(const commsTypes commsType, const int toProcNo, DynamicList< char > &sendBuf, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, const bool sendAtDestruct=true, streamFormat format=BINARY, versionNumber version=currentVersion)
Construct given process index to send to and optional buffer size,.
label capacity() const
Size of the underlying storage.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
void print(Ostream &) const
Print description of IOstream to Ostream.
Inter-processor communications stream.