1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Input inter-processor communications stream.
33 \*---------------------------------------------------------------------------*/
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Class IPstream Declaration
49 \*---------------------------------------------------------------------------*/
58 //- ID of sending processor
65 // Private member functions
67 //- Check the bufferPosition_ against messageSize_ for EOF
68 inline void checkEof();
70 //- Read a T from the transfer buffer
72 inline void readFromBuffer(T&);
74 //- Read data from the transfer buffer
75 inline void readFromBuffer(void* data, size_t count, size_t align);
82 //- Construct given process index to read from, optional buffer size,
83 // read format and IO version
86 const commsTypes commsType,
88 const label bufSize = 0,
89 streamFormat format = BINARY,
90 versionNumber version = currentVersion
103 //- Return flags of output stream
104 ios_base::fmtflags flags() const
106 return ios_base::fmtflags(0);
112 //- Read into given buffer from given processor and return the
116 const commsTypes commsType,
117 const int fromProcNo,
119 const std::streamsize bufSize
122 //- Non-blocking receives: wait until all have finished.
123 static void waitRequests();
125 //- Non-blocking receives: has request i finished?
126 static bool finishedRequest(const label i);
128 //- Return next token from stream
129 Istream& read(token&);
132 Istream& read(char&);
135 Istream& read(word&);
137 // Read a string (including enclosing double-quotes)
138 Istream& read(string&);
141 Istream& read(label&);
143 //- Read a floatScalar
144 Istream& read(floatScalar&);
146 //- Read a doubleScalar
147 Istream& read(doubleScalar&);
149 //- Read a longDoubleScalar
150 Istream& read(longDoubleScalar&);
152 //- Read binary block
153 Istream& read(char*, std::streamsize);
155 //- Rewind and return the stream so that it may be read again
161 //- Set flags of stream
162 ios_base::fmtflags flags(const ios_base::fmtflags)
164 return ios_base::fmtflags(0);
170 //- Print description of IOstream to Ostream
171 void print(Ostream&) const;
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 } // End namespace Foam
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 // ************************************************************************* //