FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::mapDistributePolyMesh
00026 
00027 Description
00028     Class containing mesh-to-mesh mapping information after a mesh distribution
00029     where we send parts of meshes (using subsetting) to other processors 
00030     and receive and reconstruct mesh.
00031 
00032     We store mapping from the bits-to-send to the complete starting mesh
00033     (subXXXMap) and from the received bits to their location in the new
00034     mesh (constructXXXMap).
00035 
00036 SourceFiles
00037     mapDistributePolyMesh.C
00038 
00039 \*---------------------------------------------------------------------------*/
00040 
00041 #ifndef mapDistributePolyMesh_H
00042 #define mapDistributePolyMesh_H
00043 
00044 #include <OpenFOAM/mapDistribute.H>
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 namespace Foam
00049 {
00050 
00051 class mapPolyMesh;
00052 class polyMesh;
00053 
00054 /*---------------------------------------------------------------------------*\
00055                            Class mapDistributePolyMesh Declaration
00056 \*---------------------------------------------------------------------------*/
00057 
00058 class mapDistributePolyMesh
00059 {
00060     // Private data
00061 
00062         const polyMesh& mesh_;
00063 
00064         //- Number of old live points
00065         const label nOldPoints_;
00066 
00067         //- Number of old live faces
00068         const label nOldFaces_;
00069 
00070         //- Number of old live cells
00071         const label nOldCells_;
00072 
00073         //- List of the old patch sizes
00074         labelList oldPatchSizes_;
00075 
00076         //- List of the old patch start labels
00077         const labelList oldPatchStarts_;
00078 
00079         //- List of numbers of mesh points per old patch
00080         const labelList oldPatchNMeshPoints_;
00081 
00082 
00083         //- Point distribute map
00084         const mapDistribute pointMap_;
00085 
00086         //- Face distribute map
00087         const mapDistribute faceMap_;
00088 
00089         //- Cell distribute map
00090         const mapDistribute cellMap_;
00091 
00092         //- Patch distribute map
00093         const mapDistribute patchMap_;
00094 
00095 
00096 
00097     // Private Member Functions
00098 
00099         void calcPatchSizes();
00100 
00101         //- Disallow default bitwise copy construct
00102         mapDistributePolyMesh(const mapDistributePolyMesh&);
00103 
00104         //- Disallow default bitwise assignment
00105         void operator=(const mapDistributePolyMesh&);
00106 
00107 
00108 public:
00109 
00110     // Constructors
00111 
00112         //- Construct from components. Note that mesh has to be changed already
00113         //  since uses mesh.nPoints etc as the new size.
00114         mapDistributePolyMesh
00115         (
00116             const polyMesh& mesh,
00117 
00118             // mesh before changes
00119             const label nOldPoints,
00120             const label nOldFaces,
00121             const label nOldCells,
00122             const labelList& oldPatchStarts,
00123             const labelList& oldPatchNMeshPoints,
00124 
00125             // how to subset pieces of mesh to send across
00126             const labelListList& subPointMap,
00127             const labelListList& subFaceMap,
00128             const labelListList& subCellMap,
00129             const labelListList& subPatchMap,
00130 
00131             // how to reconstruct received mesh
00132             const labelListList& constructPointMap,
00133             const labelListList& constructFaceMap,
00134             const labelListList& constructCellMap,
00135             const labelListList& constructPatchMap
00136         );
00137 
00138         //- (optionally destructively) construct from components
00139         //  Note that mesh has to be changed already!
00140         mapDistributePolyMesh
00141         (
00142             const polyMesh& mesh,
00143             const label nOldPoints,
00144             const label nOldFaces,
00145             const label nOldCells,
00146             labelList& oldPatchStarts,
00147             labelList& oldPatchNMeshPoints,
00148 
00149             labelListList& subPointMap,
00150             labelListList& subFaceMap,
00151             labelListList& subCellMap,
00152             labelListList& subPatchMap,
00153             labelListList& constructPointMap,
00154             labelListList& constructFaceMap,
00155             labelListList& constructCellMap,
00156             labelListList& constructPatchMap,
00157             const bool reUse                // clone or reuse
00158         );
00159 
00160 
00161     // Member Functions
00162 
00163         // Access
00164 
00165             const polyMesh& mesh() const
00166             {
00167                 return mesh_;
00168             }
00169 
00170             //- Number of points in mesh before distribution
00171             label nOldPoints() const
00172             {
00173                 return nOldPoints_;
00174             }
00175 
00176             //- Number of faces in mesh before distribution
00177             label nOldFaces() const
00178             {
00179                 return nOldFaces_;
00180             }
00181 
00182             //- Number of cells in mesh before distribution
00183             label nOldCells() const
00184             {
00185                 return nOldCells_;
00186             }
00187 
00188             //- List of the old patch sizes
00189             const labelList& oldPatchSizes() const
00190             {
00191                 return oldPatchSizes_;
00192             }
00193 
00194             //- List of the old patch start labels
00195             const labelList& oldPatchStarts() const
00196             {
00197                 return oldPatchStarts_;
00198             }
00199 
00200             //- List of numbers of mesh points per old patch
00201             const labelList& oldPatchNMeshPoints() const
00202             {
00203                 return oldPatchNMeshPoints_;
00204             }
00205 
00206             //- Point distribute map
00207             const mapDistribute& pointMap() const
00208             {
00209                 return pointMap_;
00210             }
00211 
00212             //- Face distribute map
00213             const mapDistribute& faceMap() const
00214             {
00215                 return faceMap_;
00216             }
00217 
00218             //- Cell distribute map
00219             const mapDistribute& cellMap() const
00220             {
00221                 return cellMap_;
00222             }
00223 
00224             //- Patch distribute map
00225             const mapDistribute& patchMap() const
00226             {
00227                 return patchMap_;
00228             }
00229 
00230 
00231         // Edit
00232 
00233             //- distribute list of point data
00234             template<class T>
00235             void distributePointData(List<T>& lst) const
00236             {
00237                 pointMap_.distribute(lst);
00238             }
00239 
00240             //- distribute list of face data
00241             template<class T>
00242             void distributeFaceData(List<T>& lst) const
00243             {
00244                 faceMap_.distribute(lst);
00245             }
00246 
00247             //- distribute list of cell data
00248             template<class T>
00249             void distributeCellData(List<T>& lst) const
00250             {
00251                 cellMap_.distribute(lst);
00252             }
00253 
00254             //- distribute list of patch data
00255             template<class T>
00256             void distributePatchData(List<T>& lst) const
00257             {
00258                 patchMap_.distribute(lst);
00259             }
00260 
00261 
00262             //- distribute list of point/face/cell/patch indices.
00263             //  (Converts to boolList, distributes boolList and reconstructs)
00264             void distributePointIndices(labelList& pointIDs) const;
00265 
00266             void distributeFaceIndices(labelList& faceIDs) const;
00267             void distributeCellIndices(labelList& cellIDs) const;
00268             void distributePatchIndices(labelList& patchIDs) const;
00269 
00270 
00271             //- Correct for topo change.
00272             void updateMesh(const mapPolyMesh&)
00273             {
00274                 notImplemented
00275                 (
00276                     "mapDistributePolyMesh::updateMesh(const mapPolyMesh&)"
00277                 );
00278             }
00279 };
00280 
00281 
00282 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00283 
00284 } // End namespace Foam
00285 
00286 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00287 
00288 #endif
00289 
00290 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines