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
00052
00053
00054 #ifndef primitiveMesh_H
00055 #define primitiveMesh_H
00056
00057 #include "edgeList.H"
00058 #include "boundBox.H"
00059 #include "pointField.H"
00060 #include "SubField.H"
00061 #include "SubList.H"
00062 #include "faceList.H"
00063 #include "cellList.H"
00064 #include "cellShapeList.H"
00065 #include "labelList.H"
00066 #include "boolList.H"
00067 #include "labelHashSet.H"
00068 #include "Map.H"
00069
00070
00071
00072 namespace Foam
00073 {
00074
00075
00076
00077
00078
00079 class primitiveMesh
00080 {
00081
00082
00083
00084
00085
00086 label nPoints_;
00087
00088
00089 mutable label nEdges_;
00090
00091
00092 label nInternalFaces_;
00093
00094
00095 label nFaces_;
00096
00097
00098 label nCells_;
00099
00100
00101
00102
00103
00104 pointField::subField points_;
00105
00106
00107 faceList::subList faces_;
00108
00109
00110 labelList::subList faceOwner_;
00111
00112
00113 labelList::subList faceNeighbour_;
00114
00115
00116 bool clearedPrimitives_;
00117
00118
00119
00120
00121
00122 mutable pointField::subField* oldPointsPtr_;
00123
00124
00125
00126
00127
00128 mutable cellShapeList* cellShapesPtr_;
00129
00130
00131 mutable edgeList* edgesPtr_;
00132
00133
00134
00135
00136
00137 mutable labelListList* ccPtr_;
00138
00139
00140 mutable labelListList* ecPtr_;
00141
00142
00143 mutable labelListList* pcPtr_;
00144
00145
00146 mutable cellList* cfPtr_;
00147
00148
00149 mutable labelListList* efPtr_;
00150
00151
00152 mutable labelListList* pfPtr_;
00153
00154
00155 mutable labelListList* cePtr_;
00156
00157
00158 mutable labelListList* fePtr_;
00159
00160
00161 mutable labelListList* pePtr_;
00162
00163
00164 mutable labelListList* ppPtr_;
00165
00166
00167 mutable labelListList* cpPtr_;
00168
00169
00170
00171
00172
00173 mutable vectorField* cellCentresPtr_;
00174
00175
00176 mutable vectorField* faceCentresPtr_;
00177
00178
00179 mutable scalarField* cellVolumesPtr_;
00180
00181
00182 mutable vectorField* faceAreasPtr_;
00183
00184
00185
00186
00187
00188 primitiveMesh(const primitiveMesh&);
00189
00190
00191 void operator=(const primitiveMesh&);
00192
00193
00194
00195
00196
00197
00198
00199 void calcCellShapes() const;
00200
00201
00202 void calcCellCells() const;
00203
00204
00205 void calcEdgeCells() const;
00206
00207
00208 void calcPointCells() const;
00209
00210
00211 void calcCells() const;
00212
00213
00214 void calcEdgeFaces() const;
00215
00216
00217 void calcPointFaces() const;
00218
00219
00220 void calcCellEdges() const;
00221
00222
00223 void calcPointEdges() const;
00224
00225
00226 void calcPointPoints() const;
00227
00228
00229 void calcCellPoints() const;
00230
00231
00232
00233 void calcEdges() const;
00234 void clearOutEdges();
00235
00236
00237
00238
00239
00240 void calcFaceCentresAndAreas() const;
00241 void makeFaceCentresAndAreas
00242 (
00243 const pointField& p,
00244 vectorField& fCtrs,
00245 vectorField& fAreas
00246 ) const;
00247
00248
00249 void calcCellCentresAndVols() const;
00250 void makeCellCentresAndVols
00251 (
00252 const vectorField& fCtrs,
00253 const vectorField& fAreas,
00254 vectorField& cellCtrs,
00255 scalarField& cellVols
00256 ) const;
00257
00258
00259 void calcEdgeVectors() const;
00260
00261
00262
00263
00264
00265 void warnCommonPoints
00266 (
00267 const label,
00268 const Map<label>&,
00269 bool& hasWarned
00270 ) const;
00271
00272
00273 bool checkDuplicateFaces
00274 (
00275 const label,
00276 const Map<label>&,
00277 labelHashSet*
00278 ) const;
00279
00280
00281 bool checkCommonOrder
00282 (
00283 const label,
00284 const Map<label>&,
00285 labelHashSet*
00286 ) const;
00287
00288
00289
00290
00291
00292
00293
00294 static scalar orthWarn_;
00295
00296
00297 static scalar skewWarn_;
00298
00299
00300 static scalar aspectWarn_;
00301
00302
00303 protected:
00304
00305
00306 primitiveMesh();
00307
00308
00309 public:
00310
00311
00312
00313 ClassName("primitiveMesh");
00314
00315
00316 static const unsigned cellsPerEdge_ = 4;
00317
00318
00319 static const unsigned cellsPerPoint_ = 8;
00320
00321
00322 static const unsigned facesPerCell_ = 6;
00323
00324
00325 static const unsigned facesPerEdge_ = 4;
00326
00327
00328 static const unsigned facesPerPoint_ = 12;
00329
00330
00331 static const unsigned edgesPerCell_ = 12;
00332
00333
00334 static const unsigned edgesPerFace_ = 4;
00335
00336
00337 static const unsigned edgesPerPoint_ = 6;
00338
00339
00340 static const unsigned pointsPerCell_ = 8;
00341
00342
00343 static const unsigned pointsPerFace_ = 4;
00344
00345
00346 static const scalar closedTolerance_;
00347
00348
00349
00350
00351
00352 primitiveMesh
00353 (
00354 const label nPoints,
00355 const label nInternalFaces,
00356 const label nFaces,
00357 const label nCells,
00358 const pointField& points,
00359 const faceList& faces,
00360 const labelList& faceOwner,
00361 const labelList& faceNeighbour
00362 );
00363
00364
00365
00366
00367 virtual ~primitiveMesh();
00368
00369
00370
00371
00372
00373 void reset
00374 (
00375 const label nPoints,
00376 const label nInternalFaces,
00377 const label nFaces,
00378 const label nCells,
00379 const pointField& points,
00380 const faceList& faces,
00381 const labelList& faceOwner,
00382 const labelList& faceNeighbour
00383 );
00384
00385
00386 void reset
00387 (
00388 const label nPoints,
00389 const label nInternalFaces,
00390 const label nFaces,
00391 const label nCells,
00392 const pointField& points,
00393 const faceList& faces,
00394 const labelList& faceOwner,
00395 const labelList& faceNeighbour,
00396 cellList& cells
00397 );
00398
00399
00400
00401
00402
00403
00404 inline label nPoints() const;
00405 inline label nEdges() const;
00406 inline label nInternalFaces() const;
00407 inline label nFaces() const;
00408 inline label nCells() const;
00409
00410
00411
00412
00413
00414 const pointField& points() const;
00415
00416
00417 const faceList& faces() const;
00418
00419
00420 inline const labelList& faceOwner() const;
00421
00422
00423 inline const labelList& faceNeighbour() const;
00424
00425
00426 const cellShapeList& cellShapes() const;
00427
00428
00429 const edgeList& edges() const;
00430
00431
00432
00433
00434 static void calcCells
00435 (
00436 cellList&,
00437 const unallocLabelList& own,
00438 const unallocLabelList& nei,
00439 const label nCells = -1
00440 );
00441
00442
00443
00444
00445
00446 const pointField& oldPoints() const;
00447
00448
00449
00450
00451 const labelListList& cellCells() const;
00452
00453 const labelListList& edgeCells() const;
00454 const labelListList& pointCells() const;
00455
00456 const cellList& cells() const;
00457
00458 const labelListList& edgeFaces() const;
00459 const labelListList& pointFaces() const;
00460
00461 const labelListList& cellEdges() const;
00462 const labelListList& faceEdges() const;
00463
00464 const labelListList& pointEdges() const;
00465 const labelListList& pointPoints() const;
00466 const labelListList& cellPoints() const;
00467
00468
00469
00470
00471 const vectorField& cellCentres() const;
00472 const vectorField& faceCentres() const;
00473 const scalarField& cellVolumes() const;
00474 const vectorField& faceAreas() const;
00475
00476
00477
00478
00479
00480 tmp<scalarField> movePoints
00481 (
00482 const pointField& p,
00483 const pointField& oldP
00484 );
00485
00486
00487
00488 inline bool isInternalFace(const label faceIndex) const;
00489
00490
00491
00492
00493
00494
00495
00496 bool checkClosedBoundary(const bool report = false) const;
00497
00498
00499 bool checkClosedCells
00500 (
00501 const bool report = false,
00502 labelHashSet* setPtr = NULL
00503 ) const;
00504
00505
00506 bool checkFaceAreas
00507 (
00508 const bool report = false,
00509 labelHashSet* setPtr = NULL
00510 ) const;
00511
00512
00513 bool checkCellVolumes
00514 (
00515
00516 const bool report = false,
00517 labelHashSet* setPtr = NULL
00518 ) const;
00519
00520
00521 bool checkFaceDotProduct
00522 (
00523 const bool report = false,
00524 labelHashSet* setPtr = NULL
00525 ) const;
00526
00527
00528 bool checkFacePyramids
00529 (
00530 const bool report = false,
00531 const scalar minPyrVol = -SMALL,
00532 labelHashSet* setPtr = NULL
00533 ) const;
00534
00535
00536 bool checkFaceSkewness
00537 (
00538 const bool report = false,
00539 labelHashSet* setPtr = NULL
00540 ) const;
00541
00542
00543 bool checkFaceAngles
00544 (
00545 const bool report = false,
00546 const scalar maxSin = 10,
00547 labelHashSet* setPtr = NULL
00548 ) const;
00549
00550
00551
00552
00553 bool checkFaceFlatness
00554 (
00555 const bool report,
00556 const scalar warnFlatness,
00557 labelHashSet* setPtr
00558 ) const;
00559
00560
00561 bool checkPoints
00562 (
00563 const bool report = false,
00564 labelHashSet* setPtr = NULL
00565 ) const;
00566
00567
00568 bool checkUpperTriangular
00569 (
00570 const bool report = false,
00571 labelHashSet* setPtr = NULL
00572 ) const;
00573
00574
00575
00576
00577 bool checkCellsZipUp
00578 (
00579 const bool report = false,
00580 labelHashSet* setPtr = NULL
00581 ) const;
00582
00583
00584 bool checkFaceVertices
00585 (
00586 const bool report = false,
00587 labelHashSet* setPtr = NULL
00588 ) const;
00589
00590
00591 bool checkFaceFaces
00592 (
00593 const bool report = false,
00594 labelHashSet* setPtr = NULL
00595 ) const;
00596
00597
00598 bool checkFloatingCells
00599 (
00600 const bool report = false,
00601 labelHashSet* setPtr = NULL
00602 ) const;
00603
00604
00605
00606 bool checkTopology(const bool report = false) const;
00607
00608
00609
00610 bool checkGeometry(const bool report = false) const;
00611
00612
00613 bool checkMesh(const bool report = false) const;
00614
00615
00616 bool checkMeshMotion
00617 (
00618 const pointField& newPoints,
00619 const bool report = false
00620 ) const;
00621
00622
00623 static scalar setOrthWarn(const scalar);
00624
00625
00626
00627 static scalar setSkewWarn(const scalar);
00628
00629
00630 static scalar setAspectWarn(const scalar);
00631
00632
00633
00634
00635
00636 boundBox bounds() const
00637 {
00638 return boundBox(points());
00639 }
00640
00641
00642 bool pointInCellBB(const point& p, label celli) const;
00643
00644
00645 bool pointInCell(const point& p, label celli) const;
00646
00647
00648 label findNearestCell(const point& location) const;
00649
00650
00651 label findCell(const point& location) const;
00652
00653
00654
00655
00656
00657 void printAllocated() const;
00658
00659
00660 void clearGeom();
00661
00662
00663 void clearAddressing();
00664
00665
00666 void clearOut();
00667
00668
00669
00670 void clearPrimitives();
00671
00672
00673 void clearAll();
00674 };
00675
00676
00677
00678
00679 }
00680
00681
00682
00683 #include "primitiveMeshI.H"
00684
00685
00686
00687 #endif
00688
00689