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