primitiveMesh.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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::primitiveMesh
26 
27 Description
28  Cell-face mesh analysis engine
29 
30 SourceFiles
31  primitiveMeshI.H
32  primitiveMesh.C
33  primitiveMeshClear.C
34  primitiveMeshCellCells.C
35  primitiveMeshEdgeCells.C
36  primitiveMeshPointCells.C
37  primitiveMeshCells.C
38  primitiveMeshEdgeFaces.C
39  primitiveMeshPointFaces.C
40  primitiveMeshCellEdges.C
41  primitiveMeshPointEdges.C
42  primitiveMeshPointPoints.C
43  primitiveMeshEdges.C
44  primitiveMeshCellCentresAndVols.C
45  primitiveMeshFaceCentresAndAreas.C
46  primitiveMeshFindCell.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef primitiveMesh_H
51 #define primitiveMesh_H
52 
53 #include "DynamicList.H"
54 #include "edgeList.H"
55 #include "pointField.H"
56 #include "faceList.H"
57 #include "cellList.H"
58 #include "cellShapeList.H"
59 #include "labelList.H"
60 #include "boolList.H"
61 #include "HashSet.H"
62 #include "Map.H"
63 
64 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 
66 namespace Foam
67 {
68 
69 class PackedBoolList;
70 
71 /*---------------------------------------------------------------------------*\
72  Class primitiveMesh Declaration
73 \*---------------------------------------------------------------------------*/
74 
75 class primitiveMesh
76 {
77  // Permanent data
78 
79  // Primitive size data
80 
81  //- Number of internal points (or -1 if points not sorted)
82  label nInternalPoints_;
83 
84  //- Number of points
85  label nPoints_;
86 
87  //- Number of internal edges using 0 boundary points
88  mutable label nInternal0Edges_;
89 
90  //- Number of internal edges using 0 or 1 boundary points
91  mutable label nInternal1Edges_;
92 
93  //- Number of internal edges using 0,1 or 2boundary points
94  mutable label nInternalEdges_;
95 
96  //- Number of edges
97  mutable label nEdges_;
98 
99  //- Number of internal faces
100  label nInternalFaces_;
101 
102  //- Number of faces
103  label nFaces_;
104 
105  //- Number of cells
106  label nCells_;
107 
108 
109  // Shapes
110 
111  //- Cell shapes
112  mutable cellShapeList* cellShapesPtr_;
113 
114  //- Edges
115  mutable edgeList* edgesPtr_;
116 
117 
118  // Connectivity
119 
120  //- Cell-cells
121  mutable labelListList* ccPtr_;
122 
123  //- Edge-cells
124  mutable labelListList* ecPtr_;
125 
126  //- Point-cells
127  mutable labelListList* pcPtr_;
128 
129  //- Cell-faces
130  mutable cellList* cfPtr_;
131 
132  //- Edge-faces
133  mutable labelListList* efPtr_;
134 
135  //- Point-faces
136  mutable labelListList* pfPtr_;
137 
138  //- Cell-edges
139  mutable labelListList* cePtr_;
140 
141  //- Face-edges
142  mutable labelListList* fePtr_;
143 
144  //- Point-edges
145  mutable labelListList* pePtr_;
146 
147  //- Point-points
148  mutable labelListList* ppPtr_;
149 
150  //- Cell-points
151  mutable labelListList* cpPtr_;
152 
153 
154  // On-the-fly edge addressing storage
155 
156  //- Temporary storage for addressing.
157  mutable DynamicList<label> labels_;
158 
159  //- Temporary storage for addressing
160  mutable labelHashSet labelSet_;
161 
162 
163  // Geometric data
164 
165  //- Cell centres
166  mutable vectorField* cellCentresPtr_;
167 
168  //- Face centres
169  mutable vectorField* faceCentresPtr_;
170 
171  //- Cell volumes
172  mutable scalarField* cellVolumesPtr_;
173 
174  //- Face areas
175  mutable vectorField* faceAreasPtr_;
176 
177  //- Face area magnitudes
178  mutable scalarField* magFaceAreasPtr_;
179 
180 
181  // Topological calculations
182 
183  //- Calculate cell shapes
184  void calcCellShapes() const;
185 
186  //- Calculate cell-cell addressing
187  void calcCellCells() const;
188 
189  //- Calculate point-cell addressing
190  void calcPointCells() const;
191 
192  //- Calculate cell-face addressing
193  void calcCells() const;
194 
195  //- Calculate edge list
196  void calcCellEdges() const;
197 
198  //- Calculate point-point addressing
199  void calcPointPoints() const;
200 
201  //- Calculate edges, pointEdges and faceEdges (if doFaceEdges=true)
202  // During edge calculation, a larger set of data is assembled.
203  // Create and destroy as a set, using clearOutEdges()
204  void calcEdges(const bool doFaceEdges) const;
205  void clearOutEdges();
206  //- Helper: return (after optional creation) edge between two points
207  static label getEdge
208  (
211  const label,
212  const label
213  );
214  //- For on-the-fly addressing calculation
215  static label findFirstCommonElementFromSortedLists
216  (
217  const labelList&,
218  const labelList&
219  );
220 
221 protected:
222 
223  // Static Data Members
224 
225  //- Static data to control mesh checking
226 
227  //- Cell closedness warning threshold
228  // set as the fraction of un-closed area to closed area
229  static scalar closedThreshold_;
230 
231  //- Aspect ratio warning threshold
232  static scalar aspectThreshold_;
233 
234  //- Non-orthogonality warning threshold in deg
235  static scalar nonOrthThreshold_;
236 
237  //- Skewness warning threshold
238  static scalar skewThreshold_;
239 
240  //- Threshold where faces are considered coplanar
241  static scalar planarCosAngle_;
242 
243 
244  // Geometrical calculations
245 
246  //- Calculate face centres and areas
247  void calcFaceCentresAndAreas() const;
248 
250  (
251  const pointField& p,
252  vectorField& fCtrs,
253  vectorField& fAreas,
254  scalarField& magfAreas
255  ) const;
256 
257  //- Calculate cell centres and volumes
258  void calcCellCentresAndVols() const;
259 
261  (
262  const vectorField& fCtrs,
263  const vectorField& fAreas,
264  vectorField& cellCtrs,
266  ) const;
267 
268  //- Calculate edge vectors
269  void calcEdgeVectors() const;
270 
271 
272  // Mesh checking
273 
274  //- Check if all points on face are shared with another face.
276  (
277  const label,
278  const Map<label>&,
279  label& nBaffleFaces,
280  labelHashSet*
281  ) const;
282 
283  //- Check that shared points are in consecutive order.
284  bool checkCommonOrder
285  (
286  const label,
287  const Map<label>&,
288  labelHashSet*
289  ) const;
290 
291  //- Check boundary for closedness
293  (
294  const vectorField&,
295  const bool,
296  const PackedBoolList&
297  ) const;
298 
299  //- Check cells for closedness
300  bool checkClosedCells
301  (
302  const vectorField& faceAreas,
303  const scalarField& cellVolumes,
304  const bool report,
305  labelHashSet* setPtr,
306  labelHashSet* aspectSetPtr,
307  const Vector<label>& meshD
308  ) const;
309 
310  //- Check for negative face areas
311  bool checkFaceAreas
312  (
313  const vectorField& faceAreas,
314  const bool report,
315  const bool detailedReport,
316  labelHashSet* setPtr
317  ) const;
318 
319  //- Check for negative cell volumes
320  bool checkCellVolumes
321  (
322  const scalarField& vols,
323  const bool report,
324  const bool detailedReport,
325  labelHashSet* setPtr
326  ) const;
327 
328  //- Check for non-orthogonality
330  (
331  const vectorField& fAreas,
332  const vectorField& cellCtrs,
333  const bool report,
334  labelHashSet* setPtr
335  ) const;
336 
337  //- Check face pyramid volume
338  bool checkFacePyramids
339  (
340  const pointField& points,
341  const vectorField& ctrs,
342  const bool report,
343  const bool detailedReport,
344  const scalar minPyrVol,
345  labelHashSet* setPtr
346  ) const;
347 
348  //- Check face skewness
349  bool checkFaceSkewness
350  (
351  const pointField& points,
352  const vectorField& fCtrs,
353  const vectorField& fAreas,
354  const vectorField& cellCtrs,
355  const bool report,
356  labelHashSet* setPtr
357  ) const;
358 
359  //- Check face angles
360  // Allows a slight non-convexity. E.g. maxDeg = 10 allows for
361  // angles < 190 (or 10 degrees concavity) (if truly concave and
362  // points not visible from face centre the face-pyramid check in
363  // checkMesh will fail)
364  bool checkFaceAngles
365  (
366  const pointField& points,
367  const vectorField& faceAreas,
368  const bool report,
369  const scalar maxDeg,
370  labelHashSet* setPtr
371  ) const;
372 
373  //- Check face warpage
374  bool checkFaceFlatness
375  (
376  const pointField& points,
377  const vectorField& faceCentres,
378  const vectorField& faceAreas,
379  const bool report,
380  const scalar warnFlatness,
381  labelHashSet* setPtr
382  ) const;
383 
384  //- Check for concave cells by the planes of faces
385  bool checkConcaveCells
386  (
387  const vectorField& fAreas,
388  const pointField& fCentres,
389  const bool report,
390  labelHashSet* setPtr
391  ) const;
392 
393 
394  //- Construct null
395  primitiveMesh();
396 
397 
398 public:
399 
400  // Static data
401 
402  ClassName("primitiveMesh");
403 
404  //- Estimated number of cells per edge
405  static const unsigned cellsPerEdge_ = 4;
406 
407  //- Estimated number of cells per point
408  static const unsigned cellsPerPoint_ = 8;
409 
410  //- Estimated number of faces per cell
411  static const unsigned facesPerCell_ = 6;
412 
413  //- Estimated number of faces per edge
414  static const unsigned facesPerEdge_ = 4;
415 
416  //- Estimated number of faces per point
417  static const unsigned facesPerPoint_ = 12;
418 
419  //- Estimated number of edges per cell
420  static const unsigned edgesPerCell_ = 12;
421 
422  //- Estimated number of edges per cell
423  static const unsigned edgesPerFace_ = 4;
424 
425  //- Estimated number of edges per point
426  static const unsigned edgesPerPoint_ = 6;
427 
428  //- Estimated number of points per cell
429  static const unsigned pointsPerCell_ = 8;
430 
431  //- Estimated number of points per face
432  static const unsigned pointsPerFace_ = 4;
433 
434 
435  // Constructors
436 
437  //- Construct from components
439  (
440  const label nPoints,
441  const label nInternalFaces,
442  const label nFaces,
443  const label nCells
444  );
445 
446  //- Disallow default bitwise copy construction
448 
449 
450  //- Destructor
451  virtual ~primitiveMesh();
452 
453 
454  // Member Functions
455 
456  //- Reset this primitiveMesh given the primitive array sizes
457  void reset
458  (
459  const label nPoints,
460  const label nInternalFaces,
461  const label nFaces,
462  const label nCells
463  );
464 
465  //- Reset this primitiveMesh given the primitive array sizes and cells
466  void reset
467  (
468  const label nPoints,
469  const label nInternalFaces,
470  const label nFaces,
471  const label nCells,
472  cellList& cells
473  );
474 
475  //- Reset this primitiveMesh given the primitive array sizes and cells
476  void reset
477  (
478  const label nPoints,
479  const label nInternalFaces,
480  const label nFaces,
481  const label nCells,
482  cellList&& cells
483  );
484 
485 
486  // Access
487 
488  // Mesh size parameters
489 
490  inline label nPoints() const;
491  inline label nEdges() const;
492  inline label nInternalFaces() const;
493  inline label nFaces() const;
494  inline label nCells() const;
495 
496  // If points are ordered (nInternalPoints != -1):
497 
498  //- Points not on boundary
499  inline label nInternalPoints() const;
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;
510 
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;
525 
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  const scalarField& magFaceAreas() const;
589 
590 
591  // Mesh motion
592 
593  //- Move points, returns volumes swept by faces in motion
595  (
596  const pointField& p,
597  const pointField& oldP
598  );
599 
600 
601  //- Return true if given face label is internal to the mesh
602  inline bool isInternalFace(const label faceIndex) const;
603 
604 
605  // Topological checks
606 
607  //- Check face ordering
608  virtual bool checkUpperTriangular
609  (
610  const bool report = false,
611  labelHashSet* setPtr = nullptr
612  ) const;
613 
614  //- Check cell zip-up
615  virtual bool checkCellsZipUp
616  (
617  const bool report = false,
618  labelHashSet* setPtr = nullptr
619  ) const;
620 
621  //- Check uniqueness of face vertices
622  virtual bool checkFaceVertices
623  (
624  const bool report = false,
625  labelHashSet* setPtr = nullptr
626  ) const;
627 
628  //- Check for unused points
629  virtual bool checkPoints
630  (
631  const bool report = false,
632  labelHashSet* setPtr = nullptr
633  ) const;
634 
635  //- Check face-face connectivity
636  virtual bool checkFaceFaces
637  (
638  const bool report = false,
639  labelHashSet* setPtr = nullptr
640  ) const;
641 
642 
643  // Geometric checks
644 
645  //- Check boundary for closedness
646  virtual bool checkClosedBoundary(const bool report = false)
647  const;
648 
649  //- Check cells for closedness
650  virtual bool checkClosedCells
651  (
652  const bool report = false,
653  labelHashSet* setPtr = nullptr,
654  labelHashSet* highAspectSetPtr = nullptr,
655  const Vector<label>& solutionD = Vector<label>::one
656  ) const;
657 
658  //- Check for negative face areas
659  virtual bool checkFaceAreas
660  (
661  const bool report = false,
662  labelHashSet* setPtr = nullptr
663  ) const;
664 
665  //- Check for negative cell volumes
666  virtual bool checkCellVolumes
667  (
668  const bool report = false,
669  labelHashSet* setPtr = nullptr
670  ) const;
671 
672  //- Check for non-orthogonality
673  virtual bool checkFaceOrthogonality
674  (
675  const bool report = false,
676  labelHashSet* setPtr = nullptr
677  ) const;
678 
679  //- Check face pyramid volume
680  virtual bool checkFacePyramids
681  (
682  const bool report = false,
683  const scalar minPyrVol = -small,
684  labelHashSet* setPtr = nullptr
685  ) const;
686 
687  //- Check face skewness
688  virtual bool checkFaceSkewness
689  (
690  const bool report = false,
691  labelHashSet* setPtr = nullptr
692  ) const;
693 
694  //- Check face angles
695  virtual bool checkFaceAngles
696  (
697  const bool report = false,
698  const scalar maxSin = 10, // In degrees
699  labelHashSet* setPtr = nullptr
700  ) const;
701 
702  //- Check face warpage: decompose face and check ratio between
703  // magnitude of sum of triangle areas and sum of magnitude of
704  // triangle areas.
705  virtual bool checkFaceFlatness
706  (
707  const bool report,
708  const scalar warnFlatness, // When to include in set.
709  labelHashSet* setPtr
710  ) const;
711 
712  //- Check for point-point-nearness,
713  // e.g. colocated points which may be part of baffles.
714  virtual bool checkPointNearness
715  (
716  const bool report,
717  const scalar reportDistSqr,
718  labelHashSet* setPtr = nullptr
719  ) const;
720 
721  //- Check edge length
722  virtual bool checkEdgeLength
723  (
724  const bool report,
725  const scalar minLenSqr,
726  labelHashSet* setPtr = nullptr
727  ) const;
728 
729  //- Check for concave cells by the planes of faces
730  virtual bool checkConcaveCells
731  (
732  const bool report = false,
733  labelHashSet* setPtr = nullptr
734  ) const;
735 
736 
737  //- Check mesh topology for correctness.
738  // Returns false for no error.
739  virtual bool checkTopology(const bool report = false) const;
740 
741  //- Check mesh geometry (& implicitly topology) for correctness.
742  // Returns false for no error.
743  virtual bool checkGeometry(const bool report = false) const;
744 
745  //- Check mesh for correctness. Returns false for no error.
746  virtual bool checkMesh(const bool report = false) const;
747 
748  //- Set the closedness ratio warning threshold
749  static scalar setClosedThreshold(const scalar);
750 
751  //- Set the aspect ratio warning threshold
752  static scalar setAspectThreshold(const scalar);
753 
754  //- Set the non-orthogonality warning threshold in degrees
755  static scalar setNonOrthThreshold(const scalar);
756 
757  //- Set the skewness warning threshold as percentage
758  // of the face area vector
759  static scalar setSkewThreshold(const scalar);
760 
761 
762  // Useful derived info
763 
764  //- Return true if the point in the cell bounding box.
765  // The bounding box may be isotropically inflated by the fraction
766  // inflationFraction
767  bool pointInCellBB
768  (
769  const point& p,
770  label celli,
771  scalar inflationFraction = 0
772  ) const;
773 
774  //- Return true if the point is in the cell
775  bool pointInCell(const point& p, label celli) const;
776 
777  //- Find the cell with the nearest cell centre to location
778  label findNearestCell(const point& location) const;
779 
780  //- Find cell enclosing this location (-1 if not in mesh)
781  label findCell(const point& location) const;
782 
783 
784  // Storage management
785 
786  //- Print a list of all the currently allocated mesh data
787  void printAllocated() const;
788 
789  // Per storage whether allocated
790  inline bool hasCellShapes() const;
791  inline bool hasEdges() const;
792  inline bool hasCellCells() const;
793  inline bool hasEdgeCells() const;
794  inline bool hasPointCells() const;
795  inline bool hasCells() const;
796  inline bool hasEdgeFaces() const;
797  inline bool hasPointFaces() const;
798  inline bool hasCellEdges() const;
799  inline bool hasFaceEdges() const;
800  inline bool hasPointEdges() const;
801  inline bool hasPointPoints() const;
802  inline bool hasCellPoints() const;
803  inline bool hasCellCentres() const;
804  inline bool hasFaceCentres() const;
805  inline bool hasCellVolumes() const;
806  inline bool hasFaceAreas() const;
807 
808  // On-the-fly addressing calculation. These functions return either
809  // a reference to the full addressing (if already calculated) or
810  // a reference to the supplied storage. The one-argument ones
811  // use member DynamicList labels_ so be careful when not storing
812  // result.
813 
814  //- cellCells using cells.
815  const labelList& cellCells
816  (
817  const label celli,
819  ) const;
820 
821  const labelList& cellCells(const label celli) const;
822 
823  //- cellPoints using cells
824  const labelList& cellPoints
825  (
826  const label celli,
828  ) const;
829 
830  const labelList& cellPoints(const label celli) const;
831 
832  //- pointCells using pointFaces
833  const labelList& pointCells
834  (
835  const label pointi,
837  ) const;
838 
839  const labelList& pointCells(const label pointi) const;
840 
841  //- pointPoints using edges, pointEdges
842  const labelList& pointPoints
843  (
844  const label pointi,
846  ) const;
847 
848  const labelList& pointPoints(const label pointi) const;
849 
850  //- faceEdges using pointFaces, edges, pointEdges
851  const labelList& faceEdges
852  (
853  const label facei,
855  ) const;
856 
857  const labelList& faceEdges(const label facei) const;
858 
859  //- edgeFaces using pointFaces, edges, pointEdges
860  const labelList& edgeFaces
861  (
862  const label edgeI,
864  ) const;
865 
866  const labelList& edgeFaces(const label edgeI) const;
867 
868  //- edgeCells using pointFaces, edges, pointEdges
869  const labelList& edgeCells
870  (
871  const label edgeI,
873  ) const;
874 
875  const labelList& edgeCells(const label edgeI) const;
876 
877  //- cellEdges using cells, pointFaces, edges, pointEdges
878  const labelList& cellEdges
879  (
880  const label celli,
882  ) const;
883 
884  const labelList& cellEdges(const label celli) const;
885 
886 
887  //- Clear geometry
888  void clearGeom();
889 
890  //- Clear topological data
891  void clearAddressing();
892 
893  //- Clear all geometry and addressing unnecessary for CFD
894  void clearOut();
895 
896 
897  // Member Operators
898 
899  //- Disallow default bitwise assignment
900  void operator=(const primitiveMesh&) = delete;
901 };
902 
903 
904 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
905 
906 } // End namespace Foam
907 
908 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
909 
910 #include "primitiveMeshI.H"
911 
912 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
913 
914 #endif
915 
916 // ************************************************************************* //
bool hasEdgeFaces() const
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.
void makeFaceCentresAndAreas(const pointField &p, vectorField &fCtrs, vectorField &fAreas, scalarField &magfAreas) const
label findCell(const point &location) const
Find cell enclosing this location (-1 if not in mesh)
bool hasCellCentres() const
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
bool hasCellPoints() const
const labelListList & faceEdges() const
label nInternalFaces() const
void operator=(const primitiveMesh &)=delete
Disallow default bitwise assignment.
const labelListList & pointEdges() const
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:74
label nFaces() const
label nInternalPoints() const
Points not on boundary.
const cellShapeList & cellShapes() const
Return cell shapes.
bool hasCellCells() const
label nCells() const
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,.
label nInternal0Edges() const
Internal edges (i.e. not on boundary face) using.
virtual const pointField & points() const =0
Return mesh points.
primitiveMesh()
Construct null.
Definition: primitiveMesh.C:39
bool hasCellShapes() const
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.
bool hasFaceAreas() const
static const unsigned pointsPerCell_
Estimated number of points per cell.
static const unsigned edgesPerFace_
Estimated number of edges per cell.
virtual const pointField & oldPoints() const =0
Return old points for mesh motion.
static const unsigned facesPerPoint_
Estimated number of faces per point.
static scalar setAspectThreshold(const scalar)
Set the aspect ratio warning threshold.
static scalar setSkewThreshold(const scalar)
Set the skewness warning threshold as percentage.
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.
const scalarField & magFaceAreas() const
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
const labelListList & edgeCells() const
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.
tmp< scalarField > movePoints(const pointField &p, const pointField &oldP)
Move points, returns volumes swept by faces in motion.
bool checkFaceOrthogonality(const vectorField &fAreas, const vectorField &cellCtrs, const bool report, labelHashSet *setPtr) const
Check for non-orthogonality.
Pre-declare SubField and related Field type.
Definition: Field.H:56
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.
label nInternal1Edges() const
Internal edges using 0 or 1 boundary point.
void calcCellCentresAndVols() const
Calculate cell centres and volumes.
bool hasCells() const
virtual bool checkMesh(const bool report=false) const
Check mesh for correctness. Returns false for no error.
bool hasFaceCentres() const
virtual bool checkEdgeLength(const bool report, const scalar minLenSqr, labelHashSet *setPtr=nullptr) const
Check edge length.
void makeCellCentresAndVols(const vectorField &fCtrs, const vectorField &fAreas, vectorField &cellCtrs, scalarField &cellVols) const
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.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
const labelListList & pointCells() const
bool checkCellVolumes(const scalarField &vols, const bool report, const bool detailedReport, labelHashSet *setPtr) const
Check for negative cell volumes.
bool hasCellEdges() const
void reset(const label nPoints, const label nInternalFaces, const label nFaces, const label nCells)
Reset this primitiveMesh given the primitive array sizes.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
static scalar planarCosAngle_
Threshold where faces are considered coplanar.
static const unsigned edgesPerCell_
Estimated number of edges per cell.
void calcEdgeVectors() const
Calculate edge vectors.
const scalarField & cellVols
bool hasPointFaces() const
label nEdges() const
virtual bool checkFaceVertices(const bool report=false, labelHashSet *setPtr=nullptr) const
Check uniqueness of face vertices.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const vectorField & faceCentres() const
virtual ~primitiveMesh()
Destructor.
A bit-packed bool list.
virtual bool checkTopology(const bool report=false) const
Check mesh topology for correctness.
bool checkConcaveCells(const vectorField &fAreas, const pointField &fCentres, const bool report, labelHashSet *setPtr) const
Check for concave cells by the planes of faces.
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.
bool checkDuplicateFaces(const label, const Map< label > &, label &nBaffleFaces, labelHashSet *) const
Check if all points on face are shared with another face.
bool hasEdgeCells() const
bool hasPointPoints() const
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.
label nPoints() const
bool checkFaceFlatness(const pointField &points, const vectorField &faceCentres, const vectorField &faceAreas, const bool report, const scalar warnFlatness, labelHashSet *setPtr) const
Check face warpage.
bool hasCellVolumes() const
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
A class for managing temporary objects.
Definition: PtrList.H:53
bool checkClosedBoundary(const vectorField &, const bool, const PackedBoolList &) const
Check boundary for closedness.
static bool calcPointOrder(label &nInternalPoints, labelList &pointMap, const faceList &, const label nInternalFaces, const label nPoints)
Helper function to calculate point ordering. Returns true.
bool hasPointEdges() const
label nInternalEdges() const
Internal edges using 0,1 or 2 boundary points.
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.
bool hasPointCells() const
bool hasFaceEdges() const