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[])
49 # include "addTimeOptionsNoConstant.H"
51 argList::validOptions.insert("fullTopology", "");
52 argList::validOptions.insert("pointNearness", "");
53 argList::validOptions.insert("cellDeterminant", "");
55 # include "setRootCase.H"
56 # include "createTime.H"
59 instantList Times = runTime.times();
61 # include "checkTimeOptionsNoConstant.H"
63 runTime.setTime(Times[startTime], startTime);
65 # include "createPolyMesh.H"
67 bool firstCheck = true;
69 for (label i=startTime; i<endTime; i++)
71 runTime.setTime(Times[i], i);
73 polyMesh::readUpdateState state = mesh.readUpdate();
78 || state == polyMesh::TOPO_CHANGE
79 || state == polyMesh::TOPO_PATCH_CHANGE
84 Info<< "Time = " << runTime.timeName() << nl << endl;
86 // Clear mesh before checking
89 // Reconstruct globalMeshData
94 label noFailedChecks = 0;
96 noFailedChecks += checkTopology
99 args.options().found("fullTopology")
102 noFailedChecks += checkGeometry
105 args.options().found("pointNearness"),
106 args.options().found("cellDeterminant")
109 reduce(noFailedChecks, sumOp<label>());
111 if (noFailedChecks == 0)
118 Info<< "\nFailed " << noFailedChecks << " mesh checks."
122 else if (state == polyMesh::POINTS_MOVED)
124 label noFailedChecks = checkGeometry
127 args.options().found("pointNearness"),
128 args.options().found("cellDeterminant")
131 reduce(noFailedChecks, sumOp<label>());
133 if (noFailedChecks == 0)
140 Info<< "\nFailed " << noFailedChecks << " mesh checks."
146 Info<< "End\n" << endl;
152 // ************************************************************************* //