1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM 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 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Checks validity of a mesh
31 \*---------------------------------------------------------------------------*/
36 #include "globalMeshData.H"
38 #include "printMeshStats.H"
39 #include "checkTopology.H"
40 #include "checkGeometry.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 int main(int argc, char *argv[])
48 # include "addRegionOption.H"
50 # include "addTimeOptionsNoConstant.H"
52 argList::validOptions.insert("noTopology", "");
53 argList::validOptions.insert("allGeometry", "");
54 argList::validOptions.insert("allTopology", "");
56 # include "setRootCase.H"
58 const bool noTopology = args.options().found("noTopology");
59 const bool allGeometry = args.options().found("allGeometry");
60 const bool allTopology = args.options().found("allTopology");
62 # include "createTime.H"
65 instantList Times = runTime.times();
67 # include "checkTimeOptionsNoConstant.H"
69 runTime.setTime(Times[startTime], startTime);
71 # include "createNamedPolyMesh.H"
73 bool firstCheck = true;
75 for (label i=startTime; i<endTime; i++)
77 runTime.setTime(Times[i], i);
79 polyMesh::readUpdateState state = mesh.readUpdate();
84 || state == polyMesh::TOPO_CHANGE
85 || state == polyMesh::TOPO_PATCH_CHANGE
90 Info<< "Time = " << runTime.timeName() << nl << endl;
92 // Clear mesh before checking
95 // Reconstruct globalMeshData
98 printMeshStats(mesh, allTopology);
100 label noFailedChecks = 0;
104 noFailedChecks += checkTopology(mesh, allTopology, allGeometry);
107 noFailedChecks += checkGeometry(mesh, allGeometry);
109 reduce(noFailedChecks, sumOp<label>());
111 if (noFailedChecks == 0)
118 Info<< "\nFailed " << noFailedChecks << " mesh checks."
122 else if (state == polyMesh::POINTS_MOVED)
124 Info<< "Time = " << runTime.timeName() << nl << endl;
126 label noFailedChecks = checkGeometry(mesh, allGeometry);
128 reduce(noFailedChecks, sumOp<label>());
130 if (noFailedChecks == 0)
137 Info<< "\nFailed " << noFailedChecks << " mesh checks."
143 Info<< "End\n" << endl;
149 // ************************************************************************* //