1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | 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 Global functions and variables for working with parallel streams,
29 but principally for gamma/mpi
34 \*---------------------------------------------------------------------------*/
36 #ifndef PstreamGlobals_H
37 #define PstreamGlobals_H
39 #include "FixedList.H"
40 #include "labelList.H"
41 #include "DynamicList.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class PstreamGlobals Declaration
50 \*---------------------------------------------------------------------------*/
52 namespace PstreamGlobals
55 //- Block wait for message on port procNo
56 void gammaWait(const label procNo);
58 //- Helper routine to copy out newly received data
68 extern FixedList<List<List<char> >, 4> recvBuf;
70 //- Length of receive buffers
71 extern FixedList<labelList, 4> recvBufLen;
73 //- Currently active buffer in receiving
74 extern labelList recvIndex;
75 //- Receive buffer that has to be consumed
76 extern labelList consumeIndex;
79 //- Special message to signal resizing
80 const int resizeMessageLen = 6;
81 extern uint64_t resizeMessage[];
82 //- Initial buffer length. Should be able to contain the message comfortably.
83 const int initialBufferLen = 2*resizeMessageLen*sizeof(uint64_t);
85 //- Helper routine to check if a message is a resize message.
86 // Returns -1 if not or the new size.
87 label getSizeFromHeader(const char* buf, const label len);
88 //- Change the resize message to contain the new length
89 void setResizeMessage(const label len);
91 //- Get max size of all receive buffers to procNo
92 label getMaxBufSize(const int procNo);
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 } // End namespace Foam
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 // ************************************************************************* //