39 const commsTypes commsType,
41 DynamicList<char>& externalBuf,
42 label& externalBufPosition,
45 const bool clearAtEnd,
51 Istream(format, version),
52 fromProcNo_(fromProcNo),
53 externalBuf_(externalBuf),
54 externalBufPosition_(externalBufPosition),
57 clearAtEnd_(clearAtEnd),
75 Pout<<
"UIPstream::UIPstream : read from:" << fromProcNo
76 <<
" tag:" << tag <<
" comm:" << comm_
77 <<
" wanted size:" << wantedSize
93 MPI_Get_count(&status, MPI_BYTE, &messageSize_);
96 wantedSize = messageSize_;
100 Pout<<
"UIPstream::UIPstream : probed size:" << wantedSize
109 externalBuf_.
begin(),
116 externalBuf_.
setSize(messageSize_);
129 Istream(buffers.format_, buffers.version_),
130 fromProcNo_(fromProcNo),
131 externalBuf_(buffers.recvBuf_[fromProcNo]),
132 externalBufPosition_(buffers.recvBufPos_[fromProcNo]),
134 comm_(buffers.comm_),
141 <<
"PstreamBuffers::finishedSends() never called." <<
endl 142 <<
"Please call PstreamBuffers::finishedSends() after doing" 143 <<
" all your sends (using UOPstream) and before doing any" 153 messageSize_ = buffers.recvBuf_[fromProcNo].size();
157 Pout<<
"UIPstream::UIPstream PstreamBuffers :" 158 <<
" fromProcNo:" << fromProcNo
159 <<
" tag:" << tag_ <<
" comm:" << comm_
160 <<
" receive buffer size:" << messageSize_
172 Pout<<
"UIPstream::UIPstream PstreamBuffers :" 173 <<
" read from:" << fromProcNo
174 <<
" tag:" << tag_ <<
" comm:" << comm_
175 <<
" wanted size:" << wantedSize
190 MPI_Get_count(&status, MPI_BYTE, &messageSize_);
193 wantedSize = messageSize_;
197 Pout<<
"UIPstream::UIPstream PstreamBuffers : probed size:" 206 externalBuf_.
begin(),
213 externalBuf_.
setSize(messageSize_);
228 const int fromProcNo,
230 const std::streamsize bufSize,
232 const label communicator
237 Pout<<
"UIPstream::read : starting read from:" << fromProcNo
238 <<
" tag:" << tag <<
" comm:" << communicator
239 <<
" wanted size:" <<
label(bufSize)
245 Pout<<
"UIPstream::read : starting read from:" << fromProcNo
246 <<
" tag:" << tag <<
" comm:" << communicator
247 <<
" wanted size:" <<
label(bufSize)
273 <<
"MPI_Recv cannot receive incomming message" 283 MPI_Get_count(&status, MPI_BYTE, &messageSize);
287 Pout<<
"UIPstream::read : finished read from:" << fromProcNo
288 <<
" tag:" << tag <<
" read size:" <<
label(bufSize)
293 if (messageSize > bufSize)
296 <<
"buffer (" <<
label(bufSize)
297 <<
") not large enough for incomming message (" 298 << messageSize <<
')' 323 <<
"MPI_Recv cannot start non-blocking receive" 331 Pout<<
"UIPstream::read : started read from:" << fromProcNo
332 <<
" tag:" << tag <<
" read size:" <<
label(bufSize)
346 <<
"Unsupported communications type " UIPstream(const commsTypes commsType, const int fromProcNo, DynamicList< char > &externalBuf, label &externalBufPosition, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, const bool clearAtEnd=false, streamFormat format=BINARY, versionNumber version=currentVersion)
Construct given process index to read from and optional buffer size,.
static void printStack(Ostream &)
Helper function to print a stack.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
commsTypes
Types of communications.
void setGood()
Set stream to be good.
commsTypes commsType_
Communications type of this stream.
Ostream & endl(Ostream &os)
Add newline and flush stream.
DynamicList< MPI_Request > outstandingRequests_
Istream(streamFormat format=ASCII, versionNumber version=currentVersion, compressionType compression=UNCOMPRESSED)
Set stream status.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
void setSize(const label)
Alter the addressed list size.
void setCapacity(const label)
Alter the size of the underlying storage.
iterator begin()
Return an iterator to begin traversing the UList.
static label warnComm
Debugging: warn for use of any communicator differing from warnComm.
errorManip< error > abort(error &err)
prefixOSstream Pout(cout,"Pout")
static label read(const commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=0)
Read into given buffer from given processor and return the.
static const NamedEnum< commsTypes, 3 > commsTypeNames
void setEof()
Set stream to have reached eof.
commsTypes commsType() const
Get the communications type of the stream.
void setOpened()
Set stream opened.
UPstream(const commsTypes commsType)
Construct given optional buffer size.
label capacity() const
Size of the underlying storage.
DynamicList< MPI_Comm > MPICommunicators_