1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
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
29 Determines the order in which a set of processors should communicate
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.
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.
49 \*---------------------------------------------------------------------------*/
51 #ifndef commSchedule_H
52 #define commSchedule_H
54 #include "DynamicList.H"
55 #include "labelPair.H"
56 #include "labelList.H"
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 /*---------------------------------------------------------------------------*\
64 Class commSchedule Declaration
65 \*---------------------------------------------------------------------------*/
71 //- Order in which input communication has been scheduled
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
81 label outstandingComms(const labelList&, DynamicList<label>&) const;
86 ClassName("commSchedule");
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);
102 //- order in which comms is scheduled
103 const labelList& schedule() const
108 //- Per processor the order in which communication has been scheduled
109 const labelListList& procSchedule() const
111 return procSchedule_;
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 } // End namespace Foam
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 // ************************************************************************* //