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 #ifndef ensightMesh_H
00035 #define ensightMesh_H
00036
00037 #include "cellSets.H"
00038 #include "faceSets.H"
00039 #include <OpenFOAM/HashTable.H>
00040 #include <OpenFOAM/HashSet.H>
00041 #include <finiteVolume/fvMesh.H>
00042 #include <OpenFOAM/OFstream.H>
00043 #include <fstream>
00044
00045
00046
00047 namespace Foam
00048 {
00049
00050 class fvMesh;
00051 class argList;
00052
00053
00054
00055
00056
00057 class ensightMesh
00058 {
00059 public:
00060 class nFacePrimitives
00061 {
00062 public:
00063
00064 label nPoints;
00065 label nTris;
00066 label nQuads;
00067 label nPolys;
00068
00069 nFacePrimitives()
00070 :
00071 nPoints(0),
00072 nTris(0),
00073 nQuads(0),
00074 nPolys(0)
00075 {}
00076 };
00077
00078 private:
00079
00080
00081
00082
00083 const fvMesh& mesh_;
00084
00085
00086 bool binary_;
00087
00088
00089 label patchPartOffset_;
00090
00091 cellSets meshCellSets_;
00092
00093 List<faceSets> boundaryFaceSets_;
00094
00095 wordList allPatchNames_;
00096
00097 List<labelList> allPatchProcs_;
00098
00099 wordHashSet patchNames_;
00100
00101 HashTable<nFacePrimitives> nPatchPrims_;
00102
00103
00104
00105
00106
00107 ensightMesh(const ensightMesh&);
00108
00109
00110 void operator=(const ensightMesh&);
00111
00112 void writePoints
00113 (
00114 const scalarField& pointsComponent,
00115 OFstream& ensightGeometryFile
00116 ) const;
00117
00118 cellShapeList map
00119 (
00120 const cellShapeList& cellShapes,
00121 const labelList& prims
00122 ) const;
00123
00124 cellShapeList map
00125 (
00126 const cellShapeList& cellShapes,
00127 const labelList& hexes,
00128 const labelList& wedges
00129 ) const;
00130
00131 void writePrims
00132 (
00133 const cellShapeList& cellShapes,
00134 const label pointOffset,
00135 OFstream& ensightGeometryFile
00136 ) const;
00137
00138 void writePolysNFaces
00139 (
00140 const labelList& polys,
00141 const cellList& cellFaces,
00142 OFstream& ensightGeometryFile
00143 ) const;
00144
00145 void writePolysNPointsPerFace
00146 (
00147 const labelList& polys,
00148 const cellList& cellFaces,
00149 const faceList& faces,
00150 OFstream& ensightGeometryFile
00151 ) const;
00152
00153 void writePolysPoints
00154 (
00155 const labelList& polys,
00156 const cellList& cellFaces,
00157 const faceList& faces,
00158 const label pointOffset,
00159 OFstream& ensightGeometryFile
00160 ) const;
00161
00162 void writeAllPolys
00163 (
00164 const labelList& pointOffsets,
00165 OFstream& ensightGeometryFile
00166 ) const;
00167
00168 void writeAllPrims
00169 (
00170 const char* key,
00171 const label nPrims,
00172 const cellShapeList& cellShapes,
00173 const labelList& pointOffsets,
00174 OFstream& ensightGeometryFile
00175 ) const;
00176
00177 void writeFacePrims
00178 (
00179 const faceList& patchFaces,
00180 const label pointOffset,
00181 OFstream& ensightGeometryFile
00182 ) const;
00183
00184 faceList map
00185 (
00186 const faceList& patchFaces,
00187 const labelList& prims
00188 ) const;
00189
00190 void writeAllFacePrims
00191 (
00192 const char* key,
00193 const labelList& prims,
00194 const label nPrims,
00195 const faceList& patchFaces,
00196 const labelList& pointOffsets,
00197 const labelList& patchProcessors,
00198 OFstream& ensightGeometryFile
00199 ) const;
00200
00201 void writeNSidedNPointsPerFace
00202 (
00203 const faceList& patchFaces,
00204 OFstream& ensightGeometryFile
00205 ) const;
00206
00207 void writeNSidedPoints
00208 (
00209 const faceList& patchFaces,
00210 const label pointOffset,
00211 OFstream& ensightGeometryFile
00212 ) const;
00213
00214 void writeAllNSided
00215 (
00216 const labelList& prims,
00217 const label nPrims,
00218 const faceList& patchFaces,
00219 const labelList& pointOffsets,
00220 const labelList& patchProcessors,
00221 OFstream& ensightGeometryFile
00222 ) const;
00223
00224 void writeAscii
00225 (
00226 const fileName& postProcPath,
00227 const word& prepend,
00228 const label timeIndex,
00229 Ostream& ensightCaseFile
00230 ) const;
00231
00232 void writeBinary
00233 (
00234 const fileName& postProcPath,
00235 const word& prepend,
00236 const label timeIndex,
00237 Ostream& ensightCaseFile
00238 ) const;
00239
00240 void writePrimsBinary
00241 (
00242 const cellShapeList& cellShapes,
00243 const label pointOffset,
00244 std::ofstream& ensightGeometryFile
00245 ) const;
00246
00247 void writeAllPrimsBinary
00248 (
00249 const char* key,
00250 const label nPrims,
00251 const cellShapeList& cellShapes,
00252 const labelList& pointOffsets,
00253 std::ofstream& ensightGeometryFile
00254 ) const;
00255
00256 void writePolysNFacesBinary
00257 (
00258 const labelList& polys,
00259 const cellList& cellFaces,
00260 std::ofstream& ensightGeometryFile
00261 ) const;
00262
00263 void writePolysNPointsPerFaceBinary
00264 (
00265 const labelList& polys,
00266 const cellList& cellFaces,
00267 const faceList& faces,
00268 std::ofstream& ensightGeometryFile
00269 ) const;
00270
00271 void writePolysPointsBinary
00272 (
00273 const labelList& polys,
00274 const cellList& cellFaces,
00275 const faceList& faces,
00276 const label pointOffset,
00277 std::ofstream& ensightGeometryFile
00278 ) const;
00279
00280 void writeAllPolysBinary
00281 (
00282 const labelList& pointOffsets,
00283 std::ofstream& ensightGeometryFile
00284 ) const;
00285
00286 void writeAllFacePrimsBinary
00287 (
00288 const char* key,
00289 const labelList& prims,
00290 const label nPrims,
00291 const faceList& patchFaces,
00292 const labelList& pointOffsets,
00293 const labelList& patchProcessors,
00294 std::ofstream& ensightGeometryFile
00295 ) const;
00296
00297 void writeFacePrimsBinary
00298 (
00299 const faceList& patchFaces,
00300 const label pointOffset,
00301 std::ofstream& ensightGeometryFile
00302 ) const;
00303
00304 void writeNSidedPointsBinary
00305 (
00306 const faceList& patchFaces,
00307 const label pointOffset,
00308 std::ofstream& ensightGeometryFile
00309 ) const;
00310
00311 void writeNSidedNPointsPerFaceBinary
00312 (
00313 const faceList& patchFaces,
00314 std::ofstream& ensightGeometryFile
00315 ) const;
00316
00317 void writeAllNSidedBinary
00318 (
00319 const labelList& prims,
00320 const label nPrims,
00321 const faceList& patchFaces,
00322 const labelList& pointOffsets,
00323 const labelList& patchProcessors,
00324 std::ofstream& ensightGeometryFile
00325 ) const;
00326
00327 public:
00328
00329
00330
00331
00332 ensightMesh(const fvMesh&, const argList& args, const bool binary);
00333
00334
00335
00336 ~ensightMesh();
00337
00338
00339
00340
00341
00342
00343 const fvMesh& mesh() const
00344 {
00345 return mesh_;
00346 }
00347
00348 const cellSets& meshCellSets() const
00349 {
00350 return meshCellSets_;
00351 }
00352
00353 const List<faceSets>& boundaryFaceSets() const
00354 {
00355 return boundaryFaceSets_;
00356 }
00357
00358 const wordList& allPatchNames() const
00359 {
00360 return allPatchNames_;
00361 }
00362
00363 const List<labelList>& allPatchProcs() const
00364 {
00365 return allPatchProcs_;
00366 }
00367
00368 const wordHashSet& patchNames() const
00369 {
00370 return patchNames_;
00371 }
00372
00373 const HashTable<nFacePrimitives>& nPatchPrims() const
00374 {
00375 return nPatchPrims_;
00376 }
00377
00378
00379 label patchPartOffset() const
00380 {
00381 return patchPartOffset_;
00382 }
00383
00384
00385
00386
00387 void write
00388 (
00389 const fileName& postProcPath,
00390 const word& prepend,
00391 const label timeIndex,
00392 Ostream& ensightCaseFile
00393 ) const;
00394 };
00395
00396
00397
00398
00399 }
00400
00401
00402
00403 #endif
00404
00405