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)
83 
84  //- Number of points
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
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
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 // ************************************************************************* //
Foam::primitiveMesh::printAllocated
void printAllocated() const
Print a list of all the currently allocated mesh data.
Definition: primitiveMeshClear.C:32
Foam::primitiveMesh::fePtr_
labelListList * fePtr_
Face-edges.
Definition: primitiveMesh.H:137
Foam::primitiveMesh::clearGeom
void clearGeom()
Clear geometry.
Definition: primitiveMeshClear.C:126
Foam::primitiveMesh::checkPointNearness
bool checkPointNearness(const bool report, const scalar reportDistSqr, labelHashSet *setPtr=NULL) const
Check for point-point-nearness,.
Definition: primitiveMeshCheckPointNearness.C:32
primitiveMeshI.H
Foam::PackedBoolList
A bit-packed bool list.
Definition: PackedBoolList.H:63
Foam::primitiveMesh::nCells_
label nCells_
Number of cells.
Definition: primitiveMesh.H:98
Foam::primitiveMesh::makeFaceCentresAndAreas
void makeFaceCentresAndAreas(const pointField &p, vectorField &fCtrs, vectorField &fAreas) const
Definition: primitiveMeshFaceCentresAndAreas.C:74
Foam::primitiveMesh::pePtr_
labelListList * pePtr_
Point-edges.
Definition: primitiveMesh.H:140
Foam::primitiveMesh::hasPointEdges
bool hasPointEdges() const
Definition: primitiveMeshI.H:136
Foam::primitiveMesh::skewThreshold_
static scalar skewThreshold_
Skewness warning threshold.
Definition: primitiveMesh.H:243
boolList.H
p
p
Definition: pEqn.H:62
Foam::primitiveMesh::nInternal1Edges_
label nInternal1Edges_
Number of internal edges using 0 or 1 boundary points.
Definition: primitiveMesh.H:90
Foam::primitiveMesh::nInternalEdges
label nInternalEdges() const
Internal edges using 0,1 or 2 boundary points.
Definition: primitiveMeshI.H:63
Foam::primitiveMesh::points
virtual const pointField & points() const =0
Return mesh points.
Foam::primitiveMesh::primitiveMesh
primitiveMesh()
Construct null.
Definition: primitiveMesh.C:36
Foam::primitiveMesh::ppPtr_
labelListList * ppPtr_
Point-points.
Definition: primitiveMesh.H:143
Foam::primitiveMesh::pointsPerFace_
static const unsigned pointsPerFace_
Estimated number of points per face.
Definition: primitiveMesh.H:318
Foam::primitiveMesh::checkMesh
bool checkMesh(const bool report=false) const
Check mesh for correctness. Returns false for no error.
Definition: primitiveMeshCheck.C:2131
Foam::primitiveMesh::clearAddressing
void clearAddressing()
Clear topological data.
Definition: primitiveMeshClear.C:142
Foam::primitiveMesh::cellPoints
const labelListList & cellPoints() const
Definition: primitiveMeshCellPoints.C:31
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::DynamicList< label >
Foam::primitiveMesh::faces
virtual const faceList & faces() const =0
Return faces.
Foam::primitiveMesh::facesPerCell_
static const unsigned facesPerCell_
Estimated number of faces per cell.
Definition: primitiveMesh.H:297
Foam::primitiveMesh::~primitiveMesh
virtual ~primitiveMesh()
Definition: primitiveMesh.C:112
Foam::primitiveMesh::nInternal0Edges
label nInternal0Edges() const
Internal edges (i.e. not on boundary face) using.
Definition: primitiveMeshI.H:47
Foam::primitiveMesh::edgeFaces
const labelListList & edgeFaces() const
Definition: primitiveMeshEdgeFaces.C:31
Foam::primitiveMesh::checkFaceVertices
bool checkFaceVertices(const bool report=false, labelHashSet *setPtr=NULL) const
Check uniqueness of face vertices.
Definition: primitiveMeshCheck.C:1553
Foam::primitiveMesh::pointFaces
const labelListList & pointFaces() const
Definition: primitiveMeshPointFaces.C:32
Foam::primitiveMesh::faceOwner
virtual const labelList & faceOwner() const =0
Face face-owner addresing.
Foam::primitiveMesh::setSkewThreshold
static scalar setSkewThreshold(const scalar)
Set the skewness warning threshold as percentage.
Definition: primitiveMeshCheck.C:2012
Foam::primitiveMesh::calcCells
void calcCells() const
Calculate cell-face addressing.
Definition: primitiveMeshCells.C:99
cellShapeList.H
Foam::primitiveMesh::cells
const cellList & cells() const
Definition: primitiveMeshCells.C:136
Foam::primitiveMesh::pointInCell
bool pointInCell(const point &p, label celli) const
Is the point in the cell.
Definition: primitiveMeshFindCell.C:44
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:1629
Foam::primitiveMesh::labelSet_
labelHashSet labelSet_
Temporary storage for addressing.
Definition: primitiveMesh.H:155
Foam::primitiveMesh::ecPtr_
labelListList * ecPtr_
Edge-cells.
Definition: primitiveMesh.H:119
Foam::primitiveMesh::hasCellVolumes
bool hasCellVolumes() const
Definition: primitiveMeshI.H:166
Foam::primitiveMesh::hasEdges
bool hasEdges() const
Definition: primitiveMeshI.H:82
Foam::Map< label >
Foam::primitiveMesh::cellVolumesPtr_
scalarField * cellVolumesPtr_
Cell volumes.
Definition: primitiveMesh.H:167
Foam::primitiveMesh::hasCellEdges
bool hasCellEdges() const
Definition: primitiveMeshI.H:124
Foam::primitiveMesh::aspectThreshold_
static scalar aspectThreshold_
Aspect ratio warning threshold.
Definition: primitiveMesh.H:237
Foam::primitiveMesh::edges
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
Definition: primitiveMeshEdges.C:353
Foam::primitiveMesh::edgesPerFace_
static const unsigned edgesPerFace_
Estimated number of edges per cell.
Definition: primitiveMesh.H:309
Foam::primitiveMesh::pointEdges
const labelListList & pointEdges() const
Definition: primitiveMeshPointEdges.C:96
Foam::primitiveMesh::pfPtr_
labelListList * pfPtr_
Point-faces.
Definition: primitiveMesh.H:131
faceList.H
Foam::HashSet< label, Hash< label > >
Foam::primitiveMesh::nEdges
label nEdges() const
Definition: primitiveMeshI.H:41
Foam::primitiveMesh::nEdges_
label nEdges_
Number of edges.
Definition: primitiveMesh.H:89
Foam::primitiveMesh::checkFaceAreas
bool checkFaceAreas(const bool report=false, labelHashSet *setPtr=NULL) const
Check for negative face areas.
Definition: primitiveMeshCheck.C:338
Foam::primitiveMesh::nInternal0Edges_
label nInternal0Edges_
Number of internal edges using 0 boundary points.
Definition: primitiveMesh.H:87
Foam::Xfer
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
Foam::primitiveMesh::edgesPerPoint_
static const unsigned edgesPerPoint_
Estimated number of edges per point.
Definition: primitiveMesh.H:312
Foam::primitiveMesh::calcEdges
void calcEdges() const
Calculate edges, pointEdges and faceEdges.
Definition: primitiveMeshEdges.C:74
Foam::primitiveMesh::checkTopology
bool checkTopology(const bool report=false) const
Check mesh topology for correctness.
Definition: primitiveMeshCheck.C:2065
Foam::primitiveMesh::facesPerEdge_
static const unsigned facesPerEdge_
Estimated number of faces per edge.
Definition: primitiveMesh.H:300
Foam::primitiveMesh::faceNeighbour
virtual const labelList & faceNeighbour() const =0
Face face-neighbour addressing.
Foam::primitiveMesh::hasFaceEdges
bool hasFaceEdges() const
Definition: primitiveMeshI.H:130
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:874
Foam::primitiveMesh::calcCellEdges
void calcCellEdges() const
Calculate edge list.
Definition: primitiveMeshCellEdges.C:32
Foam::primitiveMesh::nCells
label nCells() const
Definition: primitiveMeshI.H:64
Foam::primitiveMesh::setClosedThreshold
static scalar setClosedThreshold(const scalar)
Set the closedness ratio warning threshold.
Definition: primitiveMeshCheck.C:1985
Map.H
Foam::primitiveMesh::findNearestCell
label findNearestCell(const point &location) const
Find the cell with the nearest cell centre to location.
Definition: primitiveMeshFindCell.C:70
Foam::primitiveMesh::checkGeometry
bool checkGeometry(const bool report=false) const
Check mesh geometry (& implicitly topology) for correctness.
Definition: primitiveMeshCheck.C:2098
Foam::primitiveMesh::nPoints
label nPoints() const
Definition: primitiveMeshI.H:35
Foam::primitiveMesh::setNonOrthThreshold
static scalar setNonOrthThreshold(const scalar)
Set the non-orthogonality warning threshold in degrees.
Definition: primitiveMeshCheck.C:2003
Foam::primitiveMesh::calcCellCells
void calcCellCells() const
Calculate cell-cell addressing.
Definition: primitiveMeshCellCells.C:31
Foam::primitiveMesh::checkFaceFlatness
bool checkFaceFlatness(const bool report, labelHashSet *setPtr) const
Check face warpage: decompose face and check ratio between.
Definition: primitiveMeshCheck.C:1020
Foam::label
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
labelList.H
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::primitiveMesh::calcCellCentresAndVols
void calcCellCentresAndVols() const
Calculate cell centres and volumes.
Definition: primitiveMeshCellCentresAndVols.C:36
Foam::primitiveMesh::findCell
label findCell(const point &location) const
Find cell enclosing this location (-1 if not in mesh)
Definition: primitiveMeshFindCell.C:93
Foam::primitiveMesh::cellEdges
const labelListList & cellEdges() const
Definition: primitiveMeshCellEdges.C:118
Foam::primitiveMesh::checkEdgeLength
bool checkEdgeLength(const bool report, const scalar minLenSqr, labelHashSet *setPtr=NULL) const
Check edge length.
Definition: primitiveMeshCheckEdgeLength.C:31
Foam::primitiveMesh::hasCellCentres
bool hasCellCentres() const
Definition: primitiveMeshI.H:154
Foam::primitiveMesh::nonOrthThreshold_
static scalar nonOrthThreshold_
Non-orthogonality warning threshold in deg.
Definition: primitiveMesh.H:240
Foam::primitiveMesh::faceEdges
const labelListList & faceEdges() const
Definition: primitiveMeshEdges.C:366
Foam::primitiveMesh::cellCells
const labelListList & cellCells() const
Definition: primitiveMeshCellCells.C:100
Foam::primitiveMesh::checkFaceOrthogonality
bool checkFaceOrthogonality(const bool report=false, labelHashSet *setPtr=NULL) const
Check for non-orthogonality.
Definition: primitiveMeshCheck.C:464
Foam::primitiveMesh::nInternalFaces_
label nInternalFaces_
Number of internal faces.
Definition: primitiveMesh.H:92
cellVols
const scalarField & cellVols
Definition: temperatureAndPressureVariables.H:49
Foam::primitiveMesh::faceCentresPtr_
vectorField * faceCentresPtr_
Face centres.
Definition: primitiveMesh.H:164
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
Foam::primitiveMesh::pcPtr_
labelListList * pcPtr_
Point-cells.
Definition: primitiveMesh.H:122
HashSet.H
Foam::primitiveMesh::cfPtr_
cellList * cfPtr_
Cell-faces.
Definition: primitiveMesh.H:125
Foam::primitiveMesh::edgeCells
const labelListList & edgeCells() const
Definition: primitiveMeshEdgeCells.C:32
Foam::primitiveMesh::cellShapesPtr_
cellShapeList * cellShapesPtr_
Cell shapes.
Definition: primitiveMesh.H:104
Foam::primitiveMesh::calcFaceCentresAndAreas
void calcFaceCentresAndAreas() const
Calculate face centres and areas.
Definition: primitiveMeshFaceCentresAndAreas.C:38
edgeList.H
Foam::primitiveMesh::ccPtr_
labelListList * ccPtr_
Cell-cells.
Definition: primitiveMesh.H:116
Foam::primitiveMesh::nInternalFaces
label nInternalFaces() const
Definition: primitiveMeshI.H:52
Foam::primitiveMesh::clearOutEdges
void clearOutEdges()
During edge calculation, a larger set of data is assembled.
Definition: primitiveMeshEdges.C:379
Foam::primitiveMesh::aspectThreshold_
static const debug::tolerancesSwitch aspectThreshold_
Aspect ratio warning threshold.
Definition: primitiveMesh.H:327
Foam::primitiveMesh::ClassName
ClassName("primitiveMesh")
Foam::primitiveMesh::checkClosedBoundary
bool checkClosedBoundary(const bool report=false) const
Check boundary for closedness.
Definition: primitiveMeshCheck.C:79
Foam::primitiveMesh::checkFaceSkewness
bool checkFaceSkewness(const bool report=false, labelHashSet *setPtr=NULL) const
Check face skewness.
Definition: primitiveMeshCheck.C:669
Foam::primitiveMesh::findFirstCommonElementFromSortedLists
static label findFirstCommonElementFromSortedLists(const labelList &, const labelList &)
For on-the-fly addressing calculation.
Definition: primitiveMeshEdges.C:312
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::primitiveMesh::nInternalPoints
label nInternalPoints() const
Points not on boundary.
Definition: primitiveMeshI.H:35
Foam::primitiveMesh::calcPointCells
void calcPointCells() const
Calculate point-cell addressing.
Definition: primitiveMeshPointCells.C:31
Foam::primitiveMesh::cellVolumes
const scalarField & cellVolumes() const
Definition: primitiveMeshCellCentresAndVols.C:222
Foam::primitiveMesh::nInternal1Edges
label nInternal1Edges() const
Internal edges using 0 or 1 boundary point.
Definition: primitiveMeshI.H:55
Foam::primitiveMesh::cellShapes
const cellShapeList & cellShapes() const
Return cell shapes.
Definition: primitiveMesh.C:230
Foam::primitiveMesh::checkUpperTriangular
bool checkUpperTriangular(const bool report=false, labelHashSet *setPtr=NULL) const
Check face ordering.
Definition: primitiveMeshCheck.C:1285
Foam::primitiveMesh::hasFaceAreas
bool hasFaceAreas() const
Definition: primitiveMeshI.H:172
Foam::primitiveMesh::hasFaceCentres
bool hasFaceCentres() const
Definition: primitiveMeshI.H:160
Foam::primitiveMesh::labels_
dynamicLabelList labels_
Temporary storage for addressing.
Definition: primitiveMesh.H:152
Foam::primitiveMesh::edgesPerCell_
static const unsigned edgesPerCell_
Estimated number of edges per cell.
Definition: primitiveMesh.H:306
Foam::primitiveMesh::hasEdgeCells
bool hasEdgeCells() const
Definition: primitiveMeshI.H:94
pointField.H
Foam::primitiveMesh::closedThreshold_
static const debug::tolerancesSwitch closedThreshold_
Static data to control mesh checking.
Definition: primitiveMesh.H:324
Foam::primitiveMesh::hasPointPoints
bool hasPointPoints() const
Definition: primitiveMeshI.H:142
Foam::primitiveMesh::checkClosedCells
bool checkClosedCells(const bool report=false, labelHashSet *setPtr=NULL, labelHashSet *highAspectSetPtr=NULL) const
Check cells for closedness.
Definition: primitiveMeshCheck.C:135
Foam::primitiveMesh::cellCentres
const vectorField & cellCentres() const
Definition: primitiveMeshCellCentresAndVols.C:211
Foam::primitiveMesh::cpPtr_
labelListList * cpPtr_
Cell-points.
Definition: primitiveMesh.H:146
Foam::primitiveMesh::nonOrthThreshold_
static Foam::debug::tolerancesSwitch nonOrthThreshold_
Non-orthogonality warning threshold in deg.
Definition: primitiveMesh.H:330
Foam::primitiveMesh::nFaces
label nFaces() const
Definition: primitiveMeshI.H:58
Foam::primitiveMesh::makeCellCentresAndVols
void makeCellCentresAndVols(const vectorField &fCtrs, const vectorField &fAreas, vectorField &cellCtrs, scalarField &cellVols) const
Definition: primitiveMeshCellCentresAndVols.C:75
Foam::primitiveMesh::hasCells
bool hasCells() const
Definition: primitiveMeshI.H:106
Foam::primitiveMesh::checkFaceAngles
bool checkFaceAngles(const bool report=false, labelHashSet *setPtr=NULL) const
Check face angles.
Definition: primitiveMeshCheck.C:892
Foam::primitiveMesh::planarCosAngle_
static scalar planarCosAngle_
Threshold where faces are considered coplanar.
Definition: primitiveMesh.H:246
Foam::primitiveMesh::setAspectThreshold
static scalar setAspectThreshold(const scalar)
Set the aspect ratio warning threshold.
Definition: primitiveMeshCheck.C:1994
Foam::primitiveMesh::facesPerPoint_
static const unsigned facesPerPoint_
Estimated number of faces per point.
Definition: primitiveMesh.H:303
Foam::primitiveMesh::nPoints_
label nPoints_
Number of points.
Definition: primitiveMesh.H:86
Foam::primitiveMesh::skewThreshold_
static const debug::tolerancesSwitch skewThreshold_
Skewness warning threshold.
Definition: primitiveMesh.H:333
Foam::Vector< label >
Foam::primitiveMesh::faceAreasPtr_
vectorField * faceAreasPtr_
Face areas.
Definition: primitiveMesh.H:170
Foam::primitiveMesh::checkCellVolumes
bool checkCellVolumes(const bool report=false, labelHashSet *setPtr=NULL) const
Check for negative cell volumes.
Definition: primitiveMeshCheck.C:397
Foam::primitiveMesh::oldPoints
virtual const pointField & oldPoints() const =0
Return old points for mesh motion.
Foam::List< cellShape >
Foam::primitiveMesh::checkPoints
bool checkPoints(const bool report=false, labelHashSet *setPtr=NULL) const
Check for unused points.
Definition: primitiveMeshCheck.C:814
Foam::primitiveMesh::cePtr_
labelListList * cePtr_
Cell-edges.
Definition: primitiveMesh.H:134
Foam::primitiveMesh::efPtr_
labelListList * efPtr_
Edge-faces.
Definition: primitiveMesh.H:128
Foam::primitiveMesh::isInternalFace
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
Definition: primitiveMeshI.H:70
Foam::primitiveMesh::checkFaceFaces
bool checkFaceFaces(const bool report=false, labelHashSet *setPtr=NULL) const
Check face-face connectivity.
Definition: primitiveMeshCheck.C:1834
Foam::primitiveMesh::faceCentres
const vectorField & faceCentres() const
Definition: primitiveMeshFaceCentresAndAreas.C:130
Foam::primitiveMesh::edgesPtr_
edgeList * edgesPtr_
Edges are ordered in upper triangular order.
Definition: primitiveMesh.H:110
Foam::UList
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
Foam::primitiveMesh::hasEdgeFaces
bool hasEdgeFaces() const
Definition: primitiveMeshI.H:112
Foam::primitiveMesh::calcEdgeVectors
void calcEdgeVectors() const
Calculate edge vectors.
Foam::primitiveMesh::hasCellShapes
bool hasCellShapes() const
Definition: primitiveMeshI.H:76
Foam::primitiveMesh::pointCells
const labelListList & pointCells() const
Definition: primitiveMeshPointCells.C:108
Foam::primitiveMesh::movePoints
tmp< scalarField > movePoints(const pointField &p, const pointField &oldP)
Move points, returns volumes swept by faces in motion.
Definition: primitiveMesh.C:193
Foam::primitiveMesh::calcCellShapes
void calcCellShapes() const
Calculate cell shapes.
Definition: primitiveMeshCalcCellShapes.C:33
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:121
Foam::primitiveMesh::nFaces_
label nFaces_
Number of faces.
Definition: primitiveMesh.H:95
Foam::primitiveMesh::getEdge
static label getEdge(List< dynamicLabelList > &, DynamicList< edge > &, const label, const label)
Helper:
Definition: primitiveMeshEdges.C:36
Foam::primitiveMesh::nInternalEdges_
label nInternalEdges_
Number of internal edges using 0,1 or 2boundary points.
Definition: primitiveMesh.H:93
Foam::primitiveMesh::hasCellCells
bool hasCellCells() const
Definition: primitiveMeshI.H:88
Foam::primitiveMesh::clearOut
void clearOut()
Clear all geometry and addressing unnecessary for CFD.
Definition: primitiveMeshClear.C:171
Foam::primitiveMesh::pointInCellBB
bool pointInCellBB(const point &p, label celli) const
Is the point in the cell bounding box.
Definition: primitiveMeshFindCell.C:33
Foam::primitiveMesh::cellCentresPtr_
vectorField * cellCentresPtr_
Cell centres.
Definition: primitiveMesh.H:161
DynamicList.H
Foam::primitiveMesh::hasPointCells
bool hasPointCells() const
Definition: primitiveMeshI.H:100
Foam::primitiveMesh::calcPointPoints
void calcPointPoints() const
Calculate point-point addressing.
Definition: primitiveMeshPointPoints.C:30
Foam::primitiveMesh::checkCellsZipUp
bool checkCellsZipUp(const bool report=false, labelHashSet *setPtr=NULL) const
Check cell zip-up.
Definition: primitiveMeshCheck.C:1452
Foam::primitiveMesh::cellsPerPoint_
static const unsigned cellsPerPoint_
Estimated number of cells per point.
Definition: primitiveMesh.H:294
Foam::primitiveMesh::labels_
DynamicList< label > labels_
Temporary storage for addressing.
Definition: primitiveMesh.H:156
Foam::primitiveMesh::hasPointFaces
bool hasPointFaces() const
Definition: primitiveMeshI.H:118
Foam::primitiveMesh::nInternalPoints_
label nInternalPoints_
Number of internal points (or -1 if points not sorted)
Definition: primitiveMesh.H:81
Foam::primitiveMesh::pointsPerCell_
static const unsigned pointsPerCell_
Estimated number of points per cell.
Definition: primitiveMesh.H:315
Foam::primitiveMesh::checkFacePyramids
bool checkFacePyramids(const bool report=false, const scalar minPyrVol=-SMALL, labelHashSet *setPtr=NULL) const
Check face pyramid volume.
Definition: primitiveMeshCheck.C:585
Foam::primitiveMesh::cellsPerEdge_
static const unsigned cellsPerEdge_
Estimated number of cells per edge.
Definition: primitiveMesh.H:291
Foam::primitiveMesh::hasCellPoints
bool hasCellPoints() const
Definition: primitiveMeshI.H:148
Foam::primitiveMesh::checkCommonOrder
bool checkCommonOrder(const label, const Map< label > &, labelHashSet *) const
Check that shared points are in consecutive order.
Definition: primitiveMeshCheck.C:1671
Foam::primitiveMesh::pointPoints
const labelListList & pointPoints() const
Definition: primitiveMeshPointPoints.C:91
Foam::primitiveMesh::operator=
void operator=(const primitiveMesh &)
Disallow default bitwise assignment.
Foam::primitiveMesh::faceAreas
const vectorField & faceAreas() const
Definition: primitiveMeshFaceCentresAndAreas.C:141
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:79