triSurface.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 #ifndef triSurface_H
00037 #define triSurface_H
00038
00039 #include "PrimitivePatch.H"
00040 #include "pointField.H"
00041 #include "labelledTri.H"
00042 #include "boolList.H"
00043 #include "geometricSurfacePatchList.H"
00044 #include "surfacePatchList.H"
00045 #include "triFaceList.H"
00046
00047
00048
00049 namespace Foam
00050 {
00051
00052 class Time;
00053 class IFstream;
00054
00055
00056
00057
00058
00059 class triSurface
00060 :
00061 public PrimitivePatch<labelledTri, ::Foam::List, pointField, point>
00062 {
00063
00064
00065
00066 typedef labelledTri Face;
00067 typedef PrimitivePatch
00068 <
00069 labelledTri,
00070 ::Foam::List,
00071 pointField,
00072 point
00073 >
00074 ParentType;
00075
00076
00077
00078
00079
00080 static const int STLheaderSize = 80;
00081
00082
00083
00084 geometricSurfacePatchList patches_;
00085
00086
00087
00088
00089
00090 mutable labelListList* sortedEdgeFacesPtr_;
00091
00092
00093
00094 mutable labelList* edgeOwnerPtr_;
00095
00096
00097
00098
00099
00100 void calcSortedEdgeFaces() const;
00101
00102
00103 void calcEdgeOwner() const;
00104
00105
00106
00107 surfacePatchList calcPatches(labelList& faceMap) const;
00108
00109
00110 void setDefaultPatches();
00111
00112
00113
00114 bool stitchTriangles
00115 (
00116 const pointField& rawPoints,
00117 const scalar tol = SMALL,
00118 const bool verbose = false
00119 );
00120
00121
00122 bool read(Istream&);
00123
00124
00125 bool read(const fileName&, const word& ext, const bool check = true);
00126
00127 bool readSTL(const fileName&);
00128 bool readSTLASCII(const fileName&);
00129 bool readSTLBINARY(const fileName&);
00130 bool readGTS(const fileName&);
00131 bool readOBJ(const fileName&);
00132 bool readOFF(const fileName&);
00133 bool readTRI(const fileName&);
00134 bool readAC(const fileName&);
00135 bool readNAS(const fileName&);
00136
00137
00138 void write(const fileName&, const word& ext, const bool sort) const;
00139
00140
00141
00142 void writeSTLASCII(Ostream&) const;
00143
00144
00145 void writeSTLBINARY(std::ostream&) const;
00146
00147
00148
00149 void writeGTS(const bool writeSorted, Ostream&) const;
00150
00151
00152
00153
00154 void writeOBJ(const bool writeSorted, Ostream&) const;
00155
00156
00157
00158
00159 void writeOFF(const bool writeSorted, Ostream&) const;
00160
00161
00162 void writeVTK(const bool writeSorted, Ostream&) const;
00163
00164
00165
00166 void writeTRI(const bool writeSorted, Ostream&) const;
00167
00168
00169 void writeSMESH(const bool writeSorted, Ostream&) const;
00170
00171
00172 void writeAC(Ostream&) const;
00173
00174
00175 void writeDX(const bool, Ostream&) const;
00176 void writeDXGeometry(const bool, Ostream&) const;
00177 void writeDXTrailer(Ostream&) const;
00178
00179
00180
00181
00182 static List<labelledTri> convertToTri
00183 (
00184 const faceList&,
00185 const label defaultRegion = 0
00186 );
00187
00188
00189 static List<labelledTri> convertToTri
00190 (
00191 const triFaceList&,
00192 const label defaultRegion = 0
00193 );
00194
00195
00196 static void printTriangle
00197 (
00198 Ostream&,
00199 const Foam::string& pre,
00200 const labelledTri&,
00201 const pointField&
00202 );
00203
00204
00205 static string getLineNoComment(IFstream&);
00206
00207 protected:
00208
00209
00210
00211
00212 pointField& storedPoints()
00213 {
00214 return const_cast<pointField&>(ParentType::points());
00215 }
00216
00217
00218 List<Face>& storedFaces()
00219 {
00220 return static_cast<List<Face>&>(*this);
00221 }
00222
00223 public:
00224
00225
00226
00227
00228 typedef bool BoundaryMesh;
00229
00230
00231
00232 ClassName("triSurface");
00233
00234
00235
00236
00237
00238 static fileName triSurfInstance(const Time&);
00239
00240
00241
00242
00243
00244 triSurface();
00245
00246
00247 triSurface
00248 (
00249 const List<labelledTri>&,
00250 const geometricSurfacePatchList&,
00251 const pointField&
00252 );
00253
00254
00255 triSurface
00256 (
00257 List<labelledTri>&,
00258 const geometricSurfacePatchList&,
00259 pointField&,
00260 const bool reUse
00261 );
00262
00263
00264 triSurface(const List<labelledTri>&, const pointField&);
00265
00266
00267
00268 triSurface(const triFaceList&, const pointField&);
00269
00270
00271 triSurface(const fileName&);
00272
00273
00274 triSurface(Istream&);
00275
00276
00277 triSurface(const Time& d);
00278
00279
00280 triSurface(const triSurface&);
00281
00282
00283
00284
00285
00286 ~triSurface();
00287
00288 void clearOut();
00289
00290 void clearTopology();
00291
00292 void clearPatchMeshAddr();
00293
00294
00295
00296
00297
00298
00299 const geometricSurfacePatchList& patches() const
00300 {
00301 return patches_;
00302 }
00303
00304 geometricSurfacePatchList& patches()
00305 {
00306 return patches_;
00307 }
00308
00309
00310
00311
00312
00313 const labelListList& sortedEdgeFaces() const;
00314
00315
00316
00317
00318
00319 const labelList& edgeOwner() const;
00320
00321
00322
00323
00324 virtual void movePoints(const pointField&);
00325
00326
00327 virtual void scalePoints(const scalar&);
00328
00329
00330 void checkTriangles(const bool verbose);
00331
00332
00333 void checkEdges(const bool verbose);
00334
00335
00336 void cleanup(const bool verbose);
00337
00338
00339
00340
00341 void markZone
00342 (
00343 const boolList& borderEdge,
00344 const label faceI,
00345 const label currentZone,
00346 labelList& faceZone
00347 ) const;
00348
00349
00350
00351
00352 label markZones
00353 (
00354 const boolList& borderEdge,
00355 labelList& faceZone
00356 ) const;
00357
00358
00359
00360
00361
00362 void subsetMeshMap
00363 (
00364 const boolList& include,
00365 labelList& pointMap,
00366 labelList& faceMap
00367 ) const;
00368
00369
00370
00371 triSurface subsetMesh
00372 (
00373 const boolList& include,
00374 labelList& pointMap,
00375 labelList& faceMap
00376 ) const;
00377
00378
00379
00380
00381 void write(Ostream&) const;
00382
00383
00384 void write(const fileName&, const bool sortByRegion = false) const;
00385
00386
00387 void write(const Time&) const;
00388
00389
00390 void writeDX(const scalarField&, Ostream&) const;
00391 void writeDX(const vectorField&, Ostream&) const;
00392
00393
00394 void writeStats(Ostream&) const;
00395
00396
00397
00398
00399 void operator=(const triSurface&);
00400
00401
00402
00403
00404 friend Ostream& operator<<(Ostream&, const triSurface&);
00405 };
00406
00407
00408
00409
00410 }
00411
00412
00413
00414 #endif
00415
00416
Copyright © 2000-2009 OpenCFD Ltd