1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::mapDistributePolyMesh
29 Class containing mesh-to-mesh mapping information after a mesh distribution
30 where we send parts of meshes (using subsetting) to other processors
31 and receive and reconstruct mesh.
33 We store mapping from the bits-to-send to the complete starting mesh
34 (subXXXMap) and from the received bits to their location in the new
35 mesh (constructXXXMap).
38 mapDistributePolyMesh.C
40 \*---------------------------------------------------------------------------*/
42 #ifndef mapDistributePolyMesh_H
43 #define mapDistributePolyMesh_H
45 #include <OpenFOAM/mapDistribute.H>
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 /*---------------------------------------------------------------------------*\
56 Class mapDistributePolyMesh Declaration
57 \*---------------------------------------------------------------------------*/
59 class mapDistributePolyMesh
63 const polyMesh& mesh_;
65 //- Number of old live points
66 const label nOldPoints_;
68 //- Number of old live faces
69 const label nOldFaces_;
71 //- Number of old live cells
72 const label nOldCells_;
74 //- List of the old patch sizes
75 labelList oldPatchSizes_;
77 //- List of the old patch start labels
78 const labelList oldPatchStarts_;
80 //- List of numbers of mesh points per old patch
81 const labelList oldPatchNMeshPoints_;
84 //- Point distribute map
85 const mapDistribute pointMap_;
87 //- Face distribute map
88 const mapDistribute faceMap_;
90 //- Cell distribute map
91 const mapDistribute cellMap_;
93 //- Patch distribute map
94 const mapDistribute patchMap_;
98 // Private Member Functions
100 void calcPatchSizes();
102 //- Disallow default bitwise copy construct
103 mapDistributePolyMesh(const mapDistributePolyMesh&);
105 //- Disallow default bitwise assignment
106 void operator=(const mapDistributePolyMesh&);
113 //- Construct from components. Note that mesh has to be changed already
114 // since uses mesh.nPoints etc as the new size.
115 mapDistributePolyMesh
117 const polyMesh& mesh,
119 // mesh before changes
120 const label nOldPoints,
121 const label nOldFaces,
122 const label nOldCells,
123 const labelList& oldPatchStarts,
124 const labelList& oldPatchNMeshPoints,
126 // how to subset pieces of mesh to send across
127 const labelListList& subPointMap,
128 const labelListList& subFaceMap,
129 const labelListList& subCellMap,
130 const labelListList& subPatchMap,
132 // how to reconstruct received mesh
133 const labelListList& constructPointMap,
134 const labelListList& constructFaceMap,
135 const labelListList& constructCellMap,
136 const labelListList& constructPatchMap
139 //- (optionally destructively) construct from components
140 // Note that mesh has to be changed already!
141 mapDistributePolyMesh
143 const polyMesh& mesh,
144 const label nOldPoints,
145 const label nOldFaces,
146 const label nOldCells,
147 labelList& oldPatchStarts,
148 labelList& oldPatchNMeshPoints,
150 labelListList& subPointMap,
151 labelListList& subFaceMap,
152 labelListList& subCellMap,
153 labelListList& subPatchMap,
154 labelListList& constructPointMap,
155 labelListList& constructFaceMap,
156 labelListList& constructCellMap,
157 labelListList& constructPatchMap,
158 const bool reUse // clone or reuse
166 const polyMesh& mesh() const
171 //- Number of points in mesh before distribution
172 label nOldPoints() const
177 //- Number of faces in mesh before distribution
178 label nOldFaces() const
183 //- Number of cells in mesh before distribution
184 label nOldCells() const
189 //- List of the old patch sizes
190 const labelList& oldPatchSizes() const
192 return oldPatchSizes_;
195 //- List of the old patch start labels
196 const labelList& oldPatchStarts() const
198 return oldPatchStarts_;
201 //- List of numbers of mesh points per old patch
202 const labelList& oldPatchNMeshPoints() const
204 return oldPatchNMeshPoints_;
207 //- Point distribute map
208 const mapDistribute& pointMap() const
213 //- Face distribute map
214 const mapDistribute& faceMap() const
219 //- Cell distribute map
220 const mapDistribute& cellMap() const
225 //- Patch distribute map
226 const mapDistribute& patchMap() const
234 //- distribute list of point data
236 void distributePointData(List<T>& lst) const
238 pointMap_.distribute(lst);
241 //- distribute list of face data
243 void distributeFaceData(List<T>& lst) const
245 faceMap_.distribute(lst);
248 //- distribute list of cell data
250 void distributeCellData(List<T>& lst) const
252 cellMap_.distribute(lst);
255 //- distribute list of patch data
257 void distributePatchData(List<T>& lst) const
259 patchMap_.distribute(lst);
263 //- distribute list of point/face/cell/patch indices.
264 // (Converts to boolList, distributes boolList and reconstructs)
265 void distributePointIndices(labelList& pointIDs) const;
267 void distributeFaceIndices(labelList& faceIDs) const;
268 void distributeCellIndices(labelList& cellIDs) const;
269 void distributePatchIndices(labelList& patchIDs) const;
272 //- Correct for topo change.
273 void updateMesh(const mapPolyMesh&)
277 "mapDistributePolyMesh::updateMesh(const mapPolyMesh&)"
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285 } // End namespace Foam
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
291 // ************************ vim: set sw=4 sts=4 et: ************************ //