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-2019 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 
178  // Topological calculations
179 
180  //- Calculate cell shapes
181  void calcCellShapes() const;
182 
183  //- Calculate cell-cell addressing
184  void calcCellCells() const;
185 
186  //- Calculate point-cell addressing
187  void calcPointCells() const;
188 
189  //- Calculate cell-face addressing
190  void calcCells() const;
191 
192  //- Calculate edge list
193  void calcCellEdges() const;
194 
195  //- Calculate point-point addressing
196  void calcPointPoints() const;
197 
198  //- Calculate edges, pointEdges and faceEdges (if doFaceEdges=true)
199  // During edge calculation, a larger set of data is assembled.
200  // Create and destroy as a set, using clearOutEdges()
201  void calcEdges(const bool doFaceEdges) const;
202  void clearOutEdges();
203  //- Helper: return (after optional creation) edge between two points
204  static label getEdge
205  (
208  const label,
209  const label
210  );
211  //- For on-the-fly addressing calculation
212  static label findFirstCommonElementFromSortedLists
213  (
214  const labelList&,
215  const labelList&
216  );
217 
218 protected:
219 
220  // Static Data Members
221 
222  //- Static data to control mesh checking
223 
224  //- Cell closedness warning threshold
225  // set as the fraction of un-closed area to closed area
226  static scalar closedThreshold_;
227 
228  //- Aspect ratio warning threshold
229  static scalar aspectThreshold_;
230 
231  //- Non-orthogonality warning threshold in deg
232  static scalar nonOrthThreshold_;
233 
234  //- Skewness warning threshold
235  static scalar skewThreshold_;
236 
237  //- Threshold where faces are considered coplanar
238  static scalar planarCosAngle_;
239 
240 
241  // Geometrical calculations
242 
243  //- Calculate face centres and areas
244  void calcFaceCentresAndAreas() const;
246  (
247  const pointField& p,
248  vectorField& fCtrs,
249  vectorField& fAreas
250  ) const;
251 
252  //- Calculate cell centres and volumes
253  void calcCellCentresAndVols() const;
255  (
256  const vectorField& fCtrs,
257  const vectorField& fAreas,
258  vectorField& cellCtrs,
260  ) const;
261 
262  //- Calculate edge vectors
263  void calcEdgeVectors() const;
264 
265 
266  // Mesh checking
267 
268  //- Check if all points on face are shared with another face.
270  (
271  const label,
272  const Map<label>&,
273  label& nBaffleFaces,
274  labelHashSet*
275  ) const;
276 
277  //- Check that shared points are in consecutive order.
278  bool checkCommonOrder
279  (
280  const label,
281  const Map<label>&,
282  labelHashSet*
283  ) const;
284 
285  //- Check boundary for closedness
287  (
288  const vectorField&,
289  const bool,
290  const PackedBoolList&
291  ) const;
292 
293  //- Check cells for closedness
294  bool checkClosedCells
295  (
296  const vectorField& faceAreas,
297  const scalarField& cellVolumes,
298  const bool report,
299  labelHashSet* setPtr,
300  labelHashSet* aspectSetPtr,
301  const Vector<label>& meshD
302  ) const;
303 
304  //- Check for negative face areas
305  bool checkFaceAreas
306  (
307  const vectorField& faceAreas,
308  const bool report,
309  const bool detailedReport,
310  labelHashSet* setPtr
311  ) const;
312 
313  //- Check for negative cell volumes
314  bool checkCellVolumes
315  (
316  const scalarField& vols,
317  const bool report,
318  const bool detailedReport,
319  labelHashSet* setPtr
320  ) const;
321 
322  //- Check for non-orthogonality
324  (
325  const vectorField& fAreas,
326  const vectorField& cellCtrs,
327  const bool report,
328  labelHashSet* setPtr
329  ) const;
330 
331  //- Check face pyramid volume
332  bool checkFacePyramids
333  (
334  const pointField& points,
335  const vectorField& ctrs,
336  const bool report,
337  const bool detailedReport,
338  const scalar minPyrVol,
339  labelHashSet* setPtr
340  ) const;
341 
342  //- Check face skewness
343  bool checkFaceSkewness
344  (
345  const pointField& points,
346  const vectorField& fCtrs,
347  const vectorField& fAreas,
348  const vectorField& cellCtrs,
349  const bool report,
350  labelHashSet* setPtr
351  ) const;
352 
353  //- Check face angles
354  // Allows a slight non-convexity. E.g. maxDeg = 10 allows for
355  // angles < 190 (or 10 degrees concavity) (if truly concave and
356  // points not visible from face centre the face-pyramid check in
357  // checkMesh will fail)
358  bool checkFaceAngles
359  (
360  const pointField& points,
361  const vectorField& faceAreas,
362  const bool report,
363  const scalar maxDeg,
364  labelHashSet* setPtr
365  ) const;
366 
367  //- Check face warpage
368  bool checkFaceFlatness
369  (
370  const pointField& points,
371  const vectorField& faceCentres,
372  const vectorField& faceAreas,
373  const bool report,
374  const scalar warnFlatness,
375  labelHashSet* setPtr
376  ) const;
377 
378  //- Check for concave cells by the planes of faces
379  bool checkConcaveCells
380  (
381  const vectorField& fAreas,
382  const pointField& fCentres,
383  const bool report,
384  labelHashSet* setPtr
385  ) const;
386 
387 
388  //- Construct null
389  primitiveMesh();
390 
391 
392 public:
393 
394  // Static data
395 
396  ClassName("primitiveMesh");
397 
398  //- Estimated number of cells per edge
399  static const unsigned cellsPerEdge_ = 4;
400 
401  //- Estimated number of cells per point
402  static const unsigned cellsPerPoint_ = 8;
403 
404  //- Estimated number of faces per cell
405  static const unsigned facesPerCell_ = 6;
406 
407  //- Estimated number of faces per edge
408  static const unsigned facesPerEdge_ = 4;
409 
410  //- Estimated number of faces per point
411  static const unsigned facesPerPoint_ = 12;
412 
413  //- Estimated number of edges per cell
414  static const unsigned edgesPerCell_ = 12;
415 
416  //- Estimated number of edges per cell
417  static const unsigned edgesPerFace_ = 4;
418 
419  //- Estimated number of edges per point
420  static const unsigned edgesPerPoint_ = 6;
421 
422  //- Estimated number of points per cell
423  static const unsigned pointsPerCell_ = 8;
424 
425  //- Estimated number of points per face
426  static const unsigned pointsPerFace_ = 4;
427 
428 
429  // Constructors
430 
431  //- Construct from components
433  (
434  const label nPoints,
435  const label nInternalFaces,
436  const label nFaces,
437  const label nCells
438  );
439 
440  //- Disallow default bitwise copy construction
442 
443 
444  //- Destructor
445  virtual ~primitiveMesh();
446 
447 
448  // Member Functions
449 
450  //- Reset this primitiveMesh given the primitive array sizes
451  void reset
452  (
453  const label nPoints,
454  const label nInternalFaces,
455  const label nFaces,
456  const label nCells
457  );
458 
459  //- Reset this primitiveMesh given the primitive array sizes and cells
460  void reset
461  (
462  const label nPoints,
463  const label nInternalFaces,
464  const label nFaces,
465  const label nCells,
466  cellList& cells
467  );
468 
469  //- Reset this primitiveMesh given the primitive array sizes and cells
470  void reset
471  (
472  const label nPoints,
473  const label nInternalFaces,
474  const label nFaces,
475  const label nCells,
476  cellList&& cells
477  );
478 
479 
480  // Access
481 
482  // Mesh size parameters
483 
484  inline label nPoints() const;
485  inline label nEdges() const;
486  inline label nInternalFaces() const;
487  inline label nFaces() const;
488  inline label nCells() const;
489 
490  // If points are ordered (nInternalPoints != -1):
491 
492  //- Points not on boundary
493  inline label nInternalPoints() const;
494 
495  //- Internal edges (i.e. not on boundary face) using
496  // no boundary point
497  inline label nInternal0Edges() const;
498  //- Internal edges using 0 or 1 boundary point
499  inline label nInternal1Edges() const;
500  //- Internal edges using 0,1 or 2 boundary points
501  inline label nInternalEdges() const;
502 
503 
504  // Primitive mesh data
505 
506  //- Return mesh points
507  virtual const pointField& points() const = 0;
508 
509  //- Return faces
510  virtual const faceList& faces() const = 0;
511 
512  //- Face face-owner addressing
513  virtual const labelList& faceOwner() const = 0;
514 
515  //- Face face-neighbour addressing
516  virtual const labelList& faceNeighbour() const = 0;
517 
518  //- Return old points for mesh motion
519  virtual const pointField& oldPoints() const = 0;
520 
521 
522  // Derived mesh data
523 
524  //- Return cell shapes
525  const cellShapeList& cellShapes() const;
526 
527  //- Return mesh edges. Uses calcEdges.
528  const edgeList& edges() const;
529 
530  //- Helper function to calculate cell-face addressing from
531  // face-cell addressing. If nCells is not provided it will
532  // scan for the maximum.
533  static void calcCells
534  (
535  cellList&,
536  const labelUList& own,
537  const labelUList& nei,
538  const label nCells = -1
539  );
540 
541  //- Helper function to calculate point ordering. Returns true
542  // if points already ordered, false and fills pointMap (old to
543  // new). Map splits points into those not used by any boundary
544  // face and those that are.
545  static bool calcPointOrder
546  (
548  labelList& pointMap,
549  const faceList&,
550  const label nInternalFaces,
551  const label nPoints
552  );
553 
554  // Return mesh connectivity
555 
556  const labelListList& cellCells() const;
557  // faceCells given as owner and neighbour
558  const labelListList& edgeCells() const;
559  const labelListList& pointCells() const;
560 
561  const cellList& cells() const;
562  // faceFaces considered unnecessary
563  const labelListList& edgeFaces() const;
564  const labelListList& pointFaces() const;
565 
566  const labelListList& cellEdges() const;
567  const labelListList& faceEdges() const;
568  // edgeEdges considered unnecessary
569  const labelListList& pointEdges() const;
570  const labelListList& pointPoints() const;
571  const labelListList& cellPoints() const;
572 
573 
574  // Geometric data (raw!)
575 
576  const vectorField& cellCentres() const;
577  const vectorField& faceCentres() const;
578  const scalarField& cellVolumes() const;
579  const vectorField& faceAreas() const;
580 
581 
582  // Mesh motion
583 
584  //- Move points, returns volumes swept by faces in motion
586  (
587  const pointField& p,
588  const pointField& oldP
589  );
590 
591 
592  //- Return true if given face label is internal to the mesh
593  inline bool isInternalFace(const label faceIndex) const;
594 
595 
596  // Topological checks
597 
598  //- Check face ordering
599  virtual bool checkUpperTriangular
600  (
601  const bool report = false,
602  labelHashSet* setPtr = nullptr
603  ) const;
604 
605  //- Check cell zip-up
606  virtual bool checkCellsZipUp
607  (
608  const bool report = false,
609  labelHashSet* setPtr = nullptr
610  ) const;
611 
612  //- Check uniqueness of face vertices
613  virtual bool checkFaceVertices
614  (
615  const bool report = false,
616  labelHashSet* setPtr = nullptr
617  ) const;
618 
619  //- Check for unused points
620  virtual bool checkPoints
621  (
622  const bool report = false,
623  labelHashSet* setPtr = nullptr
624  ) const;
625 
626  //- Check face-face connectivity
627  virtual bool checkFaceFaces
628  (
629  const bool report = false,
630  labelHashSet* setPtr = nullptr
631  ) const;
632 
633 
634  // Geometric checks
635 
636  //- Check boundary for closedness
637  virtual bool checkClosedBoundary(const bool report = false)
638  const;
639 
640  //- Check cells for closedness
641  virtual bool checkClosedCells
642  (
643  const bool report = false,
644  labelHashSet* setPtr = nullptr,
645  labelHashSet* highAspectSetPtr = nullptr,
646  const Vector<label>& solutionD = Vector<label>::one
647  ) const;
648 
649  //- Check for negative face areas
650  virtual bool checkFaceAreas
651  (
652  const bool report = false,
653  labelHashSet* setPtr = nullptr
654  ) const;
655 
656  //- Check for negative cell volumes
657  virtual bool checkCellVolumes
658  (
659  const bool report = false,
660  labelHashSet* setPtr = nullptr
661  ) const;
662 
663  //- Check for non-orthogonality
664  virtual bool checkFaceOrthogonality
665  (
666  const bool report = false,
667  labelHashSet* setPtr = nullptr
668  ) const;
669 
670  //- Check face pyramid volume
671  virtual bool checkFacePyramids
672  (
673  const bool report = false,
674  const scalar minPyrVol = -small,
675  labelHashSet* setPtr = nullptr
676  ) const;
677 
678  //- Check face skewness
679  virtual bool checkFaceSkewness
680  (
681  const bool report = false,
682  labelHashSet* setPtr = nullptr
683  ) const;
684 
685  //- Check face angles
686  virtual bool checkFaceAngles
687  (
688  const bool report = false,
689  const scalar maxSin = 10, // In degrees
690  labelHashSet* setPtr = nullptr
691  ) const;
692 
693  //- Check face warpage: decompose face and check ratio between
694  // magnitude of sum of triangle areas and sum of magnitude of
695  // triangle areas.
696  virtual bool checkFaceFlatness
697  (
698  const bool report,
699  const scalar warnFlatness, // When to include in set.
700  labelHashSet* setPtr
701  ) const;
702 
703  //- Check for point-point-nearness,
704  // e.g. colocated points which may be part of baffles.
705  virtual bool checkPointNearness
706  (
707  const bool report,
708  const scalar reportDistSqr,
709  labelHashSet* setPtr = nullptr
710  ) const;
711 
712  //- Check edge length
713  virtual bool checkEdgeLength
714  (
715  const bool report,
716  const scalar minLenSqr,
717  labelHashSet* setPtr = nullptr
718  ) const;
719 
720  //- Check for concave cells by the planes of faces
721  virtual bool checkConcaveCells
722  (
723  const bool report = false,
724  labelHashSet* setPtr = nullptr
725  ) const;
726 
727 
728  //- Check mesh topology for correctness.
729  // Returns false for no error.
730  virtual bool checkTopology(const bool report = false) const;
731 
732  //- Check mesh geometry (& implicitly topology) for correctness.
733  // Returns false for no error.
734  virtual bool checkGeometry(const bool report = false) const;
735 
736  //- Check mesh for correctness. Returns false for no error.
737  virtual bool checkMesh(const bool report = false) const;
738 
739  //- Set the closedness ratio warning threshold
740  static scalar setClosedThreshold(const scalar);
741 
742  //- Set the aspect ratio warning threshold
743  static scalar setAspectThreshold(const scalar);
744 
745  //- Set the non-orthogonality warning threshold in degrees
746  static scalar setNonOrthThreshold(const scalar);
747 
748  //- Set the skewness warning threshold as percentage
749  // of the face area vector
750  static scalar setSkewThreshold(const scalar);
751 
752 
753  // Useful derived info
754 
755  //- Return true if the point in the cell bounding box.
756  // The bounding box may be isotropically inflated by the fraction
757  // inflationFraction
758  bool pointInCellBB
759  (
760  const point& p,
761  label celli,
762  scalar inflationFraction = 0
763  ) const;
764 
765  //- Return true if the point is in the cell
766  bool pointInCell(const point& p, label celli) const;
767 
768  //- Find the cell with the nearest cell centre to location
769  label findNearestCell(const point& location) const;
770 
771  //- Find cell enclosing this location (-1 if not in mesh)
772  label findCell(const point& location) const;
773 
774 
775  // Storage management
776 
777  //- Print a list of all the currently allocated mesh data
778  void printAllocated() const;
779 
780  // Per storage whether allocated
781  inline bool hasCellShapes() const;
782  inline bool hasEdges() const;
783  inline bool hasCellCells() const;
784  inline bool hasEdgeCells() const;
785  inline bool hasPointCells() const;
786  inline bool hasCells() const;
787  inline bool hasEdgeFaces() const;
788  inline bool hasPointFaces() const;
789  inline bool hasCellEdges() const;
790  inline bool hasFaceEdges() const;
791  inline bool hasPointEdges() const;
792  inline bool hasPointPoints() const;
793  inline bool hasCellPoints() const;
794  inline bool hasCellCentres() const;
795  inline bool hasFaceCentres() const;
796  inline bool hasCellVolumes() const;
797  inline bool hasFaceAreas() const;
798 
799  // On-the-fly addressing calculation. These functions return either
800  // a reference to the full addressing (if already calculated) or
801  // a reference to the supplied storage. The one-argument ones
802  // use member DynamicList labels_ so be careful when not storing
803  // result.
804 
805  //- cellCells using cells.
806  const labelList& cellCells
807  (
808  const label celli,
810  ) const;
811 
812  const labelList& cellCells(const label celli) const;
813 
814  //- cellPoints using cells
815  const labelList& cellPoints
816  (
817  const label celli,
819  ) const;
820 
821  const labelList& cellPoints(const label celli) const;
822 
823  //- pointCells using pointFaces
824  const labelList& pointCells
825  (
826  const label pointi,
828  ) const;
829 
830  const labelList& pointCells(const label pointi) const;
831 
832  //- pointPoints using edges, pointEdges
833  const labelList& pointPoints
834  (
835  const label pointi,
837  ) const;
838 
839  const labelList& pointPoints(const label pointi) const;
840 
841  //- faceEdges using pointFaces, edges, pointEdges
842  const labelList& faceEdges
843  (
844  const label facei,
846  ) const;
847 
848  const labelList& faceEdges(const label facei) const;
849 
850  //- edgeFaces using pointFaces, edges, pointEdges
851  const labelList& edgeFaces
852  (
853  const label edgeI,
855  ) const;
856 
857  const labelList& edgeFaces(const label edgeI) const;
858 
859  //- edgeCells using pointFaces, edges, pointEdges
860  const labelList& edgeCells
861  (
862  const label edgeI,
864  ) const;
865 
866  const labelList& edgeCells(const label edgeI) const;
867 
868  //- cellEdges using cells, pointFaces, edges, pointEdges
869  const labelList& cellEdges
870  (
871  const label celli,
873  ) const;
874 
875  const labelList& cellEdges(const label celli) const;
876 
877 
878  //- Clear geometry
879  void clearGeom();
880 
881  //- Clear topological data
882  void clearAddressing();
883 
884  //- Clear all geometry and addressing unnecessary for CFD
885  void clearOut();
886 
887 
888  // Member Operators
889 
890  //- Disallow default bitwise assignment
891  void operator=(const primitiveMesh&) = delete;
892 };
893 
894 
895 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
896 
897 } // End namespace Foam
898 
899 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
900 
901 #include "primitiveMeshI.H"
902 
903 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
904 
905 #endif
906 
907 // ************************************************************************* //
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.
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
void makeFaceCentresAndAreas(const pointField &p, vectorField &fCtrs, vectorField &fAreas) 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.
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.
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