openfoam/src/OpenFOAM/db/IOstreams/Pstreams/OPstreams.C
Mark Olesen 568ced68e2 ENH: support independent handling of MPI requests (#2674)
- UPstream::Request wrapping class provides an opaque wrapper for
  vendor MPI_Request values, independent of global lists.

ENH: support for MPI barrier (blocking or non-blocking)
ENH: support for MPI sync-send variants

STYLE: deprecate waitRequests() without a position parameter

- in many cases this can indicate a problem in the program logic since
  normally the startOfRequests should be tracked locally.
2023-01-12 21:19:12 +01:00

97 lines
2.7 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2022-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "UOPstream.H"
#include "OPstream.H"
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
Foam::UOPstream::UOPstream
(
const UPstream::commsTypes commsType,
const int toProcNo,
DynamicList<char>& sendBuf,
const int tag,
const label comm,
const bool sendAtDestruct,
IOstreamOption::streamFormat fmt
)
:
UOPstreamBase(commsType, toProcNo, sendBuf, tag, comm, sendAtDestruct, fmt)
{}
Foam::UOPstream::UOPstream(const int toProcNo, PstreamBuffers& buffers)
:
UOPstreamBase(toProcNo, buffers)
{}
Foam::OPstream::OPstream
(
const UPstream::commsTypes commsType,
const int toProcNo,
const label bufSize,
const int tag,
const label comm,
IOstreamOption::streamFormat fmt
)
:
Pstream(commsType, bufSize),
UOPstream
(
commsType,
toProcNo,
Pstream::transferBuf_,
tag,
comm,
true, // sendAtDestruct
fmt
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::UOPstream::~UOPstream()
{
if (sendAtDestruct_)
{
if (!bufferIPCsend())
{
FatalErrorInFunction
<< "Failed sending outgoing message of size "
<< sendBuf_.size() << " to processor " << toProcNo_
<< Foam::abort(FatalError);
}
}
}
// ************************************************************************* //