polyMeshGenChecks.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Class
25  polyMeshGenChecks
26 
27 Description
28  A set of functions used for mesh checking mesh quality
29 
30 SourceFiles
31  polyMeshGenAddressingChecks.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef polyMeshGenChecks_H
36 #define polyMeshGenChecks_H
37 
38 #include "polyMeshGen.H"
39 #include "boolList.H"
40 #include "HashSet.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Namespace polyMeshGenChecks functions Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 namespace polyMeshGenChecks
52 {
53 
54 // Check geometry
55 //- Check boundary closedness
56 bool checkClosedBoundary(const polyMeshGen&, const bool report = false);
57 
58 //- Check cells for closedness
60 (
61  const polyMeshGen&,
62  const bool report = false,
63  const scalar aspectWarn = 1000,
64  labelHashSet* setPtr = NULL
65 );
66 
67 //- Check for negative cell volumes
69 (
70  const polyMeshGen&,
71  const bool report = false,
72  labelHashSet* setPtr = NULL
73 );
74 
75 //- Check for negative face areas
76 bool checkFaceAreas
77 (
78  const polyMeshGen&,
79  const bool report = false,
80  const scalar minFaceArea = VSMALL,
81  labelHashSet* setPtr = NULL,
82  const boolList* changedFacePtr = NULL
83 );
84 
85 //- Check for negative part tetrahedra
86 //- Cells are decomposed into tetrahedra formed by
87 //- the cell centre, face centre and the edge vertices
89 (
90  const polyMeshGen&,
91  const bool report = false,
92  const scalar minPartTet = VSMALL,
93  labelHashSet* setPtr = NULL,
94  const boolList* changedFacePtr = NULL
95 );
96 
97 //- Check for non-orthogonality
99 (
100  const polyMeshGen&,
101  scalarField&,
102  const boolList* changedFacePtr = NULL
103 );
104 
106 (
107  const polyMeshGen&,
108  const bool report = false,
109  const scalar nonOrthWarn = 70.0,
110  labelHashSet* setPtr = NULL,
111  const boolList* changedFacePtr = NULL
112 );
113 
114 //- Check face pyramid volume
116 (
117  const polyMeshGen&,
118  const bool report = false,
119  const scalar minPyrVol = -SMALL,
120  labelHashSet* setPtr = NULL,
121  const boolList* changedFacePtr = NULL
122 );
123 
124 //- Check face skewness
126 (
127  const polyMeshGen&,
128  scalarField&,
129  const boolList* changedFacePtr = NULL
130 );
131 
133 (
134  const polyMeshGen&,
135  const bool report = false,
136  const scalar warnSkew = 4.0,
137  labelHashSet* setPtr = NULL,
138  const boolList* changedFacePtr = NULL
139 );
140 
141 //- Check face uniformity
143 (
144  const polyMeshGen&,
145  scalarField&,
146  const boolList* changedFacePtr = NULL
147 );
148 
150 (
151  const polyMeshGen&,
152  const bool report = false,
153  const scalar warnUniform = 0.1,
154  labelHashSet* setPtr = NULL,
155  const boolList* changedFacePtr = NULL
156 );
157 
158 //- check volume difference of neighbouring cells
160 (
161  const polyMeshGen&,
162  scalarField&,
163  const boolList* changedFacePtr = NULL
164 );
165 
167 (
168  const polyMeshGen&,
169  const bool report = false,
170  const scalar warnUniform = 0.1,
171  labelHashSet* setPtr = NULL,
172  const boolList* changedFacePtr = NULL
173 );
174 
175 //- Check face angles
176 bool checkFaceAngles
177 (
178  const polyMeshGen&,
179  const bool report = false,
180  const scalar maxDeg = 10, // In degrees
181  labelHashSet* setPtr = NULL,
182  const boolList* changedFacePtr = NULL
183 );
184 
185 //- Check face warpage: decompose face and check ratio between
186 // magnitude of sum of triangle areas and sum of magnitude of
187 // triangle areas.
189 (
190  const polyMeshGen&,
191  const bool report,
192  const scalar warnFlatness, // When to include in set.
193  labelHashSet* setPtr = NULL,
194  const boolList* changedFacePtr = NULL
195 );
196 
197 // Checks using topology only
198 
199 //- Check for unused points
200 bool checkPoints
201 (
202  const polyMeshGen&,
203  const bool report = false,
204  labelHashSet* setPtr = NULL
205 );
206 
207 //- Check face ordering
209 (
210  const polyMeshGen&,
211  const bool report = false,
212  labelHashSet* setPtr = NULL
213 );
214 
215 //- Check cell zip-up
216 bool checkCellsZipUp
217 (
218  const polyMeshGen&,
219  const bool report = false,
220  labelHashSet* setPtr = NULL
221 );
222 
223 //- Check uniqueness of face vertices
225 (
226  const polyMeshGen&,
227  const bool report = false,
228  labelHashSet* setPtr = NULL
229 );
230 
231 //- Check mesh topology for correctness. Returns false for no error.
232 bool checkTopology(const polyMeshGen&, const bool report = false);
233 
234 //- Check mesh geometry (& implicitly topology) for correctness.
235 // Returns false for no error.
236 bool checkGeometry(const polyMeshGen&, const bool report = false);
237 
238 //- Check mesh for correctness. Returns false for no error.
239 bool checkMesh(const polyMeshGen&, const bool report = false);
240 
241 //- checks for bad faces making the mesh unusable
242 //- checks for negative pyramids and zero area faces
244 (
245  const polyMeshGen&,
246  labelHashSet& badFaces,
247  const bool report = false,
248  const boolList* activeFacePtr = NULL
249 );
250 
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
255 (
256  const polyMeshGen&,
257  labelHashSet& badFaces,
258  const bool report = false,
259  const boolList* activeFacePtr = NULL
260 );
261 
262 //- check mesh for faces that may cause problems to the solver
263 //- checks for non-orthogonality and skewness
265 (
266  const polyMeshGen& mesh,
267  labelHashSet& badFaces,
268  const bool report = false,
269  const boolList* activeFacePtr = NULL
270 );
271 
272 //- checks the mesh and selects the faces with worst quality
274 (
275  const polyMeshGen& mesh,
276  labelHashSet& badFaces,
277  const bool report = false,
278  const boolList* activeFacePtr = NULL,
279  const scalar relativeThreshold = 0.1
280 );
281 
282 }
283 
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285 
286 } // End namespace Foam
287 
288 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
289 
290 #endif
291 
292 // ************************************************************************* //
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:48
Foam::polyMeshGenChecks::checkClosedBoundary
bool checkClosedBoundary(const polyMeshGen &, const bool report=false)
Check boundary closedness.
Definition: polyMeshGenChecksGeometry.C:45
Foam::polyMeshGenChecks::findBadFaces
label findBadFaces(const polyMeshGen &, labelHashSet &badFaces, const bool report=false, const boolList *activeFacePtr=NULL)
Definition: polyMeshGenChecksGeometry.C:2038
Foam::polyMeshGenChecks::checkGeometry
bool checkGeometry(const polyMeshGen &mesh, const bool report)
Check mesh geometry (& implicitly topology) for correctness.
Definition: polyMeshGenChecks.C:51
boolList.H
Foam::polyMeshGenChecks::checkMesh
bool checkMesh(const polyMeshGen &mesh, const bool report)
Check mesh for correctness. Returns false for no error.
Definition: polyMeshGenChecks.C:104
Foam::polyMeshGenChecks::checkFaceSkewness
void checkFaceSkewness(const polyMeshGen &, scalarField &, const boolList *changedFacePtr=NULL)
Check face skewness.
Definition: polyMeshGenChecksGeometry.C:1138
polyMeshGenChecks
A set of functions used for mesh checking mesh quality.
Foam::polyMeshGenChecks::checkUpperTriangular
bool checkUpperTriangular(const polyMeshGen &, const bool report=false, labelHashSet *setPtr=NULL)
Check face ordering.
Definition: polyMeshGenChecksTopology.C:118
Foam::polyMeshGenChecks::checkFaceAreas
bool checkFaceAreas(const polyMeshGen &, const bool report=false, const scalar minFaceArea=VSMALL, labelHashSet *setPtr=NULL, const boolList *changedFacePtr=NULL)
Check for negative face areas.
Definition: polyMeshGenChecksGeometry.C:362
polyMeshGen
Mesh with selections.
Foam::polyMeshGenChecks::checkFaceFlatness
bool checkFaceFlatness(const polyMeshGen &, const bool report, const scalar warnFlatness, labelHashSet *setPtr=NULL, const boolList *changedFacePtr=NULL)
Check face warpage: decompose face and check ratio between.
Definition: polyMeshGenChecksGeometry.C:1777
Foam::polyMeshGenChecks::checkFaceVertices
bool checkFaceVertices(const polyMeshGen &, const bool report=false, labelHashSet *setPtr=NULL)
Check uniqueness of face vertices.
Definition: polyMeshGenChecksTopology.C:373
Foam::polyMeshGenChecks::checkFaceAngles
bool checkFaceAngles(const polyMeshGen &, const bool report=false, const scalar maxDeg=10, labelHashSet *setPtr=NULL, const boolList *changedFacePtr=NULL)
Check face angles.
Definition: polyMeshGenChecksGeometry.C:1620
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
polyMeshGen.H
Foam::polyMeshGenChecks::checkCellsZipUp
bool checkCellsZipUp(const polyMeshGen &, const bool report=false, labelHashSet *setPtr=NULL)
Check cell zip-up.
Definition: polyMeshGenChecksTopology.C:254
Foam::polyMeshGenChecks::checkFaceDotProduct
void checkFaceDotProduct(const polyMeshGen &, scalarField &, const boolList *changedFacePtr=NULL)
Check for non-orthogonality.
Definition: polyMeshGenChecksGeometry.C:630
Foam::polyMeshGenChecks::findBadFacesRelaxed
label findBadFacesRelaxed(const polyMeshGen &, labelHashSet &badFaces, const bool report=false, const boolList *activeFacePtr=NULL)
Definition: polyMeshGenChecksGeometry.C:2005
Foam::polyMeshGenChecks::checkVolumeUniformity
void checkVolumeUniformity(const polyMeshGen &, scalarField &, const boolList *changedFacePtr=NULL)
check volume difference of neighbouring cells
Foam::polyMeshGenChecks::checkPoints
bool checkPoints(const polyMeshGen &, const bool report=false, labelHashSet *setPtr=NULL)
Check for unused points.
Definition: polyMeshGenChecksTopology.C:46
HashSet.H
Foam::polyMeshGenChecks::findLowQualityFaces
label findLowQualityFaces(const polyMeshGen &mesh, labelHashSet &badFaces, const bool report=false, const boolList *activeFacePtr=NULL)
Definition: polyMeshGenChecksGeometry.C:2089
Foam::polyMeshGenChecks::checkCellPartTetrahedra
bool checkCellPartTetrahedra(const polyMeshGen &, const bool report=false, const scalar minPartTet=VSMALL, labelHashSet *setPtr=NULL, const boolList *changedFacePtr=NULL)
Definition: polyMeshGenChecksGeometry.C:467
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::boolList
List< bool > boolList
Bool container classes.
Definition: boolList.H:50
Foam::polyMeshGenChecks::checkTopology
bool checkTopology(const polyMeshGen &mesh, const bool report)
Check mesh topology for correctness. Returns false for no error.
Definition: polyMeshGenChecks.C:80
Foam::polyMeshGenChecks::checkFacePyramids
bool checkFacePyramids(const polyMeshGen &, const bool report=false, const scalar minPyrVol=-SMALL, labelHashSet *setPtr=NULL, const boolList *changedFacePtr=NULL)
Check face pyramid volume.
Definition: polyMeshGenChecksGeometry.C:962
Foam::polyMeshGenChecks::checkFaceUniformity
void checkFaceUniformity(const polyMeshGen &, scalarField &, const boolList *changedFacePtr=NULL)
Check face uniformity.
Definition: polyMeshGenChecksGeometry.C:1381
Foam::polyMeshGenChecks::checkCellVolumes
bool checkCellVolumes(const polyMeshGen &, const bool report=false, labelHashSet *setPtr=NULL)
Check for negative cell volumes.
Definition: polyMeshGenChecksGeometry.C:294
Foam::labelHashSet
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
Definition: HashSet.H:210
Foam::polyMeshGenChecks::checkClosedCells
bool checkClosedCells(const polyMeshGen &, const bool report=false, const scalar aspectWarn=1000, labelHashSet *setPtr=NULL)
Check cells for closedness.
Definition: polyMeshGenChecksGeometry.C:113
Foam::polyMeshGenChecks::findWorstQualityFaces
label findWorstQualityFaces(const polyMeshGen &mesh, labelHashSet &badFaces, const bool report=false, const boolList *activeFacePtr=NULL, const scalar relativeThreshold=0.1)
checks the mesh and selects the faces with worst quality
Definition: polyMeshGenChecksGeometry.C:2122