polyDistributionMap.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-2022 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::polyDistributionMap
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  polyDistributionMap.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef polyDistributionMap_H
42 #define polyDistributionMap_H
43 
44 #include "distributionMap.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 class polyMesh;
52 
53 // Forward declaration of friend functions and operators
54 
55 class polyDistributionMap;
56 
57 Istream& operator>>(Istream&, polyDistributionMap&);
58 Ostream& operator<<(Ostream&, const polyDistributionMap&);
59 
60 
61 /*---------------------------------------------------------------------------*\
62  Class polyDistributionMap Declaration
63 \*---------------------------------------------------------------------------*/
64 
66 {
67  // Private Data
68 
69  //- Number of old live points
70  label nOldPoints_;
71 
72  //- Number of old live faces
73  label nOldFaces_;
74 
75  //- Number of old live cells
76  label nOldCells_;
77 
78  //- List of the old patch sizes
79  labelList oldPatchSizes_;
80 
81  //- List of the old patch start labels
82  labelList oldPatchStarts_;
83 
84  //- List of numbers of mesh points per old patch
85  labelList oldPatchNMeshPoints_;
86 
87 
88  //- Point distribute map
89  distributionMap pointMap_;
90 
91  //- Face distribute map
92  distributionMap faceMap_;
93 
94  //- Cell distribute map
95  distributionMap cellMap_;
96 
97  //- Patch distribute map
98  distributionMap patchMap_;
99 
100 
101  // Private Member Functions
102 
103  void calcPatchSizes();
104 
105 
106 public:
107 
108  // Constructors
109 
110  //- Construct null
112 
113  //- Move constructor from components.
114  // Note that mesh has to be changed already
115  // since uses mesh.nPoints etc as the new size.
117  (
118  const polyMesh& mesh,
119 
120  // mesh before changes
121  const label nOldPoints,
122  const label nOldFaces,
123  const label nOldCells,
126 
127  // how to subset pieces of mesh to send across
128  labelListList&& subPointMap,
129  labelListList&& subFaceMap,
130  labelListList&& subCellMap,
131  labelListList&& subPatchMap,
132 
133  // how to reconstruct received mesh
134  labelListList&& constructPointMap,
135  labelListList&& constructFaceMap,
136  labelListList&& constructCellMap,
137  labelListList&& constructPatchMap,
138 
139  const bool subFaceHasFlip = false,
140  const bool constructFaceHasFlip = false
141  );
142 
143  //- Move constructor from components
145  (
146  // mesh before changes
147  const label nOldPoints,
148  const label nOldFaces,
149  const label nOldCells,
152 
153  // how to subset pieces of mesh to send across
158  );
159 
160  //- Move constructor
162 
163  //- Construct from Istream
165 
166  //- Disallow default bitwise copy construction
167  polyDistributionMap(const polyDistributionMap&) = delete;
168 
169 
170  // Member Functions
171 
172  // Access
173 
174  //- Number of points in mesh before distribution
175  label nOldPoints() const
176  {
177  return nOldPoints_;
178  }
179 
180  //- Number of faces in mesh before distribution
181  label nOldFaces() const
182  {
183  return nOldFaces_;
184  }
185 
186  //- Number of cells in mesh before distribution
187  label nOldCells() const
188  {
189  return nOldCells_;
190  }
191 
192  //- List of the old patch sizes
193  const labelList& oldPatchSizes() const
194  {
195  return oldPatchSizes_;
196  }
197 
198  //- List of the old patch start labels
199  const labelList& oldPatchStarts() const
200  {
201  return oldPatchStarts_;
202  }
203 
204  //- List of numbers of mesh points per old patch
205  const labelList& oldPatchNMeshPoints() const
206  {
207  return oldPatchNMeshPoints_;
208  }
209 
210  //- Point distribute map
211  const distributionMap& pointMap() const
212  {
213  return pointMap_;
214  }
215 
216  //- Face distribute map
217  const distributionMap& faceMap() const
218  {
219  return faceMap_;
220  }
221 
222  //- Cell distribute map
223  const distributionMap& cellMap() const
224  {
225  return cellMap_;
226  }
227 
228  //- Patch distribute map
229  const distributionMap& patchMap() const
230  {
231  return patchMap_;
232  }
233 
234 
235  // Other
236 
237  //- Transfer the contents of the argument and annul the argument.
239 
240  //- Distribute list of point data
241  template<class T>
242  void distributePointData(List<T>& lst) const
243  {
244  pointMap_.distribute(lst);
245  }
246 
247  //- Distribute list of face data
248  template<class T>
249  void distributeFaceData(List<T>& lst) const
250  {
251  faceMap_.distribute(lst);
252  }
253 
254  //- Distribute list of cell data
255  template<class T>
256  void distributeCellData(List<T>& lst) const
257  {
258  cellMap_.distribute(lst);
259  }
260 
261  //- Distribute list of patch data
262  template<class T>
263  void distributePatchData(List<T>& lst) const
264  {
265  patchMap_.distribute(lst);
266  }
267 
268 
269  //- Distribute list of point/face/cell/patch indices.
270  // (Converts to boolList, distributes boolList and reconstructs)
271  void distributePointIndices(labelList& pointIDs) const;
272 
273  void distributeFaceIndices(labelList& faceIDs) const;
274  void distributeCellIndices(labelList& cellIDs) const;
275  void distributePatchIndices(labelList& patchIDs) const;
276 
277 
278  // Member Operators
279 
280  void operator=(const polyDistributionMap&);
281 
283 
284 
285  // IOstream Operators
286 
287  //- Read dictionary from Istream
289 
290  //- Write dictionary to Ostream
291  friend Ostream& operator<<(Ostream&, const polyDistributionMap&);
292 };
293 
294 
295 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
296 
297 } // End namespace Foam
298 
299 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
300 
301 #endif
302 
303 // ************************************************************************* //
void transfer(polyDistributionMap &)
Transfer the contents of the argument and annul the argument.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
polyDistributionMap()
Construct null.
const distributionMap & patchMap() const
Patch distribute map.
label nOldCells() const
Number of cells in mesh before distribution.
void distributePointIndices(labelList &pointIDs) const
Distribute list of point/face/cell/patch indices.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const distributionMap & cellMap() const
Cell distribute map.
const distributionMap & faceMap() const
Face distribute map.
fvMesh & mesh
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
const labelList & oldPatchStarts() const
List of the old patch start labels.
const labelList & oldPatchSizes() const
List of the old patch sizes.
Istream & operator>>(Istream &, directionInfo &)
label nOldPoints() const
Number of points in mesh before distribution.
friend Istream & operator>>(Istream &, polyDistributionMap &)
Read dictionary from Istream.
friend Ostream & operator<<(Ostream &, const polyDistributionMap &)
Write dictionary to Ostream.
label nOldFaces() const
Number of faces in mesh before distribution.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void distributeCellIndices(labelList &cellIDs) const
void distributePatchData(List< T > &lst) const
Distribute list of patch data.
void operator=(const polyDistributionMap &)
void distributeCellData(List< T > &lst) const
Distribute list of cell data.
void distributeFaceData(List< T > &lst) const
Distribute list of face data.
Class containing processor-to-processor mapping information.
Ostream & operator<<(Ostream &, const ensightPart &)
void distributePointData(List< T > &lst) const
Distribute list of point data.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
const distributionMap & pointMap() const
Point distribute map.
void distributePatchIndices(labelList &patchIDs) const
void distributeFaceIndices(labelList &faceIDs) const
Namespace for OpenFOAM.
const labelList & oldPatchNMeshPoints() const
List of numbers of mesh points per old patch.