check for non-blocking OPstream usage

This commit is contained in:
mattijs
2009-08-12 18:35:44 +01:00
parent c1dd67b8bc
commit a36af20908

View File

@ -42,20 +42,35 @@ Foam::DynamicList<MPI_Request> OPstream_outstandingRequests_;
Foam::OPstream::~OPstream() Foam::OPstream::~OPstream()
{ {
if if (commsType_ == nonBlocking)
(
!write
(
commsType_,
toProcNo_,
buf_.begin(),
bufPosition_
)
)
{ {
FatalErrorIn("OPstream::~OPstream()") // alloc nonBlocking only if empty buffer. This denotes the buffer
<< "MPI_Bsend cannot send outgoing message" // having been transfered out.
<< Foam::abort(FatalError); if (bufPosition_ > 0)
{
FatalErrorIn("OPstream::~OPstream()")
<< "OPstream contains buffer so cannot be used with nonBlocking"
<< " since destructor would destroy buffer whilst possibly"
<< " still sending." << Foam::abort(FatalError);
}
}
else
{
if
(
!write
(
commsType_,
toProcNo_,
buf_.begin(),
bufPosition_
)
)
{
FatalErrorIn("OPstream::~OPstream()")
<< "MPI cannot send outgoing message"
<< Foam::abort(FatalError);
}
} }
} }