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
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef PrimitivePatch_H
00052 #define PrimitivePatch_H
00053
00054 #include "boolList.H"
00055 #include "labelList.H"
00056 #include "edgeList.H"
00057 #include "pointField.H"
00058 #include "vectorField.H"
00059 #include "intersection.H"
00060 #include "labelHashSet.H"
00061
00062
00063
00064 namespace Foam
00065 {
00066
00067 class face;
00068 class objectHit;
00069 template<class T> class Map;
00070
00071
00072
00073
00074
00075 TemplateName(PrimitivePatch);
00076
00077
00078
00079
00080
00081
00082 template<class Face, template<class> class FaceList, class PointField>
00083 class PrimitivePatch
00084 :
00085 public PrimitivePatchName,
00086 public FaceList<Face>
00087 {
00088
00089 public:
00090
00091
00092
00093
00094 enum surfaceTopo
00095 {
00096 MANIFOLD,
00097 OPEN,
00098 ILLEGAL
00099 };
00100
00101 private:
00102
00103
00104
00105
00106 PointField points_;
00107
00108
00109
00110
00111
00112
00113
00114 mutable edgeList* edgesPtr_;
00115
00116
00117 mutable label nInternalEdges_;
00118
00119
00120 mutable labelList* boundaryPointsPtr_;
00121
00122
00123 mutable labelListList* faceFacesPtr_;
00124
00125
00126 mutable labelListList* edgeFacesPtr_;
00127
00128
00129 mutable labelListList* faceEdgesPtr_;
00130
00131
00132 mutable labelListList* pointEdgesPtr_;
00133
00134
00135 mutable labelListList* pointFacesPtr_;
00136
00137
00138 mutable List<Face>* localFacesPtr_;
00139
00140
00141 mutable labelList* meshPointsPtr_;
00142
00143
00144
00145 mutable Map<label>* meshPointMapPtr_;
00146
00147
00148 mutable labelListList* edgeLoopsPtr_;
00149
00150
00151 mutable pointField* localPointsPtr_;
00152
00153
00154 mutable labelList* localPointOrderPtr_;
00155
00156
00157 mutable vectorField* faceNormalsPtr_;
00158
00159
00160 mutable vectorField* pointNormalsPtr_;
00161
00162
00163
00164
00165
00166 void calcIntBdryEdges() const;
00167
00168
00169 void calcBdryPoints() const;
00170
00171
00172 void calcAddressing() const;
00173
00174
00175 void calcPointEdges() const;
00176
00177
00178 void calcPointFaces() const;
00179
00180
00181 void calcMeshData() const;
00182
00183
00184 void calcMeshPointMap() const;
00185
00186
00187 void calcEdgeLoops() const;
00188
00189
00190 void calcLocalPoints() const;
00191
00192
00193 void calcLocalPointOrder() const;
00194
00195
00196 void calcFaceNormals() const;
00197
00198
00199 void calcPointNormals() const;
00200
00201
00202
00203
00204 void visitPointRegion
00205 (
00206 const label pointI,
00207 const labelList& pFaces,
00208 const label startFaceI,
00209 const label startEdgeI,
00210 boolList& pFacesHad
00211 ) const;
00212
00213
00214 public:
00215
00216
00217
00218
00219 PrimitivePatch
00220 (
00221 const FaceList<Face>& faces,
00222 const pointField& points
00223 );
00224
00225
00226 PrimitivePatch(const PrimitivePatch<Face, FaceList, PointField>&);
00227
00228
00229
00230
00231 virtual ~PrimitivePatch();
00232
00233 void clearOut();
00234
00235 void clearGeom();
00236
00237 void clearTopology();
00238
00239 void clearPatchMeshAddr();
00240
00241
00242
00243
00244
00245
00246
00247 const pointField& points() const
00248 {
00249 return points_;
00250 }
00251
00252
00253
00254
00255
00256
00257
00258 label nPoints() const
00259 {
00260 return meshPoints().size();
00261 }
00262
00263
00264 label nEdges() const
00265 {
00266 return edges().size();
00267 }
00268
00269
00270 const edgeList& edges() const;
00271
00272
00273 label nInternalEdges() const;
00274
00275
00276 bool isInternalEdge(const label edgeI) const
00277 {
00278 return edgeI < nInternalEdges();
00279 }
00280
00281
00282
00283 const labelList& boundaryPoints() const;
00284
00285
00286 const labelListList& faceFaces() const;
00287
00288
00289 const labelListList& edgeFaces() const;
00290
00291
00292 const labelListList& faceEdges() const;
00293
00294
00295 const labelListList& pointEdges() const;
00296
00297
00298 const labelListList& pointFaces() const;
00299
00300
00301 const List<Face>& localFaces() const;
00302
00303
00304
00305
00306
00307 const labelList& meshPoints() const;
00308
00309
00310
00311 const Map<label>& meshPointMap() const;
00312
00313
00314 const pointField& localPoints() const;
00315
00316
00317 const labelList& localPointOrder() const;
00318
00319
00320
00321 label whichPoint(const label gp) const;
00322
00323
00324
00325 label whichEdge(const edge& e) const;
00326
00327
00328 labelList meshEdges
00329 (
00330 const edgeList& allEdges,
00331 const labelListList& cellEdges,
00332 const labelList& faceCells
00333 ) const;
00334
00335
00336 const vectorField& faceNormals() const;
00337
00338
00339 const vectorField& pointNormals() const;
00340
00341
00342
00343
00344
00345 template <class ToPatch>
00346 List<objectHit> projectPoints
00347 (
00348 const ToPatch& targetPatch,
00349 const vectorField& projectionDirection,
00350 const intersection::algorithm alg = intersection::FULL_RAY,
00351 const intersection::direction dir = intersection::VECTOR
00352 ) const;
00353
00354
00355 template <class ToPatch>
00356 List<objectHit> projectFaceCentres
00357 (
00358 const ToPatch& targetPatch,
00359 const vectorField& projectionDirection,
00360 const intersection::algorithm alg = intersection::FULL_RAY,
00361 const intersection::direction dir = intersection::VECTOR
00362 ) const;
00363
00364
00365
00366
00367 const labelListList& edgeLoops() const;
00368
00369
00370
00371
00372
00373
00374
00375
00376 surfaceTopo surfaceType() const;
00377
00378
00379
00380
00381 bool checkTopology
00382 (
00383 const bool report = false,
00384 labelHashSet* setPtr = NULL
00385 ) const;
00386
00387
00388
00389
00390
00391
00392
00393 bool checkPointManifold
00394 (
00395 const bool report = false,
00396 labelHashSet* setPtr = NULL
00397 ) const;
00398
00399
00400
00401
00402
00403 virtual void movePoints(const pointField&);
00404
00405
00406
00407
00408
00409 void operator=(const PrimitivePatch<Face, FaceList, PointField>&);
00410 };
00411
00412
00413
00414
00415 }
00416
00417
00418
00419 #ifdef NoRepository
00420 # include "PrimitivePatch.C"
00421 #endif
00422
00423
00424
00425 #endif
00426
00427