mapDistributePolyMesh.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 | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::mapDistributePolyMesh
26 
27 Description
28  Class containing mesh-to-mesh mapping information after a mesh distribution
29  where we send parts of meshes (using subsetting) to other processors
30  and receive and reconstruct mesh.
31 
32  We store mapping from the bits-to-send to the complete starting mesh
33  (subXXXMap) and from the received bits to their location in the new
34  mesh (constructXXXMap).
35 
36 SourceFiles
37  mapDistributePolyMesh.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef mapDistributePolyMesh_H
42 #define mapDistributePolyMesh_H
43 
44 #include "mapDistribute.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 class mapPolyMesh;
52 class polyMesh;
53 
54 /*---------------------------------------------------------------------------*\
55  Class mapDistributePolyMesh Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 {
60  // Private data
61 
62  const polyMesh& mesh_;
63 
64  //- Number of old live points
65  const label nOldPoints_;
66 
67  //- Number of old live faces
68  const label nOldFaces_;
69 
70  //- Number of old live cells
71  const label nOldCells_;
72 
73  //- List of the old patch sizes
74  labelList oldPatchSizes_;
75 
76  //- List of the old patch start labels
77  const labelList oldPatchStarts_;
78 
79  //- List of numbers of mesh points per old patch
80  const labelList oldPatchNMeshPoints_;
81 
82 
83  //- Point distribute map
84  const mapDistribute pointMap_;
85 
86  //- Face distribute map
87  const mapDistribute faceMap_;
88 
89  //- Cell distribute map
90  const mapDistribute cellMap_;
91 
92  //- Patch distribute map
93  const mapDistribute patchMap_;
94 
95 
96 
97  // Private Member Functions
98 
99  void calcPatchSizes();
100 
101  //- Disallow default bitwise copy construct
103 
104  //- Disallow default bitwise assignment
105  void operator=(const mapDistributePolyMesh&);
106 
107 
108 public:
109 
110  // Constructors
111 
112  //- Construct from components. Note that mesh has to be changed already
113  // since uses mesh.nPoints etc as the new size.
115  (
116  const polyMesh& mesh,
117 
118  // mesh before changes
119  const label nOldPoints,
120  const label nOldFaces,
121  const label nOldCells,
124 
125  // how to subset pieces of mesh to send across
126  const Xfer<labelListList>& subPointMap,
127  const Xfer<labelListList>& subFaceMap,
128  const Xfer<labelListList>& subCellMap,
129  const Xfer<labelListList>& subPatchMap,
130 
131  // how to reconstruct received mesh
132  const Xfer<labelListList>& constructPointMap,
133  const Xfer<labelListList>& constructFaceMap,
134  const Xfer<labelListList>& constructCellMap,
135  const Xfer<labelListList>& constructPatchMap
136  );
137 
138 
139  // Member Functions
140 
141  // Access
143  const polyMesh& mesh() const
144  {
145  return mesh_;
146  }
147 
148  //- Number of points in mesh before distribution
149  label nOldPoints() const
150  {
151  return nOldPoints_;
152  }
153 
154  //- Number of faces in mesh before distribution
155  label nOldFaces() const
156  {
157  return nOldFaces_;
158  }
159 
160  //- Number of cells in mesh before distribution
161  label nOldCells() const
162  {
163  return nOldCells_;
164  }
165 
166  //- List of the old patch sizes
167  const labelList& oldPatchSizes() const
168  {
169  return oldPatchSizes_;
170  }
171 
172  //- List of the old patch start labels
173  const labelList& oldPatchStarts() const
174  {
175  return oldPatchStarts_;
176  }
177 
178  //- List of numbers of mesh points per old patch
179  const labelList& oldPatchNMeshPoints() const
180  {
181  return oldPatchNMeshPoints_;
182  }
183 
184  //- Point distribute map
185  const mapDistribute& pointMap() const
186  {
187  return pointMap_;
188  }
189 
190  //- Face distribute map
191  const mapDistribute& faceMap() const
192  {
193  return faceMap_;
194  }
195 
196  //- Cell distribute map
197  const mapDistribute& cellMap() const
198  {
199  return cellMap_;
200  }
201 
202  //- Patch distribute map
203  const mapDistribute& patchMap() const
204  {
205  return patchMap_;
206  }
207 
208 
209  // Edit
210 
211  //- Distribute list of point data
212  template<class T>
213  void distributePointData(List<T>& lst) const
214  {
215  pointMap_.distribute(lst);
216  }
217 
218  //- Distribute list of face data
219  template<class T>
220  void distributeFaceData(List<T>& lst) const
221  {
222  faceMap_.distribute(lst);
223  }
224 
225  //- Distribute list of cell data
226  template<class T>
227  void distributeCellData(List<T>& lst) const
228  {
229  cellMap_.distribute(lst);
230  }
231 
232  //- Distribute list of patch data
233  template<class T>
234  void distributePatchData(List<T>& lst) const
235  {
236  patchMap_.distribute(lst);
237  }
238 
239 
240  //- Distribute list of point/face/cell/patch indices.
241  // (Converts to boolList, distributes boolList and reconstructs)
242  void distributePointIndices(labelList& pointIDs) const;
243 
244  void distributeFaceIndices(labelList& faceIDs) const;
245  void distributeCellIndices(labelList& cellIDs) const;
246  void distributePatchIndices(labelList& patchIDs) const;
247 
248 
249  //- Correct for topo change.
250  void updateMesh(const mapPolyMesh&)
251  {
253  (
254  "mapDistributePolyMesh::updateMesh(const mapPolyMesh&)"
255  );
256  }
257 };
258 
259 
260 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 
262 } // End namespace Foam
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 #endif
267 
268 // ************************************************************************* //
const labelList & oldPatchSizes() const
List of the old patch sizes.
void distributeFaceIndices(labelList &faceIDs) const
const labelList & oldPatchNMeshPoints() const
List of numbers of mesh points per old patch.
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const labelListList &constructMap, List< T > &, const int tag=UPstream::msgType())
Distribute data. Note:schedule only used for Pstream::scheduled.
label nOldPoints() const
Number of points in mesh before distribution.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
const mapDistribute & cellMap() const
Cell distribute map.
Class containing processor-to-processor mapping information.
const labelList & oldPatchStarts() const
List of the old patch start labels.
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
label nOldCells() const
Number of cells in mesh before distribution.
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
void distributeCellIndices(labelList &cellIDs) const
void distributePatchData(List< T > &lst) const
Distribute list of patch data.
Namespace for OpenFOAM.
const polyMesh & mesh() const
const mapDistribute & faceMap() const
Face distribute map.
void updateMesh(const mapPolyMesh &)
Correct for topo change.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
void distributePointIndices(labelList &pointIDs) const
Distribute list of point/face/cell/patch indices.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
const mapDistribute & pointMap() const
Point distribute map.
const mapDistribute & patchMap() const
Patch distribute map.
void distributePatchIndices(labelList &patchIDs) const
#define notImplemented(functionName)
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:356
void distributeFaceData(List< T > &lst) const
Distribute list of face data.
void distributeCellData(List< T > &lst) const
Distribute list of cell data.
label nOldFaces() const
Number of faces in mesh before distribution.
void distributePointData(List< T > &lst) const
Distribute list of point data.