1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh 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.
16 cfMesh 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
21 You should have received a copy of the GNU General Public License
22 along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
28 A set of functions used for mesh checking mesh quality
31 polyMeshGenAddressingChecks.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef polyMeshGenChecks_H
36 #define polyMeshGenChecks_H
38 #include "polyMeshGen.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Namespace polyMeshGenChecks functions Declaration
49 \*---------------------------------------------------------------------------*/
51 namespace polyMeshGenChecks
55 //- Check boundary closedness
56 bool checkClosedBoundary(const polyMeshGen&, const bool report = false);
58 //- Check cells for closedness
62 const bool report = false,
63 const scalar aspectWarn = 1000,
64 labelHashSet* setPtr = NULL
67 //- Check for negative cell volumes
71 const bool report = false,
72 labelHashSet* setPtr = NULL
75 //- Check for negative face areas
79 const bool report = false,
80 const scalar minFaceArea = VSMALL,
81 labelHashSet* setPtr = NULL,
82 const boolList* changedFacePtr = NULL
85 //- Check for negative part tetrahedra
86 //- Cells are decomposed into tetrahedra formed by
87 //- the cell centre, face centre and the edge vertices
88 bool checkCellPartTetrahedra
91 const bool report = false,
92 const scalar minPartTet = VSMALL,
93 labelHashSet* setPtr = NULL,
94 const boolList* changedFacePtr = NULL
97 //- Check for non-orthogonality
98 void checkFaceDotProduct
102 const boolList* changedFacePtr = NULL
105 bool checkFaceDotProduct
108 const bool report = false,
109 const scalar nonOrthWarn = 70.0,
110 labelHashSet* setPtr = NULL,
111 const boolList* changedFacePtr = NULL
114 //- Check face pyramid volume
115 bool checkFacePyramids
118 const bool report = false,
119 const scalar minPyrVol = -SMALL,
120 labelHashSet* setPtr = NULL,
121 const boolList* changedFacePtr = NULL
124 //- Check face skewness
125 void checkFaceSkewness
129 const boolList* changedFacePtr = NULL
132 bool checkFaceSkewness
135 const bool report = false,
136 const scalar warnSkew = 4.0,
137 labelHashSet* setPtr = NULL,
138 const boolList* changedFacePtr = NULL
141 //- Check face uniformity
142 void checkFaceUniformity
146 const boolList* changedFacePtr = NULL
149 bool checkFaceUniformity
152 const bool report = false,
153 const scalar warnUniform = 0.1,
154 labelHashSet* setPtr = NULL,
155 const boolList* changedFacePtr = NULL
158 //- check volume difference of neighbouring cells
159 void checkVolumeUniformity
163 const boolList* changedFacePtr = NULL
166 bool checkVolumeUniformity
169 const bool report = false,
170 const scalar warnUniform = 0.1,
171 labelHashSet* setPtr = NULL,
172 const boolList* changedFacePtr = NULL
175 //- Check face angles
179 const bool report = false,
180 const scalar maxDeg = 10, // In degrees
181 labelHashSet* setPtr = NULL,
182 const boolList* changedFacePtr = NULL
185 //- Check face warpage: decompose face and check ratio between
186 // magnitude of sum of triangle areas and sum of magnitude of
188 bool checkFaceFlatness
192 const scalar warnFlatness, // When to include in set.
193 labelHashSet* setPtr = NULL,
194 const boolList* changedFacePtr = NULL
197 // Checks using topology only
199 //- Check for unused points
203 const bool report = false,
204 labelHashSet* setPtr = NULL
207 //- Check face ordering
208 bool checkUpperTriangular
211 const bool report = false,
212 labelHashSet* setPtr = NULL
215 //- Check cell zip-up
219 const bool report = false,
220 labelHashSet* setPtr = NULL
223 //- Check uniqueness of face vertices
224 bool checkFaceVertices
227 const bool report = false,
228 labelHashSet* setPtr = NULL
231 //- Check mesh topology for correctness. Returns false for no error.
232 bool checkTopology(const polyMeshGen&, const bool report = false);
234 //- Check mesh geometry (& implicitly topology) for correctness.
235 // Returns false for no error.
236 bool checkGeometry(const polyMeshGen&, const bool report = false);
238 //- Check mesh for correctness. Returns false for no error.
239 bool checkMesh(const polyMeshGen&, const bool report = false);
241 //- checks for bad faces making the mesh unusable
242 //- checks for negative pyramids and zero area faces
243 label findBadFacesRelaxed
246 labelHashSet& badFaces,
247 const bool report = false,
248 const boolList* activeFacePtr = NULL
251 //- check mesh for bad faces which make the mesh invalid
252 //- checks for negative pyramids, face flatness,
253 //- zero area faces and negative tetrahedra
257 labelHashSet& badFaces,
258 const bool report = false,
259 const boolList* activeFacePtr = NULL
262 //- check mesh for faces that may cause problems to the solver
263 //- checks for non-orthogonality and skewness
264 label findLowQualityFaces
266 const polyMeshGen& mesh,
267 labelHashSet& badFaces,
268 const bool report = false,
269 const boolList* activeFacePtr = NULL
272 //- checks the mesh and selects the faces with worst quality
273 label findWorstQualityFaces
275 const polyMeshGen& mesh,
276 labelHashSet& badFaces,
277 const bool report = false,
278 const boolList* activeFacePtr = NULL,
279 const scalar relativeThreshold = 0.1
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286 } // End namespace Foam
288 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
292 // ************************************************************************* //