meshReader.H
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
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #ifndef meshReader_H
00058 #define meshReader_H
00059
00060 #include "polyMesh.H"
00061 #include "HashTable.H"
00062 #include "IOstream.H"
00063
00064 #include "cellTable.H"
00065
00066
00067
00068 namespace Foam
00069 {
00070
00071
00072
00073
00074
00075 class meshReader
00076 {
00077 protected:
00078
00079
00080 class cellFaceIdentifier
00081 {
00082 public:
00083
00084
00085
00086 label cell;
00087
00088
00089 label face;
00090
00091
00092
00093
00094
00095 cellFaceIdentifier() : cell(-1), face(-1) {}
00096
00097
00098 cellFaceIdentifier(label c, label f) : cell(c), face(f) {}
00099
00100
00101
00102
00103
00104 bool used() const
00105 {
00106 return (cell >= 0 && face >= 0);
00107 }
00108
00109
00110 bool unused() const
00111 {
00112 return (cell < 0 || face < 0);
00113 }
00114
00115
00116
00117
00118 bool operator!=(const cellFaceIdentifier& cf) const
00119 {
00120 return (cell != cf.cell || face != cf.face);
00121 }
00122
00123 bool operator==(const cellFaceIdentifier& cf) const
00124 {
00125 return (cell == cf.cell && face == cf.face);
00126 }
00127
00128
00129
00130 friend Ostream& operator<<
00131 (
00132 Ostream& os,
00133 const cellFaceIdentifier& cf
00134 )
00135 {
00136 os << "(" << cf.cell << "/" << cf.face << ")";
00137 return os;
00138 }
00139 };
00140
00141
00142 private:
00143
00144
00145
00146
00147
00148
00149 mutable labelListList* pointCellsPtr_;
00150
00151
00152 label nInternalFaces_;
00153
00154
00155 labelList patchStarts_;
00156 labelList patchSizes_;
00157
00158
00159 List<labelPair> interfaces_;
00160
00161
00162 List<List<cellFaceIdentifier> > baffleIds_;
00163
00164
00165 faceList meshFaces_;
00166
00167
00168 cellList cellPolys_;
00169
00170
00171 HashTable<List<label>, word, string::hash> monitoringSets_;
00172
00173
00174
00175
00176
00177 meshReader(const meshReader&);
00178
00179
00180 void operator=(const meshReader&);
00181
00182
00183 void calcPointCells() const;
00184
00185 const labelListList& pointCells() const;
00186
00187
00188 void createPolyCells();
00189
00190
00191 void addPolyBoundaryFace
00192 (
00193 const label cellId,
00194 const label cellFaceId,
00195 const label nCreatedFaces
00196 );
00197
00198
00199 void addPolyBoundaryFace
00200 (
00201 const cellFaceIdentifier& identifier,
00202 const label nCreatedFaces
00203 );
00204
00205
00206 void addCellZones(polyMesh&) const;
00207
00208
00209 void addFaceZones(polyMesh&) const;
00210
00211
00212
00213 void createPolyBoundary();
00214
00215
00216 List<polyPatch*> polyBoundaryPatches(const polyMesh&);
00217
00218
00219
00220 void clearExtraStorage();
00221
00222 void writeInterfaces(const objectRegistry&) const;
00223
00224
00225 void writeMeshLabelList
00226 (
00227 const objectRegistry& registry,
00228 const word& propertyName,
00229 const labelList& list,
00230 IOstream::streamFormat fmt = IOstream::ASCII
00231 ) const;
00232
00233
00234 faceListList& cellFaces() const
00235 {
00236 return const_cast<faceListList&>(cellFaces_);
00237 }
00238
00239
00240 protected:
00241
00242
00243
00244
00245 static const cellModel* unknownModel;
00246 static const cellModel* tetModel;
00247 static const cellModel* pyrModel;
00248 static const cellModel* prismModel;
00249 static const cellModel* hexModel;
00250
00251
00252 fileName geometryFile_;
00253
00254
00255 scalar scaleFactor_;
00256
00257
00258 pointField points_;
00259
00260
00261 labelList origCellId_;
00262
00263
00264
00265 List<List<cellFaceIdentifier> > boundaryIds_;
00266
00267
00268 wordList patchTypes_;
00269
00270
00271 wordList patchNames_;
00272
00273
00274 wordList patchPhysicalTypes_;
00275
00276
00277 faceListList cellFaces_;
00278
00279
00280 faceList baffleFaces_;
00281
00282
00283 labelList cellTableId_;
00284
00285
00286 cellTable cellTable_;
00287
00288
00289
00290
00291
00292 virtual bool readGeometry(const scalar scaleFactor = 1.0) = 0;
00293
00294 public:
00295
00296
00297
00298
00299 static void warnDuplicates(const word& context, const wordList&);
00300
00301
00302
00303
00304
00305 meshReader(const fileName&, const scalar scaleFactor = 1.0);
00306
00307
00308
00309 virtual ~meshReader();
00310
00311
00312
00313
00314
00315 virtual autoPtr<polyMesh> mesh(const objectRegistry&);
00316
00317
00318 void writeAux(const objectRegistry&) const;
00319
00320
00321 void writeMesh
00322 (
00323 const polyMesh&,
00324 IOstream::streamFormat fmt = IOstream::BINARY
00325 ) const;
00326 };
00327
00328
00329
00330
00331 }
00332
00333 #endif
00334
00335
Copyright © 2000-2009 OpenCFD Ltd