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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2015-2018 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::mapDistributePolyMesh
29 
30 Description
31  Class containing mesh-to-mesh mapping information after a mesh distribution
32  where we send parts of meshes (using subsetting) to other processors
33  and receive and reconstruct mesh.
34 
35  We store mapping from the bits-to-send to the complete starting mesh
36  (subXXXMap) and from the received bits to their location in the new
37  mesh (constructXXXMap).
38 
39 SourceFiles
40  mapDistributePolyMesh.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef mapDistributePolyMesh_H
45 #define mapDistributePolyMesh_H
46 
47 #include "mapDistribute.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward declarations
55 class mapPolyMesh;
56 class polyMesh;
57 class mapDistributePolyMesh;
58 
59 Istream& operator>>(Istream&, mapDistributePolyMesh&);
60 Ostream& operator<<(Ostream&, const mapDistributePolyMesh&);
61 
62 
63 /*---------------------------------------------------------------------------*\
64  Class mapDistributePolyMesh Declaration
65 \*---------------------------------------------------------------------------*/
66 
68 {
69  // Private data
70 
71  //- Number of old live points
72  label nOldPoints_;
73 
74  //- Number of old live faces
75  label nOldFaces_;
76 
77  //- Number of old live cells
78  label nOldCells_;
79 
80  //- List of the old patch sizes
81  labelList oldPatchSizes_;
82 
83  //- List of the old patch start labels
84  labelList oldPatchStarts_;
85 
86  //- List of numbers of mesh points per old patch
87  labelList oldPatchNMeshPoints_;
88 
89 
90  //- Point distribute map
91  mapDistribute pointMap_;
92 
93  //- Face distribute map
94  mapDistribute faceMap_;
95 
96  //- Cell distribute map
97  mapDistribute cellMap_;
98 
99  //- Patch distribute map
100  mapDistribute patchMap_;
101 
102 
103  // Private Member Functions
104 
105  void calcPatchSizes();
106 
107  //- No copy construct
109 
110 
111 public:
112 
113  // Constructors
114 
115  //- Construct null
117 
118  //- Move construct
120 
121  //- Construct from components. Note that mesh has to be changed already
122  // since uses mesh.nPoints etc as the new size.
124  (
125  const polyMesh& mesh,
126 
127  // mesh before changes
128  const label nOldPoints,
129  const label nOldFaces,
130  const label nOldCells,
133 
134  // how to subset pieces of mesh to send across
135  labelListList&& subPointMap,
136  labelListList&& subFaceMap,
137  labelListList&& subCellMap,
138  labelListList&& subPatchMap,
139 
140  // how to reconstruct received mesh
141  labelListList&& constructPointMap,
142  labelListList&& constructFaceMap,
143  labelListList&& constructCellMap,
144  labelListList&& constructPatchMap,
145 
146  const bool subFaceHasFlip = false,
147  const bool constructFaceHasFlip = false
148  );
149 
150  //- Move construct from components
152  (
153  // mesh before changes
154  const label nOldPoints,
155  const label nOldFaces,
156  const label nOldCells,
159 
160  // how to subset pieces of mesh to send across
165  );
166 
167  //- Construct from Istream
169 
170 
171  // Member Functions
172 
173  // Access
174 
175  //- Number of points in mesh before distribution
176  label nOldPoints() const
177  {
178  return nOldPoints_;
179  }
180 
181  //- Number of faces in mesh before distribution
182  label nOldFaces() const
183  {
184  return nOldFaces_;
185  }
186 
187  //- Number of cells in mesh before distribution
188  label nOldCells() const
189  {
190  return nOldCells_;
191  }
192 
193  //- List of the old patch sizes
194  const labelList& oldPatchSizes() const
195  {
196  return oldPatchSizes_;
197  }
198 
199  //- List of the old patch start labels
200  const labelList& oldPatchStarts() const
201  {
202  return oldPatchStarts_;
203  }
204 
205  //- List of numbers of mesh points per old patch
206  const labelList& oldPatchNMeshPoints() const
207  {
208  return oldPatchNMeshPoints_;
209  }
210 
211  //- Point distribute map
212  const mapDistribute& pointMap() const
213  {
214  return pointMap_;
215  }
216 
217  //- Face distribute map
218  const mapDistribute& faceMap() const
219  {
220  return faceMap_;
221  }
222 
223  //- Cell distribute map
224  const mapDistribute& cellMap() const
225  {
226  return cellMap_;
227  }
228 
229  //- Patch distribute map
230  const mapDistribute& patchMap() const
231  {
232  return patchMap_;
233  }
234 
235 
236  // Other
237 
238  //- Transfer the contents of the argument and annul the argument.
239  void transfer(mapDistributePolyMesh& map);
240 
241  //- Distribute list of point data
242  template<class T>
243  void distributePointData(List<T>& lst) const
244  {
245  pointMap_.distribute(lst);
246  }
247 
248  //- Distribute list of face data
249  template<class T>
250  void distributeFaceData(List<T>& lst) const
251  {
252  faceMap_.distribute(lst);
253  }
254 
255  //- Distribute list of cell data
256  template<class T>
257  void distributeCellData(List<T>& lst) const
258  {
259  cellMap_.distribute(lst);
260  }
261 
262  //- Distribute list of patch data
263  template<class T>
264  void distributePatchData(List<T>& lst) const
265  {
266  patchMap_.distribute(lst);
267  }
268 
269 
270  //- Distribute list of point/face/cell/patch indices.
271  // (Converts to boolList, distributes boolList and reconstructs)
272  void distributePointIndices(labelList& pointIDs) const;
273 
274  void distributeFaceIndices(labelList& faceIDs) const;
275  void distributeCellIndices(labelList& cellIDs) const;
276  void distributePatchIndices(labelList& patchIDs) const;
277 
278 
279  //- Correct for topo change.
280  void updateMesh(const mapPolyMesh&)
281  {
283  }
284 
285 
286  // Member Operators
287 
288  //- Copy assignment
289  void operator=(const mapDistributePolyMesh& map);
290 
291  //- Move assignment
292  void operator=(mapDistributePolyMesh&& map);
293 
294 
295  // IOstream operators
296 
297  //- Read dictionary from Istream
299 
300  //- Write dictionary to Ostream
302 
303 };
304 
305 
306 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
307 
308 } // End namespace Foam
309 
310 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
311 
312 #endif
313 
314 // ************************************************************************* //
Foam::mapDistributePolyMesh::distributePointIndices
void distributePointIndices(labelList &pointIDs) const
Distribute list of point/face/cell/patch indices.
Definition: mapDistributePolyMesh.C:212
Foam::mapDistributePolyMesh::distributePatchData
void distributePatchData(List< T > &lst) const
Distribute list of patch data.
Definition: mapDistributePolyMesh.H:263
Foam::mapDistributePolyMesh::updateMesh
void updateMesh(const mapPolyMesh &)
Correct for topo change.
Definition: mapDistributePolyMesh.H:279
Foam::mapDistributePolyMesh::mapDistributePolyMesh
mapDistributePolyMesh()
Construct null.
Definition: mapDistributePolyMesh.C:64
Foam::mapDistributePolyMesh::distributeCellData
void distributeCellData(List< T > &lst) const
Distribute list of cell data.
Definition: mapDistributePolyMesh.H:256
Foam::mapDistributePolyMesh::operator<<
friend Ostream & operator<<(Ostream &, const mapDistributePolyMesh &)
Write dictionary to Ostream.
Foam::mapDistributePolyMesh::transfer
void transfer(mapDistributePolyMesh &map)
Transfer the contents of the argument and annul the argument.
Definition: mapDistributePolyMesh.C:193
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::mapDistributePolyMesh::cellMap
const mapDistribute & cellMap() const
Cell distribute map.
Definition: mapDistributePolyMesh.H:223
Foam::mapDistributePolyMesh::operator=
void operator=(const mapDistributePolyMesh &map)
Copy assignment.
Definition: mapDistributePolyMesh.C:284
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:436
Foam::mapDistributePolyMesh::oldPatchNMeshPoints
const labelList & oldPatchNMeshPoints() const
List of numbers of mesh points per old patch.
Definition: mapDistributePolyMesh.H:205
Foam::mapDistributePolyMesh::operator>>
friend Istream & operator>>(Istream &, mapDistributePolyMesh &)
Read dictionary from Istream.
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::mapDistributePolyMesh::faceMap
const mapDistribute & faceMap() const
Face distribute map.
Definition: mapDistributePolyMesh.H:217
Foam::mapDistribute
Class containing processor-to-processor mapping information.
Definition: mapDistribute.H:163
Foam::mapDistributePolyMesh::patchMap
const mapDistribute & patchMap() const
Patch distribute map.
Definition: mapDistributePolyMesh.H:229
Foam::mapDistributePolyMesh::distributeFaceIndices
void distributeFaceIndices(labelList &faceIDs) const
Definition: mapDistributePolyMesh.C:228
Foam::mapDistribute::distribute
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
Definition: mapDistributeTemplates.C:152
Foam::mapDistributePolyMesh::oldPatchSizes
const labelList & oldPatchSizes() const
List of the old patch sizes.
Definition: mapDistributePolyMesh.H:193
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::mapDistributePolyMesh::distributeFaceData
void distributeFaceData(List< T > &lst) const
Distribute list of face data.
Definition: mapDistributePolyMesh.H:249
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::mapDistributePolyMesh::oldPatchStarts
const labelList & oldPatchStarts() const
List of the old patch start labels.
Definition: mapDistributePolyMesh.H:199
mapDistribute.H
Foam::List< label >
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:160
Foam::mapDistributePolyMesh::distributeCellIndices
void distributeCellIndices(labelList &cellIDs) const
Definition: mapDistributePolyMesh.C:244
Foam::mapDistributePolyMesh::pointMap
const mapDistribute & pointMap() const
Point distribute map.
Definition: mapDistributePolyMesh.H:211
Foam::mapDistributePolyMesh::nOldFaces
label nOldFaces() const
Number of faces in mesh before distribution.
Definition: mapDistributePolyMesh.H:181
Foam::mapDistributePolyMesh::distributePatchIndices
void distributePatchIndices(labelList &patchIDs) const
Definition: mapDistributePolyMesh.C:260
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::mapDistributePolyMesh
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Definition: mapDistributePolyMesh.H:66
Foam::mapDistributePolyMesh::nOldPoints
label nOldPoints() const
Number of points in mesh before distribution.
Definition: mapDistributePolyMesh.H:175
Foam::mapDistributePolyMesh::nOldCells
label nOldCells() const
Number of cells in mesh before distribution.
Definition: mapDistributePolyMesh.H:187
Foam::mapDistributePolyMesh::distributePointData
void distributePointData(List< T > &lst) const
Distribute list of point data.
Definition: mapDistributePolyMesh.H:242