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-2016 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  //- Disallow default bitwise copy construct
109 
110 
111 public:
112 
113  // Constructors
114 
115  //- Construct null
117 
118  //- Construct from components. Note that mesh has to be changed already
119  // since uses mesh.nPoints etc as the new size.
121  (
122  const polyMesh& mesh,
123 
124  // mesh before changes
125  const label nOldPoints,
126  const label nOldFaces,
127  const label nOldCells,
130 
131  // how to subset pieces of mesh to send across
132  const Xfer<labelListList>& subPointMap,
133  const Xfer<labelListList>& subFaceMap,
134  const Xfer<labelListList>& subCellMap,
135  const Xfer<labelListList>& subPatchMap,
136 
137  // how to reconstruct received mesh
138  const Xfer<labelListList>& constructPointMap,
139  const Xfer<labelListList>& constructFaceMap,
140  const Xfer<labelListList>& constructCellMap,
141  const Xfer<labelListList>& constructPatchMap,
142 
143  const bool subFaceHasFlip = false,
144  const bool constructFaceHasFlip = false
145  );
146 
147  //- Construct from components
149  (
150  // mesh before changes
151  const label nOldPoints,
152  const label nOldFaces,
153  const label nOldCells,
154  const Xfer<labelList>& oldPatchStarts,
155  const Xfer<labelList>& oldPatchNMeshPoints,
156 
157  // how to subset pieces of mesh to send across
162  );
163 
164  //- Construct by transferring parameter content
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.
240 
241  //- Transfer contents to the Xfer container
243 
244  //- Distribute list of point data
245  template<class T>
246  void distributePointData(List<T>& lst) const
247  {
248  pointMap_.distribute(lst);
249  }
250 
251  //- Distribute list of face data
252  template<class T>
253  void distributeFaceData(List<T>& lst) const
254  {
255  faceMap_.distribute(lst);
256  }
257 
258  //- Distribute list of cell data
259  template<class T>
260  void distributeCellData(List<T>& lst) const
261  {
262  cellMap_.distribute(lst);
263  }
264 
265  //- Distribute list of patch data
266  template<class T>
267  void distributePatchData(List<T>& lst) const
268  {
269  patchMap_.distribute(lst);
270  }
271 
272 
273  //- Distribute list of point/face/cell/patch indices.
274  // (Converts to boolList, distributes boolList and reconstructs)
275  void distributePointIndices(labelList& pointIDs) const;
276 
277  void distributeFaceIndices(labelList& faceIDs) const;
278  void distributeCellIndices(labelList& cellIDs) const;
279  void distributePatchIndices(labelList& patchIDs) const;
280 
281 
282  //- Correct for topo change.
283  void updateMesh(const mapPolyMesh&)
284  {
286  }
287 
288  // Member operators
289 
290  void operator=(const mapDistributePolyMesh&);
291 
292 
293  // IOstream operators
294 
295  //- Read dictionary from Istream
297 
298  //- Write dictionary to Ostream
300 };
301 
302 
303 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
304 
305 } // End namespace Foam
306 
307 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
308 
309 #endif
310 
311 // ************************************************************************* //
void operator=(const mapDistributePolyMesh &)
friend Ostream & operator<<(Ostream &, const mapDistributePolyMesh &)
Write dictionary to Ostream.
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
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
Xfer< mapDistributePolyMesh > xfer()
Transfer contents to the Xfer container.
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:53
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:366
Namespace for OpenFOAM.