commSchedule.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::commSchedule
28 
29 Description
30  Determines the order in which a set of processors should communicate
31  with one another.
32 
33  The communication order should
34  - have maximum overlap
35  - allow blocking communication without deadlock
36 
37  Does a very simple scheduling which assumes same time for all operations.
38 
39  After construction:
40  - schedule() gives the order in which the input communication should occur
41  - procSchedule()[proci] gives per proci
42 
43  Does not care whether 'talking' is first send, second receive or maybe
44  full swap. This is all responsibility of caller. See ProcessorTopology
45  class for use in scheduling processor boundary swaps.
46 
47 SourceFiles
48  commSchedule.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef commSchedule_H
53 #define commSchedule_H
54 
55 #include "DynamicList.H"
56 #include "labelPair.H"
57 #include "labelList.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class commSchedule Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 class commSchedule
69 {
70  // Private data
71 
72  //- Order in which input communication has been scheduled
73  labelList schedule_;
74 
75  //- Per processor the order in which communication has been scheduled
76  labelListList procSchedule_;
77 
78  // Private Member Functions
79 
80  //- Count the number of outstanding communications for a single
81  // processor
82  label outstandingComms(const labelList&, DynamicList<label>&) const;
83 
84 
85 public:
86 
87  ClassName("commSchedule");
88 
89  // Constructors
90 
91  //- Construct from wanted communication. Wanted communication is between
92  // two processors. Can be a one-way communication or
93  // two-way communication, that is up to the caller. This class just
94  // determines an order for it such that any processor is only talking
95  // to one other at a time. After construction:
96  // - schedule is the order in which comms is done.
97  // - procSchedule[proci] is for proci the order in which comms is done.
98  commSchedule(const label nProcs, const List<labelPair>& comms);
99 
100 
101  // Member Functions
102 
103  //- Order in which comms is scheduled
104  const labelList& schedule() const
105  {
106  return schedule_;
107  }
108 
109  //- Per processor the order in which communication has been scheduled
110  const labelListList& procSchedule() const
111  {
112  return procSchedule_;
113  }
114 
115 
116 };
117 
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 } // End namespace Foam
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 #endif
126 
127 // ************************************************************************* //
Foam::commSchedule::procSchedule
const labelListList & procSchedule() const
Per processor the order in which communication has been scheduled.
Definition: commSchedule.H:109
Foam::DynamicList< label >
Foam::commSchedule
Determines the order in which a set of processors should communicate with one another.
Definition: commSchedule.H:67
labelList.H
Foam::commSchedule::ClassName
ClassName("commSchedule")
Foam::commSchedule::schedule
const labelList & schedule() const
Order in which comms is scheduled.
Definition: commSchedule.H:103
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::List< label >
DynamicList.H
Foam::commSchedule::commSchedule
commSchedule(const label nProcs, const List< labelPair > &comms)
Construct from wanted communication. Wanted communication is between.
Definition: commSchedule.C:68
labelPair.H