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