1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 Global functions and variables for working with parallel streams,
30 but principally for gamma/mpi
35 \*---------------------------------------------------------------------------*/
37 #ifndef PstreamGlobals_H
38 #define PstreamGlobals_H
40 #include "FixedList.H"
41 #include "labelList.H"
42 #include "DynamicList.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class PstreamGlobals Declaration
51 \*---------------------------------------------------------------------------*/
53 namespace PstreamGlobals
56 //- Block wait for message on port procNo
57 void gammaWait(const label procNo);
59 //- Helper routine to copy out newly received data
69 extern FixedList<List<List<char> >, 4> recvBuf;
71 //- Length of receive buffers
72 extern FixedList<labelList, 4> recvBufLen;
74 //- Currently active buffer in receiving
75 extern labelList recvIndex;
76 //- Receive buffer that has to be consumed
77 extern labelList consumeIndex;
80 //- Special message to signal resizing
81 const int resizeMessageLen = 6;
82 extern uint64_t resizeMessage[];
83 //- Initial buffer length. Should be able to contain the message comfortably.
84 const int initialBufferLen = 2*resizeMessageLen*sizeof(uint64_t);
86 //- Helper routine to check if a message is a resize message.
87 // Returns -1 if not or the new size.
88 label getSizeFromHeader(const char* buf, const label len);
89 //- Change the resize message to contain the new length
90 void setResizeMessage(const label len);
92 //- Get max size of all receive buffers to procNo
93 label getMaxBufSize(const int procNo);
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 } // End namespace Foam
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 // ************************************************************************* //