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