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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "polyMeshGenChecks.H"
27 #include "polyMeshGenAddressing.H"
28 #include "pyramidPointFaceRef.H"
29 #include "tetrahedron.H"
31 #include "mathematicalConstants.H"
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace polyMeshGenChecks
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 bool checkGeometry(const polyMeshGen& mesh, const bool report)
53 label noFailedChecks(0);
55 if( checkClosedBoundary(mesh, report) ) ++noFailedChecks;
56 if( checkClosedCells(mesh, report) ) ++noFailedChecks;
57 if( checkFaceAreas(mesh, report) ) ++noFailedChecks;
58 if( checkCellVolumes(mesh, report) ) ++noFailedChecks;
59 if( checkFaceDotProduct(mesh, report) ) ++noFailedChecks;
60 if( checkFaceUniformity(mesh, report) ) ++noFailedChecks;
61 if( checkFacePyramids(mesh, report) ) ++noFailedChecks;
62 if( checkFaceSkewness(mesh, report) ) ++noFailedChecks;
63 if( checkCellPartTetrahedra(mesh, report) ) ++noFailedChecks;
65 if( noFailedChecks == 0 )
68 Info << "Mesh geometry OK." << endl;
74 Info<< "Failed " << noFailedChecks << " mesh geometry checks." << endl;
80 bool checkTopology(const polyMeshGen& mesh, const bool report)
82 label noFailedChecks(0);
84 if( checkPoints(mesh, report) ) ++noFailedChecks;
85 if( checkUpperTriangular(mesh, report) ) ++noFailedChecks;
86 if( checkCellsZipUp(mesh, report) ) ++noFailedChecks;
87 if( checkFaceVertices(mesh, report) ) ++noFailedChecks;
89 if( noFailedChecks == 0 )
92 Info << "Mesh topology OK." << endl;
98 Info<< "Failed " << noFailedChecks << " mesh topology checks." << endl;
104 bool checkMesh(const polyMeshGen& mesh, const bool report)
106 bool failedChecks = checkTopology(mesh, report);
107 failedChecks |= checkGeometry(mesh, report);
112 Info << "Mesh OK." << endl;
118 Info << "Failed some mesh checks." << endl;
124 } // End namespace polyMeshGenChecks
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 } // End namespace Foam
130 // ************************************************************************* //