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