FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

commSchedule.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::commSchedule
00026 
00027 Description
00028     Determines the order in which a set of processors should communicate
00029     with one another.
00030  
00031     The communication order should 
00032       - have maximum overlap
00033       - allow blocking communication without deadlock
00034  
00035     Does a very simple scheduling which assumes same time for all operations.
00036 
00037     After construction:
00038       - schedule() gives the order in which the input communication should occur
00039       - procSchedule()[procI] gives per procI
00040 
00041     Does not care whether 'talking' is first send, second receive or maybe
00042     full swap. This is all responsability of caller. See ProcessorTopology
00043     class for use in scheduling processor boundary swaps.
00044 
00045 SourceFiles
00046     commSchedule.C
00047 
00048 \*---------------------------------------------------------------------------*/
00049 
00050 #ifndef commSchedule_H
00051 #define commSchedule_H
00052 
00053 #include <OpenFOAM/DynamicList.H>
00054 #include <OpenFOAM/labelPair.H>
00055 #include <OpenFOAM/labelList.H>
00056 
00057 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00058 
00059 namespace Foam
00060 {
00061 
00062 /*---------------------------------------------------------------------------*\
00063                            Class commSchedule Declaration
00064 \*---------------------------------------------------------------------------*/
00065 
00066 class commSchedule
00067 {
00068     // Private data
00069 
00070         //- Order in which input communication has been scheduled
00071         labelList schedule_;
00072 
00073         //- Per processor the order in which communication has been scheduled
00074         labelListList procSchedule_;
00075 
00076     // Private Member Functions
00077 
00078         //- Count the number of outstanding communications for a single
00079         //  processor
00080         label outstandingComms(const labelList&, DynamicList<label>&) const;
00081 
00082 
00083 public:
00084 
00085     ClassName("commSchedule");
00086 
00087     // Constructors
00088 
00089         //- Construct from wanted communication. Wanted communication is between
00090         //  two processors. Can be a one-way communication or
00091         //  two-way communication, that is up to the caller. This class just
00092         //  determines an order for it such that any processor is only talking
00093         //  to one other at a time. After construction:
00094         //  - schedule is the order in which comms is done.
00095         //  - procSchedule[procI] is for procI the order in which comms is done.
00096         commSchedule(const label nProcs, const List<labelPair>& comms);
00097 
00098 
00099     // Member Functions
00100 
00101         //- order in which comms is scheduled
00102         const labelList& schedule() const
00103         {
00104             return schedule_;
00105         }
00106 
00107         //- Per processor the order in which communication has been scheduled
00108         const labelListList& procSchedule() const
00109         {
00110             return procSchedule_;
00111         }
00112 
00113 
00114 };
00115 
00116 
00117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00118 
00119 } // End namespace Foam
00120 
00121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00122 
00123 #endif
00124 
00125 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines