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 #ifndef face_H
00041 #define face_H
00042
00043 #include "pointField.H"
00044 #include "labelList.H"
00045 #include "edgeList.H"
00046 #include "vectorField.H"
00047 #include "faceListFwd.H"
00048 #include "intersection.H"
00049 #include "pointHit.H"
00050
00051
00052
00053 namespace Foam
00054 {
00055
00056
00057
00058 class face;
00059 class triFace;
00060
00061 template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
00062 class DynamicList;
00063
00064 inline bool operator==(const face& a, const face& b);
00065 inline bool operator!=(const face& a, const face& b);
00066 inline Istream& operator>>(Istream&, face&);
00067
00068
00069
00070
00071
00072 class face
00073 :
00074 public labelList
00075 {
00076
00077
00078
00079 inline label right(const label i) const;
00080
00081
00082 inline label left(const label i) const;
00083
00084
00085 tmp<vectorField> calcEdges
00086 (
00087 const pointField& points
00088 ) const;
00089
00090
00091 scalar edgeCos
00092 (
00093 const vectorField& edges,
00094 const label index
00095 ) const;
00096
00097
00098 label mostConcaveAngle
00099 (
00100 const pointField& points,
00101 const vectorField& edges,
00102 scalar& edgeCos
00103 ) const;
00104
00105
00106 enum splitMode
00107 {
00108 COUNTTRIANGLE,
00109 COUNTQUAD,
00110 SPLITTRIANGLE,
00111 SPLITQUAD
00112 };
00113
00114
00115
00116
00117 label split
00118 (
00119 const splitMode mode,
00120 const pointField& points,
00121 label& triI,
00122 label& quadI,
00123 faceList& triFaces,
00124 faceList& quadFaces
00125 ) const;
00126
00127
00128 public:
00129
00130
00131
00132 static const char* const typeName;
00133
00134
00135
00136
00137
00138 inline face();
00139
00140
00141 explicit inline face(label);
00142
00143
00144 explicit inline face(const UList<label>&);
00145
00146
00147 explicit inline face(const labelList&);
00148
00149
00150 explicit inline face(const Xfer<labelList>&);
00151
00152
00153 face(const triFace&);
00154
00155
00156 inline face(Istream&);
00157
00158
00159
00160
00161
00162
00163 label collapse();
00164
00165
00166 inline pointField points(const pointField& meshPoints) const;
00167
00168
00169 point centre(const pointField&) const;
00170
00171
00172 template<class Type>
00173 Type average(const pointField&, const Field<Type>&) const;
00174
00175
00176 inline scalar mag(const pointField&) const;
00177
00178
00179 vector normal(const pointField&) const;
00180
00181
00182 face reverseFace() const;
00183
00184
00185
00186
00187 label which(const label globalIndex) const;
00188
00189
00190 inline label nextLabel(const label i) const;
00191
00192
00193 inline label prevLabel(const label i) const;
00194
00195
00196
00197 scalar sweptVol
00198 (
00199 const pointField& oldPoints,
00200 const pointField& newPoints
00201 ) const;
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215 pointHit ray
00216 (
00217 const point& p,
00218 const vector& n,
00219 const pointField& meshPoints,
00220 const intersection::algorithm alg = intersection::FULL_RAY,
00221 const intersection::direction dir = intersection::VECTOR
00222 ) const;
00223
00224
00225
00226
00227 pointHit intersection
00228 (
00229 const point& p,
00230 const vector& q,
00231 const point& ctr,
00232 const pointField& meshPoints,
00233 const intersection::algorithm alg,
00234 const scalar tol = 0.0
00235 ) const;
00236
00237
00238 pointHit nearestPoint
00239 (
00240 const point& p,
00241 const pointField& meshPoints
00242 ) const;
00243
00244
00245 scalar contactSphereDiameter
00246 (
00247 const point& p,
00248 const vector& n,
00249 const pointField& meshPoints
00250 ) const;
00251
00252
00253 scalar areaInContact
00254 (
00255 const pointField& points,
00256 const scalarField& v
00257 ) const;
00258
00259
00260 inline label nEdges() const;
00261
00262
00263
00264 edgeList edges() const;
00265
00266
00267 inline edge faceEdge(const label n) const;
00268
00269
00270
00271
00272
00273 int edgeDirection(const edge&) const;
00274
00275
00276
00277
00278 inline label nTriangles() const;
00279
00280
00281 label nTriangles(const pointField& points) const;
00282
00283
00284
00285
00286
00287 label triangles
00288 (
00289 const pointField& points,
00290 label& triI,
00291 faceList& triFaces
00292 ) const;
00293
00294
00295
00296
00297 template<unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
00298 label triangles
00299 (
00300 const pointField& points,
00301 DynamicList<face, SizeInc, SizeMult, SizeDiv>& triFaces
00302 ) const;
00303
00304
00305
00306 label nTrianglesQuads
00307 (
00308 const pointField& points,
00309 label& nTris,
00310 label& nQuads
00311 ) const;
00312
00313
00314
00315
00316
00317 label trianglesQuads
00318 (
00319 const pointField& points,
00320 label& triI,
00321 label& quadI,
00322 faceList& triFaces,
00323 faceList& quadFaces
00324 ) const;
00325
00326
00327
00328
00329
00330 static int compare(const face&, const face&);
00331
00332
00333
00334
00335 friend bool operator==(const face& a, const face& b);
00336 friend bool operator!=(const face& a, const face& b);
00337
00338
00339
00340
00341 friend Istream& operator>>(Istream&, face&);
00342 };
00343
00344
00345
00346
00347 }
00348
00349
00350
00351 #include "faceI.H"
00352
00353 #ifdef NoRepository
00354 # include "faceTemplates.C"
00355 #endif
00356
00357
00358
00359 #endif
00360
00361