OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

mapDistributePolyMesh.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::mapDistributePolyMesh
00027 
00028 Description
00029     Class containing mesh-to-mesh mapping information after a mesh distribution
00030     where we send parts of meshes (using subsetting) to other processors 
00031     and receive and reconstruct mesh.
00032 
00033     We store mapping from the bits-to-send to the complete starting mesh
00034     (subXXXMap) and from the received bits to their location in the new
00035     mesh (constructXXXMap).
00036 
00037 SourceFiles
00038     mapDistributePolyMesh.C
00039 
00040 \*---------------------------------------------------------------------------*/
00041 
00042 #ifndef mapDistributePolyMesh_H
00043 #define mapDistributePolyMesh_H
00044 
00045 #include "mapDistribute.H"
00046 
00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00048 
00049 namespace Foam
00050 {
00051 
00052 class mapPolyMesh;
00053 class polyMesh;
00054 
00055 /*---------------------------------------------------------------------------*\
00056                            Class mapDistributePolyMesh Declaration
00057 \*---------------------------------------------------------------------------*/
00058 
00059 class mapDistributePolyMesh
00060 {
00061     // Private data
00062 
00063         const polyMesh& mesh_;
00064 
00065         //- Number of old live points
00066         const label nOldPoints_;
00067 
00068         //- Number of old live faces
00069         const label nOldFaces_;
00070 
00071         //- Number of old live cells
00072         const label nOldCells_;
00073 
00074         //- List of the old patch sizes
00075         labelList oldPatchSizes_;
00076 
00077         //- List of the old patch start labels
00078         const labelList oldPatchStarts_;
00079 
00080         //- List of numbers of mesh points per old patch
00081         const labelList oldPatchNMeshPoints_;
00082 
00083 
00084         //- Point distribute map
00085         const mapDistribute pointMap_;
00086 
00087         //- Face distribute map
00088         const mapDistribute faceMap_;
00089 
00090         //- Cell distribute map
00091         const mapDistribute cellMap_;
00092 
00093         //- Patch distribute map
00094         const mapDistribute patchMap_;
00095 
00096 
00097 
00098     // Private Member Functions
00099 
00100         void calcPatchSizes();
00101 
00102         //- Disallow default bitwise copy construct
00103         mapDistributePolyMesh(const mapDistributePolyMesh&);
00104 
00105         //- Disallow default bitwise assignment
00106         void operator=(const mapDistributePolyMesh&);
00107 
00108 
00109 public:
00110 
00111     // Constructors
00112 
00113         //- Construct from components. Note that mesh has to be changed already
00114         //  since uses mesh.nPoints etc as the new size.
00115         mapDistributePolyMesh
00116         (
00117             const polyMesh& mesh,
00118 
00119             // mesh before changes
00120             const label nOldPoints,
00121             const label nOldFaces,
00122             const label nOldCells,
00123             const labelList& oldPatchStarts,
00124             const labelList& oldPatchNMeshPoints,
00125 
00126             // how to subset pieces of mesh to send across
00127             const labelListList& subPointMap,
00128             const labelListList& subFaceMap,
00129             const labelListList& subCellMap,
00130             const labelListList& subPatchMap,
00131 
00132             // how to reconstruct received mesh
00133             const labelListList& constructPointMap,
00134             const labelListList& constructFaceMap,
00135             const labelListList& constructCellMap,
00136             const labelListList& constructPatchMap
00137         );
00138 
00139         //- (optionally destructively) construct from components
00140         //  Note that mesh has to be changed already!
00141         mapDistributePolyMesh
00142         (
00143             const polyMesh& mesh,
00144             const label nOldPoints,
00145             const label nOldFaces,
00146             const label nOldCells,
00147             labelList& oldPatchStarts,
00148             labelList& oldPatchNMeshPoints,
00149 
00150             labelListList& subPointMap,
00151             labelListList& subFaceMap,
00152             labelListList& subCellMap,
00153             labelListList& subPatchMap,
00154             labelListList& constructPointMap,
00155             labelListList& constructFaceMap,
00156             labelListList& constructCellMap,
00157             labelListList& constructPatchMap,
00158             const bool reUse                // clone or reuse
00159         );
00160 
00161 
00162     // Member Functions
00163 
00164         // Access
00165 
00166             const polyMesh& mesh() const
00167             {
00168                 return mesh_;
00169             }
00170 
00171             //- Number of points in mesh before distribution
00172             label nOldPoints() const
00173             {
00174                 return nOldPoints_;
00175             }
00176 
00177             //- Number of faces in mesh before distribution
00178             label nOldFaces() const
00179             {
00180                 return nOldFaces_;
00181             }
00182 
00183             //- Number of cells in mesh before distribution
00184             label nOldCells() const
00185             {
00186                 return nOldCells_;
00187             }
00188 
00189             //- List of the old patch sizes
00190             const labelList& oldPatchSizes() const
00191             {
00192                 return oldPatchSizes_;
00193             }
00194 
00195             //- List of the old patch start labels
00196             const labelList& oldPatchStarts() const
00197             {
00198                 return oldPatchStarts_;
00199             }
00200 
00201             //- List of numbers of mesh points per old patch
00202             const labelList& oldPatchNMeshPoints() const
00203             {
00204                 return oldPatchNMeshPoints_;
00205             }
00206 
00207             //- Point distribute map
00208             const mapDistribute& pointMap() const
00209             {
00210                 return pointMap_;
00211             }
00212 
00213             //- Face distribute map
00214             const mapDistribute& faceMap() const
00215             {
00216                 return faceMap_;
00217             }
00218 
00219             //- Cell distribute map
00220             const mapDistribute& cellMap() const
00221             {
00222                 return cellMap_;
00223             }
00224 
00225             //- Patch distribute map
00226             const mapDistribute& patchMap() const
00227             {
00228                 return patchMap_;
00229             }
00230 
00231 
00232         // Edit
00233 
00234             //- distribute list of point data
00235             template<class T>
00236             void distributePointData(List<T>& lst) const
00237             {
00238                 pointMap_.distribute(lst);
00239             }
00240 
00241             //- distribute list of face data
00242             template<class T>
00243             void distributeFaceData(List<T>& lst) const
00244             {
00245                 faceMap_.distribute(lst);
00246             }
00247 
00248             //- distribute list of cell data
00249             template<class T>
00250             void distributeCellData(List<T>& lst) const
00251             {
00252                 cellMap_.distribute(lst);
00253             }
00254 
00255             //- distribute list of patch data
00256             template<class T>
00257             void distributePatchData(List<T>& lst) const
00258             {
00259                 patchMap_.distribute(lst);
00260             }
00261 
00262 
00263             //- distribute list of point/face/cell/patch indices.
00264             //  (Converts to boolList, distributes boolList and reconstructs)
00265             void distributePointIndices(labelList& pointIDs) const;
00266 
00267             void distributeFaceIndices(labelList& faceIDs) const;
00268             void distributeCellIndices(labelList& cellIDs) const;
00269             void distributePatchIndices(labelList& patchIDs) const;
00270 
00271 
00272             //- Correct for topo change.
00273             void updateMesh(const mapPolyMesh&)
00274             {
00275                 notImplemented
00276                 (
00277                     "mapDistributePolyMesh::updateMesh(const mapPolyMesh&)"
00278                 );
00279             }
00280 };
00281 
00282 
00283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00284 
00285 } // End namespace Foam
00286 
00287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00288 
00289 #endif
00290 
00291 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd