All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
59 
60 
61 /*---------------------------------------------------------------------------*\
62  Class polyDistributionMap Declaration
63 \*---------------------------------------------------------------------------*/
64 
66 {
67  // Private Data
68 
69  //- Reference to the mesh
70  const polyMesh& mesh_;
71 
72  //- Number of old live points
73  label nOldPoints_;
74 
75  //- Number of old live faces
76  label nOldFaces_;
77 
78  //- Number of old live cells
79  label nOldCells_;
80 
81  //- List of the old patch sizes
82  labelList oldPatchSizes_;
83 
84  //- List of the old patch start labels
85  labelList oldPatchStarts_;
86 
87  //- List of numbers of mesh points per old patch
88  labelList oldPatchNMeshPoints_;
89 
90  //- Point distribute map
91  distributionMap pointMap_;
92 
93  //- Face distribute map
94  distributionMap faceMap_;
95 
96  //- Cell distribute map
97  distributionMap cellMap_;
98 
99  //- Patch distribute map
100  distributionMap patchMap_;
101 
102 
103  // Private Member Functions
104 
105  //- ...
106  void calcPatchSizes();
107 
108 
109 public:
110 
111  // Constructors
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  //- Disallow default bitwise copy construction
144  polyDistributionMap(const polyDistributionMap&) = delete;
145 
146 
147  // Member Functions
148 
149  // Access
150 
151  //- Return polyMesh
152  const polyMesh& mesh() const
153  {
154  return mesh_;
155  }
156 
157  //- Number of points in mesh before distribution
158  label nOldPoints() const
159  {
160  return nOldPoints_;
161  }
162 
163  //- Number of faces in mesh before distribution
164  label nOldFaces() const
165  {
166  return nOldFaces_;
167  }
168 
169  //- Number of cells in mesh before distribution
170  label nOldCells() const
171  {
172  return nOldCells_;
173  }
174 
175  //- List of the old patch sizes
176  const labelList& oldPatchSizes() const
177  {
178  return oldPatchSizes_;
179  }
180 
181  //- List of the old patch start labels
182  const labelList& oldPatchStarts() const
183  {
184  return oldPatchStarts_;
185  }
186 
187  //- List of numbers of mesh points per old patch
188  const labelList& oldPatchNMeshPoints() const
189  {
190  return oldPatchNMeshPoints_;
191  }
192 
193  //- Point distribute map
194  const distributionMap& pointMap() const
195  {
196  return pointMap_;
197  }
198 
199  //- Face distribute map
200  const distributionMap& faceMap() const
201  {
202  return faceMap_;
203  }
204 
205  //- Cell distribute map
206  const distributionMap& cellMap() const
207  {
208  return cellMap_;
209  }
210 
211  //- Patch distribute map
212  const distributionMap& patchMap() const
213  {
214  return patchMap_;
215  }
216 
217 
218  // Other
219 
220  //- Distribute list of point data
221  template<class T>
222  void distributePointData(List<T>& lst) const
223  {
224  pointMap_.distribute(lst);
225  }
226 
227  //- Distribute list of face data
228  template<class T>
229  void distributeFaceData(List<T>& lst) const
230  {
231  faceMap_.distribute(lst);
232  }
233 
234  //- Distribute list of cell data
235  template<class T>
236  void distributeCellData(List<T>& lst) const
237  {
238  cellMap_.distribute(lst);
239  }
240 
241  //- Distribute list of patch data
242  template<class T>
243  void distributePatchData(List<T>& lst) const
244  {
245  patchMap_.distribute(lst);
246  }
247 
248  //- Distribute list of point indices
249  // (Converts to boolList, distributes boolList and reconstructs)
250  void distributePointIndices(labelList& pointIDs) const;
251 
252  //- Distribute list of face indices
253  // (Converts to boolList, distributes boolList and reconstructs)
254  void distributeFaceIndices(labelList& faceIDs) const;
255 
256  //- Distribute list of cell indices
257  // (Converts to boolList, distributes boolList and reconstructs)
258  void distributeCellIndices(labelList& cellIDs) const;
259 
260  //- Distribute list of patch indices
261  // (Converts to boolList, distributes boolList and reconstructs)
262  void distributePatchIndices(labelList& patchIDs) const;
263 
264 
265  // Member Operators
266 
267  //- Disallow default bitwise assignment
268  void operator=(const polyDistributionMap&) = delete;
269 };
270 
271 
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273 
274 } // End namespace Foam
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
278 #endif
279 
280 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Class containing processor-to-processor mapping information.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
label nOldCells() const
Number of cells in mesh before distribution.
polyDistributionMap(const polyMesh &mesh, const label nOldPoints, const label nOldFaces, const label nOldCells, labelList &&oldPatchStarts, labelList &&oldPatchNMeshPoints, labelListList &&subPointMap, labelListList &&subFaceMap, labelListList &&subCellMap, labelListList &&subPatchMap, labelListList &&constructPointMap, labelListList &&constructFaceMap, labelListList &&constructCellMap, labelListList &&constructPatchMap, const bool subFaceHasFlip=false, const bool constructFaceHasFlip=false)
Move constructor from components.
void distributePatchIndices(labelList &patchIDs) const
Distribute list of patch indices.
const distributionMap & cellMap() const
Cell distribute map.
void distributeCellData(List< T > &lst) const
Distribute list of cell data.
void distributePointIndices(labelList &pointIDs) const
Distribute list of point indices.
void distributeFaceIndices(labelList &faceIDs) const
Distribute list of face indices.
void distributeCellIndices(labelList &cellIDs) const
Distribute list of cell indices.
const labelList & oldPatchNMeshPoints() const
List of numbers of mesh points per old patch.
void distributeFaceData(List< T > &lst) const
Distribute list of face data.
const distributionMap & faceMap() const
Face distribute map.
void operator=(const polyDistributionMap &)=delete
Disallow default bitwise assignment.
void distributePatchData(List< T > &lst) const
Distribute list of patch data.
label nOldFaces() const
Number of faces in mesh before distribution.
label nOldPoints() const
Number of points in mesh before distribution.
const labelList & oldPatchStarts() const
List of the old patch start labels.
const distributionMap & patchMap() const
Patch distribute map.
void distributePointData(List< T > &lst) const
Distribute list of point data.
const polyMesh & mesh() const
Return polyMesh.
const labelList & oldPatchSizes() const
List of the old patch sizes.
const distributionMap & pointMap() const
Point distribute map.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Namespace for OpenFOAM.
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
Istream & operator>>(Istream &, pistonPointEdgeData &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)