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-2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
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  Class mapDistributePolyMesh Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 {
60  // Private data
61 
62  //- Number of old live points
64 
65  //- Number of old live faces
67 
68  //- Number of old live cells
70 
71  //- List of the old patch sizes
73 
74  //- List of the old patch start labels
76 
77  //- List of numbers of mesh points per old patch
79 
80 
81  //- Point distribute map
83 
84  //- Face distribute map
86 
87  //- Cell distribute map
89 
90  //- Patch distribute map
92 
93 
94  // Private Member Functions
95 
96  void calcPatchSizes();
97 
98  //- Disallow default bitwise copy construct
100 
101 
102 public:
103 
104  // Constructors
105 
106  //- Construct null
108 
109  //- Construct from components. Note that mesh has to be changed already
110  // since uses mesh.nPoints etc as the new size.
112  (
113  const polyMesh& mesh,
114 
115  // mesh before changes
116  const label nOldPoints,
117  const label nOldFaces,
118  const label nOldCells,
121 
122  // how to subset pieces of mesh to send across
123  const Xfer<labelListList>& subPointMap,
124  const Xfer<labelListList>& subFaceMap,
125  const Xfer<labelListList>& subCellMap,
126  const Xfer<labelListList>& subPatchMap,
127 
128  // how to reconstruct received mesh
129  const Xfer<labelListList>& constructPointMap,
130  const Xfer<labelListList>& constructFaceMap,
131  const Xfer<labelListList>& constructCellMap,
132  const Xfer<labelListList>& constructPatchMap,
133 
134  const bool subFaceHasFlip = false,
135  const bool constructFaceHasFlip = false
136  );
137 
138  //- Construct from components
140  (
141  // mesh before changes
142  const label nOldPoints,
143  const label nOldFaces,
144  const label nOldCells,
147 
148  // how to subset pieces of mesh to send across
153  );
154 
155  //- Construct by transferring parameter content
157 
158  //- Construct from Istream
160 
161 
162  // Member Functions
163 
164  // Access
165 
166  //- Number of points in mesh before distribution
167  label nOldPoints() const
168  {
169  return nOldPoints_;
170  }
171 
172  //- Number of faces in mesh before distribution
173  label nOldFaces() const
174  {
175  return nOldFaces_;
176  }
177 
178  //- Number of cells in mesh before distribution
179  label nOldCells() const
180  {
181  return nOldCells_;
182  }
183 
184  //- List of the old patch sizes
185  const labelList& oldPatchSizes() const
186  {
187  return oldPatchSizes_;
188  }
189 
190  //- List of the old patch start labels
191  const labelList& oldPatchStarts() const
192  {
193  return oldPatchStarts_;
194  }
195 
196  //- List of numbers of mesh points per old patch
197  const labelList& oldPatchNMeshPoints() const
198  {
199  return oldPatchNMeshPoints_;
200  }
201 
202  //- Point distribute map
203  const mapDistribute& pointMap() const
204  {
205  return pointMap_;
206  }
207 
208  //- Face distribute map
209  const mapDistribute& faceMap() const
210  {
211  return faceMap_;
212  }
213 
214  //- Cell distribute map
215  const mapDistribute& cellMap() const
216  {
217  return cellMap_;
218  }
219 
220  //- Patch distribute map
221  const mapDistribute& patchMap() const
222  {
223  return patchMap_;
224  }
225 
226 
227  // Other
228 
229  //- Transfer the contents of the argument and annul the argument.
231 
232  //- Transfer contents to the Xfer container
234 
235  //- Distribute list of point data
236  template<class T>
237  void distributePointData(List<T>& lst) const
238  {
239  pointMap_.distribute(lst);
240  }
241 
242  //- Distribute list of face data
243  template<class T>
244  void distributeFaceData(List<T>& lst) const
245  {
246  faceMap_.distribute(lst);
247  }
248 
249  //- Distribute list of cell data
250  template<class T>
251  void distributeCellData(List<T>& lst) const
252  {
253  cellMap_.distribute(lst);
254  }
255 
256  //- Distribute list of patch data
257  template<class T>
258  void distributePatchData(List<T>& lst) const
259  {
260  patchMap_.distribute(lst);
261  }
262 
263 
264  //- Distribute list of point/face/cell/patch indices.
265  // (Converts to boolList, distributes boolList and reconstructs)
266  void distributePointIndices(labelList& pointIDs) const;
267 
268  void distributeFaceIndices(labelList& faceIDs) const;
269  void distributeCellIndices(labelList& cellIDs) const;
270  void distributePatchIndices(labelList& patchIDs) const;
271 
272 
273  //- Correct for topo change.
274  void updateMesh(const mapPolyMesh&)
275  {
277  }
278 
279  // Member operators
280 
281  void operator=(const mapDistributePolyMesh&);
282 
283 
284  // IOstream operators
285 
286  //- Read dictionary from Istream
288 
289  //- Write dictionary to Ostream
291 };
292 
293 
294 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
295 
296 } // End namespace Foam
297 
298 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
299 
300 #endif
301 
302 // ************************************************************************* //
Foam::mapDistributePolyMesh::distributePointIndices
void distributePointIndices(labelList &pointIDs) const
Distribute list of point/face/cell/patch indices.
Definition: mapDistributePolyMesh.C:203
Foam::mapDistributePolyMesh::pointMap_
mapDistribute pointMap_
Point distribute map.
Definition: mapDistributePolyMesh.H:81
Foam::mapDistributePolyMesh::nOldCells_
label nOldCells_
Number of old live cells.
Definition: mapDistributePolyMesh.H:68
Foam::mapDistributePolyMesh::distributePatchData
void distributePatchData(List< T > &lst) const
Distribute list of patch data.
Definition: mapDistributePolyMesh.H:257
Foam::mapDistributePolyMesh::cellMap_
mapDistribute cellMap_
Cell distribute map.
Definition: mapDistributePolyMesh.H:87
Foam::mapDistributePolyMesh::updateMesh
void updateMesh(const mapPolyMesh &)
Correct for topo change.
Definition: mapDistributePolyMesh.H:273
Foam::mapDistributePolyMesh::mapDistributePolyMesh
mapDistributePolyMesh()
Construct null.
Definition: mapDistributePolyMesh.C:61
Foam::mapDistributePolyMesh::distributeCellData
void distributeCellData(List< T > &lst) const
Distribute list of cell data.
Definition: mapDistributePolyMesh.H:250
Foam::mapDistributePolyMesh::operator<<
friend Ostream & operator<<(Ostream &, const mapDistributePolyMesh &)
Write dictionary to Ostream.
Foam::mapDistributePolyMesh::operator=
void operator=(const mapDistributePolyMesh &)
Definition: mapDistributePolyMesh.C:293
Foam::Xfer
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::mapDistributePolyMesh::cellMap
const mapDistribute & cellMap() const
Cell distribute map.
Definition: mapDistributePolyMesh.H:214
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:365
Foam::mapDistributePolyMesh::nOldFaces_
label nOldFaces_
Number of old live faces.
Definition: mapDistributePolyMesh.H:65
Foam::mapDistributePolyMesh::oldPatchNMeshPoints
const labelList & oldPatchNMeshPoints() const
List of numbers of mesh points per old patch.
Definition: mapDistributePolyMesh.H:196
Foam::label
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
Foam::mapDistributePolyMesh::operator>>
friend Istream & operator>>(Istream &, mapDistributePolyMesh &)
Read dictionary from Istream.
Foam::mapDistributePolyMesh::patchMap_
mapDistribute patchMap_
Patch distribute map.
Definition: mapDistributePolyMesh.H:90
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::mapDistributePolyMesh::faceMap
const mapDistribute & faceMap() const
Face distribute map.
Definition: mapDistributePolyMesh.H:208
Foam::mapDistribute
Class containing processor-to-processor mapping information.
Definition: mapDistribute.H:152
Foam::mapDistributePolyMesh::patchMap
const mapDistribute & patchMap() const
Patch distribute map.
Definition: mapDistributePolyMesh.H:220
Foam::mapDistributePolyMesh::oldPatchSizes_
labelList oldPatchSizes_
List of the old patch sizes.
Definition: mapDistributePolyMesh.H:71
Foam::mapDistributePolyMesh::distributeFaceIndices
void distributeFaceIndices(labelList &faceIDs) const
Definition: mapDistributePolyMesh.C:225
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:155
Foam::mapDistributePolyMesh::oldPatchSizes
const labelList & oldPatchSizes() const
List of the old patch sizes.
Definition: mapDistributePolyMesh.H:184
Foam::mapDistributePolyMesh::oldPatchStarts_
labelList oldPatchStarts_
List of the old patch start labels.
Definition: mapDistributePolyMesh.H:74
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::mapDistributePolyMesh::xfer
Xfer< mapDistributePolyMesh > xfer()
Transfer contents to the Xfer container.
Definition: mapDistributePolyMesh.C:197
Foam::mapDistributePolyMesh::transfer
void transfer(mapDistributePolyMesh &)
Transfer the contents of the argument and annul the argument.
Definition: mapDistributePolyMesh.C:182
Foam::mapDistributePolyMesh::distributeFaceData
void distributeFaceData(List< T > &lst) const
Distribute list of face data.
Definition: mapDistributePolyMesh.H:243
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::mapDistributePolyMesh::oldPatchStarts
const labelList & oldPatchStarts() const
List of the old patch start labels.
Definition: mapDistributePolyMesh.H:190
mapDistribute.H
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::mapDistributePolyMesh::nOldPoints_
label nOldPoints_
Number of old live points.
Definition: mapDistributePolyMesh.H:62
Foam::mapDistributePolyMesh::distributeCellIndices
void distributeCellIndices(labelList &cellIDs) const
Definition: mapDistributePolyMesh.C:247
Foam::mapDistributePolyMesh::oldPatchNMeshPoints_
labelList oldPatchNMeshPoints_
List of numbers of mesh points per old patch.
Definition: mapDistributePolyMesh.H:77
Foam::mapDistributePolyMesh::pointMap
const mapDistribute & pointMap() const
Point distribute map.
Definition: mapDistributePolyMesh.H:202
Foam::mapDistributePolyMesh::nOldFaces
label nOldFaces() const
Number of faces in mesh before distribution.
Definition: mapDistributePolyMesh.H:172
Foam::mapDistributePolyMesh::distributePatchIndices
void distributePatchIndices(labelList &patchIDs) const
Definition: mapDistributePolyMesh.C:269
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::mapDistributePolyMesh
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Definition: mapDistributePolyMesh.H:57
Foam::mapDistributePolyMesh::nOldPoints
label nOldPoints() const
Number of points in mesh before distribution.
Definition: mapDistributePolyMesh.H:166
Foam::mapDistributePolyMesh::calcPatchSizes
void calcPatchSizes()
Definition: mapDistributePolyMesh.C:31
Foam::mapDistributePolyMesh::nOldCells
label nOldCells() const
Number of cells in mesh before distribution.
Definition: mapDistributePolyMesh.H:178
Foam::mapDistributePolyMesh::distributePointData
void distributePointData(List< T > &lst) const
Distribute list of point data.
Definition: mapDistributePolyMesh.H:236
Foam::mapDistributePolyMesh::faceMap_
mapDistribute faceMap_
Face distribute map.
Definition: mapDistributePolyMesh.H:84