53#ifndef Foam_primitiveMesh_H
54#define Foam_primitiveMesh_H
87 label nInternalPoints_;
93 mutable label nInternal0Edges_;
96 mutable label nInternal1Edges_;
99 mutable label nInternalEdges_;
102 mutable label nEdges_;
105 label nInternalFaces_;
117 mutable std::unique_ptr<cellShapeList> cellShapesPtr_;
120 mutable std::unique_ptr<edgeList> edgesPtr_;
126 mutable std::unique_ptr<labelListList> ccPtr_;
129 mutable std::unique_ptr<labelListList> ecPtr_;
132 mutable std::unique_ptr<labelListList> pcPtr_;
135 mutable std::unique_ptr<cellList> cfPtr_;
138 mutable std::unique_ptr<labelListList> efPtr_;
141 mutable std::unique_ptr<labelListList> pfPtr_;
144 mutable std::unique_ptr<labelListList> cePtr_;
147 mutable std::unique_ptr<labelListList> fePtr_;
150 mutable std::unique_ptr<labelListList> pePtr_;
153 mutable std::unique_ptr<labelListList> ppPtr_;
156 mutable std::unique_ptr<labelListList> cpPtr_;
171 mutable std::unique_ptr<vectorField> cellCentresPtr_;
174 mutable std::unique_ptr<vectorField> faceCentresPtr_;
177 mutable std::unique_ptr<scalarField> cellVolumesPtr_;
180 mutable std::unique_ptr<vectorField> faceAreasPtr_;
189 void operator=(
const primitiveMesh&) =
delete;
195 void calcCellShapes()
const;
198 void calcCellCells()
const;
201 void calcPointCells()
const;
204 void calcCells()
const;
207 void calcCellEdges()
const;
210 void calcCellPoints()
const;
213 void calcPointPoints()
const;
218 void calcEdges(
const bool doFaceEdges)
const;
219 void clearOutEdges();
281 const bitSet& internalOrCoupledFaces
300 const bool detailedReport,
309 const bool detailedReport,
328 const bool detailedReport,
329 const scalar minPyrVol,
365 const scalar warnFlatness,
467 virtual bool init(
const bool doInit)
481 inline label
nEdges() const;
541 static
void calcCells
609 const
bool report = false,
616 const
bool report = false,
623 const
bool report = false,
630 const
bool report = false,
637 const
bool report = false,
651 const
bool report = false,
660 const
bool report = false,
667 const
bool report = false,
674 const
bool report = false,
681 const
bool report = false,
682 const scalar minPyrVol = -SMALL,
689 const
bool report = false,
696 const
bool report = false,
697 const scalar maxSin = 10,
707 const scalar warnFlatness,
716 const scalar reportDistSqr,
724 const scalar minLenSqr,
731 const
bool report = false,
745 virtual
bool checkMesh(const
bool report = false) const;
773 scalar inflationFraction = 0
914#include "primitiveMeshI.H"
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
A HashTable to objects of type <T> with a label key.
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A bounding box defined in terms of min/max extrema points.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
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.
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.
const labelListList & pointCells() const
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
boundBox cellBb(const label celli) const
The bounding box for given cell index.
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
Internal edges (i.e. not on boundary face) using no boundary point.
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.
List< edge > edgeList
List of edge.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
List< face > faceList
List of faces.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
List< cell > cellList
List of cell.
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
List< cellShape > cellShapeList
List of cellShape.