1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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.
34 \*---------------------------------------------------------------------------*/
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class IPstream Declaration
50 \*---------------------------------------------------------------------------*/
63 // Private member functions
65 //- Check the bufferPosition_ against messageSize_ for EOF
66 inline void checkEof();
68 //- Read a T from the transfer buffer
70 inline void readFromBuffer(T&);
72 //- Read data from the transfer buffer
73 inline void readFromBuffer(void* data, size_t count, size_t align);
80 //- Construct given process index to read from and optional buffer size,
81 // read format and IO version
84 const commsTypes commsType,
86 const label bufSize = 0,
87 streamFormat format=BINARY,
88 versionNumber version=currentVersion
101 //- Return flags of output stream
102 ios_base::fmtflags flags() const
104 return ios_base::fmtflags(0);
110 //- Read into given buffer from given processor and return the
114 const commsTypes commsType,
115 const int fromProcNo,
117 const std::streamsize bufSize
120 //- Non-blocking receives: wait until all have finished.
121 static void waitRequests();
123 //- Non-blocking receives: has request i finished?
124 static bool finishedRequest(const label i);
126 //- Return next token from stream
127 Istream& read(token&);
130 Istream& read(char&);
133 Istream& read(word&);
135 // Read a string (including enclosing double-quotes)
136 Istream& read(string&);
139 Istream& read(label&);
141 //- Read a floatScalar
142 Istream& read(floatScalar&);
144 //- Read a doubleScalar
145 Istream& read(doubleScalar&);
147 //- Read binary block
148 Istream& read(char*, std::streamsize);
150 //- Rewind and return the stream so that it may be read again
156 //- Set flags of stream
157 ios_base::fmtflags flags(const ios_base::fmtflags)
159 return ios_base::fmtflags(0);
165 //- Print description of IOstream to Ostream
166 void print(Ostream&) const;
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 } // End namespace Foam
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 // ************************************************************************* //