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