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-2015 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  bool checkFaceAngles
364  (
365  const pointField& points,
366  const vectorField& faceAreas,
367  const bool report,
368  const scalar maxDeg,
369  labelHashSet* setPtr
370  ) const;
371 
372  //- Check face warpage
373  bool checkFaceFlatness
374  (
375  const pointField& points,
376  const vectorField& faceCentres,
377  const vectorField& faceAreas,
378  const bool report,
379  const scalar warnFlatness,
380  labelHashSet* setPtr
381  ) const;
382 
383  //- Check for concave cells by the planes of faces
384  bool checkConcaveCells
385  (
386  const vectorField& fAreas,
387  const pointField& fCentres,
388  const bool report,
389  labelHashSet* setPtr
390  ) const;
391 
392 
393  //- Construct null
394  primitiveMesh();
395 
396 
397 public:
398 
399  // Static data
400 
401  ClassName("primitiveMesh");
402 
403  //- Estimated number of cells per edge
404  static const unsigned cellsPerEdge_ = 4;
405 
406  //- Estimated number of cells per point
407  static const unsigned cellsPerPoint_ = 8;
408 
409  //- Estimated number of faces per cell
410  static const unsigned facesPerCell_ = 6;
411 
412  //- Estimated number of faces per edge
413  static const unsigned facesPerEdge_ = 4;
414 
415  //- Estimated number of faces per point
416  static const unsigned facesPerPoint_ = 12;
417 
418  //- Estimated number of edges per cell
419  static const unsigned edgesPerCell_ = 12;
420 
421  //- Estimated number of edges per cell
422  static const unsigned edgesPerFace_ = 4;
423 
424  //- Estimated number of edges per point
425  static const unsigned edgesPerPoint_ = 6;
426 
427  //- Estimated number of points per cell
428  static const unsigned pointsPerCell_ = 8;
429 
430  //- Estimated number of points per face
431  static const unsigned pointsPerFace_ = 4;
432 
433 
434  // Constructors
435 
436  //- Construct from components
438  (
439  const label nPoints,
440  const label nInternalFaces,
441  const label nFaces,
442  const label nCells
443  );
444 
445 
446  //- Destructor
447  virtual ~primitiveMesh();
448 
449 
450  // Member Functions
451 
452  //- Reset this primitiveMesh given the primitive array sizes
453  void reset
454  (
455  const label nPoints,
456  const label nInternalFaces,
457  const label nFaces,
458  const label nCells
459  );
460 
461  //- Reset this primitiveMesh given the primitive array sizes and cells
462  void reset
463  (
464  const label nPoints,
465  const label nInternalFaces,
466  const label nFaces,
467  const label nCells,
468  cellList& cells
469  );
470 
471 
472  //- Reset this primitiveMesh given the primitive array sizes and cells
473  void reset
474  (
475  const label nPoints,
476  const label nInternalFaces,
477  const label nFaces,
478  const label nCells,
479  const Xfer<cellList>& cells
480  );
481 
482 
483  // Access
484 
485  // Mesh size parameters
486 
487  inline label nPoints() const;
488  inline label nEdges() const;
489  inline label nInternalFaces() const;
490  inline label nFaces() const;
491  inline label nCells() const;
492 
493  // If points are ordered (nInternalPoints != -1):
494 
495  //- Points not on boundary
496  inline label nInternalPoints() const;
497 
498  //- Internal edges (i.e. not on boundary face) using
499  // no boundary point
500  inline label nInternal0Edges() const;
501  //- Internal edges using 0 or 1 boundary point
502  inline label nInternal1Edges() const;
503  //- Internal edges using 0,1 or 2 boundary points
504  inline label nInternalEdges() const;
505 
506 
507  // Primitive mesh data
508 
509  //- Return mesh points
510  virtual const pointField& points() const = 0;
511 
512  //- Return faces
513  virtual const faceList& faces() const = 0;
514 
515  //- Face face-owner addresing
516  virtual const labelList& faceOwner() const = 0;
517 
518  //- Face face-neighbour addressing
519  virtual const labelList& faceNeighbour() const = 0;
520 
521  //- Return old points for mesh motion
522  virtual const pointField& oldPoints() const = 0;
523 
524 
525  // Derived mesh data
526 
527  //- Return cell shapes
528  const cellShapeList& cellShapes() const;
529 
530  //- Return mesh edges. Uses calcEdges.
531  const edgeList& edges() const;
532 
533  //- Helper function to calculate cell-face addressing from
534  // face-cell addressing. If nCells is not provided it will
535  // scan for the maximum.
536  static void calcCells
537  (
538  cellList&,
539  const labelUList& own,
540  const labelUList& nei,
541  const label nCells = -1
542  );
543 
544  //- Helper function to calculate point ordering. Returns true
545  // if points already ordered, false and fills pointMap (old to
546  // new). Map splits points into those not used by any boundary
547  // face and those that are.
548  static bool calcPointOrder
549  (
551  labelList& pointMap,
552  const faceList&,
553  const label nInternalFaces,
554  const label nPoints
555  );
556 
557  // Return mesh connectivity
558 
559  const labelListList& cellCells() const;
560  // faceCells given as owner and neighbour
561  const labelListList& edgeCells() const;
562  const labelListList& pointCells() const;
563 
564  const cellList& cells() const;
565  // faceFaces considered unnecessary
566  const labelListList& edgeFaces() const;
567  const labelListList& pointFaces() const;
568 
569  const labelListList& cellEdges() const;
570  const labelListList& faceEdges() const;
571  // edgeEdges considered unnecessary
572  const labelListList& pointEdges() const;
573  const labelListList& pointPoints() const;
574  const labelListList& cellPoints() const;
575 
576 
577  // Geometric data (raw!)
578 
579  const vectorField& cellCentres() const;
580  const vectorField& faceCentres() const;
581  const scalarField& cellVolumes() const;
582  const vectorField& faceAreas() const;
583 
584 
585  // Mesh motion
586 
587  //- Move points, returns volumes swept by faces in motion
589  (
590  const pointField& p,
591  const pointField& oldP
592  );
593 
594 
595  //- Return true if given face label is internal to the mesh
596  inline bool isInternalFace(const label faceIndex) const;
597 
598 
599  // Topological checks
600 
601  //- Check face ordering
602  virtual bool checkUpperTriangular
603  (
604  const bool report = false,
605  labelHashSet* setPtr = NULL
606  ) const;
607 
608  //- Check cell zip-up
609  virtual bool checkCellsZipUp
610  (
611  const bool report = false,
612  labelHashSet* setPtr = NULL
613  ) const;
614 
615  //- Check uniqueness of face vertices
616  virtual bool checkFaceVertices
617  (
618  const bool report = false,
619  labelHashSet* setPtr = NULL
620  ) const;
621 
622  //- Check for unused points
623  virtual bool checkPoints
624  (
625  const bool report = false,
626  labelHashSet* setPtr = NULL
627  ) const;
628 
629  //- Check face-face connectivity
630  virtual bool checkFaceFaces
631  (
632  const bool report = false,
633  labelHashSet* setPtr = NULL
634  ) const;
635 
636 
637  // Geometric checks
638 
639  //- Check boundary for closedness
640  virtual bool checkClosedBoundary(const bool report = false)
641  const;
642 
643  //- Check cells for closedness
644  virtual bool checkClosedCells
645  (
646  const bool report = false,
647  labelHashSet* setPtr = NULL,
648  labelHashSet* highAspectSetPtr = NULL,
649  const Vector<label>& solutionD = Vector<label>::one
650  ) const;
651 
652  //- Check for negative face areas
653  virtual bool checkFaceAreas
654  (
655  const bool report = false,
656  labelHashSet* setPtr = NULL
657  ) const;
658 
659  //- Check for negative cell volumes
660  virtual bool checkCellVolumes
661  (
662  const bool report = false,
663  labelHashSet* setPtr = NULL
664  ) const;
665 
666  //- Check for non-orthogonality
667  virtual bool checkFaceOrthogonality
668  (
669  const bool report = false,
670  labelHashSet* setPtr = NULL
671  ) const;
672 
673  //- Check face pyramid volume
674  virtual bool checkFacePyramids
675  (
676  const bool report = false,
677  const scalar minPyrVol = -SMALL,
678  labelHashSet* setPtr = NULL
679  ) const;
680 
681  //- Check face skewness
682  virtual bool checkFaceSkewness
683  (
684  const bool report = false,
685  labelHashSet* setPtr = NULL
686  ) const;
687 
688  //- Check face angles
689  virtual bool checkFaceAngles
690  (
691  const bool report = false,
692  const scalar maxSin = 10, // In degrees
693  labelHashSet* setPtr = NULL
694  ) const;
695 
696  //- Check face warpage: decompose face and check ratio between
697  // magnitude of sum of triangle areas and sum of magnitude of
698  // triangle areas.
699  virtual bool checkFaceFlatness
700  (
701  const bool report,
702  const scalar warnFlatness, // When to include in set.
703  labelHashSet* setPtr
704  ) const;
705 
706  //- Check for point-point-nearness,
707  // e.g. colocated points which may be part of baffles.
708  virtual bool checkPointNearness
709  (
710  const bool report,
711  const scalar reportDistSqr,
712  labelHashSet* setPtr = NULL
713  ) const;
714 
715  //- Check edge length
716  virtual bool checkEdgeLength
717  (
718  const bool report,
719  const scalar minLenSqr,
720  labelHashSet* setPtr = NULL
721  ) const;
722 
723  //- Check for concave cells by the planes of faces
724  virtual bool checkConcaveCells
725  (
726  const bool report = false,
727  labelHashSet* setPtr = NULL
728  ) const;
729 
730 
731  //- Check mesh topology for correctness.
732  // Returns false for no error.
733  virtual bool checkTopology(const bool report = false) const;
734 
735  //- Check mesh geometry (& implicitly topology) for correctness.
736  // Returns false for no error.
737  virtual bool checkGeometry(const bool report = false) const;
738 
739  //- Check mesh for correctness. Returns false for no error.
740  virtual bool checkMesh(const bool report = false) const;
741 
742  //- Set the closedness ratio warning threshold
743  static scalar setClosedThreshold(const scalar);
744 
745  //- Set the aspect ratio warning threshold
746  static scalar setAspectThreshold(const scalar);
747 
748  //- Set the non-orthogonality warning threshold in degrees
749  static scalar setNonOrthThreshold(const scalar);
750 
751  //- Set the skewness warning threshold as percentage
752  // of the face area vector
753  static scalar setSkewThreshold(const scalar);
754 
755 
756  // Useful derived info
757 
758  //- Return true if the point in the cell bounding box.
759  // The bounding box may be isotropically inflated by the fraction
760  // inflationFraction
761  bool pointInCellBB
762  (
763  const point& p,
764  label celli,
765  scalar inflationFraction = 0
766  ) const;
767 
768  //- Return true if the point is in the cell
769  bool pointInCell(const point& p, label celli) const;
770 
771  //- Find the cell with the nearest cell centre to location
772  label findNearestCell(const point& location) const;
773 
774  //- Find cell enclosing this location (-1 if not in mesh)
775  label findCell(const point& location) const;
776 
777 
778  // Storage management
779 
780  //- Print a list of all the currently allocated mesh data
781  void printAllocated() const;
782 
783  // Per storage whether allocated
784  inline bool hasCellShapes() const;
785  inline bool hasEdges() const;
786  inline bool hasCellCells() const;
787  inline bool hasEdgeCells() const;
788  inline bool hasPointCells() const;
789  inline bool hasCells() const;
790  inline bool hasEdgeFaces() const;
791  inline bool hasPointFaces() const;
792  inline bool hasCellEdges() const;
793  inline bool hasFaceEdges() const;
794  inline bool hasPointEdges() const;
795  inline bool hasPointPoints() const;
796  inline bool hasCellPoints() const;
797  inline bool hasCellCentres() const;
798  inline bool hasFaceCentres() const;
799  inline bool hasCellVolumes() const;
800  inline bool hasFaceAreas() const;
801 
802  // On-the-fly addressing calculation. These functions return either
803  // a reference to the full addressing (if already calculated) or
804  // a reference to the supplied storage. The one-argument ones
805  // use member DynamicList labels_ so be careful when not storing
806  // result.
807 
808  //- cellCells using cells.
809  const labelList& cellCells
810  (
811  const label cellI,
813  ) const;
814 
815  const labelList& cellCells(const label cellI) const;
816 
817  //- cellPoints using cells
818  const labelList& cellPoints
819  (
820  const label cellI,
822  ) const;
823 
824  const labelList& cellPoints(const label cellI) const;
825 
826  //- pointCells using pointFaces
827  const labelList& pointCells
828  (
829  const label pointI,
831  ) const;
832 
833  const labelList& pointCells(const label pointI) const;
834 
835  //- pointPoints using edges, pointEdges
836  const labelList& pointPoints
837  (
838  const label pointI,
840  ) const;
841 
842  const labelList& pointPoints(const label pointI) const;
843 
844  //- faceEdges using pointFaces, edges, pointEdges
845  const labelList& faceEdges
846  (
847  const label faceI,
849  ) const;
850 
851  const labelList& faceEdges(const label faceI) const;
852 
853  //- edgeFaces using pointFaces, edges, pointEdges
854  const labelList& edgeFaces
855  (
856  const label edgeI,
858  ) const;
859 
860  const labelList& edgeFaces(const label edgeI) const;
861 
862  //- edgeCells using pointFaces, edges, pointEdges
863  const labelList& edgeCells
864  (
865  const label edgeI,
867  ) const;
868 
869  const labelList& edgeCells(const label edgeI) const;
870 
871  //- cellEdges using cells, pointFaces, edges, pointEdges
872  const labelList& cellEdges
873  (
874  const label cellI,
876  ) const;
877 
878  const labelList& cellEdges(const label cellI) const;
879 
880 
881  //- Clear geometry
882  void clearGeom();
883 
884  //- Clear topological data
885  void clearAddressing();
886 
887  //- Clear all geometry and addressing unnecessary for CFD
888  void clearOut();
889 };
890 
891 
892 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
893 
894 } // End namespace Foam
895 
896 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
897 
898 #include "primitiveMeshI.H"
899 
900 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
901 
902 #endif
903 
904 // ************************************************************************* //
const vectorField & faceAreas() const
bool checkFaceAreas(const vectorField &faceAreas, const bool report, const bool detailedReport, labelHashSet *setPtr) const
Check for negative face areas.
const labelListList & cellPoints() const
ClassName("primitiveMesh")
void makeCellCentresAndVols(const vectorField &fCtrs, const vectorField &fAreas, vectorField &cellCtrs, scalarField &cellVols) const
static const unsigned cellsPerPoint_
Estimated number of cells per point.
virtual bool checkPoints(const bool report=false, labelHashSet *setPtr=NULL) const
Check for unused points.
const labelListList & cellCells() const
virtual const pointField & points() const =0
Return mesh points.
bool hasCellPoints() const
static scalar closedThreshold_
Static data to control mesh checking.
label findCell(const point &location) const
Find cell enclosing this location (-1 if not in mesh)
label nFaces() const
bool hasCellVolumes() const
void calcCellCentresAndVols() const
Calculate cell centres and volumes.
bool checkFacePyramids(const pointField &points, const vectorField &ctrs, const bool report, const bool detailedReport, const scalar minPyrVol, labelHashSet *setPtr) const
Check face pyramid volume.
void clearAddressing()
Clear topological data.
static const unsigned cellsPerEdge_
Estimated number of cells per edge.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const labelListList & pointEdges() const
bool checkCellVolumes(const scalarField &vols, const bool report, const bool detailedReport, labelHashSet *setPtr) const
Check for negative cell volumes.
bool checkDuplicateFaces(const label, const Map< label > &, label &nBaffleFaces, labelHashSet *) const
Check if all points on face are shared with another face.
static const unsigned edgesPerFace_
Estimated number of edges per cell.
bool pointInCell(const point &p, label celli) const
Return true if the point is in the cell.
bool hasCellEdges() const
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
static scalar aspectThreshold_
Aspect ratio warning threshold.
bool checkClosedBoundary(const vectorField &, const bool, const PackedBoolList &) const
Check boundary for closedness.
virtual bool checkEdgeLength(const bool report, const scalar minLenSqr, labelHashSet *setPtr=NULL) const
Check edge length.
A bit-packed bool list.
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
static scalar planarCosAngle_
Threshold where faces are considered coplanar.
virtual bool checkCellsZipUp(const bool report=false, labelHashSet *setPtr=NULL) const
Check cell zip-up.
label nCells() const
const cellList & cells() const
const labelListList & pointCells() const
const scalarField & cellVols
void printAllocated() const
Print a list of all the currently allocated mesh data.
label nEdges() const
const vectorField & cellCentres() const
const cellShapeList & cellShapes() const
Return cell shapes.
virtual const faceList & faces() const =0
Return faces.
bool checkFaceAngles(const pointField &points, const vectorField &faceAreas, const bool report, const scalar maxDeg, labelHashSet *setPtr) const
Check face angles.
label nInternal1Edges() const
Internal edges using 0 or 1 boundary point.
bool hasCellCentres() const
static const unsigned facesPerPoint_
Estimated number of faces per point.
const labelListList & faceEdges() const
bool checkConcaveCells(const vectorField &fAreas, const pointField &fCentres, const bool report, labelHashSet *setPtr) const
Check for concave cells by the planes of faces.
const labelListList & cellEdges() const
static const unsigned pointsPerCell_
Estimated number of points per cell.
Namespace for OpenFOAM.
bool hasPointFaces() const
bool hasPointCells() const
label findNearestCell(const point &location) const
Find the cell with the nearest cell centre to location.
bool hasCells() const
bool hasEdges() const
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:74
label nInternal0Edges() const
Internal edges (i.e. not on boundary face) using.
virtual bool checkUpperTriangular(const bool report=false, labelHashSet *setPtr=NULL) const
Check face ordering.
void makeFaceCentresAndAreas(const pointField &p, vectorField &fCtrs, vectorField &fAreas) const
volScalarField & p
Definition: createFields.H:51
primitiveMesh()
Construct null.
Definition: primitiveMesh.C:39
static scalar setNonOrthThreshold(const scalar)
Set the non-orthogonality warning threshold in degrees.
void reset(const label nPoints, const label nInternalFaces, const label nFaces, const label nCells)
Reset this primitiveMesh given the primitive array sizes.
static const unsigned edgesPerCell_
Estimated number of edges per cell.
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 scalar skewThreshold_
Skewness warning threshold.
static scalar setSkewThreshold(const scalar)
Set the skewness warning threshold as percentage.
static const unsigned facesPerCell_
Estimated number of faces per cell.
virtual const pointField & oldPoints() const =0
Return old points for mesh motion.
static scalar nonOrthThreshold_
Non-orthogonality warning threshold in deg.
virtual bool checkFaceVertices(const bool report=false, labelHashSet *setPtr=NULL) const
Check uniqueness of face vertices.
virtual bool checkPointNearness(const bool report, const scalar reportDistSqr, labelHashSet *setPtr=NULL) const
Check for point-point-nearness,.
bool hasCellShapes() const
static const unsigned facesPerEdge_
Estimated number of faces per edge.
void clearOut()
Clear all geometry and addressing unnecessary for CFD.
virtual ~primitiveMesh()
Destructor.
static const unsigned pointsPerFace_
Estimated number of points per face.
const labelListList & pointFaces() const
static scalar setAspectThreshold(const scalar)
Set the aspect ratio warning threshold.
void calcFaceCentresAndAreas() const
Calculate face centres and areas.
bool hasFaceAreas() const
bool checkFaceOrthogonality(const vectorField &fAreas, const vectorField &cellCtrs, const bool report, labelHashSet *setPtr) const
Check for non-orthogonality.
label nInternalFaces() 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 setClosedThreshold(const scalar)
Set the closedness ratio warning threshold.
virtual bool checkFaceFaces(const bool report=false, labelHashSet *setPtr=NULL) const
Check face-face connectivity.
virtual bool checkMesh(const bool report=false) const
Check mesh for correctness. Returns false for no error.
bool hasEdgeCells() const
const labelListList & edgeFaces() const
bool checkFaceSkewness(const pointField &points, const vectorField &fCtrs, const vectorField &fAreas, const vectorField &cellCtrs, const bool report, labelHashSet *setPtr) const
Check face skewness.
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
label nInternalEdges() const
Internal edges using 0,1 or 2 boundary points.
tmp< scalarField > movePoints(const pointField &p, const pointField &oldP)
Move points, returns volumes swept by faces in motion.
bool pointInCellBB(const point &p, label celli, scalar inflationFraction=0) const
Return true if the point in the cell bounding box.
bool hasPointEdges() const
void clearGeom()
Clear geometry.
static const unsigned edgesPerPoint_
Estimated number of edges per point.
static bool calcPointOrder(label &nInternalPoints, labelList &pointMap, const faceList &, const label nInternalFaces, const label nPoints)
Helper function to calculate point ordering. Returns true.
void calcEdgeVectors() const
Calculate edge vectors.
const labelListList & edgeCells() const
const labelListList & pointPoints() const
bool checkCommonOrder(const label, const Map< label > &, labelHashSet *) const
Check that shared points are in consecutive order.
const scalarField & cellVolumes() const
bool hasPointPoints() const
virtual bool checkTopology(const bool report=false) const
Check mesh topology for correctness.
bool hasFaceEdges() const
bool hasCellCells() const
virtual const labelList & faceOwner() const =0
Face face-owner addresing.
bool hasEdgeFaces() const
virtual const labelList & faceNeighbour() const =0
Face face-neighbour addressing.
A class for managing temporary objects.
Definition: PtrList.H:118
label nInternalPoints() const
Points not on boundary.
label nPoints() const
virtual bool checkGeometry(const bool report=false) const
Check mesh geometry (& implicitly topology) for correctness.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
const vectorField & faceCentres() const
bool hasFaceCentres() const