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 #ifndef triSurfaceTools_H
00036 #define triSurfaceTools_H
00037
00038 #include "boolList.H"
00039 #include "pointField.H"
00040 #include "DynamicList.H"
00041 #include "labelHashSet.H"
00042 #include "FixedList.H"
00043 #include "vector2D.H"
00044 #include "triPointRef.H"
00045
00046
00047
00048 namespace Foam
00049 {
00050
00051
00052 class triSurface;
00053 class edge;
00054 class labelledTri;
00055 class polyBoundaryMesh;
00056
00057
00058
00059
00060
00061 namespace triSurfaceTools
00062 {
00063
00064 void writeOBJ
00065 (
00066 const fileName& fName,
00067 const pointField& pts
00068 );
00069
00070
00071 void writeOBJ
00072 (
00073 const triSurface& surf,
00074 const fileName& fName,
00075 const boolList& markedVerts
00076 );
00077
00078
00079 void getVertexTriangles
00080 (
00081 const triSurface& surf,
00082 const label edgeI,
00083 labelList& edgeTris
00084 );
00085
00086
00087 labelList getVertexVertices
00088 (
00089 const triSurface& surf,
00090 const edge& e
00091 );
00092
00093
00094
00095 FixedList<label, 3> sortedFaceEdges
00096 (
00097 const triSurface& surf,
00098 const label faceI
00099 );
00100
00101
00102 void orderVertices
00103 (
00104 const labelledTri& f,
00105 const label v1,
00106 const label v2,
00107 label& vA,
00108 label& vB
00109 );
00110
00111
00112 label otherFace
00113 (
00114 const triSurface& surf,
00115 const label faceI,
00116 const label edgeI
00117 );
00118
00119
00120 void otherEdges
00121 (
00122 const triSurface& surf,
00123 const label faceI,
00124 const label edgeI,
00125 label& e1,
00126 label& e2
00127 );
00128
00129
00130 void otherVertices
00131 (
00132 const triSurface& surf,
00133 const label faceI,
00134 const label vertI,
00135 label& vert1I,
00136 label& vert2I
00137 );
00138
00139
00140 label oppositeEdge
00141 (
00142 const triSurface& surf,
00143 const label faceI,
00144 const label vertI
00145 );
00146
00147
00148 label oppositeVertex
00149 (
00150 const triSurface& surf,
00151 const label faceI,
00152 const label edgeI
00153 );
00154
00155
00156 label getEdge
00157 (
00158 const triSurface& surf,
00159 const label vert1I,
00160 const label vert2I
00161 );
00162
00163
00164 label getTriangle
00165 (
00166 const triSurface& surf,
00167 const label e0I,
00168 const label e1I,
00169 const label e2I
00170 );
00171
00172
00173 label minEdge
00174 (
00175 const triSurface& surf,
00176 const labelList& edgeIndices
00177 );
00178
00179
00180 label maxEdge
00181 (
00182 const triSurface& surf,
00183 const labelList& edgeIndices
00184 );
00185
00186 scalar faceCosAngle
00187 (
00188 const point& pStart,
00189 const point& pEnd,
00190 const point& pLeft,
00191 const point& pRight
00192 );
00193
00194
00195
00196
00197
00198 scalar pseudoAngle
00199 (
00200 const vector& e0,
00201 const vector& e1,
00202 const vector& vec
00203 );
00204
00205
00206
00207 labelHashSet getCollapsedFaces
00208 (
00209 const triSurface& surf,
00210 label edgeI
00211 );
00212
00213
00214
00215 label vertexUsesFace
00216 (
00217 const triSurface& surf,
00218 const labelHashSet& faceUsed,
00219 const label vertI
00220 );
00221
00222
00223
00224
00225
00226
00227
00228
00229 void getMergedEdges
00230 (
00231 const triSurface& surf,
00232 const label edgeI,
00233 const labelHashSet& collapsedFaces,
00234 HashTable<label, label, Hash<label> >& edgeToEdge,
00235 HashTable<label, label, Hash<label> >& edgeToFace
00236 );
00237
00238
00239
00240 scalar edgeCosAngle
00241 (
00242 const triSurface& surf,
00243 const label v1,
00244 const point& pt,
00245 const labelHashSet& collapsedFaces,
00246 const HashTable<label, label, Hash<label> >& edgeToEdge,
00247 const HashTable<label, label, Hash<label> >& edgeToFace,
00248 const label faceI,
00249 const label edgeI
00250 );
00251
00252
00253
00254
00255 scalar collapseMinCosAngle
00256 (
00257 const triSurface& surf,
00258 const label v1,
00259 const point& pt,
00260 const labelHashSet& collapsedFaces,
00261 const HashTable<label, label, Hash<label> >& edgeToEdge,
00262 const HashTable<label, label, Hash<label> >& edgeToFace
00263 );
00264
00265
00266 bool collapseCreatesFold
00267 (
00268 const triSurface& surf,
00269 const label v1,
00270 const point& pt,
00271 const labelHashSet& collapsedFaces,
00272 const HashTable<label, label, Hash<label> >& edgeToEdge,
00273 const HashTable<label, label, Hash<label> >& edgeToFace,
00274 const scalar minCos
00275 );
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290 static const label ANYEDGE = -1;
00291 static const label NOEDGE = -2;
00292 static const label COLLAPSED = -3;
00293
00294 void protectNeighbours
00295 (
00296 const triSurface& surf,
00297 const label vertI,
00298 labelList& faceStatus
00299 );
00300
00301
00302 triSurface collapseEdges
00303 (
00304 const triSurface& surf,
00305 const labelList& collapsableEdges
00306 );
00307
00308
00309
00310
00311
00312 triSurface collapseEdges
00313 (
00314 const triSurface& surf,
00315 const labelList& collapsableEdges,
00316 const pointField& edgeMids,
00317 labelList& faceStatus
00318 );
00319
00320 enum refineType
00321 {
00322 NONE,
00323 RED,
00324 GREEN
00325 };
00326
00327 void calcRefineStatus
00328 (
00329 const triSurface& surf,
00330 const label faceI,
00331 labelList& refine
00332 );
00333
00334 void greenRefine
00335 (
00336 const triSurface& surf,
00337 const label faceI,
00338 const label edgeI,
00339 const label newPointI,
00340 DynamicList<labelledTri>& newFaces
00341 );
00342
00343
00344 triSurface greenRefine
00345 (
00346 const triSurface& surf,
00347 const labelList& refineEdges
00348 );
00349
00350 triSurface doRefine
00351 (
00352 const triSurface& surf,
00353 const labelList& refineStatus
00354 );
00355
00356
00357 triSurface redGreenRefine
00358 (
00359 const triSurface& surf,
00360 const labelList& refineFaces
00361 );
00362
00363
00364 triSurface mergePoints
00365 (
00366 const triSurface& surf,
00367 const scalar mergeTol
00368 );
00369
00370
00371
00372
00373 vector surfaceNormal
00374 (
00375 const triSurface& surf,
00376 const label nearestFaceI,
00377 const point& nearestPt
00378 );
00379
00380
00381 enum sideType
00382 {
00383 UNKNOWN,
00384 INSIDE,
00385 OUTSIDE
00386 };
00387
00388
00389
00390 sideType edgeSide
00391 (
00392 const triSurface& surf,
00393 const point& sample,
00394 const point& nearestPoint,
00395 const label edgeI
00396 );
00397
00398
00399
00400
00401 sideType surfaceSide
00402 (
00403 const triSurface& surf,
00404 const point& sample,
00405 const label nearestFaceI,
00406 const point& nearestPt
00407 );
00408
00409
00410
00411
00412
00413 triSurface triangulate
00414 (
00415 const polyBoundaryMesh& mBesh,
00416 const labelHashSet& includePatches,
00417 const bool verbose = false
00418 );
00419
00420
00421
00422
00423 triSurface triangulateFaceCentre
00424 (
00425 const polyBoundaryMesh& mBesh,
00426 const labelHashSet& includePatches,
00427 const bool verbose = false
00428 );
00429
00430
00431
00432 void calcInterpolationWeights
00433 (
00434 const triPointRef&,
00435 const point&,
00436 FixedList<scalar, 3>& weights
00437 );
00438
00439
00440
00441
00442
00443
00444
00445
00446 void calcInterpolationWeights
00447 (
00448 const triSurface& s,
00449 const pointField& samplePts,
00450 List<FixedList<label, 3> >& verts,
00451 List<FixedList<scalar, 3> >& weights
00452 );
00453
00454
00455
00456 triSurface delaunay2D(const List<vector2D>&);
00457 }
00458
00459
00460
00461
00462 }
00463
00464
00465
00466 #endif
00467
00468
Copyright © 2000-2007 OpenCFD Ltd