initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / OpenFOAM / meshes / ProcessorTopology / commSchedule.H
blobf316fe97ffb101755ac9ccfed9846db2f16f971b
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 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 Class
26     Foam::commSchedule
28 Description
29     Determines the order in which a set of processors should communicate
30     with one another.
32     The communication order should 
33       - have maximum overlap
34       - allow blocking communication without deadlock
36     Does a very simple scheduling which assumes same time for all operations.
38     After construction:
39       - schedule() gives the order in which the input communication should occur
40       - procSchedule()[procI] gives per procI
42     Does not care whether 'talking' is first send, second receive or maybe
43     full swap. This is all responsability of caller. See ProcessorTopology
44     class for use in scheduling processor boundary swaps.
46 SourceFiles
47     commSchedule.C
49 \*---------------------------------------------------------------------------*/
51 #ifndef commSchedule_H
52 #define commSchedule_H
54 #include "DynamicList.H"
55 #include "labelPair.H"
56 #include "labelList.H"
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 namespace Foam
63 /*---------------------------------------------------------------------------*\
64                            Class commSchedule Declaration
65 \*---------------------------------------------------------------------------*/
67 class commSchedule
69     // Private data
71         //- Order in which input communication has been scheduled
72         labelList schedule_;
74         //- Per processor the order in which communication has been scheduled
75         labelListList procSchedule_;
77     // Private Member Functions
79         //- Count the number of outstanding communications for a single
80         //  processor
81         label outstandingComms(const labelList&, DynamicList<label>&) const;
84 public:
86     ClassName("commSchedule");
88     // Constructors
90         //- Construct from wanted communication. Wanted communication is between
91         //  two processors. Can be a one-way communication or
92         //  two-way communication, that is up to the caller. This class just
93         //  determines an order for it such that any processor is only talking
94         //  to one other at a time. After construction:
95         //  - schedule is the order in which comms is done.
96         //  - procSchedule[procI] is for procI the order in which comms is done.
97         commSchedule(const label nProcs, const List<labelPair>& comms);
100     // Member Functions
102         //- order in which comms is scheduled
103         const labelList& schedule() const
104         {
105             return schedule_;
106         }
108         //- Per processor the order in which communication has been scheduled
109         const labelListList& procSchedule() const
110         {
111             return procSchedule_;
112         }
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 } // End namespace Foam
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 #endif
126 // ************************************************************************* //