IPstream.H
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-2013 OpenFOAM Foundation
9  Copyright (C) 2021-2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 Class
28  Foam::IPstream
29 
30 Description
31  Input inter-processor communications stream.
32 
33 SourceFiles
34  IPstreams.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #include "Pstream.H"
39 
40 #ifndef Foam_IPstream_H
41 #define Foam_IPstream_H
42 
43 #include "UIPstream.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class IPstream Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class IPstream
55 :
56  public Pstream,
57  public UIPstream
58 {
59 public:
60 
61  // Constructors
62 
63  //- Construct given process index to read from
64  //- and optional buffer size, read format
65  IPstream
66  (
68  const int fromProcNo,
69  const label bufSize = 0,
70  const int tag = UPstream::msgType(),
71  const label comm = UPstream::worldComm,
73  );
74 };
75 
76 
77 /*---------------------------------------------------------------------------*\
78  Class IPBstream Declaration
79 \*---------------------------------------------------------------------------*/
80 
81 //- Input inter-processor communications stream
82 //- using MPI broadcast.
83 class IPBstream
84 :
85  public Pstream,
86  public UIPBstream
87 {
88 public:
89 
90  // Constructors
91 
92  //- Construct for broadcast root, optional buffer size, read format
93  IPBstream
94  (
95  const UPstream::commsTypes,
96  const int rootProcNo,
97  const label bufSize = 0,
98  const int tag = UPstream::msgType(),
99  const label comm = UPstream::worldComm,
101  );
102 
103  //- Construct for broadcast root with optional communicator,
104  //- write format
105  explicit IPBstream
106  (
107  const int rootProcNo,
108  const label comm = UPstream::worldComm,
110  );
111 };
112 
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 } // End namespace Foam
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 #endif
121 
122 // ************************************************************************* //
IPBstream(const UPstream::commsTypes, const int rootProcNo, const label bufSize=0, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Construct for broadcast root, optional buffer size, read format.
Definition: IPBstreams.C:56
IPstream(const UPstream::commsTypes commsType, const int fromProcNo, const label bufSize=0, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Construct given process index to read from and optional buffer size, read format. ...
Definition: IPstreams.C:98
commsTypes
Communications types.
Definition: UPstream.H:72
static int & msgType() noexcept
Message tag of standard messages.
Definition: UPstream.H:1229
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
Definition: UPstream.H:409
Input inter-processor communications stream.
Definition: IPstream.H:49
Input inter-processor communications stream using MPI send/recv etc. - operating on external buffer...
Definition: UIPstream.H:287
Input inter-processor communications stream using MPI broadcast - operating on external buffer...
Definition: UIPstream.H:528
Inter-processor communications stream.
Definition: Pstream.H:57
commsTypes commsType() const noexcept
Get the communications type of the stream.
Definition: UPstream.H:1261
Input inter-processor communications stream using MPI broadcast.
Definition: IPstream.H:82
streamFormat
Data format (ascii | binary)
Namespace for OpenFOAM.