primitiveMesh.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | foam-extend: Open Source CFD
4  \\ / O peration | Version: 3.2
5  \\ / A nd | Web: http://www.foam-extend.org
6  \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9  This file is part of foam-extend.
10 
11  foam-extend is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation, either version 3 of the License, or (at your
14  option) any later version.
15 
16  foam-extend is distributed in the hope that it will be useful, but
17  WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with foam-extend. 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  primitiveMeshEdgeVectors.C
47  primitiveMeshCheck.C
48  primitiveMeshCheckMotion.C
49  primitiveMeshFindCell.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef primitiveMesh_H
54 #define primitiveMesh_H
55 
56 #include "DynamicList.H"
57 #include "edgeList.H"
58 #include "pointField.H"
59 #include "SubField.H"
60 #include "SubList.H"
61 #include "faceList.H"
62 #include "cellList.H"
63 #include "cellShapeList.H"
64 #include "labelList.H"
65 #include "boolList.H"
66 #include "HashSet.H"
67 #include "Map.H"
68 #include "EdgeMap.H"
69 #include "tolerancesSwitch.H"
70 
71 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72 
73 namespace Foam
74 {
75 
76 /*---------------------------------------------------------------------------*\
77  Class primitiveMesh Declaration
78 \*---------------------------------------------------------------------------*/
79 
80 class primitiveMesh
81 {
82  // Permanent data
83 
84  // Primitive size data
85 
86  //- Number of points
88 
89  //- Number of edges
90  mutable label nEdges_;
91 
92  //- Number of internal faces
94 
95  //- Number of faces
96  label nFaces_;
97 
98  //- Number of cells
99  label nCells_;
100 
101 
102  // Shapes
103 
104  //- Cell shapes
105  mutable cellShapeList* cellShapesPtr_;
106 
107  //- Edges are ordered in upper triangular order
108  // Note: inconsistency with 1.6.x to re-instate
109  // parallelisation of point-based operations
110  // HJ, 9/Jul/2010
111  mutable edgeList* edgesPtr_;
112 
113 
114  // Connectivity
115 
116  //- Cell-cells
117  mutable labelListList* ccPtr_;
118 
119  //- Edge-cells
120  mutable labelListList* ecPtr_;
121 
122  //- Point-cells
123  mutable labelListList* pcPtr_;
124 
125  //- Cell-faces
126  mutable cellList* cfPtr_;
127 
128  //- Edge-faces
129  mutable labelListList* efPtr_;
130 
131  //- Point-faces
132  mutable labelListList* pfPtr_;
133 
134  //- Cell-edges
135  mutable labelListList* cePtr_;
136 
137  //- Face-edges
138  mutable labelListList* fePtr_;
139 
140  //- Point-edges
141  mutable labelListList* pePtr_;
142 
143  //- Point-points
144  mutable labelListList* ppPtr_;
145 
146  //- Cell-points
147  mutable labelListList* cpPtr_;
148 
149 
150  // On-the-fly edge addresing storage
151 
152  //- Temporary storage for addressing.
153  mutable dynamicLabelList labels_;
154 
155  //- Temporary storage for addressing
156  mutable labelHashSet labelSet_;
157 
158 
159  // Geometric data
160 
161  //- Cell centres
162  mutable vectorField* cellCentresPtr_;
163 
164  //- Face centres
165  mutable vectorField* faceCentresPtr_;
166 
167  //- Cell volumes
168  mutable scalarField* cellVolumesPtr_;
169 
170  //- Face areas
171  mutable vectorField* faceAreasPtr_;
172 
173 
174  // Private member functions
175 
176  //- Disallow construct as copy
178 
179  //- Disallow default bitwise assignment
180  void operator=(const primitiveMesh&);
181 
182 
183  // Topological calculations
184 
185  //- Calculate cell shapes
186  void calcCellShapes() const;
187 
188  //- Calculate cell-cell addressing
189  void calcCellCells() const;
190 
191  //- Calculate point-cell addressing
192  void calcPointCells() const;
193 
194  //- Calculate cell-face addressing
195  void calcCells() const;
196 
197  //- Calculate edge list
198  void calcCellEdges() const;
199 
200  //- Calculate point-edge addressing
201  void calcPointEdges() const;
202 
203  //- Calculate point-point addressing
204  void calcPointPoints() const;
205 
206  //- Calculate edges, pointEdges and faceEdges
207  void calcEdges() const;
208 
209  //- During edge calculation, a larger set of data is assembled.
210  // Create and destroy as a set, using clearOutEdges()
211  void clearOutEdges();
212 
213  //- Helper:
214  // return (after optional creation) edge between two points
215  static label getEdge
216  (
219  const label,
220  const label
221  );
222  //- For on-the-fly addressing calculation
224  (
225  const labelList&,
226  const labelList&
227  );
228 
229 
230  // Geometrical calculations
231 
232  //- Calculate face centres and areas
233  void calcFaceCentresAndAreas() const;
234 
236  (
237  const pointField& p,
238  vectorField& fCtrs,
239  vectorField& fAreas
240  ) const;
241 
242  //- Calculate cell centres and volumes
243  void calcCellCentresAndVols() const;
245  (
246  const vectorField& fCtrs,
247  const vectorField& fAreas,
248  vectorField& cellCtrs,
250  ) const;
251 
252  //- Calculate edge vectors
253  void calcEdgeVectors() const;
254 
255 
256  // Helper functions for mesh checking
257 
258  //- Check if all points on face are shared with another face.
260  (
261  const label,
262  const Map<label>&,
263  label& nBaffleFaces,
264  labelHashSet*
265  ) const;
266 
267  //- Check that shared points are in consecutive order.
268  bool checkCommonOrder
269  (
270  const label,
271  const Map<label>&,
272  labelHashSet*
273  ) const;
274 
275 
276 protected:
277 
278  //- Construct null
279  primitiveMesh();
280 
281 
282 public:
283 
284  // Static data
285 
286  ClassName("primitiveMesh");
287 
288 
289  // Static mesh analysis data
290 
291  //- Estimated number of cells per edge
292  static const unsigned cellsPerEdge_ = 4;
293 
294  //- Estimated number of cells per point
295  static const unsigned cellsPerPoint_ = 8;
296 
297  //- Estimated number of faces per cell
298  static const unsigned facesPerCell_ = 6;
299 
300  //- Estimated number of faces per edge
301  static const unsigned facesPerEdge_ = 4;
302 
303  //- Estimated number of faces per point
304  static const unsigned facesPerPoint_ = 12;
305 
306  //- Estimated number of edges per cell
307  static const unsigned edgesPerCell_ = 12;
308 
309  //- Estimated number of edges per cell
310  static const unsigned edgesPerFace_ = 4;
311 
312  //- Estimated number of edges per point
313  static const unsigned edgesPerPoint_ = 6;
314 
315  //- Estimated number of points per cell
316  static const unsigned pointsPerCell_ = 8;
317 
318  //- Estimated number of points per face
319  static const unsigned pointsPerFace_ = 4;
320 
321  //- Static data to control mesh checking
322 
323  //- Cell closedness warning threshold
324  // set as the fraction of un-closed area to closed area
325  static const debug::tolerancesSwitch closedThreshold_;
326 
327  //- Aspect ratio warning threshold
328  static const debug::tolerancesSwitch aspectThreshold_;
329 
330  //- Non-orthogonality warning threshold in deg
331  static Foam::debug::tolerancesSwitch nonOrthThreshold_;
332 
333  //- Skewness warning threshold
334  static const debug::tolerancesSwitch skewThreshold_;
335 
336  //- Face angle threshold
337  static Foam::debug::tolerancesSwitch faceAngleThreshold_;
338 
339  //- Face flatness threshold
340  static const debug::tolerancesSwitch faceFlatnessThreshold_;
341 
342 
343  // Constructors
344 
345  //- Construct from components
347  (
348  const label nPoints,
349  const label nInternalFaces,
350  const label nFaces,
351  const label nCells
352  );
353 
354 
355  // Destructor
356 
357  virtual ~primitiveMesh();
358 
359 
360  // Member Functions
361 
362  //- Reset this primitiveMesh given the primitive array sizes
363  void reset
364  (
365  const label nPoints,
366  const label nInternalFaces,
367  const label nFaces,
368  const label nCells
369  );
370 
371  //- Reset this primitiveMesh given the primitive array sizes and cells
372  void reset
373  (
374  const label nPoints,
375  const label nInternalFaces,
376  const label nFaces,
377  const label nCells,
378  cellList& cells
379  );
380 
381 
382  //- Reset this primitiveMesh given the primitive array sizes and cells
383  void reset
384  (
385  const label nPoints,
386  const label nInternalFaces,
387  const label nFaces,
388  const label nCells,
389  const Xfer<cellList>& cells
390  );
391 
392 
393  // Access
394 
395  // Mesh size parameters
396 
397  inline label nPoints() const;
398  inline label nEdges() const;
399  inline label nInternalFaces() const;
400  inline label nFaces() const;
401  inline label nCells() const;
402 
403 
404  // Primitive mesh data
405 
406  //- Return mesh points
407  virtual const pointField& points() const = 0;
408 
409  //- Return faces
410  virtual const faceList& faces() const = 0;
411 
412  //- Face face-owner addresing
413  virtual const labelList& faceOwner() const = 0;
414 
415  //- Face face-neighbour addressing
416  virtual const labelList& faceNeighbour() const = 0;
417 
418  //- Return old points for mesh motion
419  virtual const pointField& oldPoints() const = 0;
420 
421 
422  // Derived mesh data
423 
424  //- Return cell shapes
425  const cellShapeList& cellShapes() const;
426 
427  //- Return mesh edges. Uses calcEdges.
428  const edgeList& edges() const;
429 
430  //- Helper function to calculate cell-face addressing from
431  // face-cell addressing. If nCells is not provided it will
432  // scan for the maximum.
433  static void calcCells
434  (
435  cellList&,
436  const unallocLabelList& own,
437  const unallocLabelList& nei,
438  const label nCells = -1
439  );
440 
441  // Removed calcPointOrder - garbage. HJ, 27/Aug/2010
442 
443 
444  // Return mesh connectivity
445 
446  const labelListList& cellCells() const;
447  // faceCells given as owner and neighbour
448  const labelListList& edgeCells() const;
449  const labelListList& pointCells() const;
450 
451  const cellList& cells() const;
452  // faceFaces considered unnecessary
453  const labelListList& edgeFaces() const;
454  const labelListList& pointFaces() const;
455 
456  const labelListList& cellEdges() const;
457  const labelListList& faceEdges() const;
458  // edgeEdges considered unnecessary
459  const labelListList& pointEdges() const;
460  const labelListList& pointPoints() const;
461  const labelListList& cellPoints() const;
462 
463 
464  // Geometric data (raw!)
465 
466  const vectorField& cellCentres() const;
467  const vectorField& faceCentres() const;
468  const scalarField& cellVolumes() const;
469  const vectorField& faceAreas() const;
470 
471 
472  // Mesh motion
473 
474  //- Move points, returns volumes swept by faces in motion
476  (
477  const pointField& p,
478  const pointField& oldP
479  );
480 
481 
482  //- Return true if given face label is internal to the mesh
483  inline bool isInternalFace(const label faceIndex) const;
484 
485 
486  // Topological checks
487 
488  //- Check cell zip-up
489  bool checkCellsZipUp
490  (
491  const bool report = false,
492  labelHashSet* setPtr = NULL
493  ) const;
494 
495  //- Check uniqueness of face vertices
496  bool checkFaceVertices
497  (
498  const bool report = false,
499  labelHashSet* setPtr = NULL
500  ) const;
501 
502  //- Check face-face connectivity
503  bool checkFaceFaces
504  (
505  const bool report = false,
506  labelHashSet* setPtr = NULL
507  ) const;
508 
509  //- Check face ordering
511  (
512  const bool report = false,
513  labelHashSet* setPtr = NULL
514  ) const;
515 
516 
517  // Geometric checks
518 
519  //- Check boundary for closedness
520  bool checkClosedBoundary(const bool report = false) const;
521 
522  //- Check cells for closedness
523  bool checkClosedCells
524  (
525  const bool report = false,
526  labelHashSet* setPtr = NULL,
527  labelHashSet* highAspectSetPtr = NULL
528  ) const;
529 
530  //- Check for negative face areas
531  bool checkFaceAreas
532  (
533  const bool report = false,
534  labelHashSet* setPtr = NULL
535  ) const;
536 
537  //- Check for negative cell volumes
538  bool checkCellVolumes
539  (
540  const bool report = false,
541  labelHashSet* setPtr = NULL
542  ) const;
543 
544  //- Check for non-orthogonality
546  (
547  const bool report = false,
548  labelHashSet* setPtr = NULL
549  ) const;
550 
551  //- Check face pyramid volume
552  bool checkFacePyramids
553  (
554  const bool report = false,
555  const scalar minPyrVol = -SMALL,
556  labelHashSet* setPtr = NULL
557  ) const;
558 
559  //- Check face skewness
560  bool checkFaceSkewness
561  (
562  const bool report = false,
563  labelHashSet* setPtr = NULL
564  ) const;
565 
566  //- Check face angles
567  bool checkFaceAngles
568  (
569  const bool report = false,
570  labelHashSet* setPtr = NULL
571  ) const;
572 
573  //- Check face warpage: decompose face and check ratio between
574  // magnitude of sum of triangle areas and sum of magnitude of
575  // triangle areas.
576  bool checkFaceFlatness
577  (
578  const bool report,
579  labelHashSet* setPtr
580  ) const;
581 
582  //- Check edge alignment for 1D/2D cases
583  bool checkEdgeAlignment
584  (
585  const bool report,
586  const Vector<label>& directions,
587  labelHashSet* setPtr = NULL
588  ) const;
589 
590  //- Check for unused points
591  bool checkPoints
592  (
593  const bool report = false,
594  labelHashSet* setPtr = NULL
595  ) const;
596 
597  //- Check for point-point-nearness,
598  // e.g. colocated points which may be part of baffles.
599  bool checkPointNearness
600  (
601  const bool report,
602  const scalar reportDistSqr,
603  labelHashSet* setPtr = NULL
604  ) const;
605 
606  //- Check edge length
607  bool checkEdgeLength
608  (
609  const bool report,
610  const scalar minLenSqr,
611  labelHashSet* setPtr = NULL
612  ) const;
613 
614  //- Check cell determinant
616  (
617  const bool report = false,
618  labelHashSet* setPtr = NULL
619  ) const;
620 
621 
622  //- Check mesh topology for correctness.
623  // Returns false for no error.
624  bool checkTopology(const bool report = false) const;
625 
626  //- Check mesh geometry (& implicitly topology) for correctness.
627  // Returns false for no error.
628  bool checkGeometry(const bool report = false) const;
629 
630  //- Check mesh for correctness. Returns false for no error.
631  bool checkMesh(const bool report = false) const;
632 
633  //- Check mesh motion for correctness given motion points
634  bool checkMeshMotion
635  (
636  const pointField& newPoints,
637  const bool report = false
638  ) const;
639 
640 
641  // Useful derived info
642 
643  //- Is the point in the cell bounding box
644  bool pointInCellBB(const point& p, label celli) const;
645 
646  //- Is the point in the cell
647  bool pointInCell(const point& p, label celli) const;
648 
649  //- Find the cell with the nearest cell centre to location
650  label findNearestCell(const point& location) const;
651 
652  //- Find cell enclosing this location (-1 if not in mesh)
653  label findCell(const point& location) const;
654 
655 
656  // Storage management
657 
658  //- Print a list of all the currently allocated mesh data
659  void printAllocated() const;
660 
661  // Per storage whether allocated
662  inline bool hasCellShapes() const;
663  inline bool hasEdges() const;
664  inline bool hasCellCells() const;
665  inline bool hasEdgeCells() const;
666  inline bool hasPointCells() const;
667  inline bool hasCells() const;
668  inline bool hasEdgeFaces() const;
669  inline bool hasPointFaces() const;
670  inline bool hasCellEdges() const;
671  inline bool hasFaceEdges() const;
672  inline bool hasPointEdges() const;
673  inline bool hasPointPoints() const;
674  inline bool hasCellPoints() const;
675  inline bool hasCellCentres() const;
676  inline bool hasFaceCentres() const;
677  inline bool hasCellVolumes() const;
678  inline bool hasFaceAreas() const;
679 
680  // On-the-fly addressing calculation. These functions return either
681  // a reference to the full addressing (if already calculated) or
682  // a reference to the supplied storage. The one-argument ones
683  // use member DynamicList labels_ so be careful when not storing
684  // result.
685 
686  //- cellCells using cells.
687  const labelList& cellCells
688  (
689  const label cellI,
690  dynamicLabelList&
691  ) const;
692 
693  const labelList& cellCells(const label cellI) const;
694 
695  //- cellPoints using cells
696  const labelList& cellPoints
697  (
698  const label cellI,
699  dynamicLabelList&
700  ) const;
701 
702  const labelList& cellPoints(const label cellI) const;
703 
704  //- pointCells using pointFaces
705  const labelList& pointCells
706  (
707  const label pointI,
708  dynamicLabelList&
709  ) const;
710 
711  const labelList& pointCells(const label pointI) const;
712 
713  //- pointPoints using edges, pointEdges
714  const labelList& pointPoints
715  (
716  const label pointI,
717  dynamicLabelList&
718  ) const;
719 
720  const labelList& pointPoints(const label pointI) const;
721 
722  //- faceEdges using pointFaces, edges, pointEdges
723  const labelList& faceEdges
724  (
725  const label faceI,
726  dynamicLabelList&
727  ) const;
728 
729  const labelList& faceEdges(const label faceI) const;
730 
731  //- edgeFaces using pointFaces, edges, pointEdges
732  const labelList& edgeFaces
733  (
734  const label edgeI,
735  dynamicLabelList&
736  ) const;
737 
738  const labelList& edgeFaces(const label edgeI) const;
739 
740  //- edgeCells using pointFaces, edges, pointEdges
741  const labelList& edgeCells
742  (
743  const label edgeI,
744  dynamicLabelList&
745  ) const;
746 
747  const labelList& edgeCells(const label edgeI) const;
748 
749  //- cellEdges using cells, pointFaces, edges, pointEdges
750  const labelList& cellEdges
751  (
752  const label cellI,
753  dynamicLabelList&
754  ) const;
755 
756  const labelList& cellEdges(const label cellI) const;
757 
758 
759  //- Clear geometry
760  void clearGeom();
761 
762  //- Clear topological data
763  void clearAddressing();
764 
765  //- Clear all geometry and addressing unnecessary for CFD
766  void clearOut();
767 };
768 
769 
770 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
771 
772 } // End namespace Foam
773 
774 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
775 
776 #include "primitiveMeshI.H"
777 
778 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
779 
780 #endif
781 
782 // ************************************************************************* //
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
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
SubList.H
boolList.H
p
p
Definition: pEqn.H:62
SubField.H
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
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:56
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::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::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::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::directions
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
Definition: directions.H:63
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::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::calcCellEdges
void calcCellEdges() const
Calculate edge list.
Definition: primitiveMeshCellEdges.C:32
Foam::primitiveMesh::nCells
label nCells() const
Definition: primitiveMeshI.H:64
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::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
primitiveMeshI.H
Foam::primitiveMesh::hasCellCentres
bool hasCellCentres() const
Definition: primitiveMeshI.H:154
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
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::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::cellShapes
const cellShapeList & cellShapes() const
Return cell shapes.
Definition: primitiveMesh.C:230
Foam::primitiveMesh::checkEdgeAlignment
bool checkEdgeAlignment(const bool report, const Vector< label > &directions, labelHashSet *setPtr=NULL) const
Check edge alignment for 1D/2D cases.
Definition: primitiveMeshCheck.C:1150
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::checkCellDeterminant
bool checkCellDeterminant(const bool report=false, labelHashSet *setPtr=NULL) const
Check cell determinant.
Definition: primitiveMeshCheck.C:1944
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::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
EdgeMap.H
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::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::calcPointEdges
void calcPointEdges() const
Calculate point-edge addressing.
Definition: primitiveMeshPointEdges.C:35
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::faceFlatnessThreshold_
static const debug::tolerancesSwitch faceFlatnessThreshold_
Face flatness threshold.
Definition: primitiveMesh.H:339
Foam::primitiveMesh::hasPointFaces
bool hasPointFaces() const
Definition: primitiveMeshI.H:118
Foam::primitiveMesh::faceAngleThreshold_
static Foam::debug::tolerancesSwitch faceAngleThreshold_
Face angle threshold.
Definition: primitiveMesh.H:336
Foam::primitiveMesh::checkMeshMotion
bool checkMeshMotion(const pointField &newPoints, const bool report=false) const
Check mesh motion for correctness given motion points.
Definition: primitiveMeshCheckMotion.C:38
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