![]() |
|
00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 00025 Class 00026 mapAddedPolyMesh 00027 00028 Description 00029 Class containing mesh-to-mesh mapping information after a mesh addition 00030 where we add a mesh ('added mesh') to an old mesh, creating a new mesh. 00031 00032 We choose to store mapping from the new mesh to the old and added meshes 00033 and if nessecary construct the inverse mapping. (not for the patches 00034 since patches might have been deleted). ?Might be a better idea to 00035 reverse this: store from old to current mesh and calculate if nessecary 00036 combined meshes? 00037 00038 These maps are stored as a single labelList where a negative index is 00039 an index into the old mesh and a positive one into the added mesh. 00040 (similar to face turning index in decomposePar) 00041 00042 E.g. 00043 00044 cellMap[i] < 0: 00045 00046 oldCellI = -cellMap[I]-1; 00047 00048 cellMap[i] > 0: 00049 00050 addedCellI = cellMap[I]-1; 00051 00052 cellMap[i] == 0: 00053 00054 Illegal 00055 00056 00057 Note: Might need some more access functions or maybe some zone maps? 00058 00059 00060 SourceFiles 00061 00062 \*---------------------------------------------------------------------------*/ 00063 00064 #ifndef mapAddedPolyMesh_H 00065 #define mapAddedPolyMesh_H 00066 00067 //#include "refCount.H" 00068 #include "labelList.H" 00069 00070 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00071 00072 namespace Foam 00073 { 00074 00075 class mapPolyMesh; 00076 00077 /*---------------------------------------------------------------------------*\ 00078 Class mapAddedPolyMesh Declaration 00079 \*---------------------------------------------------------------------------*/ 00080 00081 class mapAddedPolyMesh 00082 { 00083 // Private data 00084 00085 //- Old mesh points/face/cells 00086 label nOldPoints_; 00087 label nOldFaces_; 00088 label nOldCells_; 00089 00090 //- Added mesh points/faces/cells 00091 label nAddedPoints_; 00092 label nAddedFaces_; 00093 label nAddedCells_; 00094 00095 00096 //- Old point map. 00097 // Contains the point label on either old mesh or added mesh for all 00098 // new points. Size of the list equals the size of new points 00099 labelList pointMap_; 00100 00101 //- Old face map. 00102 // Contains the face label on either old mesh or added mesh for all 00103 // new faces. Size of the list equals the size of new faces 00104 labelList faceMap_; 00105 00106 //- Old cell map. 00107 // Contains the cell label on either old mesh or added mesh for all 00108 // new cells. Size of the list equals the size of new cells 00109 labelList cellMap_; 00110 00111 //- original mesh to new mesh patch map. -1 for deleted patches. 00112 labelList oldPatchMap_; 00113 00114 //- added mesh to new mesh patch map. -1 for deleted patches. 00115 labelList addedPatchMap_; 00116 00117 00118 // Private member functions 00119 00120 static labelList calcReverseMap 00121 ( 00122 const labelList&, 00123 const bool getOldMesh, 00124 const label nOldElems 00125 ); 00126 00127 public: 00128 00129 // Constructors 00130 00131 //- Construct null 00132 mapAddedPolyMesh(); 00133 00134 //- Construct from components 00135 mapAddedPolyMesh 00136 ( 00137 const label nOldPoints, 00138 const label nOldFaces, 00139 const label nOldCells, 00140 const label nAddedPoints, 00141 const label nAddedFaces, 00142 const label nAddedCells, 00143 const labelList& pointMap, 00144 const labelList& faceMap, 00145 const labelList& cellMap, 00146 const labelList& oldPatchMap, 00147 const labelList& addedPatchMap 00148 ); 00149 00150 //- Construct as copy 00151 mapAddedPolyMesh(const mapAddedPolyMesh&); 00152 00153 00154 // Helper functions for constructing. 00155 00156 //- combine and invert map from old to new and from added to new 00157 static labelList combine 00158 ( 00159 const label nNew, 00160 const labelList&, 00161 const labelList& 00162 ); 00163 00164 //- combine and invert map from old to new and from added to new. 00165 // Difference with above one is that map from old to new is 00166 // an identimap. 00167 static labelList combine 00168 ( 00169 const label nNew, 00170 const label nOld, 00171 const labelList& 00172 ); 00173 00174 00175 // Member Functions 00176 00177 // Access 00178 00179 // Old mesh data 00180 00181 label nOldPoints() const 00182 { 00183 return nOldPoints_; 00184 } 00185 00186 label nOldFaces() const 00187 { 00188 return nOldFaces_; 00189 } 00190 00191 label nOldCells() const 00192 { 00193 return nOldCells_; 00194 } 00195 00196 //- From old patch index to new patch index or -1 if patch 00197 // not present (since 0 size) 00198 const labelList& oldPatchMap() const 00199 { 00200 return oldPatchMap_; 00201 } 00202 00203 00204 // Added mesh data 00205 00206 label nAddedPoints() const 00207 { 00208 return nAddedPoints_; 00209 } 00210 00211 label nAddedFaces() const 00212 { 00213 return nAddedFaces_; 00214 } 00215 00216 label nAddedCells() const 00217 { 00218 return nAddedCells_; 00219 } 00220 00221 //- From added mesh patch index to new patch index or -1 if 00222 // patch not present (since 0 size) 00223 const labelList& addedPatchMap() const 00224 { 00225 return addedPatchMap_; 00226 } 00227 00228 00229 // Merged mesh data 00230 00231 const labelList& pointMap() const 00232 { 00233 return pointMap_; 00234 } 00235 00236 const labelList& faceMap() const 00237 { 00238 return faceMap_; 00239 } 00240 00241 const labelList& cellMap() const 00242 { 00243 return cellMap_; 00244 } 00245 00246 00247 //- From old mesh cells to new mesh cells. 00248 labelList oldCellMap() const; 00249 00250 //- From added mesh cells to new mesh cells. -1 if cell not added. 00251 labelList addedCellMap() const; 00252 00253 //- From old mesh faces to new mesh faces. 00254 labelList oldFaceMap() const; 00255 00256 //- From added mesh faces to new mesh facess. -1 if face not added. 00257 labelList addedFaceMap() const; 00258 00259 //- From old mesh points to new mesh points. 00260 labelList oldPointMap() const; 00261 00262 //- From added mesh points to new mesh points. -1 if pt not added. 00263 labelList addedPointMap() const; 00264 00265 00266 // Edit 00267 00268 void updateMesh(const mapPolyMesh&) 00269 { 00270 notImplemented 00271 ( 00272 "mapAddedPolyMesh::updateMesh(const mapPolyMesh&)" 00273 ); 00274 } 00275 }; 00276 00277 00278 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00279 00280 } // End namespace Foam 00281 00282 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00283 00284 #endif 00285 00286 // ************************************************************************* //