1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Input inter-processor communications stream.
35 \*---------------------------------------------------------------------------*/
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class IPstream Declaration
51 \*---------------------------------------------------------------------------*/
64 // Private member functions
66 //- Check the bufferPosition_ against messageSize_ for EOF
67 inline void checkEof();
69 //- Read a T from the transfer buffer
71 inline void readFromBuffer(T&);
73 //- Read data from the transfer buffer
74 inline void readFromBuffer(void* data, size_t count);
81 //- Construct given process index to read from and optional buffer size,
82 // read format and IO version
85 const commsTypes commsType,
87 const label bufSize = 0,
88 streamFormat format=BINARY,
89 versionNumber version=currentVersion
102 //- Return flags of output stream
103 ios_base::fmtflags flags() const
105 return ios_base::fmtflags(0);
111 //- Read into given buffer from given processor and return the
115 const commsTypes commsType,
116 const int fromProcNo,
118 const std::streamsize bufSize
121 //- Non-blocking receives: wait until all have finished.
122 static void waitRequests();
124 //- Non-blocking receives: has request i finished?
125 static bool finishedRequest(const label i);
127 //- Return next token from stream
128 Istream& read(token&);
131 Istream& read(char&);
134 Istream& read(word&);
136 // Read a string (including enclosing double-quotes)
137 Istream& read(string&);
140 Istream& read(label&);
142 //- Read a floatScalar
143 Istream& read(floatScalar&);
145 //- Read a doubleScalar
146 Istream& read(doubleScalar&);
148 //- Read binary block
149 Istream& read(char*, std::streamsize);
151 //- Rewind and return the stream so that it may be read again
157 //- Set flags of stream
158 ios_base::fmtflags flags(const ios_base::fmtflags)
160 return ios_base::fmtflags(0);
166 //- Print description of IOstream to Ostream
167 void print(Ostream&) const;
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 } // End namespace Foam
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 // ************************************************************************* //