mapDistributePolyMesh.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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 // Forward declaration of friend functions and operators
56 
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 
108 public:
109 
110  // Constructors
111 
112  //- Construct null
114 
115  //- Move constructor from components.
116  // Note that mesh has to be changed already
117  // since uses mesh.nPoints etc as the new size.
119  (
120  const polyMesh& mesh,
121 
122  // mesh before changes
123  const label nOldPoints,
124  const label nOldFaces,
125  const label nOldCells,
128 
129  // how to subset pieces of mesh to send across
130  labelListList&& subPointMap,
131  labelListList&& subFaceMap,
132  labelListList&& subCellMap,
133  labelListList&& subPatchMap,
134 
135  // how to reconstruct received mesh
136  labelListList&& constructPointMap,
137  labelListList&& constructFaceMap,
138  labelListList&& constructCellMap,
139  labelListList&& constructPatchMap,
140 
141  const bool subFaceHasFlip = false,
142  const bool constructFaceHasFlip = false
143  );
144 
145  //- Move constructor from components
147  (
148  // mesh before changes
149  const label nOldPoints,
150  const label nOldFaces,
151  const label nOldCells,
154 
155  // how to subset pieces of mesh to send across
160  );
161 
162  //- Move constructor
164 
165  //- Construct from Istream
167 
168  //- Disallow default bitwise copy construction
170 
171 
172  // Member Functions
173 
174  // Access
175 
176  //- Number of points in mesh before distribution
177  label nOldPoints() const
178  {
179  return nOldPoints_;
180  }
181 
182  //- Number of faces in mesh before distribution
183  label nOldFaces() const
184  {
185  return nOldFaces_;
186  }
187 
188  //- Number of cells in mesh before distribution
189  label nOldCells() const
190  {
191  return nOldCells_;
192  }
193 
194  //- List of the old patch sizes
195  const labelList& oldPatchSizes() const
196  {
197  return oldPatchSizes_;
198  }
199 
200  //- List of the old patch start labels
201  const labelList& oldPatchStarts() const
202  {
203  return oldPatchStarts_;
204  }
205 
206  //- List of numbers of mesh points per old patch
207  const labelList& oldPatchNMeshPoints() const
208  {
209  return oldPatchNMeshPoints_;
210  }
211 
212  //- Point distribute map
213  const mapDistribute& pointMap() const
214  {
215  return pointMap_;
216  }
217 
218  //- Face distribute map
219  const mapDistribute& faceMap() const
220  {
221  return faceMap_;
222  }
223 
224  //- Cell distribute map
225  const mapDistribute& cellMap() const
226  {
227  return cellMap_;
228  }
229 
230  //- Patch distribute map
231  const mapDistribute& patchMap() const
232  {
233  return patchMap_;
234  }
235 
236 
237  // Other
238 
239  //- Transfer the contents of the argument and annul the argument.
241 
242  //- Distribute list of point data
243  template<class T>
244  void distributePointData(List<T>& lst) const
245  {
246  pointMap_.distribute(lst);
247  }
248 
249  //- Distribute list of face data
250  template<class T>
251  void distributeFaceData(List<T>& lst) const
252  {
253  faceMap_.distribute(lst);
254  }
255 
256  //- Distribute list of cell data
257  template<class T>
258  void distributeCellData(List<T>& lst) const
259  {
260  cellMap_.distribute(lst);
261  }
262 
263  //- Distribute list of patch data
264  template<class T>
265  void distributePatchData(List<T>& lst) const
266  {
267  patchMap_.distribute(lst);
268  }
269 
270 
271  //- Distribute list of point/face/cell/patch indices.
272  // (Converts to boolList, distributes boolList and reconstructs)
273  void distributePointIndices(labelList& pointIDs) const;
274 
275  void distributeFaceIndices(labelList& faceIDs) const;
276  void distributeCellIndices(labelList& cellIDs) const;
277  void distributePatchIndices(labelList& patchIDs) const;
278 
279 
280  //- Correct for topo change.
281  void updateMesh(const mapPolyMesh&)
282  {
284  }
285 
286 
287  // Member Operators
288 
289  void operator=(const mapDistributePolyMesh&);
290 
292 
293 
294  // IOstream Operators
295 
296  //- Read dictionary from Istream
298 
299  //- Write dictionary to Ostream
301 };
302 
303 
304 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
305 
306 } // End namespace Foam
307 
308 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
309 
310 #endif
311 
312 // ************************************************************************* //
void operator=(const mapDistributePolyMesh &)
friend Ostream & operator<<(Ostream &, const mapDistributePolyMesh &)
Write dictionary to Ostream.
void distributeCellIndices(labelList &cellIDs) const
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
const mapDistribute & pointMap() const
Point distribute map.
label nOldFaces() const
Number of faces in mesh before distribution.
void distributePointData(List< T > &lst) const
Distribute list of point data.
void distributePatchIndices(labelList &patchIDs) const
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
const mapDistribute & cellMap() const
Cell distribute map.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
const mapDistribute & patchMap() const
Patch distribute map.
mapDistributePolyMesh()
Construct null.
void distributeCellData(List< T > &lst) const
Distribute list of cell data.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
dynamicFvMesh & mesh
void distributeFaceData(List< T > &lst) const
Distribute list of face data.
Istream & operator>>(Istream &, directionInfo &)
const labelList & oldPatchStarts() const
List of the old patch start labels.
const labelList & oldPatchNMeshPoints() const
List of numbers of mesh points per old patch.
friend Istream & operator>>(Istream &, mapDistributePolyMesh &)
Read dictionary from Istream.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
const mapDistribute & faceMap() const
Face distribute map.
void distributeFaceIndices(labelList &faceIDs) const
label nOldPoints() const
Number of points in mesh before distribution.
label nOldCells() const
Number of cells in mesh before distribution.
Class containing processor-to-processor mapping information.
const labelList & oldPatchSizes() const
List of the old patch sizes.
void distributePointIndices(labelList &pointIDs) const
Distribute list of point/face/cell/patch indices.
Ostream & operator<<(Ostream &, const ensightPart &)
void transfer(mapDistributePolyMesh &)
Transfer the contents of the argument and annul the argument.
void distributePatchData(List< T > &lst) const
Distribute list of patch data.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
void updateMesh(const mapPolyMesh &)
Correct for topo change.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:370
Namespace for OpenFOAM.