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  Copyright (C) 2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::commSchedule
29 
30 Description
31  Determines the order in which a set of processors should communicate
32  with one another.
33 
34  The communication order should
35  - have maximum overlap
36  - allow blocking communication without deadlock
37 
38  Does a very simple scheduling which assumes same time for all operations.
39 
40  After construction:
41  - schedule() gives the order in which the input communication should occur
42  - procSchedule()[proci] gives per proci
43 
44  Does not care whether 'talking' is first send, second receive or maybe
45  full swap. This is all responsibility of caller.
46  See Foam::rocessorTopology for use in scheduling processor boundary swaps.
47 
48 SourceFiles
49  commSchedule.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef Foam_commSchedule_H
54 #define Foam_commSchedule_H
55 
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 
79 public:
80 
81  //- Runtime type information
82  ClassName("commSchedule");
83 
84 
85  // Constructors
86 
87  //- Construct from wanted communication. Wanted communication is between
88  //- two processors. Can be a one-way communication or
89  //- two-way communication, that is up to the caller.
90  //
91  // 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);
97 
98 
99  // Member Functions
100 
101  //- Order in which comms is scheduled
102  const labelList& schedule() const noexcept
103  {
104  return schedule_;
105  }
106 
107  //- Per processor the order in which communication has been scheduled
109  {
110  return procSchedule_;
111  }
112 };
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 } // End namespace Foam
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 #endif
122 
123 // ************************************************************************* //
const labelList & schedule() const noexcept
Order in which comms is scheduled.
Definition: commSchedule.H:108
ClassName("commSchedule")
Runtime type information.
const labelListList & procSchedule() const noexcept
Per processor the order in which communication has been scheduled.
Definition: commSchedule.H:116
commSchedule(const label nProcs, const List< labelPair > &comms)
Construct from wanted communication. Wanted communication is between two processors. Can be a one-way communication or two-way communication, that is up to the caller.
Definition: commSchedule.C:66
const direction noexcept
Definition: Scalar.H:258
Determines the order in which a set of processors should communicate with one another.
Definition: commSchedule.H:63
Namespace for OpenFOAM.