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 #ifndef autoLayerDriver_H
00037 #define autoLayerDriver_H
00038
00039 #include "meshRefinement.H"
00040 #include "wallPoint.H"
00041
00042
00043
00044 namespace Foam
00045 {
00046
00047
00048 class removePoints;
00049 class pointSet;
00050 class motionSmoother;
00051 class addPatchCellLayer;
00052 class pointData;
00053 class wallPoint;
00054 class faceSet;
00055 class layerParameters;
00056
00057
00058
00059
00060
00061 class autoLayerDriver
00062 {
00063
00064
00065
00066 enum extrudeMode
00067 {
00068 NOEXTRUDE,
00069 EXTRUDE,
00070 EXTRUDEREMOVE
00072 };
00073
00074
00075
00076
00077
00078 class nomalsCombine
00079 {
00080 public:
00081
00082 void operator()(vector& x, const vector& y) const
00083 {
00084 if (y != wallPoint::greatPoint)
00085 {
00086 if (x == wallPoint::greatPoint)
00087 {
00088 x = y;
00089 }
00090 else
00091 {
00092 x *= (x&y);
00093 }
00094 }
00095 }
00096 };
00097
00098
00099
00100
00101
00102 meshRefinement& meshRefiner_;
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 label mergePatchFacesUndo
00113 (
00114 const scalar minCos,
00115 const scalar concaveCos,
00116 const dictionary&
00117 );
00118
00119
00120 autoPtr<mapPolyMesh> doRemovePoints
00121 (
00122 removePoints& pointRemover,
00123 const boolList& pointCanBeDeleted
00124 );
00125
00126
00127 autoPtr<mapPolyMesh> doRestorePoints
00128 (
00129 removePoints& pointRemover,
00130 const labelList& facesToRestore
00131 );
00132
00133
00134 labelList collectFaces
00135 (
00136 const labelList& candidateFaces,
00137 const labelHashSet& set
00138 ) const;
00139
00140
00141 labelList growFaceCellFace(const labelHashSet&) const;
00142
00143
00144
00145 label mergeEdgesUndo(const scalar minCos, const dictionary&);
00146
00147
00148
00149
00150
00151 static void dumpDisplacement
00152 (
00153 const fileName&,
00154 const indirectPrimitivePatch&,
00155 const vectorField&,
00156 const List<extrudeMode>&
00157 );
00158
00159
00160
00161 static void checkManifold
00162 (
00163 const indirectPrimitivePatch&,
00164 pointSet& nonManifoldPoints
00165 );
00166
00167
00168 void checkMeshManifold() const;
00169
00170
00171
00172
00173
00174 static bool unmarkExtrusion
00175 (
00176 const label patchPointI,
00177 pointField& patchDisp,
00178 labelList& patchNLayers,
00179 List<extrudeMode>& extrudeStatus
00180 );
00181
00182
00183 static bool unmarkExtrusion
00184 (
00185 const face& localFace,
00186 pointField& patchDisp,
00187 labelList& patchNLayers,
00188 List<extrudeMode>& extrudeStatus
00189 );
00190
00191
00192 void handleNonManifolds
00193 (
00194 const indirectPrimitivePatch& pp,
00195 const labelList& meshEdges,
00196 pointField& patchDisp,
00197 labelList& patchNLayers,
00198 List<extrudeMode>& extrudeStatus
00199 ) const;
00200
00201
00202
00203 void handleFeatureAngle
00204 (
00205 const indirectPrimitivePatch& pp,
00206 const labelList& meshEdges,
00207 const scalar minCos,
00208 pointField& patchDisp,
00209 labelList& patchNLayers,
00210 List<extrudeMode>& extrudeStatus
00211 ) const;
00212
00213
00214 void handleWarpedFaces
00215 (
00216 const indirectPrimitivePatch& pp,
00217 const scalar faceRatio,
00218 const scalar edge0Len,
00219 const labelList& cellLevel,
00220 pointField& patchDisp,
00221 labelList& patchNLayers,
00222 List<extrudeMode>& extrudeStatus
00223 ) const;
00224
00225
00226
00227 void setNumLayers
00228 (
00229 const labelList& patchToNLayers,
00230 const labelList& patchIDs,
00231 const indirectPrimitivePatch& pp,
00232 pointField& patchDisp,
00233 labelList& patchNLayers,
00234 List<extrudeMode>& extrudeStatus
00235 ) const;
00236
00237
00238 static void growNoExtrusion
00239 (
00240 const indirectPrimitivePatch& pp,
00241 pointField& patchDisp,
00242 labelList& patchNLayers,
00243 List<extrudeMode>& extrudeStatus
00244 );
00245
00246
00247
00248
00249
00250
00251 void calculateLayerThickness
00252 (
00253 const indirectPrimitivePatch& pp,
00254 const labelList& patchIDs,
00255
00256 const scalarField& patchExpansionRatio,
00257 const bool relativeSizes,
00258 const scalarField& patchFinalLayerThickness,
00259 const scalarField& patchMinThickness,
00260
00261 const labelList& cellLevel,
00262 const labelList& patchNLayers,
00263 const scalar edge0Len,
00264
00265 scalarField& thickness,
00266 scalarField& minThickness,
00267 scalarField& expansionRatio
00268 ) const;
00269
00270
00271
00272
00273
00274 void syncPatchDisplacement
00275 (
00276 const motionSmoother& meshMover,
00277 const scalarField& minThickness,
00278 pointField& patchDisp,
00279 labelList& patchNLayers,
00280 List<extrudeMode>& extrudeStatus
00281 ) const;
00282
00283
00284 void getPatchDisplacement
00285 (
00286 const motionSmoother& meshMover,
00287 const scalarField& thickness,
00288 const scalarField& minThickness,
00289 pointField& patchDisp,
00290 labelList& patchNLayers,
00291 List<extrudeMode>& extrudeStatus
00292 ) const;
00293
00294
00295
00296
00297
00298 label truncateDisplacement
00299 (
00300 const motionSmoother& meshMover,
00301 const scalarField& minThickness,
00302 const faceSet& illegalPatchFaces,
00303 pointField& patchDisp,
00304 labelList& patchNLayers,
00305 List<extrudeMode>& extrudeStatus
00306 ) const;
00307
00308
00309
00310
00311
00312
00313
00314 void setupLayerInfoTruncation
00315 (
00316 const motionSmoother& meshMover,
00317 const labelList& patchNLayers,
00318 const List<extrudeMode>& extrudeStatus,
00319 const label nBufferCellsNoExtrude,
00320 labelList& nPatchPointLayers,
00321 labelList& nPatchFaceLayers
00322 ) const;
00323
00324
00325 static bool cellsUseFace
00326 (
00327 const polyMesh& mesh,
00328 const labelList& cellLabels,
00329 const labelHashSet& faces
00330 );
00331
00332
00333
00334
00335 static label checkAndUnmark
00336 (
00337 const addPatchCellLayer& addLayer,
00338 const dictionary& motionDict,
00339 const indirectPrimitivePatch& pp,
00340 const fvMesh&,
00341
00342 pointField& patchDisp,
00343 labelList& patchNLayers,
00344 List<extrudeMode>& extrudeStatus
00345 );
00346
00347
00348 static label countExtrusion
00349 (
00350 const indirectPrimitivePatch& pp,
00351 const List<extrudeMode>& extrudeStatus
00352 );
00353
00354
00355
00356 static void getLayerCellsFaces
00357 (
00358 const polyMesh&,
00359 const addPatchCellLayer&,
00360 boolList&,
00361 boolList&
00362 );
00363
00364
00365
00366
00367
00368
00369 template<class Type>
00370 static void averageNeighbours
00371 (
00372 const polyMesh& mesh,
00373 const PackedBoolList& isMasterEdge,
00374 const labelList& meshEdges,
00375 const labelList& meshPoints,
00376 const edgeList& edges,
00377 const scalarField& invSumWeight,
00378 const Field<Type>& data,
00379 Field<Type>& average
00380 );
00381
00382
00383 void sumWeights
00384 (
00385 const PackedBoolList& isMasterEdge,
00386 const labelList& meshEdges,
00387 const labelList& meshPoints,
00388 const edgeList& edges,
00389 scalarField& invSumWeight
00390 ) const;
00391
00392
00393 void smoothField
00394 (
00395 const motionSmoother& meshMover,
00396 const PackedBoolList& isMasterEdge,
00397 const labelList& meshEdges,
00398 const scalarField& fieldMin,
00399 const label& nSmoothDisp,
00400 scalarField& field
00401 ) const;
00402
00403
00404 void smoothPatchNormals
00405 (
00406 const motionSmoother& meshMover,
00407 const PackedBoolList& isMasterEdge,
00408 const labelList& meshEdges,
00409 const label nSmoothDisp,
00410 pointField& normals
00411 ) const;
00412
00413
00414 void smoothNormals
00415 (
00416 const label nSmoothDisp,
00417 const PackedBoolList& isMasterEdge,
00418 const labelList& fixedPoints,
00419 pointVectorField& normals
00420 ) const;
00421
00422 bool isMaxEdge
00423 (
00424 const List<pointData>&,
00425 const label edgeI,
00426 const scalar minCos
00427 ) const;
00428
00429
00430
00431 void handleFeatureAngleLayerTerminations
00432 (
00433 const indirectPrimitivePatch& pp,
00434 const scalar minCos,
00435 List<extrudeMode>& extrudeStatus,
00436 pointField& patchDisp,
00437 labelList& patchNLayers,
00438 label& nPointCounter
00439 ) const;
00440
00441
00442
00443
00444 void findIsolatedRegions
00445 (
00446 const indirectPrimitivePatch& pp,
00447 const PackedBoolList& isMasterEdge,
00448 const labelList& meshEdges,
00449 const scalar minCosLayerTermination,
00450 scalarField& field,
00451 List<extrudeMode>& extrudeStatus,
00452 pointField& patchDisp,
00453 labelList& patchNLayers
00454 ) const;
00455
00456
00457 void medialAxisSmoothingInfo
00458 (
00459 const motionSmoother& meshMover,
00460 const label nSmoothNormals,
00461 const label nSmoothSurfaceNormals,
00462 const scalar minMedianAxisAngleCos,
00463
00464 pointVectorField& dispVec,
00465 pointScalarField& medialRatio,
00466 pointScalarField& medialDist
00467 ) const;
00468
00469
00470 void shrinkMeshMedialDistance
00471 (
00472 motionSmoother& meshMover,
00473 const dictionary& meshQualityDict,
00474 const label nSmoothThickness,
00475 const scalar maxThicknessToMedialRatio,
00476 const label nAllowableErrors,
00477 const label nSnap,
00478 const scalar minCosLayerTermination,
00479
00480 const scalarField& layerThickness,
00481 const scalarField& minThickness,
00482
00483 const pointVectorField& dispVec,
00484 const pointScalarField& medialRatio,
00485 const pointScalarField& medialDist,
00486
00487 List<extrudeMode>& extrudeStatus,
00488 pointField& patchDisp,
00489 labelList& patchNLayers
00490 ) const;
00491
00492
00493
00494
00495 autoLayerDriver(const autoLayerDriver&);
00496
00497
00498 void operator=(const autoLayerDriver&);
00499
00500
00501 public:
00502
00503
00504 ClassName("autoLayerDriver");
00505
00506
00507
00508
00509 autoLayerDriver(meshRefinement& meshRefiner);
00510
00511
00512
00513
00514
00515 void mergePatchFacesUndo
00516 (
00517 const layerParameters& layerParams,
00518 const dictionary& motionDict
00519 );
00520
00521
00522 void addLayers
00523 (
00524 const layerParameters& layerParams,
00525 const dictionary& motionDict,
00526 const label nAllowableErrors,
00527 motionSmoother& meshMover,
00528 decompositionMethod& decomposer,
00529 fvMeshDistribute& distributor
00530 );
00531
00532
00533 void doLayers
00534 (
00535 const dictionary& shrinkDict,
00536 const dictionary& motionDict,
00537 const layerParameters& layerParams,
00538 decompositionMethod& decomposer,
00539 fvMeshDistribute& distributor
00540 );
00541
00542 };
00543
00544
00545
00546
00547 }
00548
00549
00550
00551 #ifdef NoRepository
00552 # include "autoLayerDriverTemplates.C"
00553 #endif
00554
00555
00556
00557 #endif
00558
00559