helperFunctionsPar.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh 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 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh 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.
20 
21  You should have received a copy of the GNU General Public License
22  along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  helperFunctionsPar
26 
27 Description
28  Functions used for exchanging data between processors
29 
30 SourceFiles
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef helperFunctionsPar_H
35 #define helperFunctionsPar_H
36 
37 #include "labelList.H"
38 #include "LongList.H"
39 
40 #include <map>
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 namespace help
48 {
49 
50 //- exchanges the data between processors such that in the end thwy all have
51 //- the necessary information to proceed with the local work
52 template<class sendOp, class combineOp, class T, class ListType>
53 void combineData(const sendOp&, combineOp&);
54 
55 //- each processor exchanges the data with all of its neighbours
56 //- processors with lower labels first send the data to processors with
57 //- higher labels first and and then to the processors with lower labels
58 template<class T, class ListType, class scatterOp, class gatherOp>
59 void whisperReduce(const ListType&, const scatterOp&, gatherOp&);
60 
61 //- send the data stored in the map to other processors and collects the data
62 //- sent from other processors into the list
63 template<class T, class ListType>
64 void exchangeMap
65 (
66  const std::map<label, ListType>&,
67  LongList<T>&,
68  const Pstream::commsTypes commsType = Pstream::blocking
69 );
70 
71 //- sends the data stored in a map to other processors and receives the data
72 //- received from other processors into another map
73 template<class T, class ListType>
74 void exchangeMap(const std::map<label, ListType>&, std::map<label, List<T> >&);
75 
76 //- calculates the reverse addressing of the graph by transposing the graph
77 template<class RowType, template<class ListTypeArg> class GraphType>
78 void reverseAddressingSMP(const GraphType<RowType>&, GraphType<RowType>&);
79 
80 } // End namespace help
81 
82 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
83 
84 } // End namespace Foam
85 
86 #ifdef NoRepository
87 # include "helperFunctionsPar.C"
88 #endif
89 
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91 
92 #endif
93 
94 // ************************************************************************* //
Foam::help::whisperReduce
void whisperReduce(const ListType &neis, const scatterOp &sop, gatherOp &gop)
Definition: helperFunctionsPar.C:62
helperFunctionsPar.C
LongList.H
LongList
A dynamic list is a 1-D vector of objects of type T which resizes itself as necessary to accept the n...
Foam::UPstream::blocking
@ blocking
Definition: UPstream.H:66
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
labelList.H
Foam::help::reverseAddressingSMP
void reverseAddressingSMP(const GraphType< RowType > &addr, GraphType< RowType > &reverseAddr)
calculates the reverse addressing of the graph by transposing the graph
Definition: helperFunctionsPar.C:340
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:64
Foam::help::exchangeMap
void exchangeMap(const std::map< label, ListType > &m, LongList< T > &data, const Pstream::commsTypes commsType)
Definition: helperFunctionsPar.C:129
List
Definition: Test.C:19
Foam::help::combineData
void combineData(const sendOp &sop, combineOp &cop)
Definition: helperFunctionsPar.C:49