BUG: potentialFoam/cylinder: indexing into non-existing patch in parallel
[OpenFOAM-2.0.x.git] / src / OpenFOAM / meshes / ProcessorTopology / commSchedule.H
blob061ef0e4c634a67f12b81672946b0c9761a11ca3
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::commSchedule
27 Description
28     Determines the order in which a set of processors should communicate
29     with one another.
31     The communication order should
32       - have maximum overlap
33       - allow blocking communication without deadlock
35     Does a very simple scheduling which assumes same time for all operations.
37     After construction:
38       - schedule() gives the order in which the input communication should occur
39       - procSchedule()[procI] gives per procI
41     Does not care whether 'talking' is first send, second receive or maybe
42     full swap. This is all responsability of caller. See ProcessorTopology
43     class for use in scheduling processor boundary swaps.
45 SourceFiles
46     commSchedule.C
48 \*---------------------------------------------------------------------------*/
50 #ifndef commSchedule_H
51 #define commSchedule_H
53 #include "DynamicList.H"
54 #include "labelPair.H"
55 #include "labelList.H"
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 namespace Foam
62 /*---------------------------------------------------------------------------*\
63                            Class commSchedule Declaration
64 \*---------------------------------------------------------------------------*/
66 class commSchedule
68     // Private data
70         //- Order in which input communication has been scheduled
71         labelList schedule_;
73         //- Per processor the order in which communication has been scheduled
74         labelListList procSchedule_;
76     // Private Member Functions
78         //- Count the number of outstanding communications for a single
79         //  processor
80         label outstandingComms(const labelList&, DynamicList<label>&) const;
83 public:
85     ClassName("commSchedule");
87     // Constructors
89         //- Construct from wanted communication. Wanted communication is between
90         //  two processors. Can be a one-way communication or
91         //  two-way communication, that is up to the caller. This class just
92         //  determines an order for it such that any processor is only talking
93         //  to one other at a time. After construction:
94         //  - schedule is the order in which comms is done.
95         //  - procSchedule[procI] is for procI the order in which comms is done.
96         commSchedule(const label nProcs, const List<labelPair>& comms);
99     // Member Functions
101         //- order in which comms is scheduled
102         const labelList& schedule() const
103         {
104             return schedule_;
105         }
107         //- Per processor the order in which communication has been scheduled
108         const labelListList& procSchedule() const
109         {
110             return procSchedule_;
111         }
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 } // End namespace Foam
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 #endif
125 // ************************************************************************* //