Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 #ifndef polyMesh_H
00041 #define polyMesh_H
00042 
00043 #include <OpenFOAM/objectRegistry.H>
00044 #include <OpenFOAM/primitiveMesh.H>
00045 #include <OpenFOAM/pointField.H>
00046 #include <OpenFOAM/faceList.H>
00047 #include <OpenFOAM/cellList.H>
00048 #include <OpenFOAM/cellShapeList.H>
00049 #include <OpenFOAM/pointIOField.H>
00050 #include <OpenFOAM/faceIOList.H>
00051 #include <OpenFOAM/labelIOList.H>
00052 #include <OpenFOAM/polyBoundaryMesh.H>
00053 #include <OpenFOAM/boundBox.H>
00054 #include <OpenFOAM/pointZoneMesh.H>
00055 #include <OpenFOAM/faceZoneMesh.H>
00056 #include <OpenFOAM/cellZoneMesh.H>
00057 
00058 
00059 
00060 namespace Foam
00061 {
00062 
00063 class globalMeshData;
00064 class mapPolyMesh;
00065 
00066 
00067 
00068 
00069 
00070 class polyMesh
00071 :
00072     public objectRegistry,
00073     public primitiveMesh
00074 {
00075 
00076 public:
00077 
00078     
00079 
00080         
00081         
00082         
00083         
00084         enum readUpdateState
00085         {
00086             UNCHANGED,
00087             POINTS_MOVED,
00088             TOPO_CHANGE,
00089             TOPO_PATCH_CHANGE
00090         };
00091 
00092 
00093 private:
00094 
00095     
00096 
00097         
00098 
00099             
00100             pointIOField points_;
00101 
00102             
00103             faceIOList faces_;
00104 
00105             
00106             labelIOList owner_;
00107 
00108             
00109             labelIOList neighbour_;
00110 
00111             
00112             bool clearedPrimitives_;
00113 
00114 
00115             
00116             mutable polyBoundaryMesh boundary_;
00117 
00118             
00119             
00120             boundBox bounds_;
00121 
00122             
00123             
00124             mutable Vector<label> geometricD_;
00125 
00126             
00127             
00128             mutable Vector<label> solutionD_;
00129 
00130 
00131         
00132 
00133             
00134             pointZoneMesh pointZones_;
00135 
00136             
00137             faceZoneMesh faceZones_;
00138 
00139             
00140             cellZoneMesh cellZones_;
00141 
00142 
00143         
00144         mutable globalMeshData* globalMeshDataPtr_;
00145 
00146 
00147         
00148 
00149             
00150             bool moving_;
00151 
00152             
00153             bool changing_;
00154 
00155             
00156             mutable label curMotionTimeIndex_;
00157 
00158             
00159             mutable pointField* oldPointsPtr_;
00160 
00161 
00162     
00163 
00164         
00165         polyMesh(const polyMesh&);
00166 
00167         
00168         void operator=(const polyMesh&);
00169 
00170         
00171         void initMesh();
00172 
00173         
00174         void initMesh(cellList& c);
00175 
00176         
00177         void calcDirections() const;
00178 
00179         
00180         
00181         void calcCellShapes() const;
00182 
00183 
00184         
00185 
00186             labelListList cellShapePointCells(const cellShapeList&) const;
00187 
00188             labelList facePatchFaceCells
00189             (
00190                 const faceList& patchFaces,
00191                 const labelListList& pointCells,
00192                 const faceListList& cellsFaceShapes,
00193                 const label patchID
00194             ) const;
00195 
00196 
00197 public:
00198 
00199     
00200 
00201         typedef polyMesh Mesh;
00202         typedef polyBoundaryMesh BoundaryMesh;
00203 
00204 
00205     
00206     TypeName("polyMesh");
00207 
00208     
00209     static word defaultRegion;
00210 
00211     
00212     static word meshSubDir;
00213 
00214 
00215     
00216 
00217         
00218         explicit polyMesh(const IOobject& io);
00219 
00220         
00221         
00222         polyMesh
00223         (
00224             const IOobject& io,
00225             const Xfer<pointField>& points,
00226             const Xfer<faceList>& faces,
00227             const Xfer<labelList>& owner,
00228             const Xfer<labelList>& neighbour,
00229             const bool syncPar = true
00230         );
00231 
00232         
00233         
00234         polyMesh
00235         (
00236             const IOobject& io,
00237             const Xfer<pointField>& points,
00238             const Xfer<faceList>& faces,
00239             const Xfer<cellList>& cells,
00240             const bool syncPar = true
00241         );
00242 
00243         
00244         polyMesh
00245         (
00246             const IOobject& io,
00247             const Xfer<pointField>& points,
00248             const cellShapeList& shapes,
00249             const faceListList& boundaryFaces,
00250             const wordList& boundaryPatchNames,
00251             const wordList& boundaryPatchTypes,
00252             const word& defaultBoundaryPatchName,
00253             const word& defaultBoundaryPatchType,
00254             const wordList& boundaryPatchPhysicalTypes,
00255             const bool syncPar = true
00256         );
00257 
00258 
00259     
00260 
00261         virtual ~polyMesh();
00262 
00263 
00264     
00265 
00266         
00267 
00268             
00269             virtual const fileName& dbDir() const;
00270 
00271             
00272             fileName meshDir() const;
00273 
00274             
00275             
00276             
00277             const fileName& pointsInstance() const;
00278 
00279             
00280             const fileName& facesInstance() const;
00281 
00282             
00283             void setInstance(const fileName&);
00284 
00285 
00286         
00287 
00288             
00289             virtual const pointField& points() const;
00290 
00291             
00292             virtual const faceList& faces() const;
00293 
00294             
00295             virtual const labelList& faceOwner() const;
00296 
00297             
00298             virtual const labelList& faceNeighbour() const;
00299 
00300             
00301             virtual const pointField& oldPoints() const;
00302 
00303             
00304             const polyBoundaryMesh& boundaryMesh() const
00305             {
00306                 return boundary_;
00307             }
00308 
00309             
00310             const boundBox& bounds() const
00311             {
00312                 return bounds_;
00313             }
00314 
00315             
00316             
00317             
00318             
00319             const Vector<label>& geometricD() const;
00320 
00321             
00322             label nGeometricD() const;
00323 
00324             
00325             
00326             
00327             
00328             const Vector<label>& solutionD() const;
00329 
00330             
00331             label nSolutionD() const;
00332 
00333             
00334             const pointZoneMesh& pointZones() const
00335             {
00336                 return pointZones_;
00337             }
00338 
00339             
00340             const faceZoneMesh& faceZones() const
00341             {
00342                 return faceZones_;
00343             }
00344 
00345             
00346             const cellZoneMesh& cellZones() const
00347             {
00348                 return cellZones_;
00349             }
00350 
00351             
00352             const globalMeshData& globalData() const;
00353 
00354             
00355             const objectRegistry& thisDb() const
00356             {
00357                 return *this;
00358             }
00359 
00360         
00361 
00362             
00363             bool moving() const
00364             {
00365                 return moving_;
00366             }
00367 
00368             
00369             bool moving(const bool m)
00370             {
00371                 bool m0 = moving_;
00372                 moving_ = m;
00373                 changing_ = changing_ || moving_;
00374                 return m0;
00375             }
00376 
00377             
00378             bool changing() const
00379             {
00380                 return changing_;
00381             }
00382 
00383             
00384             bool changing(const bool c)
00385             {
00386                 bool c0 = changing_;
00387                 changing_ = c;
00388                 return c0;
00389             }
00390 
00391             
00392             virtual tmp<scalarField> movePoints(const pointField&);
00393 
00394             
00395             void resetMotion() const;
00396 
00397 
00398         
00399 
00400             
00401             pointZoneMesh& pointZones()
00402             {
00403                 return pointZones_;
00404             }
00405 
00406             
00407             faceZoneMesh& faceZones()
00408             {
00409                 return faceZones_;
00410             }
00411 
00412             
00413             cellZoneMesh& cellZones()
00414             {
00415                 return cellZones_;
00416             }
00417 
00418             
00419             void addPatches
00420             (
00421                 const List<polyPatch*>&,
00422                 const bool validBoundary = true
00423             );
00424 
00425             
00426             void addZones
00427             (
00428                 const List<pointZone*>& pz,
00429                 const List<faceZone*>& fz,
00430                 const List<cellZone*>& cz
00431             );
00432 
00433             
00434             
00435             virtual readUpdateState readUpdate();
00436 
00437             
00438             virtual void updateMesh(const mapPolyMesh& mpm);
00439 
00440             
00441             void removeBoundary();
00442 
00443             
00444             
00445             
00446             
00447             
00448             void resetPrimitives
00449             (
00450                 const Xfer<pointField>& points,
00451                 const Xfer<faceList>& faces,
00452                 const Xfer<labelList>& owner,
00453                 const Xfer<labelList>& neighbour,
00454                 const labelList& patchSizes,
00455                 const labelList& patchStarts,
00456                 const bool validBoundary = true
00457             );
00458 
00459 
00460         
00461 
00462             
00463             void clearGeom();
00464 
00465             
00466             void clearAddressing();
00467 
00468             
00469             void clearOut();
00470 
00471             
00472             void clearPrimitives();
00473 
00474             
00475             void removeFiles(const fileName& instanceDir) const;
00476 
00477             
00478             void removeFiles() const;
00479 };
00480 
00481 
00482 
00483 
00484 } 
00485 
00486 
00487 
00488 #endif
00489 
00490