initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / Pstream / gamma / PstreamGlobals.H
blobb40c48cddfcd7b02ca19d864dc0e92f2589daac8
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Namespace
26     Foam::PstreamGlobals
28 Description
29     Global functions and variables for working with parallel streams,
30     but principally for gamma/mpi
32 SourceFiles
33     PstreamGlobals.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef PstreamGlobals_H
38 #define PstreamGlobals_H
40 #include "FixedList.H"
41 #include "labelList.H"
42 #include "DynamicList.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
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
60 label copyReceive
62     const label procNo,
63     char* buf,
64     const label bufSize
68 //- Receive buffers
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 #endif
106 // ************************************************************************* //