Go to the documentation of this file.
43 const commsTypes commsType,
45 DynamicList<char>& receiveBuf,
46 label& receiveBufPosition,
49 const bool clearAtEnd,
50 IOstreamOption::streamFormat fmt
54 Istream(fmt, IOstreamOption::currentVersion),
55 fromProcNo_(fromProcNo),
57 recvBufPos_(receiveBufPosition),
60 clearAtEnd_(clearAtEnd),
74 Pout<<
"UIPstream::UIPstream :"
75 <<
" read from:" << fromProcNo
76 <<
" tag:" << tag_ <<
" comm:" << comm_
77 <<
" wanted size:" << recvBuf_.
capacity()
95 MPI_Get_count(&status, MPI_BYTE, &messageSize_);
100 recvBuf_.
resize(messageSize_);
104 Pout<<
"UIPstream::UIPstream : probed size:"
120 recvBuf_.
resize(messageSize_);
132 UPstream(buffers.commsType_),
133 Istream(buffers.format_, IOstreamOption::currentVersion),
134 fromProcNo_(fromProcNo),
135 recvBuf_(buffers.recvBuf_[fromProcNo]),
136 recvBufPos_(buffers.recvBufPos_[fromProcNo]),
138 comm_(buffers.comm_),
145 && !buffers.finishedSendsCalled_
149 <<
"PstreamBuffers::finishedSends() never called." <<
endl
150 <<
"Please call PstreamBuffers::finishedSends() after doing"
151 <<
" all your sends (using UOPstream) and before doing any"
161 messageSize_ = recvBuf_.size();
165 Pout<<
"UIPstream::UIPstream PstreamBuffers :"
166 <<
" fromProcNo:" << fromProcNo
167 <<
" tag:" << tag_ <<
" comm:" << comm_
168 <<
" receive buffer size:" << messageSize_
176 Pout<<
"UIPstream::UIPstream PstreamBuffers :"
177 <<
" read from:" << fromProcNo
178 <<
" tag:" << tag_ <<
" comm:" << comm_
179 <<
" wanted size:" << recvBuf_.
capacity()
197 MPI_Get_count(&status, MPI_BYTE, &messageSize_);
202 recvBuf_.
resize(messageSize_);
206 Pout<<
"UIPstream::UIPstream PstreamBuffers : probed size:"
222 recvBuf_.
resize(messageSize_);
236 const commsTypes commsType,
237 const int fromProcNo,
239 const std::streamsize bufSize,
241 const label communicator
246 Pout<<
"UIPstream::read : starting read from:" << fromProcNo
247 <<
" tag:" << tag <<
" comm:" << communicator
248 <<
" wanted size:" << label(bufSize)
254 Pout<<
"UIPstream::read : starting read from:" << fromProcNo
255 <<
" tag:" << tag <<
" comm:" << communicator
256 <<
" wanted size:" << label(bufSize)
267 commsType == commsTypes::blocking
268 || commsType == commsTypes::scheduled
288 <<
"MPI_Recv cannot receive incoming message"
299 MPI_Get_count(&status, MPI_BYTE, &messageSize);
303 Pout<<
"UIPstream::read : finished read from:" << fromProcNo
304 <<
" tag:" << tag <<
" read size:" << label(bufSize)
309 if (messageSize > bufSize)
312 <<
"buffer (" << label(bufSize)
313 <<
") not large enough for incoming message ("
314 << messageSize <<
')'
320 else if (commsType == commsTypes::nonBlocking)
339 <<
"MPI_Recv cannot start non-blocking receive"
349 Pout<<
"UIPstream::read : started read from:" << fromProcNo
350 <<
" tag:" << tag <<
" read size:" << label(bufSize)
363 <<
"Unsupported communications type " << int(commsType)
int debug
Static debugging option.
static label warnComm
Debugging: warn for use of any communicator differing from warnComm.
void resize(const label len)
commsTypes commsType() const noexcept
Get the communications type of the stream.
static void addWaitTime()
Add time increment to waitTime.
static void printStack(Ostream &os)
Helper function to print a stack.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
static void beginTiming()
Update timer prior to measurement.
DynamicList< MPI_Request > outstandingRequests_
Outstanding non-blocking operations.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label capacity() const noexcept
Size of the underlying storage.
void setOpened() noexcept
Set stream opened.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
static label read(const commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=UPstream::worldComm)
Read into given buffer from given processor.
void setGood() noexcept
Set stream state to be good.
DynamicList< MPI_Comm > MPICommunicators_
void setEof() noexcept
Set stream state as reached 'eof'.
UIPstream(const commsTypes commsType, const int fromProcNo, DynamicList< char > &receiveBuf, label &receiveBufPosition, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, const bool clearAtEnd=false, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
static void addGatherTime()
Add time increment to gatherTime.
static const Enum< commsTypes > commsTypeNames
Names of the communication types.
errorManip< error > abort(error &err)
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.