conformalVoronoiMesh.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2012-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::conformalVoronoiMesh
28 
29 Description
30 
31 SourceFiles
32  conformalVoronoiMeshI.H
33  conformalVoronoiMesh.C
34  conformalVoronoiMeshZones.C
35  conformalVoronoiMeshIO.C
36  conformalVoronoiMeshConformToSurface.C
37  conformalVoronoiMeshFeaturePoints.C
38  conformalVoronoiMeshCalcDualMesh.C
39  conformalVoronoiMeshTemplates.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef conformalVoronoiMesh_H
44 #define conformalVoronoiMesh_H
45 
47 #include "searchableSurfaces.H"
48 #include "conformationSurfaces.H"
49 #include "cellShapeControl.H"
50 #include "cvControls.H"
51 #include "DynamicList.H"
52 #include "bitSet.H"
53 #include "Time.H"
54 #include "polyMesh.H"
55 #include "plane.H"
56 #include "meshTools.H"
57 #include "dynamicIndexedOctree.H"
58 #include "dynamicTreeDataPoint.H"
59 #include "indexedOctree.H"
60 #include "treeDataPoint.H"
61 #include "unitConversion.H"
62 #include "transform.H"
63 #include "volFields.H"
64 #include "fvMesh.H"
65 #include "labelPair.H"
66 #include "HashSet.H"
67 #include "memInfo.H"
68 #include "point.H"
69 #include "cellSet.H"
70 #include "wallPolyPatch.H"
71 #include "processorPolyPatch.H"
73 #include "globalIndex.H"
74 #include "pointFeatureEdgesTypes.H"
75 #include "pointConversion.H"
76 #include "Pair.H"
78 #include "featurePointConformer.H"
79 #include "pointPairs.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 // Forward declaration of classes
87 class initialPointsMethod;
88 class relaxationModel;
89 class faceAreaWeightModel;
90 class backgroundMeshDecomposition;
91 class OBJstream;
92 
93 /*---------------------------------------------------------------------------*\
94  Class conformalVoronoiMesh Declaration
95 \*---------------------------------------------------------------------------*/
96 
98 :
99  public DistributedDelaunayMesh<Delaunay>
100 {
101 public:
102 
103  typedef Delaunay::Vertex_handle Vertex_handle;
104  typedef Delaunay::Cell_handle Cell_handle;
105  typedef Delaunay::Edge Edge;
106  typedef Delaunay::Facet Facet;
107  typedef Delaunay::Point Point;
108 
110 
114 
115  // Static data
116 
117  enum dualMeshPointType
118  {
119  internal = 0,
120  surface = 1,
123  constrained = 4
124  };
125 
127 
128 
129 private:
130 
131  // Static data
132 
133  static const scalar searchConeAngle;
134 
135  static const scalar searchAngleOppositeSurface;
136 
137 
138  // Private data
139 
140  //- The time registry of the application
141  const Time& runTime_;
142 
143  //- Random number generator
144  mutable Random rndGen_;
145 
146  //- Controls for the conformal Voronoi meshing process
147  cvControls foamyHexMeshControls_;
148 
149  //- All geometry of the meshing process, including surfaces to be
150  // conformed to and those to be used for refinement
151  searchableSurfaces allGeometry_;
152 
153  //- The surfaces to conform to
154  conformationSurfaces geometryToConformTo_;
155 
156  //- Background mesh decomposition, only available in parallel.
158 
159  //- The cell shape control object
160  cellShapeControl cellShapeControl_;
161 
162  //- Limiting bound box before infinity begins
163  treeBoundBox limitBounds_;
164 
165  mutable pointPairs<Delaunay> ptPairs_;
166 
167  featurePointConformer ftPtConformer_;
168 
169  //- Search tree for edge point locations
171  edgeLocationTreePtr_;
172 
173  mutable DynamicList<Foam::point> existingEdgeLocations_;
174 
175  //- Search tree for surface point locations
177  surfacePtLocationTreePtr_;
178 
179  mutable DynamicList<Foam::point> existingSurfacePtLocations_;
180 
181  //- Store the surface and feature edge conformation locations to be
182  // reinserted
183  List<Vb> surfaceConformationVertices_;
184 
185  //- Method for inserting initial points. Runtime selectable.
186  autoPtr<initialPointsMethod> initialPointsMethod_;
187 
188  //- Relaxation coefficient model. Runtime selectable.
189  autoPtr<relaxationModel> relaxationModel_;
190 
191  //- Face area weight function. Runtime selectable.
192  autoPtr<faceAreaWeightModel> faceAreaWeightModel_;
193 
194 
195  // Private Member Functions
196 
197  inline scalar defaultCellSize() const;
198 
199  //- Return the local target cell size at the given location. Takes
200  // boolean argument to allow speed-up of queries if the point is going
201  // to be on a surface.
202  inline scalar targetCellSize(const Foam::point& pt) const;
203 
204  //- Return the target cell size from that stored on a pair of
205  // Delaunay vertices, including the possibility that one of
206  // them is not an internalOrBoundaryPoint, and so will not
207  // have valid data.
208  inline scalar averageAnyCellSize
209  (
210  const Vertex_handle& vA,
211  const Vertex_handle& vB
212  ) const;
213 
214  //- The average target cell size of a Delaunay facet, i.e., of
215  // a dual edge
216  inline scalar averageAnyCellSize
217  (
218  const Delaunay::Finite_facets_iterator& fit
219  ) const;
220 
221  //- Insert Delaunay vertices using the CGAL range insertion method,
222  // optionally check processor occupancy and distribute to other
223  // processors
224  void insertInternalPoints
225  (
227  const bool distribute = false
228  );
229 
230  Map<label> insertPointPairs
231  (
233  bool distribute,
234  bool reIndex
235  );
236 
237  //- Create a point-pair at a ppDist distance either side of
238  // surface point surfPt, in the direction n
239  inline void createPointPair
240  (
241  const scalar ppDist,
242  const Foam::point& surfPt,
243  const vector& n,
244  const bool ptPair,
245  DynamicList<Vb>& pts
246  ) const;
247 
248  inline Foam::point perturbPoint(const Foam::point& pt) const;
249 
250  //- Create a point-pair at a ppDist distance either side of
251  // surface point surfPt, in the direction n
252  inline void createBafflePointPair
253  (
254  const scalar ppDist,
255  const Foam::point& surfPt,
256  const vector& n,
257  const bool ptPair,
258  DynamicList<Vb>& pts
259  ) const;
260 
261  //- Check internal point is completely inside the meshable region
262  inline bool internalPointIsInside(const Foam::point& pt) const;
263 
264  //- Insert pairs of points on the surface with the given normals, at the
265  // specified spacing
266  void insertSurfacePointPairs
267  (
268  const pointIndexHitAndFeatureList& surfaceHits,
269  const fileName fName,
270  DynamicList<Vb>& pts
271  );
272 
273  //- Insert groups of points to conform to an edge given a list of
274  // pointIndexHits specifying the location and edge index of the point
275  // to be conformed to on the corresponding entry in featureHit
276  void insertEdgePointGroups
277  (
278  const pointIndexHitAndFeatureList& edgeHits,
279  const fileName fName,
280  DynamicList<Vb>& pts
281  );
282 
283  void createEdgePointGroupByCirculating
284  (
285  const extendedFeatureEdgeMesh& feMesh,
286  const pointIndexHit& edHit,
287  DynamicList<Vb>& pts
288  ) const;
289 
290  bool meshableRegion
291  (
292  const plane::side side,
294  ) const;
295 
296  bool regionIsInside
297  (
299  const vector& normalA,
301  const vector& normalB,
302  const vector& masterPtVec
303  ) const;
304 
305  //- Create points to conform to an external edge
306  void createExternalEdgePointGroup
307  (
308  const extendedFeatureEdgeMesh& feMesh,
309  const pointIndexHit& edHit,
310  DynamicList<Vb>& pts
311  ) const;
312 
313  //- Create points to conform to an internal edge
314  void createInternalEdgePointGroup
315  (
316  const extendedFeatureEdgeMesh& feMesh,
317  const pointIndexHit& edHit,
318  DynamicList<Vb>& pts
319  ) const;
320 
321  //- Create points to conform to a flat edge
322  void createFlatEdgePointGroup
323  (
324  const extendedFeatureEdgeMesh& feMesh,
325  const pointIndexHit& edHit,
326  DynamicList<Vb>& pts
327  ) const;
328 
329  //- Create points to conform to an open edge
330  void createOpenEdgePointGroup
331  (
332  const extendedFeatureEdgeMesh& feMesh,
333  const pointIndexHit& edHit,
334  DynamicList<Vb>& pts
335  ) const;
336 
337  //- Create points to conform to multiply connected edge
338  void createMultipleEdgePointGroup
339  (
340  const extendedFeatureEdgeMesh& feMesh,
341  const pointIndexHit& edHit,
342  DynamicList<Vb>& pts
343  ) const;
344 
345  //- Determine and insert point groups at the feature points
346  void insertFeaturePoints(bool distribute = false);
347 
348  //- Check if a location is in exclusion range around a feature point
349  bool nearFeaturePt(const Foam::point& pt) const;
350 
351  //- Check if a surface point is in exclusion range around a feature edge
352  bool surfacePtNearFeatureEdge(const Foam::point& pt) const;
353 
354  //- Insert the initial points into the triangulation, based on the
355  // initialPointsMethod
356  void insertInitialPoints();
357 
358  //- In parallel redistribute the backgroundMeshDecomposition and
359  // vertices to balance the number of vertices on each processor.
360  // Returns true if the background mesh changes as this removes all
361  // referred vertices, so the parallel interface may need rebuilt.
362  template<class Triangulation>
363  bool distributeBackground(const Triangulation& mesh);
364 
365  // Test for full containment
366  void cellSizeMeshOverlapsBackground() const;
367 
368  //-
369  void distribute();
370 
371  void buildCellSizeAndAlignmentMesh();
372 
373  //- Set the size and alignment data for each vertex
374  void setVertexSizeAndAlignment();
375 
376  //- Builds a dual face by circulating around the supplied edge.
377  face buildDualFace
378  (
379  const Delaunay::Finite_edges_iterator& eit
380  ) const;
381 
382  boolList dualFaceBoundaryPoints
383  (
384  const Delaunay::Finite_edges_iterator& eit
385  ) const;
386 
387  //- Finds the maximum filterCount of the dual vertices
388  // (Delaunay cells) that form the dual face produced by the
389  // supplied edge
390  label maxFilterCount
391  (
392  const Delaunay::Finite_edges_iterator& eit
393  ) const;
394 
395  //- Determines the owner and neighbour labels for dual cells
396  // corresponding to the dual face formed by the supplied
397  // Delaunay vertices. If the dual face is a boundary face
398  // then neighbour = -1. Returns true if the dual face
399  // created by vA -> vB needs to be reversed to be correctly
400  // orientated.
401  bool ownerAndNeighbour
402  (
403  Vertex_handle vA,
404  Vertex_handle vB,
405  label& owner,
406  label& neighbour
407  ) const;
408 
409  //- Insert the necessary point pairs to conform to the surface, either
410  // from stored results, or trigger a re-conformation
411  void conformToSurface();
412 
413  //- Decision making function for when to rebuild the surface
414  // conformation
415  bool reconformToSurface() const;
416 
417  //- Determines geometrically whether a vertex is close to a surface
418  // This is an optimisation
419  label findVerticesNearBoundaries();
420 
421  //- Create and insert the necessary point pairs to conform to the
422  // surface, then store the result
423  void buildSurfaceConformation();
424 
425  label synchroniseEdgeTrees
426  (
427  const DynamicList<label>& edgeToTreeShape,
428  pointIndexHitAndFeatureList& featureEdgeHits
429  );
430 
431  label synchroniseSurfaceTrees
432  (
433  const DynamicList<label>& surfaceToTreeShape,
434  pointIndexHitAndFeatureList& surfaceHits
435  );
436 
437  bool surfaceLocationConformsToInside
438  (
439  const pointIndexHitAndFeature& info
440  ) const;
441 
442  //- Check to see if dual cell specified by given vertex iterator
443  // intersects the boundary and hence requires a point-pair
444  bool dualCellSurfaceAnyIntersection
445  (
446  const Delaunay::Finite_vertices_iterator& vit
447  ) const;
448 
449  //- Return all intersections
450  bool dualCellSurfaceAllIntersections
451  (
452  const Delaunay::Finite_vertices_iterator& vit,
454  ) const;
455 
456  //- Return false if the line is entirely outside the current processor
457  // domain, true is either point is inside, or the processor domain
458  // bounadry is intersected (i.e. the points are box outside but the
459  // line cuts. The points will be moved onto the box where they
460  // intersect.
461  bool clipLineToProc
462  (
463  const Foam::point& pt,
464  Foam::point& a,
465  Foam::point& b
466  ) const;
467 
468  //- Find the "worst" protrusion of a dual cell through the surface,
469  // subject to the maxSurfaceProtrusion tolerance
470  void dualCellLargestSurfaceProtrusion
471  (
472  const Delaunay::Finite_vertices_iterator& vit,
473  pointIndexHit& surfHit,
474  label& hitSurface
475  ) const;
476 
477  void dualCellLargestSurfaceIncursion
478  (
479  const Delaunay::Finite_vertices_iterator& vit,
480  pointIndexHit& surfHit,
481  label& hitSurface
482  ) const;
483 
484  //- Write out vertex-processor occupancy information for debugging
485  void reportProcessorOccupancy();
486 
487  //- Write out debugging information about the surface conformation
488  // quality
489 // void reportSurfaceConformationQuality();
490 
491  //- Limit the displacement of a point so that it doesn't penetrate the
492  // surface to be meshed or come too close to it
493  void limitDisplacement
494  (
495  const Delaunay::Finite_vertices_iterator& vit,
496  vector& displacement,
497  label callCount = 0
498  ) const;
499 
500  //- Find angle between the normals of two close surface points.
501  scalar angleBetweenSurfacePoints(Foam::point pA, Foam::point pB) const;
502 
503  //- Check if a surface point is near another.
504  bool nearSurfacePoint
505  (
507  ) const;
508 
509  //- Append a point to the surface point tree and the existing list
510  bool appendToSurfacePtTree
511  (
512  const Foam::point& pt
513  ) const;
514 
515  //- Append a point to the edge location tree and the existing list
516  bool appendToEdgeLocationTree
517  (
518  const Foam::point& pt
519  ) const;
520 
521  //- Return a list of the nearest feature edge locations
522  List<pointIndexHit> nearestFeatureEdgeLocations
523  (
524  const Foam::point& pt
525  ) const;
526 
527  //- Check if a point is near any feature edge points.
528  bool pointIsNearFeatureEdgeLocation(const Foam::point& pt) const;
529 
530  bool pointIsNearFeatureEdgeLocation
531  (
532  const Foam::point& pt,
533  pointIndexHit& info
534  ) const;
535 
536  //- Check if a point is near any surface conformation points.
537  bool pointIsNearSurfaceLocation(const Foam::point& pt) const;
538 
539  bool pointIsNearSurfaceLocation
540  (
541  const Foam::point& pt,
542  pointIndexHit& info
543  ) const;
544 
545  //- Check if a location is in the exclusion range of an existing feature
546  // edge conformation location
547  bool nearFeatureEdgeLocation
548  (
549  const pointIndexHit& pHit,
550  pointIndexHit& nearestEdgeHit
551  ) const;
552 
553  //- Build or rebuild the edge location tree
554  void buildEdgeLocationTree
555  (
556  const DynamicList<Foam::point>& existingEdgeLocations
557  ) const;
558 
559  //- Build or rebuild the surface point location tree
560  void buildSurfacePtLocationTree
561  (
562  const DynamicList<Foam::point>& existingSurfacePtLocations
563  ) const;
564 
565  //- Process the surface conformation locations to decide which surface
566  // and edge conformation locations to add
567  void addSurfaceAndEdgeHits
568  (
569  const Foam::point& vit,
570  const pointIndexHitAndFeatureDynList& surfaceIntersections,
571  scalar surfacePtReplaceDistCoeffSqr,
572  scalar edgeSearchDistCoeffSqr,
573  pointIndexHitAndFeatureDynList& surfaceHits,
574  pointIndexHitAndFeatureDynList& featureEdgeHits,
575  DynamicList<label>& surfaceToTreeShape,
576  DynamicList<label>& edgeToTreeShape,
577  Map<scalar>& surfacePtToEdgePtDist,
578  bool firstPass
579  ) const;
580 
581  //- Store the surface conformation with the indices offset to be
582  // relative to zero
583  void storeSurfaceConformation();
584 
585  //- Reinsert the surface conformation re-offsetting indices to be
586  // relative to new number of internal vertices
587  void reinsertSurfaceConformation();
588 
589  void checkCells();
590 
591  void checkDuals();
592 
593  void checkVertices();
594 
595  void checkCoPlanarCells() const;
596 
597  //- Dual calculation
598  void calcDualMesh
599  (
601  labelList& boundaryPts,
602  faceList& faces,
603  labelList& owner,
604  labelList& neighbour,
607  pointField& cellCentres,
608  labelList& cellToDelaunayVertex,
609  labelListList& patchToDelaunayVertex,
610  bitSet& boundaryFacesToRemove
611  );
612 
613  void calcNeighbourCellCentres
614  (
615  const polyMesh& mesh,
616  const pointField& cellCentres,
617  pointField& neiCc
618  ) const;
619 
620  void selectSeparatedCoupledFaces
621  (
622  const polyMesh& mesh,
623  boolList& selected
624  ) const;
625 
626  //- From meshRefinementBaffles.C. Use insidePoint for a surface to
627  // determine the cell zone.
628  void findCellZoneInsideWalk
629  (
630  const polyMesh& mesh,
631  const labelList& locationSurfaces,
632  const labelList& faceToSurface,
633  labelList& cellToSurface
634  ) const;
635 
636  //- Calculate the cell zones from cellCentres using all closed surfaces
637  labelList calcCellZones(const pointField& cellCentres) const;
638 
639  //- Calculate the face zones
640  void calcFaceZones
641  (
642  const polyMesh& mesh,
643  const pointField& cellCentres,
644  const labelList& cellToSurface,
645  labelList& faceToSurface,
646  boolList& flipMap
647  ) const;
648 
649  //- Add zones to the polyMesh
650  void addZones(polyMesh& mesh, const pointField& cellCentres) const;
651 
652  //- Tet mesh calculation
653  void calcTetMesh
654  (
656  labelList& pointToDelaunayVertex,
657  faceList& faces,
658  labelList& owner,
659  labelList& neighbour,
662  );
663 
664  //- Determines if the dual face constructed by the Delaunay
665  // edge is a boundary face
666  inline bool isBoundaryDualFace
667  (
668  const Delaunay::Finite_edges_iterator& eit
669  ) const;
670 
671  //- Which processors are attached to the dual edge represented by this
672  // Delaunay facet
673  inline List<label> processorsAttached
674  (
675  const Delaunay::Finite_facets_iterator& fit
676  ) const;
677 
678  //- Determines if the edge constructed from the face is on
679  // a processor patch
680  inline bool isParallelDualEdge
681  (
682  const Delaunay::Finite_facets_iterator& fit
683  ) const;
684 
685  //- Determines if the dual face constructed by the Delaunay
686  // edge is a processor boundary face
687  inline bool isProcBoundaryEdge
688  (
689  const Delaunay::Finite_edges_iterator& eit
690  ) const;
691 
692  //- Merge vertices that are identical
693  void mergeIdenticalDualVertices
694  (
695  const pointField& pts,
696  labelList& boundaryPts
697  );
698 
699  label mergeIdenticalDualVertices
700  (
701  const pointField& pts,
702  Map<label>& dualPtIndexMap
703  ) const;
704 
705  //- Identify the face labels of the deferred collapse faces
706  void deferredCollapseFaceSet
707  (
708  labelList& owner,
709  labelList& neighbour,
710  const labelPairHashSet& deferredCollapseFaces
711  ) const;
712 
713  //- Check whether the cell sizes are fine enough. Creates a polyMesh.
714  void checkCellSizing();
715 
716  //- Find all cells with a patch face that is not near the surface. The
717  // allowed offset is the fraction of the target cell size.
718  labelHashSet findOffsetPatchFaces
719  (
720  const polyMesh& mesh,
721  const scalar allowedOffset
722  ) const;
723 
724  //- Create a polyMesh and check its quality, reports which
725  // elements damage the mesh quality, allowing backtracking.
726  labelHashSet checkPolyMeshQuality(const pointField& pts) const;
727 
728  label classifyBoundaryPoint(Cell_handle cit) const;
729 
730  //- Index all of the Delaunay cells and calculate their dual points
731  void indexDualVertices
732  (
733  pointField& pts,
734  labelList& boundaryPts
735  );
736 
737  //- Re-index all of the Delaunay cells
738  void reindexDualVertices
739  (
740  const Map<label>& dualPtIndexMap,
741  labelList& boundaryPts
742  );
743 
744  label createPatchInfo
745  (
748  ) const;
749 
750  vector calcSharedPatchNormal(Cell_handle c1, Cell_handle c2) const;
751 
752  bool boundaryDualFace(Cell_handle c1, Cell_handle c2) const;
753 
754  //- Create all of the internal and boundary faces
755  void createFacesOwnerNeighbourAndPatches
756  (
757  const pointField& pts,
758  faceList& faces,
759  labelList& owner,
760  labelList& neighbour,
763  labelListList& patchPointPairSlaves,
764  bitSet& boundaryFacesToRemove,
765  bool includeEmptyPatches = false
766  ) const;
767 
768  //- Sort the faces, owner and neighbour lists into
769  // upper-triangular order. For internal faces only, use
770  // before adding patch faces
771  void sortFaces
772  (
773  faceList& faces,
774  labelList& owner,
775  labelList& neighbour
776  ) const;
777 
778  //- Sort the processor patches so that the faces are in the same order
779  // on both processors
780  void sortProcPatches
781  (
782  List<DynamicList<face>>& patchFaces,
783  List<DynamicList<label>>& patchOwners,
784  List<DynamicList<label>>& patchPointPairSlaves,
785  labelPairPairDynListList& patchSortingIndices
786  ) const;
787 
788  //- Add the faces and owner information for the patches
789  void addPatches
790  (
791  const label nInternalFaces,
792  faceList& faces,
793  labelList& owner,
795  bitSet& boundaryFacesToRemove,
796  const List<DynamicList<face>>& patchFaces,
797  const List<DynamicList<label>>& patchOwners,
798  const List<DynamicList<bool>>& indirectPatchFace
799  ) const;
800 
801  //- Remove points that are no longer used by any faces
802  void removeUnusedPoints
803  (
804  faceList& faces,
805  pointField& pts,
806  labelList& boundaryPts
807  ) const;
808 
809  //- Remove dual cells that are not used by any faces. Return compaction
810  // map.
811  labelList removeUnusedCells
812  (
813  labelList& owner,
814  labelList& neighbour
815  ) const;
816 
817  //- Create an empty fvMesh
818  autoPtr<fvMesh> createDummyMesh
819  (
820  const IOobject& io,
821  const wordList& patchNames,
823  ) const;
824 
825  //- Create a polyMesh from points.
826  autoPtr<polyMesh> createPolyMeshFromPoints(const pointField& pts) const;
827 
828  void checkProcessorPatchesMatch
829  (
831  ) const;
832 
833  void reorderPoints
834  (
836  labelList& boundaryPts,
837  faceList& faces,
838  const label nInternalFaces
839  ) const;
840 
841  //- Rotate the faces on processor patches if necessary
842  void reorderProcessorPatches
843  (
844  const word& meshName,
845  const fileName& instance,
846  const pointField& points,
847  faceList& faces,
848  const wordList& patchNames,
850  ) const;
851 
852  void writePointPairs(const fileName& fName) const;
853 
854  //- No copy construct
856 
857  //- No copy assignment
858  void operator=(const conformalVoronoiMesh&) = delete;
859 
860 
861 public:
862 
863  //- Runtime type information
864  ClassName("conformalVoronoiMesh");
865 
866 
867  // Constructors
868 
869  //- Construct from Time and foamyHexMeshDict
871  (
872  const Time& runTime,
873  const dictionary& foamyHexMeshDict,
874  const fileName& decompDictFile = ""
875  );
876 
877 
878  //- Destructor
880 
881 
882  // Member Functions
883 
884  void initialiseForMotion();
885 
887 
888  //- Move the vertices according to the controller, re-conforming to the
889  // surface as required
890  void move();
891 
892 // //- Which other processors does each sphere overlap
893 // labelListList overlapsProc
894 // (
895 // const List<Foam::point>& centres,
896 // const List<scalar>& radiusSqrs
897 // ) const;
898 
899 
900  // Access
901 
902  //- Return the Time object
903  inline const Time& time() const;
904 
905  //- Return the random number generator
906  inline Random& rndGen() const;
907 
908  //- Return the allGeometry object
909  inline const searchableSurfaces& allGeometry() const;
910 
911  //- Return the conformationSurfaces object
912  inline const conformationSurfaces& geometryToConformTo() const;
913 
914  //- Return the backgroundMeshDecomposition
915  inline const backgroundMeshDecomposition& decomposition() const;
916 
917  //- Return the cellShapeControl object
918  inline const cellShapeControl& cellShapeControls() const;
919 
920  //- Return the foamyHexMeshControls object
921  inline const cvControls& foamyHexMeshControls() const;
922 
923 
924  // Query
925 
926  //- Return the local point pair separation at the given location
927  inline scalar pointPairDistance(const Foam::point& pt) const;
928 
929  //- Return the local mixed feature point placement distance
930  inline scalar mixedFeaturePointDistance
931  (
932  const Foam::point& pt
933  ) const;
934 
935  //- Return the square of the local feature point exclusion distance
937  (
938  const Foam::point& pt
939  ) const;
940 
941  //- Return the square of the local feature edge exclusion distance
942  inline scalar featureEdgeExclusionDistanceSqr
943  (
944  const Foam::point& pt
945  ) const;
946 
947  //- Return the square of the local surface point exclusion distance
948  inline scalar surfacePtExclusionDistanceSqr
949  (
950  const Foam::point& pt
951  ) const;
952 
953  //- Return the square of the local surface search distance
954  inline scalar surfaceSearchDistanceSqr(const Foam::point& pt) const;
955 
956  //- Return the local maximum surface protrusion distance
957  inline scalar maxSurfaceProtrusion(const Foam::point& pt) const;
958 
959  //- Call the appropriate function to conform to an edge
961  (
962  const extendedFeatureEdgeMesh& feMesh,
963  const pointIndexHit& edHit,
964  DynamicList<Vb>& pts
965  ) const;
966 
967 
968  // Write
969 
970  //- Write the elapsedCpuTime and memory usage, with an optional
971  // description
972  static void timeCheck
973  (
974  const Time& runTime,
975  const string& description = string::null,
976  const bool check = true
977  );
978 
979  void timeCheck
980  (
981  const string& description = string::null
982  ) const;
983 
984  //- Prepare data and call writeMesh for polyMesh and
985  // tetDualMesh
986  void writeMesh(const fileName& instance);
987 
988  //- Write mesh to disk
989  void writeMesh
990  (
991  const word& meshName,
992  const fileName& instance,
994  labelList& boundaryPts,
995  faceList& faces,
996  labelList& owner,
997  labelList& neighbour,
998  const wordList& patchNames,
1000  const pointField& cellCentres,
1001  bitSet& boundaryFacesToRemove
1002  ) const;
1003 
1004  //- Calculate and write a field of the target cell size,
1005  // target cell volume, actual cell volume and equivalent
1006  // actual cell size (cbrt(actual cell volume)).
1007  void writeCellSizes(const fvMesh& mesh) const;
1008 
1009  void writeCellAlignments(const fvMesh& mesh) const;
1010 
1011  //- Calculate and write the cell centres.
1012  void writeCellCentres(const fvMesh& mesh) const;
1013 
1014  //- Find the cellSet of the boundary cells which have points that
1015  // protrude out of the surface beyond a tolerance.
1017 };
1018 
1019 
1020 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1021 
1022 } // End namespace Foam
1023 
1024 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1025 
1026 #include "conformalVoronoiMeshI.H"
1027 
1028 #ifdef NoRepository
1030 #endif
1031 
1032 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1033 
1034 #endif
1035 
1036 // ************************************************************************* //
Foam::conformalVoronoiMesh::cellShapeControls
const cellShapeControl & cellShapeControls() const
Return the cellShapeControl object.
Definition: conformalVoronoiMeshI.H:567
volFields.H
dynamicTreeDataPoint.H
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::conformalVoronoiMesh
Definition: conformalVoronoiMesh.H:96
Foam::Random
Random number generator.
Definition: Random.H:59
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
meshTools.H
Foam::Enum< dualMeshPointType >
Foam::cvControls
Controls for the conformalVoronoiMesh mesh generator.
Definition: cvControls.H:55
Foam::conformalVoronoiMesh::Edge
Delaunay::Edge Edge
Definition: conformalVoronoiMesh.H:104
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
pointConversion.H
cellShapeControl.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::conformalVoronoiMesh::ClassName
ClassName("conformalVoronoiMesh")
Runtime type information.
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:63
Foam::conformalVoronoiMesh::writeCellCentres
void writeCellCentres(const fvMesh &mesh) const
Calculate and write the cell centres.
Foam::conformalVoronoiMesh::pointIndexHitAndFeatureList
List< pointIndexHitAndFeature > pointIndexHitAndFeatureList
Definition: conformalVoronoiMesh.H:111
Foam::conformalVoronoiMesh::featurePoint
Definition: conformalVoronoiMesh.H:121
Foam::conformalVoronoiMesh::labelPairPairDynListList
List< DynamicList< labelPairPair > > labelPairPairDynListList
Definition: conformalVoronoiMesh.H:108
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:55
Foam::conformalVoronoiMesh::surfaceSearchDistanceSqr
scalar surfaceSearchDistanceSqr(const Foam::point &pt) const
Return the square of the local surface search distance.
Definition: conformalVoronoiMeshI.H:202
Foam::conformalVoronoiMesh::Vertex_handle
Delaunay::Vertex_handle Vertex_handle
Definition: conformalVoronoiMesh.H:102
Foam::conformalVoronoiMesh::writeMesh
void writeMesh(const fileName &instance)
Prepare data and call writeMesh for polyMesh and.
point.H
Foam::conformalVoronoiMesh::pointPairDistance
scalar pointPairDistance(const Foam::point &pt) const
Return the local point pair separation at the given location.
Definition: conformalVoronoiMeshI.H:140
globalIndex.H
Foam::treeBoundBox
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:86
Foam::conformalVoronoiMesh::findRemainingProtrusionSet
labelHashSet findRemainingProtrusionSet(const polyMesh &mesh) const
Find the cellSet of the boundary cells which have points that.
Foam::conformalVoronoiMesh::createEdgePointGroup
void createEdgePointGroup(const extendedFeatureEdgeMesh &feMesh, const pointIndexHit &edHit, DynamicList< Vb > &pts) const
Call the appropriate function to conform to an edge.
Foam::conformalVoronoiMesh::timeCheck
static void timeCheck(const Time &runTime, const string &description=string::null, const bool check=true)
Write the elapsedCpuTime and memory usage, with an optional.
indexedOctree.H
cvControls.H
Foam::conformalVoronoiMesh::Cell_handle
Delaunay::Cell_handle Cell_handle
Definition: conformalVoronoiMesh.H:103
wallPolyPatch.H
Foam::conformalVoronoiMesh::geometryToConformTo
const conformationSurfaces & geometryToConformTo() const
Return the conformationSurfaces object.
Definition: conformalVoronoiMeshI.H:546
Foam::conformalVoronoiMesh::~conformalVoronoiMesh
~conformalVoronoiMesh()
Destructor.
Foam::conformalVoronoiMesh::move
void move()
Move the vertices according to the controller, re-conforming to the.
Foam::Map< label >
unitConversion.H
Unit conversion functions.
Pair.H
Foam::conformalVoronoiMesh::mixedFeaturePointDistance
scalar mixedFeaturePointDistance(const Foam::point &pt) const
Return the local mixed feature point placement distance.
Definition: conformalVoronoiMeshI.H:149
Foam::conformalVoronoiMesh::rndGen
Random & rndGen() const
Return the random number generator.
Definition: conformalVoronoiMeshI.H:532
Foam::conformalVoronoiMesh::pointIndexHitAndFeature
Tuple2< pointIndexHit, label > pointIndexHitAndFeature
Definition: conformalVoronoiMesh.H:110
polyMesh.H
Foam::HashSet
A HashTable with keys but without contents that is similar to std::unordered_set.
Definition: HashSet.H:77
bitSet.H
Foam::conformationSurfaces
Definition: conformationSurfaces.H:55
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
patchDicts
PtrList< dictionary > patchDicts
Definition: readKivaGrid.H:532
Foam::conformalVoronoiMesh::writeCellSizes
void writeCellSizes(const fvMesh &mesh) const
Calculate and write a field of the target cell size,.
searchableSurfaces.H
n
label n
Definition: TABSMDCalcMethod2.H:31
dynamicIndexedOctree.H
Foam::PointIndexHit
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Definition: PointIndexHit.H:52
Foam::constant::physicoChemical::c1
const dimensionedScalar c1
First radiation constant: default SI units: [W/m2].
Foam::check
static void check(const int retVal, const char *what)
Definition: ptscotchDecomp.C:80
Foam::plane::side
side
Side of the plane.
Definition: plane.H:94
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::Field< vector >
treeDataPoint.H
plane.H
Foam::conformalVoronoiMesh::initialiseForConformation
void initialiseForConformation()
Foam::conformalVoronoiMesh::decomposition
const backgroundMeshDecomposition & decomposition() const
Return the backgroundMeshDecomposition.
Definition: conformalVoronoiMeshI.H:553
Foam::pointPairs< Delaunay >
Foam::extendedEdgeMesh::sideVolumeType
sideVolumeType
Normals point to the outside.
Definition: extendedEdgeMesh.H:117
conformationSurfaces.H
conformalVoronoiMeshI.H
Foam::conformalVoronoiMesh::dualMeshPointTypeNames_
static const Enum< dualMeshPointType > dualMeshPointTypeNames_
Definition: conformalVoronoiMesh.H:125
DistributedDelaunayMesh.H
Foam::conformalVoronoiMesh::constrained
Definition: conformalVoronoiMesh.H:122
Foam::DistributedDelaunayMesh
Definition: DistributedDelaunayMesh.H:58
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
patchNames
wordList patchNames(nPatches)
Foam::conformalVoronoiMesh::dualMeshPointType
dualMeshPointType
Definition: conformalVoronoiMesh.H:116
featurePointConformer.H
Foam::conformalVoronoiMesh::pointIndexHitAndFeatureDynList
DynamicList< pointIndexHitAndFeature > pointIndexHitAndFeatureDynList
Definition: conformalVoronoiMesh.H:112
pointPairs.H
conformalVoronoiMeshTemplates.C
HashSet.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
processorPolyPatch.H
Foam::vertices
pointField vertices(const blockVertexList &bvl)
Definition: blockVertexList.H:49
Foam::cellShapeControl
Definition: cellShapeControl.H:64
Foam::string::null
static const string null
An empty string.
Definition: string.H:169
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::featurePointConformer
The Delaunay vertices required to conform to a feature point can be determined upon initialisation be...
Definition: featurePointConformer.H:65
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::constant::physicoChemical::c2
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
Foam::conformalVoronoiMesh::Point
Delaunay::Point Point
Definition: conformalVoronoiMesh.H:106
Time.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::conformalVoronoiMesh::foamyHexMeshControls
const cvControls & foamyHexMeshControls() const
Return the foamyHexMeshControls object.
Definition: conformalVoronoiMeshI.H:574
Foam::conformalVoronoiMesh::time
const Time & time() const
Return the Time object.
Definition: conformalVoronoiMeshI.H:526
pointFeatureEdgesTypes.H
Foam::conformalVoronoiMesh::surfacePtExclusionDistanceSqr
scalar surfacePtExclusionDistanceSqr(const Foam::point &pt) const
Return the square of the local surface point exclusion distance.
Definition: conformalVoronoiMeshI.H:188
Foam::conformalVoronoiMesh::featureEdgeExclusionDistanceSqr
scalar featureEdgeExclusionDistanceSqr(const Foam::point &pt) const
Return the square of the local feature edge exclusion distance.
Definition: conformalVoronoiMeshI.H:174
Foam::conformalVoronoiMesh::Facet
Delaunay::Facet Facet
Definition: conformalVoronoiMesh.H:105
Foam::Vector< scalar >
Foam::conformalVoronoiMesh::writeCellAlignments
void writeCellAlignments(const fvMesh &mesh) const
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::searchableSurfaces
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Definition: searchableSurfaces.H:92
Foam::backgroundMeshDecomposition
Store a background polyMesh to use for the decomposition of space and queries for parallel conformalV...
Definition: backgroundMeshDecomposition.H:94
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::conformalVoronoiMesh::maxSurfaceProtrusion
scalar maxSurfaceProtrusion(const Foam::point &pt) const
Return the local maximum surface protrusion distance.
Definition: conformalVoronoiMeshI.H:216
Foam::conformalVoronoiMesh::featurePointExclusionDistanceSqr
scalar featurePointExclusionDistanceSqr(const Foam::point &pt) const
Return the square of the local feature point exclusion distance.
Definition: conformalVoronoiMeshI.H:160
Point
CGAL::Point_3< K > Point
Definition: CGALIndexedPolyhedron.H:53
Foam::extendedFeatureEdgeMesh
extendedEdgeMesh + IO.
Definition: extendedFeatureEdgeMesh.H:56
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:72
DynamicList.H
Foam::conformalVoronoiMesh::featureEdge
Definition: conformalVoronoiMesh.H:120
cellSet.H
transform.H
3D tensor transformation operations.
Foam::Tuple2
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition: stringOps.H:60
Foam::conformalVoronoiMesh::surface
Definition: conformalVoronoiMesh.H:119
Foam::conformalVoronoiMesh::initialiseForMotion
void initialiseForMotion()
Foam::conformalVoronoiMesh::allGeometry
const searchableSurfaces & allGeometry() const
Return the allGeometry object.
Definition: conformalVoronoiMeshI.H:539
CGALTriangulation3Ddefs.H
CGAL data structures used for 3D Delaunay meshing.
zeroGradientFvPatchFields.H
labelPair.H