UIPread.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-2015 OpenFOAM Foundation
9  Copyright (C) 2021 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 Description
28  Read from UIPstream
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #include "UIPstream.H"
33 
34 // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
35 
37 (
38  const commsTypes commsType,
39  const int fromProcNo,
40  DynamicList<char>& receiveBuf,
41  label& receiveBufPosition,
42  const int tag,
43  const label comm,
44  const bool clearAtEnd,
46 )
47 :
48  UPstream(commsType),
49  Istream(fmt, IOstreamOption::currentVersion),
50  fromProcNo_(fromProcNo),
51  recvBuf_(receiveBuf),
52  recvBufPos_(receiveBufPosition),
53  tag_(tag),
54  comm_(comm),
55  clearAtEnd_(clearAtEnd),
56  messageSize_(0)
57 {
59 }
60 
61 
62 Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
63 :
64  UPstream(buffers.commsType_),
65  Istream(buffers.format_, IOstreamOption::currentVersion),
66  fromProcNo_(fromProcNo),
67  recvBuf_(buffers.recvBuf_[fromProcNo]),
68  recvBufPos_(buffers.recvBufPos_[fromProcNo]),
69  tag_(buffers.tag_),
70  comm_(buffers.comm_),
71  clearAtEnd_(true),
72  messageSize_(0)
73 {
75 }
76 
77 
78 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
79 
80 Foam::label Foam::UIPstream::read
81 (
82  const commsTypes commsType,
83  const int fromProcNo,
84  char* buf,
85  const std::streamsize bufSize,
86  const int tag,
87  const label communicator
88 )
89 {
91  return 0;
92 }
93 
94 
95 // ************************************************************************* //
Foam::DynamicList< char >
Foam::PstreamBuffers
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Definition: PstreamBuffers.H:88
Foam::UIPstream::read
static label read(const commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=UPstream::worldComm)
Read into given buffer from given processor.
Definition: UIPread.C:81
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::UIPstream::UIPstream
UIPstream(const commsTypes commsType, const int fromProcNo, DynamicList< char > &receiveBuf, label &receiveBufPosition, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, const bool clearAtEnd=false, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Definition: UIPread.C:37
Foam::UPstream
Inter-processor communications stream.
Definition: UPstream.H:61
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::IOstreamOption::streamFormat
streamFormat
Data format (ascii | binary)
Definition: IOstreamOption.H:70
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::UPstream::communicator
Helper class for allocating/freeing communicators.
Definition: UPstream.H:329
UIPstream.H