primitiveMesh.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2018-2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::primitiveMesh
29 
30 Description
31  Cell-face mesh analysis engine
32 
33 SourceFiles
34  primitiveMeshI.H
35  primitiveMesh.C
36  primitiveMeshClear.C
37  primitiveMeshCellCells.C
38  primitiveMeshEdgeCells.C
39  primitiveMeshPointCells.C
40  primitiveMeshCells.C
41  primitiveMeshEdgeFaces.C
42  primitiveMeshPointFaces.C
43  primitiveMeshCellEdges.C
44  primitiveMeshPointEdges.C
45  primitiveMeshPointPoints.C
46  primitiveMeshEdges.C
47  primitiveMeshCellCentresAndVols.C
48  primitiveMeshFaceCentresAndAreas.C
49  primitiveMeshFindCell.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef Foam_primitiveMesh_H
54 #define Foam_primitiveMesh_H
55 
56 #include "DynamicList.H"
57 #include "edgeList.H"
58 #include "pointField.H"
59 #include "faceList.H"
60 #include "cellList.H"
61 #include "cellShapeList.H"
62 #include "labelList.H"
63 #include "boolList.H"
64 #include "HashSet.H"
65 #include "Map.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 // Forward Declarations
73 class bitSet;
74 class boundBox;
75 
76 /*---------------------------------------------------------------------------*\
77  Class primitiveMesh Declaration
78 \*---------------------------------------------------------------------------*/
79 
80 class primitiveMesh
81 {
82  // Permanent data
83 
84  // Primitive size data
85 
86  //- Number of internal points (or -1 if points not sorted)
87  label nInternalPoints_;
88 
89  //- Number of points
90  label nPoints_;
91 
92  //- Number of internal edges using 0 boundary points
93  mutable label nInternal0Edges_;
94 
95  //- Number of internal edges using 0 or 1 boundary points
96  mutable label nInternal1Edges_;
97 
98  //- Number of internal edges using 0,1 or 2 boundary points
99  mutable label nInternalEdges_;
100 
101  //- Number of edges
102  mutable label nEdges_;
103 
104  //- Number of internal faces
105  label nInternalFaces_;
106 
107  //- Number of faces
108  label nFaces_;
109 
110  //- Number of cells
111  label nCells_;
112 
113 
114  // Shapes
115 
116  //- Cell shapes
117  mutable cellShapeList* cellShapesPtr_;
118 
119  //- Edges
120  mutable edgeList* edgesPtr_;
121 
122 
123  // Connectivity
124 
125  //- Cell-cells
126  mutable labelListList* ccPtr_;
127 
128  //- Edge-cells
129  mutable labelListList* ecPtr_;
130 
131  //- Point-cells
132  mutable labelListList* pcPtr_;
133 
134  //- Cell-faces
135  mutable cellList* cfPtr_;
136 
137  //- Edge-faces
138  mutable labelListList* efPtr_;
139 
140  //- Point-faces
141  mutable labelListList* pfPtr_;
142 
143  //- Cell-edges
144  mutable labelListList* cePtr_;
145 
146  //- Face-edges
147  mutable labelListList* fePtr_;
148 
149  //- Point-edges
150  mutable labelListList* pePtr_;
151 
152  //- Point-points
153  mutable labelListList* ppPtr_;
154 
155  //- Cell-points
156  mutable labelListList* cpPtr_;
157 
158 
159  // On-the-fly edge addressing storage
160 
161  //- Temporary storage for addressing.
162  mutable DynamicList<label> labels_;
163 
164  //- Temporary storage for addressing
165  mutable labelHashSet labelSet_;
166 
167 
168  // Geometric data
169 
170  //- Cell centres
171  mutable vectorField* cellCentresPtr_;
172 
173  //- Face centres
174  mutable vectorField* faceCentresPtr_;
175 
176  //- Cell volumes
177  mutable scalarField* cellVolumesPtr_;
178 
179  //- Face areas
180  mutable vectorField* faceAreasPtr_;
181 
182 
183  // Private Member Functions
184 
185  //- No copy construct
186  primitiveMesh(const primitiveMesh&) = delete;
187 
188  //- No copy assignment
189  void operator=(const primitiveMesh&) = delete;
190 
191 
192  // Topological Calculations
193 
194  //- Calculate cell shapes
195  void calcCellShapes() const;
196 
197  //- Calculate cell-cell addressing
198  void calcCellCells() const;
199 
200  //- Calculate point-cell addressing
201  void calcPointCells() const;
202 
203  //- Calculate cell-face addressing
204  void calcCells() const;
205 
206  //- Calculate edge list
207  void calcCellEdges() const;
208 
209  //- Calculate cell-point addressing
210  void calcCellPoints() const;
211 
212  //- Calculate point-point addressing
213  void calcPointPoints() const;
214 
215  //- Calculate edges, pointEdges and faceEdges (if doFaceEdges=true)
216  // During edge calculation, a larger set of data is assembled.
217  // Create and destroy as a set, using clearOutEdges()
218  void calcEdges(const bool doFaceEdges) const;
219  void clearOutEdges();
220 
221 
222 protected:
223 
224  // Static data members
225 
226  //- Static data to control mesh checking
227 
228  //- Cell closedness warning threshold
229  // set as the fraction of un-closed area to closed area
230  static scalar closedThreshold_;
231 
232  //- Aspect ratio warning threshold
233  static scalar aspectThreshold_;
234 
235  //- Non-orthogonality warning threshold in deg
236  static scalar nonOrthThreshold_;
237 
238  //- Skewness warning threshold
239  static scalar skewThreshold_;
240 
241  //- Threshold where faces are considered coplanar
242  static scalar planarCosAngle_;
243 
244 
245  // Geometrical calculations
246 
247  //- Calculate face centres and areas
248  void calcFaceCentresAndAreas() const;
249 
250  //- Calculate cell centres and volumes
251  void calcCellCentresAndVols() const;
252 
253  //- Calculate edge vectors
254  void calcEdgeVectors() const;
255 
256 
257  // Mesh checking
258 
259  //- Check if all points on face are shared with another face.
261  (
262  const label,
263  const Map<label>&,
264  label& nBaffleFaces,
265  labelHashSet*
266  ) const;
267 
268  //- Check that shared points are in consecutive order.
269  bool checkCommonOrder
270  (
271  const label,
272  const Map<label>&,
273  labelHashSet*
274  ) const;
275 
276  //- Check boundary for closedness
278  (
279  const vectorField& areas,
280  const bool report,
281  const bitSet& internalOrCoupledFaces
282  ) const;
283 
284  //- Check cells for closedness
285  bool checkClosedCells
286  (
287  const vectorField& faceAreas,
288  const scalarField& cellVolumes,
289  const bool report,
290  labelHashSet* setPtr,
291  labelHashSet* aspectSetPtr,
292  const Vector<label>& meshD
293  ) const;
294 
295  //- Check for negative face areas
296  bool checkFaceAreas
297  (
298  const vectorField& faceAreas,
299  const bool report,
300  const bool detailedReport,
301  labelHashSet* setPtr
302  ) const;
303 
304  //- Check for negative cell volumes
305  bool checkCellVolumes
306  (
307  const scalarField& vols,
308  const bool report,
309  const bool detailedReport,
310  labelHashSet* setPtr
311  ) const;
313  //- Check for non-orthogonality
315  (
316  const vectorField& fAreas,
317  const vectorField& cellCtrs,
318  const bool report,
319  labelHashSet* setPtr
320  ) const;
321 
322  //- Check face pyramid volume
323  bool checkFacePyramids
324  (
325  const pointField& points,
326  const vectorField& ctrs,
327  const bool report,
328  const bool detailedReport,
329  const scalar minPyrVol,
330  labelHashSet* setPtr
331  ) const;
332 
333  //- Check face skewness
334  bool checkFaceSkewness
335  (
336  const pointField& points,
337  const vectorField& fCtrs,
338  const vectorField& fAreas,
339  const vectorField& cellCtrs,
340  const bool report,
341  labelHashSet* setPtr
342  ) const;
343 
344  //- Check face angles
345  // Allows a slight non-convexity. E.g. maxDeg = 10 allows for
346  // angles < 190 (or 10 degrees concavity) (if truly concave and
347  // points not visible from face centre the face-pyramid check in
348  // checkMesh will fail)
349  bool checkFaceAngles
350  (
351  const pointField& points,
352  const vectorField& faceAreas,
353  const bool report,
354  const scalar maxDeg,
355  labelHashSet* setPtr
356  ) const;
357 
358  //- Check face warpage
359  bool checkFaceFlatness
360  (
361  const pointField& points,
362  const vectorField& faceCentres,
363  const vectorField& faceAreas,
364  const bool report,
365  const scalar warnFlatness,
366  labelHashSet* setPtr
367  ) const;
368 
369  //- Check for concave cells by the planes of faces
370  bool checkConcaveCells
371  (
372  const vectorField& fAreas,
373  const pointField& fCentres,
374  const bool report,
375  labelHashSet* setPtr
376  ) const;
377 
378 
379  //- Construct null
380  primitiveMesh();
381 
382 
383 public:
384 
385  // Static data
386 
387  ClassName("primitiveMesh");
388 
389  //- Estimated number of cells per edge
390  static const unsigned cellsPerEdge_ = 4;
391 
392  //- Estimated number of cells per point
393  static const unsigned cellsPerPoint_ = 8;
394 
395  //- Estimated number of faces per cell
396  static const unsigned facesPerCell_ = 6;
397 
398  //- Estimated number of faces per edge
399  static const unsigned facesPerEdge_ = 4;
400 
401  //- Estimated number of faces per point
402  static const unsigned facesPerPoint_ = 12;
403 
404  //- Estimated number of edges per cell
405  static const unsigned edgesPerCell_ = 12;
406 
407  //- Estimated number of edges per cell
408  static const unsigned edgesPerFace_ = 4;
409 
410  //- Estimated number of edges per point
411  static const unsigned edgesPerPoint_ = 6;
412 
413  //- Estimated number of points per cell
414  static const unsigned pointsPerCell_ = 8;
415 
416  //- Estimated number of points per face
417  static const unsigned pointsPerFace_ = 4;
418 
419 
420  // Constructors
421 
422  //- Construct from components
424  (
425  const label nPoints,
426  const label nInternalFaces,
427  const label nFaces,
428  const label nCells
429  );
430 
431 
432  //- Destructor
433  virtual ~primitiveMesh();
434 
435 
436  // Member Functions
437 
438  //- Reset this primitiveMesh given the primitive array sizes
439  void reset
440  (
441  const label nPoints,
442  const label nInternalFaces,
443  const label nFaces,
444  const label nCells
445  );
446 
447  //- Reset this primitiveMesh given the primitive array sizes and cells
448  void reset
449  (
450  const label nPoints,
451  const label nInternalFaces,
452  const label nFaces,
453  const label nCells,
454  cellList& cells
455  );
456 
457  //- Reset the local geometry
458  void resetGeometry
459  (
464  );
465 
466  //- Initialise all non-demand-driven data
467  virtual bool init(const bool doInit)
468  {
469  return false;
470  }
471 
472 
473  // Access
474 
475  // Mesh size parameters
476 
477  //- Number of mesh points
478  inline label nPoints() const noexcept;
479 
480  //- Number of mesh edges
481  inline label nEdges() const;
482 
483  //- Number of mesh faces
484  inline label nFaces() const noexcept;
485 
486  //- Number of mesh cells
487  inline label nCells() const noexcept;
488 
489  //- Number of internal faces
490  inline label nInternalFaces() const noexcept;
491 
492  //- Number of boundary faces (== nFaces - nInternalFaces)
493  inline label nBoundaryFaces() const noexcept;
494 
495 
496  // If points are ordered (nInternalPoints != -1):
497 
498  //- Points not on boundary
499  inline label nInternalPoints() const noexcept;
500 
501  //- Internal edges (i.e. not on boundary face) using
502  //- no boundary point
503  inline label nInternal0Edges() const;
504 
505  //- Internal edges using 0 or 1 boundary point
506  inline label nInternal1Edges() const;
507 
508  //- Internal edges using 0,1 or 2 boundary points
509  inline label nInternalEdges() const;
511 
512  // Primitive mesh data
513 
514  //- Return mesh points
515  virtual const pointField& points() const = 0;
516 
517  //- Return faces
518  virtual const faceList& faces() const = 0;
519 
520  //- Face face-owner addressing
521  virtual const labelList& faceOwner() const = 0;
522 
523  //- Face face-neighbour addressing
524  virtual const labelList& faceNeighbour() const = 0;
526  //- Return old points for mesh motion
527  virtual const pointField& oldPoints() const = 0;
528 
529 
530  // Derived mesh data
531 
532  //- Return cell shapes
533  const cellShapeList& cellShapes() const;
534 
535  //- Return mesh edges. Uses calcEdges.
536  const edgeList& edges() const;
537 
538  //- Helper function to calculate cell-face addressing from
539  // face-cell addressing. If nCells is not provided it will
540  // scan for the maximum.
541  static void calcCells
542  (
543  cellList&,
544  const labelUList& own,
545  const labelUList& nei,
546  const label nCells = -1
547  );
548 
549  //- Helper function to calculate point ordering. Returns true
550  // if points already ordered, false and fills pointMap (old to
551  // new). Map splits points into those not used by any boundary
552  // face and those that are.
553  static bool calcPointOrder
554  (
556  labelList& pointMap,
557  const faceList&,
558  const label nInternalFaces,
559  const label nPoints
560  );
561 
562  // Return mesh connectivity
563 
564  const labelListList& cellCells() const;
565  // faceCells given as owner and neighbour
566  const labelListList& edgeCells() const;
567  const labelListList& pointCells() const;
568 
569  const cellList& cells() const;
570  // faceFaces considered unnecessary
571  const labelListList& edgeFaces() const;
572  const labelListList& pointFaces() const;
573 
574  const labelListList& cellEdges() const;
575  const labelListList& faceEdges() const;
576  // edgeEdges considered unnecessary
577  const labelListList& pointEdges() const;
578  const labelListList& pointPoints() const;
579  const labelListList& cellPoints() const;
580 
581 
582  // Geometric data (raw!)
583 
584  const vectorField& cellCentres() const;
585  const vectorField& faceCentres() const;
586  const scalarField& cellVolumes() const;
587  const vectorField& faceAreas() const;
588 
589 
590  // Mesh motion
591 
592  //- Move points
593  void movePoints
594  (
595  const pointField& p,
596  const pointField& oldP
597  );
598 
599 
600  //- Return true if given face label is internal to the mesh
601  inline bool isInternalFace(const label faceIndex) const noexcept;
602 
603 
604  // Topological checks
605 
606  //- Check face ordering
607  virtual bool checkUpperTriangular
608  (
609  const bool report = false,
610  labelHashSet* setPtr = nullptr
611  ) const;
612 
613  //- Check cell zip-up
614  virtual bool checkCellsZipUp
615  (
616  const bool report = false,
617  labelHashSet* setPtr = nullptr
618  ) const;
619 
620  //- Check uniqueness of face vertices
621  virtual bool checkFaceVertices
622  (
623  const bool report = false,
624  labelHashSet* setPtr = nullptr
625  ) const;
626 
627  //- Check for unused points
628  virtual bool checkPoints
629  (
630  const bool report = false,
631  labelHashSet* setPtr = nullptr
632  ) const;
633 
634  //- Check face-face connectivity
635  virtual bool checkFaceFaces
636  (
637  const bool report = false,
638  labelHashSet* setPtr = nullptr
639  ) const;
640 
641 
642  // Geometric checks
643 
644  //- Check boundary for closedness
645  virtual bool checkClosedBoundary(const bool report = false)
646  const;
647 
648  //- Check cells for closedness
649  virtual bool checkClosedCells
650  (
651  const bool report = false,
652  labelHashSet* setPtr = nullptr,
653  labelHashSet* highAspectSetPtr = nullptr,
654  const Vector<label>& solutionD = Vector<label>::one
655  ) const;
656 
657  //- Check for negative face areas
658  virtual bool checkFaceAreas
659  (
660  const bool report = false,
661  labelHashSet* setPtr = nullptr
662  ) const;
663 
664  //- Check for negative cell volumes
665  virtual bool checkCellVolumes
666  (
667  const bool report = false,
668  labelHashSet* setPtr = nullptr
669  ) const;
670 
671  //- Check for non-orthogonality
672  virtual bool checkFaceOrthogonality
673  (
674  const bool report = false,
675  labelHashSet* setPtr = nullptr
676  ) const;
677 
678  //- Check face pyramid volume
679  virtual bool checkFacePyramids
680  (
681  const bool report = false,
682  const scalar minPyrVol = -SMALL,
683  labelHashSet* setPtr = nullptr
684  ) const;
685 
686  //- Check face skewness
687  virtual bool checkFaceSkewness
688  (
689  const bool report = false,
690  labelHashSet* setPtr = nullptr
691  ) const;
692 
693  //- Check face angles
694  virtual bool checkFaceAngles
695  (
696  const bool report = false,
697  const scalar maxSin = 10, // In degrees
698  labelHashSet* setPtr = nullptr
699  ) const;
700 
701  //- Check face warpage: decompose face and check ratio between
702  // magnitude of sum of triangle areas and sum of magnitude of
703  // triangle areas.
704  virtual bool checkFaceFlatness
705  (
706  const bool report,
707  const scalar warnFlatness, // When to include in set.
708  labelHashSet* setPtr
709  ) const;
710 
711  //- Check for point-point-nearness,
712  // e.g. colocated points which may be part of baffles.
713  virtual bool checkPointNearness
714  (
715  const bool report,
716  const scalar reportDistSqr,
717  labelHashSet* setPtr = nullptr
718  ) const;
719 
720  //- Check edge length
721  virtual bool checkEdgeLength
722  (
723  const bool report,
724  const scalar minLenSqr,
725  labelHashSet* setPtr = nullptr
726  ) const;
727 
728  //- Check for concave cells by the planes of faces
729  virtual bool checkConcaveCells
730  (
731  const bool report = false,
732  labelHashSet* setPtr = nullptr
733  ) const;
734 
735 
736  //- Check mesh topology for correctness.
737  // Returns false for no error.
738  virtual bool checkTopology(const bool report = false) const;
739 
740  //- Check mesh geometry (& implicitly topology) for correctness.
741  // Returns false for no error.
742  virtual bool checkGeometry(const bool report = false) const;
743 
744  //- Check mesh for correctness. Returns false for no error.
745  virtual bool checkMesh(const bool report = false) const;
746 
747  //- Set the closedness ratio warning threshold
748  static scalar setClosedThreshold(const scalar);
749 
750  //- Set the aspect ratio warning threshold
751  static scalar setAspectThreshold(const scalar);
752 
753  //- Set the non-orthogonality warning threshold in degrees
754  static scalar setNonOrthThreshold(const scalar);
755 
756  //- Set the skewness warning threshold as percentage
757  // of the face area vector
758  static scalar setSkewThreshold(const scalar);
759 
760 
761  // Useful derived info
762 
763  //- The bounding box for given cell index
764  boundBox cellBb(const label celli) const;
765 
766  //- Return true if the point in the cell bounding box.
767  // The bounding box may be isotropically inflated by the fraction
768  // inflationFraction
769  bool pointInCellBB
770  (
771  const point& p,
772  label celli,
773  scalar inflationFraction = 0
774  ) const;
775 
776  //- Return true if the point is in the cell
777  bool pointInCell(const point& p, label celli) const;
778 
779  //- Find the cell with the nearest cell centre to location
780  label findNearestCell(const point& location) const;
781 
782  //- Find cell enclosing this location (-1 if not in mesh)
783  label findCell(const point& location) const;
784 
785 
786  // Storage management
787 
788  //- Print a list of all the currently allocated mesh data
789  void printAllocated() const;
790 
791  // Per storage whether allocated
792  inline bool hasCellShapes() const noexcept;
793  inline bool hasEdges() const noexcept;
794  inline bool hasCellCells() const noexcept;
795  inline bool hasEdgeCells() const noexcept;
796  inline bool hasPointCells() const noexcept;
797  inline bool hasCells() const noexcept;
798  inline bool hasEdgeFaces() const noexcept;
799  inline bool hasPointFaces() const noexcept;
800  inline bool hasCellEdges() const noexcept;
801  inline bool hasFaceEdges() const noexcept;
802  inline bool hasPointEdges() const noexcept;
803  inline bool hasPointPoints() const noexcept;
804  inline bool hasCellPoints() const noexcept;
805  inline bool hasCellCentres() const noexcept;
806  inline bool hasCellVolumes() const noexcept;
807  inline bool hasFaceCentres() const noexcept;
808  inline bool hasFaceAreas() const noexcept;
809 
810  // On-the-fly addressing calculation. These functions return either
811  // a reference to the full addressing (if already calculated) or
812  // a reference to the supplied storage. The one-argument ones
813  // use member DynamicList labels_ so be careful when not storing
814  // result.
815 
816  //- cellCells using cells.
817  const labelList& cellCells
818  (
819  const label celli,
820  DynamicList<label>&
821  ) const;
822 
823  const labelList& cellCells(const label celli) const;
824 
825  //- cellPoints using cells
826  const labelList& cellPoints
827  (
828  const label celli,
829  labelHashSet&,
830  DynamicList<label>&
831  ) const;
832 
833  const labelList& cellPoints(const label celli) const;
834 
835  //- pointCells using pointFaces
836  const labelList& pointCells
837  (
838  const label pointi,
839  DynamicList<label>&
840  ) const;
841 
842  const labelList& pointCells(const label pointi) const;
843 
844  //- pointPoints using edges, pointEdges
845  const labelList& pointPoints
846  (
847  const label pointi,
848  DynamicList<label>&
849  ) const;
850 
851  const labelList& pointPoints(const label pointi) const;
852 
853  //- faceEdges using pointFaces, edges, pointEdges
854  const labelList& faceEdges
855  (
856  const label facei,
857  DynamicList<label>&
858  ) const;
859 
860  const labelList& faceEdges(const label facei) const;
861 
862  //- edgeFaces using pointFaces, edges, pointEdges
863  const labelList& edgeFaces
864  (
865  const label edgeI,
866  DynamicList<label>&
867  ) const;
868 
869  const labelList& edgeFaces(const label edgeI) const;
870 
871  //- edgeCells using pointFaces, edges, pointEdges
872  const labelList& edgeCells
873  (
874  const label edgeI,
875  DynamicList<label>&
876  ) const;
877 
878  const labelList& edgeCells(const label edgeI) const;
879 
880  //- cellEdges using cells, pointFaces, edges, pointEdges
881  const labelList& cellEdges
882  (
883  const label celli,
884  labelHashSet&,
885  DynamicList<label>&
886  ) const;
887 
888  const labelList& cellEdges(const label celli) const;
889 
890  //- Update all geometric data
891  virtual void updateGeom();
892 
893  //- Clear geometry
894  void clearGeom();
895 
896  //- Clear cell-based geometry only
897  // Use with care! currently used by cyclicACMI
898  void clearCellGeom();
899 
900  //- Clear topological data
901  void clearAddressing();
902 
903  //- Clear all geometry and addressing unnecessary for CFD
904  void clearOut();
905 };
906 
907 
908 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
909 
910 } // End namespace Foam
911 
912 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
913 
914 #include "primitiveMeshI.H"
915 
916 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
917 
918 #endif
919 
920 // ************************************************************************* //
bool checkFaceAreas(const vectorField &faceAreas, const bool report, const bool detailedReport, labelHashSet *setPtr) const
Check for negative face areas.
static const unsigned cellsPerEdge_
Estimated number of cells per edge.
static scalar aspectThreshold_
Aspect ratio warning threshold.
const labelListList & cellEdges() const
ClassName("primitiveMesh")
bool checkFaceAngles(const pointField &points, const vectorField &faceAreas, const bool report, const scalar maxDeg, labelHashSet *setPtr) const
Check face angles.
void clearAddressing()
Clear topological data.
label findCell(const point &location) const
Find cell enclosing this location (-1 if not in mesh)
label nPoints() const noexcept
Number of mesh points.
const labelListList & faceEdges() const
const labelListList & pointEdges() const
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:75
const cellShapeList & cellShapes() const
Return cell shapes.
static scalar setClosedThreshold(const scalar)
Set the closedness ratio warning threshold.
void printAllocated() const
Print a list of all the currently allocated mesh data.
virtual bool checkPointNearness(const bool report, const scalar reportDistSqr, labelHashSet *setPtr=nullptr) const
Check for point-point-nearness,.
virtual const pointField & points() const =0
Return mesh points.
primitiveMesh()
Construct null.
Definition: primitiveMesh.C:34
Smooth ATC in cells having a point to a set of patches supplied by type.
Definition: pointCells.H:52
A bounding box defined in terms of min/max extrema points.
Definition: boundBox.H:63
const cellList & cells() const
bool pointInCell(const point &p, label celli) const
Return true if the point is in the cell.
static const unsigned edgesPerPoint_
Estimated number of edges per point.
static const unsigned pointsPerCell_
Estimated number of points per cell.
label nFaces() const noexcept
Number of mesh faces.
static const unsigned edgesPerFace_
Estimated number of edges per cell.
virtual const pointField & oldPoints() const =0
Return old points for mesh motion.
bool hasCellShapes() const noexcept
void movePoints(const pointField &p, const pointField &oldP)
Move points.
static const unsigned facesPerPoint_
Estimated number of faces per point.
static scalar setAspectThreshold(const scalar)
Set the aspect ratio warning threshold.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
bool checkClosedBoundary(const vectorField &areas, const bool report, const bitSet &internalOrCoupledFaces) const
Check boundary for closedness.
static scalar setSkewThreshold(const scalar)
Set the skewness warning threshold as percentage.
label nInternal1Edges() const
Internal edges using 0 or 1 boundary point.
static const unsigned pointsPerFace_
Estimated number of points per face.
bool checkFaceSkewness(const pointField &points, const vectorField &fCtrs, const vectorField &fAreas, const vectorField &cellCtrs, const bool report, labelHashSet *setPtr) const
Check face skewness.
bool checkClosedCells(const vectorField &faceAreas, const scalarField &cellVolumes, const bool report, labelHashSet *setPtr, labelHashSet *aspectSetPtr, const Vector< label > &meshD) const
Check cells for closedness.
bool hasEdges() const noexcept
const labelListList & edgeCells() const
void resetGeometry(pointField &&faceCentres, pointField &&faceAreas, pointField &&cellCentres, scalarField &&cellVolumes)
Reset the local geometry.
virtual const labelList & faceNeighbour() const =0
Face face-neighbour addressing.
bool checkFacePyramids(const pointField &points, const vectorField &ctrs, const bool report, const bool detailedReport, const scalar minPyrVol, labelHashSet *setPtr) const
Check face pyramid volume.
static const unsigned facesPerCell_
Estimated number of faces per cell.
void clearGeom()
Clear geometry.
bool checkFaceOrthogonality(const vectorField &fAreas, const vectorField &cellCtrs, const bool report, labelHashSet *setPtr) const
Check for non-orthogonality.
bool hasCellEdges() const noexcept
static scalar closedThreshold_
Static data to control mesh checking.
void clearOut()
Clear all geometry and addressing unnecessary for CFD.
static const unsigned cellsPerPoint_
Estimated number of cells per point.
void calcCellCentresAndVols() const
Calculate cell centres and volumes.
bool hasPointEdges() const noexcept
label nInternalPoints() const noexcept
Points not on boundary.
bool hasFaceCentres() const noexcept
virtual bool checkMesh(const bool report=false) const
Check mesh for correctness. Returns false for no error.
virtual void updateGeom()
Update all geometric data.
virtual bool checkEdgeLength(const bool report, const scalar minLenSqr, labelHashSet *setPtr=nullptr) const
Check edge length.
label nInternalFaces() const noexcept
Number of internal faces.
bool hasCellCentres() const noexcept
bool hasEdgeFaces() const noexcept
bool hasEdgeCells() const noexcept
static scalar setNonOrthThreshold(const scalar)
Set the non-orthogonality warning threshold in degrees.
const vectorField & cellCentres() const
static const unsigned facesPerEdge_
Estimated number of faces per edge.
label nEdges() const
Number of mesh edges.
bool checkCellVolumes(const scalarField &vols, const bool report, const bool detailedReport, labelHashSet *setPtr) const
Check for negative cell volumes.
label nInternalEdges() const
Internal edges using 0,1 or 2 boundary points.
void reset(const label nPoints, const label nInternalFaces, const label nFaces, const label nCells)
Reset this primitiveMesh given the primitive array sizes.
static scalar planarCosAngle_
Threshold where faces are considered coplanar.
const direction noexcept
Definition: Scalar.H:258
static const unsigned edgesPerCell_
Estimated number of edges per cell.
bool hasCellPoints() const noexcept
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
void calcEdgeVectors() const
Calculate edge vectors.
bool hasPointCells() const noexcept
bool hasFaceEdges() const noexcept
bool hasFaceAreas() const noexcept
bool hasCells() const noexcept
virtual bool checkFaceVertices(const bool report=false, labelHashSet *setPtr=nullptr) const
Check uniqueness of face vertices.
bool hasPointFaces() const noexcept
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const vectorField & faceCentres() const
virtual ~primitiveMesh()
Destructor.
virtual bool checkTopology(const bool report=false) const
Check mesh topology for correctness.
bool hasCellVolumes() const noexcept
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:59
bool checkConcaveCells(const vectorField &fAreas, const pointField &fCentres, const bool report, labelHashSet *setPtr) const
Check for concave cells by the planes of faces.
label nCells() const noexcept
Number of mesh cells.
bool checkCommonOrder(const label, const Map< label > &, labelHashSet *) const
Check that shared points are in consecutive order.
void calcFaceCentresAndAreas() const
Calculate face centres and areas.
const vectorField & faceAreas() const
virtual const faceList & faces() const =0
Return faces.
label findNearestCell(const point &location) const
Find the cell with the nearest cell centre to location.
void clearCellGeom()
Clear cell-based geometry only.
bool checkDuplicateFaces(const label, const Map< label > &, label &nBaffleFaces, labelHashSet *) const
Check if all points on face are shared with another face.
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
const labelListList & pointPoints() const
const labelListList & pointFaces() const
virtual const labelList & faceOwner() const =0
Face face-owner addressing.
virtual bool checkCellsZipUp(const bool report=false, labelHashSet *setPtr=nullptr) const
Check cell zip-up.
virtual bool checkUpperTriangular(const bool report=false, labelHashSet *setPtr=nullptr) const
Check face ordering.
virtual bool checkPoints(const bool report=false, labelHashSet *setPtr=nullptr) const
Check for unused points.
virtual bool checkGeometry(const bool report=false) const
Check mesh geometry (& implicitly topology) for correctness.
bool hasPointPoints() const noexcept
bool checkFaceFlatness(const pointField &points, const vectorField &faceCentres, const vectorField &faceAreas, const bool report, const scalar warnFlatness, labelHashSet *setPtr) const
Check face warpage.
bool hasCellCells() const noexcept
virtual bool checkFaceFaces(const bool report=false, labelHashSet *setPtr=nullptr) const
Check face-face connectivity.
static scalar skewThreshold_
Skewness warning threshold.
static scalar nonOrthThreshold_
Non-orthogonality warning threshold in deg.
volScalarField & p
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
static bool calcPointOrder(label &nInternalPoints, labelList &pointMap, const faceList &, const label nInternalFaces, const label nPoints)
Helper function to calculate point ordering. Returns true.
label nInternal0Edges() const
Internal edges (i.e. not on boundary face) using no boundary point.
boundBox cellBb(const label celli) const
The bounding box for given cell index.
const labelListList & cellCells() const
const labelListList & edgeFaces() const
const labelListList & cellPoints() const
Namespace for OpenFOAM.
const scalarField & cellVolumes() const
bool pointInCellBB(const point &p, label celli, scalar inflationFraction=0) const
Return true if the point in the cell bounding box.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:56