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