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