![]() |
|
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 ZoneMesh 00027 00028 Description 00029 List of mesh zones 00030 SourceFiles 00031 ZoneMesh.C 00032 00033 \*---------------------------------------------------------------------------*/ 00034 00035 #ifndef ZoneMesh_H 00036 #define ZoneMesh_H 00037 00038 #include "List.H" 00039 #include "IndirectList.H" 00040 #include "regIOobject.H" 00041 #include "labelHashSet.H" 00042 #include "pointFieldsFwd.H" 00043 00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00045 00046 namespace Foam 00047 { 00048 00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00050 00051 class polyMesh; 00052 00053 // * * * * * * Forward declaration of template friend fuctions * * * * * * * // 00054 00055 template<class ZoneType> class ZoneMesh; 00056 00057 template<class ZoneType> 00058 Ostream& operator<<(Ostream&, const ZoneMesh<ZoneType>&); 00059 00060 /*---------------------------------------------------------------------------*\ 00061 Class ZoneMesh Declaration 00062 \*---------------------------------------------------------------------------*/ 00063 00064 template<class ZoneType> 00065 class ZoneMesh 00066 : 00067 public PtrList<ZoneType>, 00068 public regIOobject 00069 { 00070 // Private data 00071 00072 //- Reference to mesh 00073 const polyMesh& mesh_; 00074 00075 //- Map of zone labels for given element 00076 mutable Map<label>* zoneMapPtr_; 00077 00078 00079 // Private member functions 00080 00081 //- Disallow construct as copy 00082 ZoneMesh(const ZoneMesh&); 00083 00084 //- Disallow assignment 00085 void operator=(const ZoneMesh<ZoneType>&); 00086 00087 00088 //- Create zone map 00089 void calcZoneMap() const; 00090 00091 00092 public: 00093 00094 // Constructors 00095 00096 //- Read constructor given IOobject and a polyMesh reference 00097 ZoneMesh 00098 ( 00099 const IOobject&, 00100 const polyMesh& 00101 ); 00102 00103 //- Construct given size 00104 ZoneMesh 00105 ( 00106 const IOobject&, 00107 const polyMesh&, 00108 const label size 00109 ); 00110 00111 // Destructor 00112 00113 ~ZoneMesh(); 00114 00115 00116 // Member functions 00117 00118 //- Return the mesh reference 00119 const polyMesh& mesh() const 00120 { 00121 return mesh_; 00122 } 00123 00124 //- Map of zones containing zone index for all zoned elements 00125 // Return -1 if the object is not in the zone 00126 const Map<label>& zoneMap() const; 00127 00128 //- Given a global object index, return the zone it is in. If 00129 //object does not belong to any zones, return -1 00130 label whichZone(const label objectIndex) const; 00131 00132 //- Return a list of zone types 00133 wordList types() const; 00134 00135 //- Return a list of zone names 00136 wordList names() const; 00137 00138 //- Find zone index given a name 00139 label findZoneID(const word& zoneName) const; 00140 00141 //- Clear addressing 00142 void clearAddressing(); 00143 00144 //- Clear the zones 00145 void clear(); 00146 00147 //- Correct zone mesh after moving points 00148 void movePoints(const pointField&); 00149 00150 //- writeData member function required by regIOobject 00151 bool writeData(Ostream&) const; 00152 00153 00154 // Ostream operator 00155 00156 friend Ostream& operator<< <ZoneType> 00157 ( 00158 Ostream&, 00159 const ZoneMesh<ZoneType>& 00160 ); 00161 }; 00162 00163 00164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00165 00166 } // End namespace Foam 00167 00168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00169 00170 #ifdef NoRepository 00171 # include "ZoneMesh.C" 00172 #endif 00173 00174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00175 00176 #endif 00177 00178 // ************************************************************************* //