OPstreams.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011 OpenFOAM Foundation
9 Copyright (C) 2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "UOPstream.H"
30#include "OPstream.H"
31
32// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
33
35(
36 const commsTypes commsType,
37 const int toProcNo,
38 DynamicList<char>& sendBuf,
39 const int tag,
40 const label comm,
41 const bool sendAtDestruct,
43)
44:
45 UOPstreamBase(commsType, toProcNo, sendBuf, tag, comm, sendAtDestruct, fmt)
46{}
47
48
49Foam::UOPstream::UOPstream(const int toProcNo, PstreamBuffers& buffers)
50:
51 UOPstreamBase(toProcNo, buffers)
52{}
53
54
56(
57 const commsTypes commsType,
58 const int toProcNo,
59 const label bufSize,
60 const int tag,
61 const label comm,
63)
64:
65 Pstream(commsType, bufSize),
67 (
68 commsType,
69 toProcNo,
70 Pstream::transferBuf_,
71 tag,
72 comm,
73 true, // sendAtDestruct
74 fmt
75 )
76{}
77
78
79// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
80
82{
83 if (sendAtDestruct_)
84 {
85 if (!bufferIPCsend())
86 {
88 << "Failed sending outgoing message of size "
89 << sendBuf_.size() << " to processor " << toProcNo_
91 }
92 }
93}
94
95
96// ************************************************************************* //
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:72
streamFormat
Data format (ascii | binary)
Output inter-processor communications stream.
Definition: OPstream.H:57
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Inter-processor communications stream.
Definition: Pstream.H:63
Base class for output inter-processor communications stream (ie, parallel streams)....
Definition: UOPstream.H:62
virtual ~UOPstream()
Destructor, usually sends buffer on destruct.
Definition: OPstreams.C:81
commsTypes
Types of communications.
Definition: UPstream.H:67
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
errorManip< error > abort(error &err)
Definition: errorManip.H:144
error FatalError