Go to the documentation of this file.
43 const commsTypes commsType,
45 DynamicList<char>& externalBuf,
46 label& externalBufPosition,
49 const bool clearAtEnd,
56 fromProcNo_(fromProcNo),
57 externalBuf_(externalBuf),
58 externalBufPosition_(externalBufPosition),
61 clearAtEnd_(clearAtEnd),
75 label wantedSize = externalBuf_.
capacity();
79 Pout<<
"UIPstream::UIPstream : read from:" << fromProcNo
80 <<
" tag:" << tag <<
" comm:" << comm_
81 <<
" wanted size:" << wantedSize
99 MPI_Get_count(&status, MPI_BYTE, &messageSize_);
105 wantedSize = messageSize_;
109 Pout<<
"UIPstream::UIPstream : probed size:" << wantedSize
118 externalBuf_.begin(),
125 externalBuf_.
setSize(messageSize_);
137 UPstream(buffers.commsType_),
138 Istream(buffers.format_, buffers.version_),
139 fromProcNo_(fromProcNo),
140 externalBuf_(buffers.recvBuf_[fromProcNo]),
141 externalBufPosition_(buffers.recvBufPos_[fromProcNo]),
143 comm_(buffers.comm_),
150 && !buffers.finishedSendsCalled_
154 <<
"PstreamBuffers::finishedSends() never called." <<
endl
155 <<
"Please call PstreamBuffers::finishedSends() after doing"
156 <<
" all your sends (using UOPstream) and before doing any"
166 messageSize_ = buffers.recvBuf_[fromProcNo].size();
170 Pout<<
"UIPstream::UIPstream PstreamBuffers :"
171 <<
" fromProcNo:" << fromProcNo
172 <<
" tag:" << tag_ <<
" comm:" << comm_
173 <<
" receive buffer size:" << messageSize_
181 label wantedSize = externalBuf_.
capacity();
185 Pout<<
"UIPstream::UIPstream PstreamBuffers :"
186 <<
" read from:" << fromProcNo
187 <<
" tag:" << tag_ <<
" comm:" << comm_
188 <<
" wanted size:" << wantedSize
205 MPI_Get_count(&status, MPI_BYTE, &messageSize_);
211 wantedSize = messageSize_;
215 Pout<<
"UIPstream::UIPstream PstreamBuffers : probed size:"
224 externalBuf_.begin(),
231 externalBuf_.
setSize(messageSize_);
245 const commsTypes commsType,
246 const int fromProcNo,
248 const std::streamsize bufSize,
250 const label communicator
255 Pout<<
"UIPstream::read : starting read from:" << fromProcNo
256 <<
" tag:" << tag <<
" comm:" << communicator
257 <<
" wanted size:" << label(bufSize)
263 Pout<<
"UIPstream::read : starting read from:" << fromProcNo
264 <<
" tag:" << tag <<
" comm:" << communicator
265 <<
" wanted size:" << label(bufSize)
274 if (commsType == commsTypes::blocking || commsType == commsTypes::scheduled)
293 <<
"MPI_Recv cannot receive incoming message"
304 MPI_Get_count(&status, MPI_BYTE, &messageSize);
308 Pout<<
"UIPstream::read : finished read from:" << fromProcNo
309 <<
" tag:" << tag <<
" read size:" << label(bufSize)
314 if (messageSize > bufSize)
317 <<
"buffer (" << label(bufSize)
318 <<
") not large enough for incoming message ("
319 << messageSize <<
')'
325 else if (commsType == commsTypes::nonBlocking)
344 <<
"MPI_Recv cannot start non-blocking receive"
354 Pout<<
"UIPstream::read : started read from:" << fromProcNo
355 <<
" tag:" << tag <<
" read size:" << label(bufSize)
368 <<
"Unsupported communications type " << int(commsType)
int debug
Static debugging option.
static label warnComm
Debugging: warn for use of any communicator differing from warnComm.
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...
void setEof()
Set stream to have reached eof.
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.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
void setOpened()
Set stream opened.
DynamicList< MPI_Comm > MPICommunicators_
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.
word format(conversionProperties.get< word >("format"))
static void addGatherTime()
Add time increment to gatherTime.
commsTypes commsType() const
Get the communications type of the stream.
static const Enum< commsTypes > commsTypeNames
Names of the communication types.
errorManip< error > abort(error &err)
void setSize(const label nElem)
Alter addressable list size.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void setCapacity(const label nElem)
Alter the size of the underlying storage.
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void setGood()
Set stream to be good.
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,.