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 #ifndef hexRef8_H
00036 #define hexRef8_H
00037
00038 #include <OpenFOAM/labelIOList.H>
00039 #include <OpenFOAM/face.H>
00040 #include <OpenFOAM/HashSet.H>
00041 #include <OpenFOAM/DynamicList.H>
00042 #include <OpenFOAM/primitivePatch.H>
00043 #include "removeFaces.H"
00044 #include "refinementHistory.H"
00045 #include <OpenFOAM/PackedBoolList.H>
00046
00047
00048
00049 namespace Foam
00050 {
00051
00052
00053 class polyMesh;
00054 class polyPatch;
00055 class polyTopoChange;
00056 class mapPolyMesh;
00057 class mapDistributePolyMesh;
00058
00059
00060
00061
00062
00063 class hexRef8
00064 {
00065
00066
00067
00068 const polyMesh& mesh_;
00069
00070
00071 labelIOList cellLevel_;
00072
00073
00074 labelIOList pointLevel_;
00075
00076
00077 const scalar level0Edge_;
00078
00079
00080 refinementHistory history_;
00081
00082
00083 removeFaces faceRemover_;
00084
00085
00086 Map<label> savedPointLevel_;
00087
00088
00089 Map<label> savedCellLevel_;
00090
00091
00092
00093
00094
00095 static void reorder
00096 (
00097 const labelList& map,
00098 const label len,
00099 const label null,
00100 labelList& elems
00101 );
00102
00103
00104 void getFaceInfo
00105 (
00106 const label faceI,
00107 label& patchID,
00108 label& zoneID,
00109 label& zoneFlip
00110 ) const;
00111
00112
00113 label addFace
00114 (
00115 polyTopoChange& meshMod,
00116 const label faceI,
00117 const face& newFace,
00118 const label own,
00119 const label nei
00120 ) const;
00121
00122
00123 label addInternalFace
00124 (
00125 polyTopoChange& meshMod,
00126 const label meshFaceI,
00127 const label meshPointI,
00128 const face& newFace,
00129 const label own,
00130 const label nei
00131 ) const;
00132
00133
00134
00135 void modFace
00136 (
00137 polyTopoChange& meshMod,
00138 const label faceI,
00139 const face& newFace,
00140 const label own,
00141 const label nei
00142 ) const;
00143
00144 scalar getLevel0EdgeLength() const;
00145
00146
00147 label getAnchorCell
00148 (
00149 const labelListList& cellAnchorPoints,
00150 const labelListList& cellAddedCells,
00151 const label cellI,
00152 const label faceI,
00153 const label pointI
00154 ) const;
00155
00156
00157
00158 void getFaceNeighbours
00159 (
00160 const labelListList& cellAnchorPoints,
00161 const labelListList& cellAddedCells,
00162 const label faceI,
00163 const label pointI,
00164
00165 label& own,
00166 label& nei
00167 ) const;
00168
00169
00170
00171 label findMinLevel(const labelList& f) const;
00172
00173 label findMaxLevel(const labelList& f) const;
00174
00175 label countAnchors(const labelList&, const label) const;
00176
00177 void dumpCell(const label cellI) const;
00178
00179 label findLevel
00180 (
00181 const label faceI,
00182 const face& f,
00183 const label startFp,
00184 const bool searchForward,
00185 const label wantedLevel
00186 ) const;
00187
00189
00190
00191
00192 static void checkInternalOrientation
00193 (
00194 polyTopoChange& meshMod,
00195 const label cellI,
00196 const label faceI,
00197 const point& ownPt,
00198 const point& neiPt,
00199 const face& newFace
00200 );
00201
00202
00203 static void checkBoundaryOrientation
00204 (
00205 polyTopoChange& meshMod,
00206 const label cellI,
00207 const label faceI,
00208 const point& ownPt,
00209 const point& boundaryPt,
00210 const face& newFace
00211 );
00212
00213
00214
00215 void insertEdgeSplit
00216 (
00217 const labelList& edgeMidPoint,
00218 const label p0,
00219 const label p1,
00220 DynamicList<label>& verts
00221 ) const;
00222
00223
00224 label storeMidPointInfo
00225 (
00226 const labelListList& cellAnchorPoints,
00227 const labelListList& cellAddedCells,
00228 const labelList& cellMidPoint,
00229 const labelList& edgeMidPoint,
00230 const label cellI,
00231 const label faceI,
00232 const bool faceOrder,
00233 const label midPointI,
00234 const label anchorPointI,
00235 const label faceMidPointI,
00236
00237 Map<edge>& midPointToAnchors,
00238 Map<edge>& midPointToFaceMids,
00239 polyTopoChange& meshMod
00240 ) const;
00241
00242
00243 void createInternalFromSplitFace
00244 (
00245 const labelListList& cellAnchorPoints,
00246 const labelListList& cellAddedCells,
00247 const labelList& cellMidPoint,
00248 const labelList& faceMidPoint,
00249 const labelList& edgeMidPoint,
00250 const label cellI,
00251 const label faceI,
00252
00253 Map<edge>& midPointToAnchors,
00254 Map<edge>& midPointToFaceMids,
00255 polyTopoChange& meshMod,
00256 label& nFacesAdded
00257 ) const;
00258
00259
00260 void createInternalFaces
00261 (
00262 const labelListList& cellAnchorPoints,
00263 const labelListList& cellAddedCells,
00264 const labelList& cellMidPoint,
00265 const labelList& faceMidPoint,
00266 const labelList& faceAnchorLevel,
00267 const labelList& edgeMidPoint,
00268 const label cellI,
00269 polyTopoChange& meshMod
00270 ) const;
00271
00272
00273
00274 void walkFaceToMid
00275 (
00276 const labelList& edgeMidPoint,
00277 const label cLevel,
00278 const label faceI,
00279 const label startFp,
00280 DynamicList<label>& faceVerts
00281 ) const;
00282
00283
00284 void walkFaceFromMid
00285 (
00286 const labelList& edgeMidPoint,
00287 const label cLevel,
00288 const label faceI,
00289 const label startFp,
00290 DynamicList<label>& faceVerts
00291 ) const;
00292
00293
00294
00295 label faceConsistentRefinement
00296 (
00297 const bool maxSet,
00298 PackedBoolList& refineCell
00299 ) const;
00300
00301
00302 void checkWantedRefinementLevels(const labelList&) const;
00303
00304
00305
00306
00307 hexRef8(const hexRef8&);
00308
00309
00310 void operator=(const hexRef8&);
00311
00312
00313 public:
00314
00315
00316 ClassName("hexRef8");
00317
00318
00319
00320
00321
00322
00323 hexRef8(const polyMesh& mesh);
00324
00325
00326 hexRef8
00327 (
00328 const polyMesh& mesh,
00329 const labelList& cellLevel,
00330 const labelList& pointLevel,
00331 const refinementHistory& history
00332 );
00333
00334
00335 hexRef8
00336 (
00337 const polyMesh& mesh,
00338 const labelList& cellLevel,
00339 const labelList& pointLevel
00340 );
00341
00342
00343
00344
00345
00346
00347 const labelIOList& cellLevel() const
00348 {
00349 return cellLevel_;
00350 }
00351
00352 const labelIOList& pointLevel() const
00353 {
00354 return pointLevel_;
00355 }
00356
00357 const refinementHistory& history() const
00358 {
00359 return history_;
00360 }
00361
00362
00363 scalar level0EdgeLength() const
00364 {
00365 return level0Edge_;
00366 }
00367
00368
00369
00370
00371 label getAnchorLevel(const label faceI) const;
00372
00373
00374
00375
00376
00377
00378 labelList consistentRefinement
00379 (
00380 const labelList& cellsToRefine,
00381 const bool maxSet
00382 ) const;
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397 labelList consistentSlowRefinement
00398 (
00399 const label maxFaceDiff,
00400 const labelList& cellsToRefine,
00401 const labelList& facesToCheck,
00402 const label maxPointDiff,
00403 const labelList& pointsToCheck
00404 ) const;
00405
00406
00407
00408
00409 labelList consistentSlowRefinement2
00410 (
00411 const label maxFaceDiff,
00412 const labelList& cellsToRefine,
00413 const labelList& facesToCheck
00414 ) const;
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429 labelListList setRefinement
00430 (
00431 const labelList& cells,
00432 polyTopoChange&
00433 );
00434
00435
00436 void updateMesh(const mapPolyMesh&);
00437
00438
00439
00440
00441
00442
00443
00444
00445 void storeData
00446 (
00447 const labelList& pointsToStore,
00448 const labelList& facesToStore,
00449 const labelList& cellsToStore
00450 );
00451
00452
00453
00454
00455 void updateMesh
00456 (
00457 const mapPolyMesh&,
00458 const Map<label>& pointsToRestore,
00459 const Map<label>& facesToRestore,
00460 const Map<label>& cellsToRestore
00461 );
00462
00463
00464
00465
00466 void subset
00467 (
00468 const labelList& pointMap,
00469 const labelList& faceMap,
00470 const labelList& cellMap
00471 );
00472
00473
00474 void distribute(const mapDistributePolyMesh&);
00475
00476
00477 void checkMesh() const;
00478
00479
00480
00481
00482 void checkRefinementLevels
00483 (
00484 const label maxPointDiff,
00485 const labelList& pointsToCheck
00486 ) const;
00487
00488
00489
00490
00491
00492 labelList getSplitPoints() const;
00493
00494
00495
00496
00497
00498
00499 labelList consistentUnrefinement
00500 (
00501 const labelList& pointsToUnrefine,
00502 const bool maxSet
00503 ) const;
00504
00505
00506
00507
00508
00509 void setUnrefinement
00510 (
00511 const labelList& splitPointLabels,
00512 polyTopoChange&
00513 );
00514
00515
00516
00517
00518 void setInstance(const fileName& inst);
00519
00520
00521 bool write() const;
00522
00523 };
00524
00525
00526
00527
00528 }
00529
00530
00531
00532 #endif
00533
00534