autoLayerDriver.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::autoLayerDriver
26 
27 Description
28  All to do with adding layers
29 
30 SourceFiles
31  autoLayerDriver.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef autoLayerDriver_H
36 #define autoLayerDriver_H
37 
38 #include "meshRefinement.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // Forward declaration of classes
46 class removePoints;
47 class pointSet;
48 class motionSmoother;
49 class addPatchCellLayer;
50 class faceSet;
51 class layerParameters;
52 
53 /*---------------------------------------------------------------------------*\
54  Class autoLayerDriver Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class autoLayerDriver
58 {
59 public:
60 
61  // Public data types
62 
63  //- Extrusion controls
64  enum extrudeMode
65  {
70  };
71 
72 private:
73 
74  // Private classes
75 
76  //- Combine operator class to combine normal with other normal.
77  class nomalsCombine
78  {
79  public:
80 
81  void operator()(vector& x, const vector& y) const
82  {
83  if (y != point::max)
84  {
85  if (x == point::max)
86  {
87  x = y;
88  }
89  else
90  {
91  x *= (x&y);
92  }
93  }
94  }
95  };
96 
97 
98  // Private data
99 
100  //- Mesh+surface
102 
103  //- From surface region to patch
105 
106  //- From surface region to patch
108 
109 
110  // Private Member Functions
111 
112  // Layers
113 
114  //- For debugging: Dump displacement to .obj files
115  static void dumpDisplacement
116  (
117  const fileName&,
118  const indirectPrimitivePatch&,
119  const vectorField&,
120  const List<extrudeMode>&
121  );
122 
123  //- Average point wise data to face wise
125  (
126  const indirectPrimitivePatch&,
127  const scalarField& pointFld
128  );
129 
130  //- Check that primitivePatch is not multiply connected.
131  // Collect non-manifold points in pointSet.
132  static void checkManifold
133  (
134  const indirectPrimitivePatch&,
135  pointSet& nonManifoldPoints
136  );
137 
138  //- Check that mesh outside is not multiply connected.
139  void checkMeshManifold() const;
140 
141 
142  // Static extrusion setup
143 
144  //- Unset extrusion on point. Returns true if anything unset.
145  static bool unmarkExtrusion
146  (
147  const label patchPointI,
148  pointField& patchDisp,
149  labelList& patchNLayers,
150  List<extrudeMode>& extrudeStatus
151  );
152 
153  //- Unset extrusion on face. Returns true if anything unset.
154  static bool unmarkExtrusion
155  (
156  const face& localFace,
157  pointField& patchDisp,
158  labelList& patchNLayers,
159  List<extrudeMode>& extrudeStatus
160  );
161 
162  //- No extrusion at non-manifold points.
163  void handleNonManifolds
164  (
165  const indirectPrimitivePatch& pp,
166  const labelList& meshEdges,
167  const labelListList& edgeGlobalFaces,
168  pointField& patchDisp,
169  labelList& patchNLayers,
170  List<extrudeMode>& extrudeStatus
171  ) const;
172 
173  //- No extrusion on feature edges. Assumes non-manifold
174  // edges already handled.
175  void handleFeatureAngle
176  (
177  const indirectPrimitivePatch& pp,
178  const labelList& meshEdges,
179  const scalar minCos,
180  pointField& patchDisp,
181  labelList& patchNLayers,
182  List<extrudeMode>& extrudeStatus
183  ) const;
184 
185  //- No extrusion on warped faces
186  void handleWarpedFaces
187  (
188  const indirectPrimitivePatch& pp,
189  const scalar faceRatio,
190  const scalar edge0Len,
191  const labelList& cellLevel,
192  pointField& patchDisp,
193  labelList& patchNLayers,
194  List<extrudeMode>& extrudeStatus
195  ) const;
196 
197  //- Determine the number of layers per point from the number of
198  // layers per surface.
199  void setNumLayers
200  (
201  const labelList& patchToNLayers,
202  const labelList& patchIDs,
203  const indirectPrimitivePatch& pp,
204  pointField& patchDisp,
205  labelList& patchNLayers,
206  List<extrudeMode>& extrudeStatus,
207  label& nIdealAddedCells
208  ) const;
209 
210  //- Helper function to make a pointVectorField with correct
211  // bcs for layer addition:
212  // - numLayers > 0 : fixedValue
213  // - numLayers == 0 : fixedValue (always zero)
214  // - processor : calculated (so free to move)
215  // - cyclic/wedge/symmetry : slip
216  // - other : slip
218  (
219  const pointMesh& pMesh,
220  const labelList& numLayers
221  );
222 
223  //- Grow no-extrusion layer.
224  void growNoExtrusion
225  (
226  const indirectPrimitivePatch& pp,
227  pointField& patchDisp,
228  labelList& patchNLayers,
229  List<extrudeMode>& extrudeStatus
230  ) const;
231 
232  //- See what zones and patches edges should be extruded into
234  (
235  const globalIndex& globalFaces,
236  const labelListList& edgeGlobalFaces,
237  const indirectPrimitivePatch& pp,
238 
239  labelList& edgePatchID,
240  labelList& edgeZoneID,
241  boolList& edgeFlip,
242  labelList& inflateFaceID
243  );
244 
245  //- Calculate pointwise wanted and minimum thickness.
246  // thickness: wanted thickness
247  // minthickness: when to give up and not extrude
248  // Gets per patch parameters and determine pp pointwise
249  // parameters.
251  (
252  const indirectPrimitivePatch& pp,
253  const labelList& patchIDs,
254  const layerParameters& layerParams,
255  const labelList& cellLevel,
256  const labelList& patchNLayers,
257  const scalar edge0Len,
258 
259  scalarField& thickness,
260  scalarField& minThickness,
261  scalarField& expansionRatio
262  ) const;
263 
264 
265  // Extrusion execution
266 
267  //- Synchronize displacement among coupled patches.
269  (
270  const indirectPrimitivePatch& pp,
271  const scalarField& minThickness,
272  pointField& patchDisp,
273  labelList& patchNLayers,
274  List<extrudeMode>& extrudeStatus
275  ) const;
276 
277  //- Get nearest point on surface to snap to
279  (
280  const indirectPrimitivePatch& pp,
281  const scalarField& thickness,
282  const scalarField& minThickness,
283  pointField& patchDisp,
284  labelList& patchNLayers,
285  List<extrudeMode>& extrudeStatus
286  ) const;
287 
288  //- For truncateDisplacement: find strings of edges
289  bool sameEdgeNeighbour
290  (
291  const labelListList& globalEdgeFaces,
292  const label myGlobalFaceI,
293  const label nbrGlobFaceI,
294  const label edgeI
295  ) const;
296 
297  //- For truncateDisplacement: find strings of edges
298  void getVertexString
299  (
300  const indirectPrimitivePatch& pp,
301  const labelListList& globalEdgeFaces,
302  const label faceI,
303  const label edgeI,
304  const label myGlobFaceI,
305  const label nbrGlobFaceI,
306  DynamicList<label>& vertices
307  ) const;
308 
309  //- Truncates displacement
310  // - for all patchFaces in the faceset displacement gets set
311  // to zero
312  // - all displacement < minThickness gets set to zero
313  // - all non-consecutive extrusions get set to 0
315  (
316  const globalIndex& globalFaces,
317  const labelListList& edgeGlobalFaces,
318  const indirectPrimitivePatch& pp,
319  const scalarField& minThickness,
320  const faceSet& illegalPatchFaces,
321  pointField& patchDisp,
322  labelList& patchNLayers,
323  List<extrudeMode>& extrudeStatus
324  ) const;
325 
326  //- Setup layer information (at points and faces) to
327  // modify mesh topology in
328  // regions where layer mesh terminates. Guarantees an
329  // optional slow decreasing of the number of layers.
330  // Returns the number of layers per face and per point
331  // to go into the actual layer addition engine.
333  (
334  const indirectPrimitivePatch& pp,
335  const labelList& patchNLayers,
336  const List<extrudeMode>& extrudeStatus,
337  const label nBufferCellsNoExtrude,
338  labelList& nPatchPointLayers,
339  labelList& nPatchFaceLayers
340  ) const;
341 
342  //- Does any of the cells use a face from faces?
343  static bool cellsUseFace
344  (
345  const polyMesh& mesh,
346  const labelList& cellLabels,
347  const labelHashSet& faces
348  );
349 
350  //- Checks the newly added cells and locally unmarks points
351  // so they will not get extruded next time round. Returns
352  // global number of unmarked points (0 if all was fine)
353  static label checkAndUnmark
354  (
355  const addPatchCellLayer& addLayer,
356  const dictionary& motionDict,
357  const bool additionalReporting,
358  const List<labelPair>& baffles,
359  const indirectPrimitivePatch& pp,
360  const fvMesh&,
361 
362  pointField& patchDisp,
363  labelList& patchNLayers,
364  List<extrudeMode>& extrudeStatus
365  );
366 
367  //- Count global number of extruded faces
368  static label countExtrusion
369  (
370  const indirectPrimitivePatch& pp,
371  const List<extrudeMode>& extrudeStatus
372  );
373 
374  //- After adding to mesh get the new baffles
376  (
377  const polyMesh& mesh,
378  const labelList& newToOldFaces,
379  const List<labelPair>& baffles
380  );
381 
382  //- Collect layer faces and layer cells into bools
383  // for ease of handling
384  static void getLayerCellsFaces
385  (
386  const polyMesh&,
387  const addPatchCellLayer&,
388  const scalarField& oldRealThickness,
389 
390  labelList& cellStatus,
391  scalarField& faceRealThickness
392  );
393 
394  //- Print layer coverage table
395  void printLayerData
396  (
397  const fvMesh& mesh,
398  const labelList& patchIDs,
399  const labelList& cellNLayers,
400  const scalarField& faceWantedThickness,
401  const scalarField& faceRealThickness
402  ) const;
403 
404  //- Write cellSet,faceSet for layers
405  bool writeLayerSets
406  (
407  const fvMesh& mesh,
408  const labelList& cellNLayers,
409  const scalarField& faceRealThickness
410  ) const;
411 
412  //- Write volFields,cellSet,faceSet for layers depending
413  // on write level
414  bool writeLayerData
415  (
416  const fvMesh& mesh,
417  const labelList& patchIDs,
418  const labelList& cellNLayers,
419  const scalarField& faceWantedThickness,
420  const scalarField& faceRealThickness
421  ) const;
422 
423 
424  // Mesh shrinking (to create space for layers)
425 
426  //- Average field (over all subset of mesh points) by
427  // summing contribution from edges. Global parallel since only
428  // does master edges for coupled edges.
429  template<class Type>
430  static void averageNeighbours
431  (
432  const polyMesh& mesh,
433  const PackedBoolList& isMasterEdge,
434  const labelList& meshEdges,
435  const labelList& meshPoints,
436  const edgeList& edges,
437  const scalarField& invSumWeight,
438  const Field<Type>& data,
440  );
441 
442  //- Calculate inverse sum of edge weights (currently always 1.0)
443  void sumWeights
444  (
445  const PackedBoolList& isMasterEdge,
446  const labelList& meshEdges,
447  const labelList& meshPoints,
448  const edgeList& edges,
449  scalarField& invSumWeight
450  ) const;
451 
452  //- Smooth scalar field on patch
453  void smoothField
454  (
455  const motionSmoother& meshMover,
456  const PackedBoolList& isMasterPoint,
457  const PackedBoolList& isMasterEdge,
458  const labelList& meshEdges,
459  const scalarField& fieldMin,
460  const label nSmoothDisp,
461  scalarField& field
462  ) const;
463 
464  //- Smooth normals on patch.
465  void smoothPatchNormals
466  (
467  const motionSmoother& meshMover,
468  const PackedBoolList& isMasterPoint,
469  const PackedBoolList& isMasterEdge,
470  const labelList& meshEdges,
471  const label nSmoothDisp,
472  pointField& normals
473  ) const;
474 
475  //- Smooth normals in interior.
476  void smoothNormals
477  (
478  const label nSmoothDisp,
479  const PackedBoolList& isMasterPoint,
480  const PackedBoolList& isMasterEdge,
481  const labelList& fixedPoints,
482  pointVectorField& normals
483  ) const;
484 
485  //- Stop layer growth where mesh wraps around edge with a
486  // large feature angle
488  (
489  const scalar minCos,
490  const PackedBoolList& isMasterPoint,
491  const indirectPrimitivePatch& pp,
492  const labelList& meshEdges,
493 
494  List<extrudeMode>& extrudeStatus,
495  pointField& patchDisp,
496  labelList& patchNLayers,
497  label& nPointCounter
498  ) const;
499 
500  //- Find isolated islands (points, edges and faces and
501  // layer terminations)
502  // in the layer mesh and stop any layer growth at these points.
504  (
505  const scalar minCosLayerTermination,
506  const PackedBoolList& isMasterPoint,
507  const PackedBoolList& isMasterEdge,
508  const indirectPrimitivePatch& pp,
509  const labelList& meshEdges,
510  const scalarField& minThickness,
511 
512  List<extrudeMode>& extrudeStatus,
513  pointField& patchDisp,
514  labelList& patchNLayers
515  ) const;
516 
517  // Calculate medial axis fields
519  (
520  const motionSmoother& meshMover,
521  const label nSmoothNormals,
522  const label nSmoothSurfaceNormals,
523  const scalar minMedialAxisAngleCos,
524  const scalar featureAngle,
525 
526  pointVectorField& dispVec,
527  pointScalarField& medialRatio,
528  pointScalarField& medialDist,
529  pointVectorField& medialVec
530  ) const;
531 
532  //- Main routine to shrink mesh
534  (
535  motionSmoother& meshMover,
536  const dictionary& meshQualityDict,
537  const List<labelPair>& baffles,
538  const label nSmoothPatchThickness,
539  const label nSmoothDisplacement,
540  const scalar maxThicknessToMedialRatio,
541  const label nAllowableErrors,
542  const label nSnap,
543  const scalar minCosLayerTermination,
544 
545  const scalarField& layerThickness,
546  const scalarField& minThickness,
547 
548  const pointVectorField& dispVec,
549  const pointScalarField& medialRatio,
550  const pointScalarField& medialDist,
551  const pointVectorField& medialVec,
552 
553  List<extrudeMode>& extrudeStatus,
554  pointField& patchDisp,
555  labelList& patchNLayers
556  ) const;
557 
558 
559 
560  //- Disallow default bitwise copy construct
562 
563  //- Disallow default bitwise assignment
564  void operator=(const autoLayerDriver&);
565 
566 
567 public:
568 
569  //- Runtime type information
570  ClassName("autoLayerDriver");
571 
572  // Constructors
573 
574  //- Construct from components
576  (
577  meshRefinement& meshRefiner,
578  const labelList& globalToMasterPatch,
579  const labelList& globalToSlavePatch
580  );
581 
582 
583  // Member Functions
584 
585  //- Merge patch faces on same cell.
587  (
588  const layerParameters& layerParams,
589  const dictionary& motionDict
590  );
591 
592  //- Add cell layers
593  void addLayers
594  (
595  const layerParameters& layerParams,
596  const dictionary& motionDict,
597  const labelList& patchIDs,
598  const label nAllowableErrors,
599  decompositionMethod& decomposer,
600  fvMeshDistribute& distributor
601  );
602 
603  //- Add layers according to the dictionary settings
604  void doLayers
605  (
606  const dictionary& shrinkDict,
607  const dictionary& motionDict,
608  const layerParameters& layerParams,
609  const bool mergePatchFaces, // merging patch faces
610  const bool preBalance, // balance before adding?
611  decompositionMethod& decomposer,
612  fvMeshDistribute& distributor
613  );
614 
615 };
616 
617 
618 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
619 
620 } // End namespace Foam
621 
622 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
623 
624 #ifdef NoRepository
625 # include "autoLayerDriverTemplates.C"
626 #endif
627 
628 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
629 
630 #endif
631 
632 // ************************************************************************* //
Foam::autoLayerDriver::mergePatchFacesUndo
void mergePatchFacesUndo(const layerParameters &layerParams, const dictionary &motionDict)
Merge patch faces on same cell.
Definition: autoLayerDriver.C:2873
Foam::PackedBoolList
A bit-packed bool list.
Definition: PackedBoolList.H:63
Foam::autoLayerDriver::doLayers
void doLayers(const dictionary &shrinkDict, const dictionary &motionDict, const layerParameters &layerParams, const bool mergePatchFaces, const bool preBalance, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Add layers according to the dictionary settings.
Definition: autoLayerDriver.C:4263
Foam::autoLayerDriver::shrinkMeshMedialDistance
void shrinkMeshMedialDistance(motionSmoother &meshMover, const dictionary &meshQualityDict, const List< labelPair > &baffles, const label nSmoothPatchThickness, const label nSmoothDisplacement, const scalar maxThicknessToMedialRatio, const label nAllowableErrors, const label nSnap, const scalar minCosLayerTermination, const scalarField &layerThickness, const scalarField &minThickness, const pointVectorField &dispVec, const pointScalarField &medialRatio, const pointScalarField &medialDist, const pointVectorField &medialVec, List< extrudeMode > &extrudeStatus, pointField &patchDisp, labelList &patchNLayers) const
Main routine to shrink mesh.
Foam::autoLayerDriver::getLayerCellsFaces
static void getLayerCellsFaces(const polyMesh &, const addPatchCellLayer &, const scalarField &oldRealThickness, labelList &cellStatus, scalarField &faceRealThickness)
Collect layer faces and layer cells into bools.
Definition: autoLayerDriver.C:2499
Foam::autoLayerDriver::determineSidePatches
void determineSidePatches(const globalIndex &globalFaces, const labelListList &edgeGlobalFaces, const indirectPrimitivePatch &pp, labelList &edgePatchID, labelList &edgeZoneID, boolList &edgeFlip, labelList &inflateFaceID)
See what zones and patches edges should be extruded into.
Definition: autoLayerDriver.C:969
Foam::autoLayerDriver::sameEdgeNeighbour
bool sameEdgeNeighbour(const labelListList &globalEdgeFaces, const label myGlobalFaceI, const label nbrGlobFaceI, const label edgeI) const
For truncateDisplacement: find strings of edges.
Definition: autoLayerDriver.C:1628
Foam::autoLayerDriver::growNoExtrusion
void growNoExtrusion(const indirectPrimitivePatch &pp, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
Grow no-extrusion layer.
Definition: autoLayerDriver.C:879
Foam::autoLayerDriver::operator=
void operator=(const autoLayerDriver &)
Disallow default bitwise assignment.
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::autoLayerDriver::checkMeshManifold
void checkMeshManifold() const
Check that mesh outside is not multiply connected.
Definition: autoLayerDriver.C:160
Foam::DynamicList< label >
Foam::autoLayerDriver::EXTRUDEREMOVE
@ EXTRUDEREMOVE
Definition: autoLayerDriver.H:67
Foam::autoLayerDriver::nomalsCombine::operator()
void operator()(vector &x, const vector &y) const
Definition: autoLayerDriver.H:80
Foam::Vector< scalar >::max
static const Vector max
Definition: Vector.H:82
Foam::autoLayerDriver::truncateDisplacement
label truncateDisplacement(const globalIndex &globalFaces, const labelListList &edgeGlobalFaces, const indirectPrimitivePatch &pp, const scalarField &minThickness, const faceSet &illegalPatchFaces, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
Truncates displacement.
Definition: autoLayerDriver.C:1727
Foam::autoLayerDriver::unmarkExtrusion
static bool unmarkExtrusion(const label patchPointI, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus)
Unset extrusion on point. Returns true if anything unset.
Definition: autoLayerDriver.C:215
Foam::autoLayerDriver::extrudeMode
extrudeMode
Extrusion controls.
Definition: autoLayerDriver.H:63
Foam::autoLayerDriver::handleFeatureAngleLayerTerminations
void handleFeatureAngleLayerTerminations(const scalar minCos, const PackedBoolList &isMasterPoint, const indirectPrimitivePatch &pp, const labelList &meshEdges, List< extrudeMode > &extrudeStatus, pointField &patchDisp, labelList &patchNLayers, label &nPointCounter) const
Stop layer growth where mesh wraps around edge with a.
Foam::faceSet
A list of face labels.
Definition: faceSet.H:48
Foam::autoLayerDriver::addLayers
void addLayers(const layerParameters &layerParams, const dictionary &motionDict, const labelList &patchIDs, const label nAllowableErrors, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Add cell layers.
Definition: autoLayerDriver.C:2924
autoLayerDriverTemplates.C
Foam::autoLayerDriver::globalToSlavePatch_
const labelList globalToSlavePatch_
From surface region to patch.
Definition: autoLayerDriver.H:106
Foam::HashSet< label, Hash< label > >
Foam::autoLayerDriver::setupLayerInfoTruncation
void setupLayerInfoTruncation(const indirectPrimitivePatch &pp, const labelList &patchNLayers, const List< extrudeMode > &extrudeStatus, const label nBufferCellsNoExtrude, labelList &nPatchPointLayers, labelList &nPatchFaceLayers) const
Setup layer information (at points and faces) to.
Definition: autoLayerDriver.C:2042
Foam::autoLayerDriver::calculateLayerThickness
void calculateLayerThickness(const indirectPrimitivePatch &pp, const labelList &patchIDs, const layerParameters &layerParams, const labelList &cellLevel, const labelList &patchNLayers, const scalar edge0Len, scalarField &thickness, scalarField &minThickness, scalarField &expansionRatio) const
Calculate pointwise wanted and minimum thickness.
Definition: autoLayerDriver.C:1073
Foam::help::mergePatchFaces
faceList mergePatchFaces(const List< DynList< label > > &pfcs, const pointField &polyPoints)
Definition: helperFunctionsGeometryQueriesI.H:232
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::autoLayerDriver::smoothPatchNormals
void smoothPatchNormals(const motionSmoother &meshMover, const PackedBoolList &isMasterPoint, const PackedBoolList &isMasterEdge, const labelList &meshEdges, const label nSmoothDisp, pointField &normals) const
Smooth normals on patch.
Foam::autoLayerDriver::syncPatchDisplacement
void syncPatchDisplacement(const indirectPrimitivePatch &pp, const scalarField &minThickness, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
Synchronize displacement among coupled patches.
Definition: autoLayerDriver.C:1361
Foam::autoLayerDriver::avgPointData
static tmp< scalarField > avgPointData(const indirectPrimitivePatch &, const scalarField &pointFld)
Average point wise data to face wise.
Definition: autoLayerDriver.C:107
Foam::autoLayerDriver::averageNeighbours
static void averageNeighbours(const polyMesh &mesh, const PackedBoolList &isMasterEdge, const labelList &meshEdges, const labelList &meshPoints, const edgeList &edges, const scalarField &invSumWeight, const Field< Type > &data, Field< Type > &average)
Average field (over all subset of mesh points) by.
Definition: autoLayerDriverTemplates.C:33
Foam::autoLayerDriver::getPatchDisplacement
void getPatchDisplacement(const indirectPrimitivePatch &pp, const scalarField &thickness, const scalarField &minThickness, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
Get nearest point on surface to snap to.
Definition: autoLayerDriver.C:1492
Foam::autoLayerDriver::dumpDisplacement
static void dumpDisplacement(const fileName &, const indirectPrimitivePatch &, const vectorField &, const List< extrudeMode > &)
For debugging: Dump displacement to .obj files.
Definition: autoLayerDriver.C:75
Foam::autoLayerDriver::writeLayerSets
bool writeLayerSets(const fvMesh &mesh, const labelList &cellNLayers, const scalarField &faceRealThickness) const
Write cellSet,faceSet for layers.
Definition: autoLayerDriver.C:2649
Foam::autoLayerDriver::writeLayerData
bool writeLayerData(const fvMesh &mesh, const labelList &patchIDs, const labelList &cellNLayers, const scalarField &faceWantedThickness, const scalarField &faceRealThickness) const
Write volFields,cellSet,faceSet for layers depending.
Definition: autoLayerDriver.C:2712
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::autoLayerDriver::smoothField
void smoothField(const motionSmoother &meshMover, const PackedBoolList &isMasterPoint, const PackedBoolList &isMasterEdge, const labelList &meshEdges, const scalarField &fieldMin, const label nSmoothDisp, scalarField &field) const
Smooth scalar field on patch.
Foam::autoLayerDriver::medialAxisSmoothingInfo
void medialAxisSmoothingInfo(const motionSmoother &meshMover, const label nSmoothNormals, const label nSmoothSurfaceNormals, const scalar minMedialAxisAngleCos, const scalar featureAngle, pointVectorField &dispVec, pointScalarField &medialRatio, pointScalarField &medialDist, pointVectorField &medialVec) const
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::autoLayerDriver::getVertexString
void getVertexString(const indirectPrimitivePatch &pp, const labelListList &globalEdgeFaces, const label faceI, const label edgeI, const label myGlobFaceI, const label nbrGlobFaceI, DynamicList< label > &vertices) const
For truncateDisplacement: find strings of edges.
Definition: autoLayerDriver.C:1648
Foam::autoLayerDriver::countExtrusion
static label countExtrusion(const indirectPrimitivePatch &pp, const List< extrudeMode > &extrudeStatus)
Count global number of extruded faces.
Definition: autoLayerDriver.C:2407
Foam::autoLayerDriver::ClassName
ClassName("autoLayerDriver")
Runtime type information.
Foam::motionSmoother
Given a displacement moves the mesh by scaling the displacement back until there are no more mesh err...
Definition: motionSmoother.H:89
Foam::autoLayerDriver::checkAndUnmark
static label checkAndUnmark(const addPatchCellLayer &addLayer, const dictionary &motionDict, const bool additionalReporting, const List< labelPair > &baffles, const indirectPrimitivePatch &pp, const fvMesh &, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus)
Checks the newly added cells and locally unmarks points.
Definition: autoLayerDriver.C:2272
Foam::autoLayerDriver::getBafflesOnAddedMesh
static List< labelPair > getBafflesOnAddedMesh(const polyMesh &mesh, const labelList &newToOldFaces, const List< labelPair > &baffles)
After adding to mesh get the new baffles.
Definition: autoLayerDriver.C:2437
Foam::layerParameters
Simple container to keep together layer specific information.
Definition: layerParameters.H:55
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::addPatchCellLayer
Adds layers of cells to outside of polyPatch. Can optionally create stand-alone extruded mesh (addToM...
Definition: addPatchCellLayer.H:125
Foam::autoLayerDriver::handleWarpedFaces
void handleWarpedFaces(const indirectPrimitivePatch &pp, const scalar faceRatio, const scalar edge0Len, const labelList &cellLevel, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
No extrusion on warped faces.
Definition: autoLayerDriver.C:506
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
meshRefinement.H
Foam::autoLayerDriver::autoLayerDriver
autoLayerDriver(const autoLayerDriver &)
Disallow default bitwise copy construct.
Foam::decompositionMethod
Abstract base class for decomposition.
Definition: decompositionMethod.H:48
Foam::autoLayerDriver::NOEXTRUDE
@ NOEXTRUDE
Definition: autoLayerDriver.H:65
Foam::autoLayerDriver::EXTRUDE
@ EXTRUDE
Definition: autoLayerDriver.H:66
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::pointMesh
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:48
Foam::globalIndex
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:63
Foam::autoLayerDriver::meshRefiner_
meshRefinement & meshRefiner_
Mesh+surface.
Definition: autoLayerDriver.H:100
Foam::autoLayerDriver::sumWeights
void sumWeights(const PackedBoolList &isMasterEdge, const labelList &meshEdges, const labelList &meshPoints, const edgeList &edges, scalarField &invSumWeight) const
Calculate inverse sum of edge weights (currently always 1.0)
Foam::autoLayerDriver
All to do with adding layers.
Definition: autoLayerDriver.H:56
Foam::autoLayerDriver::handleNonManifolds
void handleNonManifolds(const indirectPrimitivePatch &pp, const labelList &meshEdges, const labelListList &edgeGlobalFaces, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
No extrusion at non-manifold points.
Definition: autoLayerDriver.C:276
Foam::autoLayerDriver::makeLayerDisplacementField
static tmp< pointVectorField > makeLayerDisplacementField(const pointMesh &pMesh, const labelList &numLayers)
Helper function to make a pointVectorField with correct.
Definition: autoLayerDriver.C:805
Foam::autoLayerDriver::smoothNormals
void smoothNormals(const label nSmoothDisp, const PackedBoolList &isMasterPoint, const PackedBoolList &isMasterEdge, const labelList &fixedPoints, pointVectorField &normals) const
Smooth normals in interior.
Foam::autoLayerDriver::cellsUseFace
static bool cellsUseFace(const polyMesh &mesh, const labelList &cellLabels, const labelHashSet &faces)
Does any of the cells use a face from faces?
Definition: autoLayerDriver.C:2246
Foam::pointSet
A set of point labels.
Definition: pointSet.H:48
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::autoLayerDriver::findIsolatedRegions
void findIsolatedRegions(const scalar minCosLayerTermination, const PackedBoolList &isMasterPoint, const PackedBoolList &isMasterEdge, const indirectPrimitivePatch &pp, const labelList &meshEdges, const scalarField &minThickness, List< extrudeMode > &extrudeStatus, pointField &patchDisp, labelList &patchNLayers) const
Find isolated islands (points, edges and faces and.
Foam::meshRefinement
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
Definition: meshRefinement.H:82
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::autoLayerDriver::checkManifold
static void checkManifold(const indirectPrimitivePatch &, pointSet &nonManifoldPoints)
Check that primitivePatch is not multiply connected.
Definition: autoLayerDriver.C:134
Foam::autoLayerDriver::printLayerData
void printLayerData(const fvMesh &mesh, const labelList &patchIDs, const labelList &cellNLayers, const scalarField &faceWantedThickness, const scalarField &faceRealThickness) const
Print layer coverage table.
Definition: autoLayerDriver.C:2554
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Foam::autoLayerDriver::handleFeatureAngle
void handleFeatureAngle(const indirectPrimitivePatch &pp, const labelList &meshEdges, const scalar minCos, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus) const
No extrusion on feature edges. Assumes non-manifold.
Definition: autoLayerDriver.C:387
Foam::autoLayerDriver::nomalsCombine
Combine operator class to combine normal with other normal.
Definition: autoLayerDriver.H:76
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::autoLayerDriver::setNumLayers
void setNumLayers(const labelList &patchToNLayers, const labelList &patchIDs, const indirectPrimitivePatch &pp, pointField &patchDisp, labelList &patchNLayers, List< extrudeMode > &extrudeStatus, label &nIdealAddedCells) const
Determine the number of layers per point from the number of.
Definition: autoLayerDriver.C:681
Foam::autoLayerDriver::globalToMasterPatch_
const labelList globalToMasterPatch_
From surface region to patch.
Definition: autoLayerDriver.H:103
Foam::fvMeshDistribute
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Definition: fvMeshDistribute.H:70
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:52
Foam::average
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:335
y
scalar y
Definition: LISASMDCalcMethod1.H:14
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatchTemplate.H:88