checkMesh.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "argList.H"
00034 #include "timeSelector.H"
00035 #include "Time.H"
00036
00037 #include "polyMesh.H"
00038 #include "globalMeshData.H"
00039
00040 #include "printMeshStats.H"
00041 #include "checkTopology.H"
00042 #include "checkGeometry.H"
00043
00044 using namespace Foam;
00045
00046
00047
00048 int main(int argc, char *argv[])
00049 {
00050 timeSelector::addOptions(false);
00051 # include "addRegionOption.H"
00052 argList::validOptions.insert("noTopology", "");
00053 argList::validOptions.insert("allGeometry", "");
00054 argList::validOptions.insert("allTopology", "");
00055
00056 # include "setRootCase.H"
00057 # include "createTime.H"
00058 instantList timeDirs = timeSelector::select0(runTime, args);
00059 # include "createNamedPolyMesh.H"
00060
00061 const bool noTopology = args.optionFound("noTopology");
00062 const bool allGeometry = args.optionFound("allGeometry");
00063 const bool allTopology = args.optionFound("allTopology");
00064
00065 forAll(timeDirs, timeI)
00066 {
00067 runTime.setTime(timeDirs[timeI], timeI);
00068
00069 polyMesh::readUpdateState state = mesh.readUpdate();
00070
00071 if
00072 (
00073 !timeI
00074 || state == polyMesh::TOPO_CHANGE
00075 || state == polyMesh::TOPO_PATCH_CHANGE
00076 )
00077 {
00078 Info<< "Time = " << runTime.timeName() << nl << endl;
00079
00080
00081 mesh.clearOut();
00082
00083
00084 mesh.globalData();
00085
00086 printMeshStats(mesh, allTopology);
00087
00088 label noFailedChecks = 0;
00089
00090 if (!noTopology)
00091 {
00092 noFailedChecks += checkTopology(mesh, allTopology, allGeometry);
00093 }
00094
00095 noFailedChecks += checkGeometry(mesh, allGeometry);
00096
00097 reduce(noFailedChecks, sumOp<label>());
00098
00099 if (noFailedChecks == 0)
00100 {
00101 Info<< "\nMesh OK.\n" << endl;
00102 }
00103 else
00104 {
00105 Info<< "\nFailed " << noFailedChecks << " mesh checks.\n"
00106 << endl;
00107 }
00108 }
00109 else if (state == polyMesh::POINTS_MOVED)
00110 {
00111 Info<< "Time = " << runTime.timeName() << nl << endl;
00112
00113 label nFailedChecks = checkGeometry(mesh, allGeometry);
00114
00115 reduce(nFailedChecks, sumOp<label>());
00116
00117 if (nFailedChecks)
00118 {
00119 Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"
00120 << endl;
00121 }
00122 else
00123 {
00124 Info << "\nMesh OK.\n" << endl;
00125 }
00126 }
00127 }
00128
00129 Info<< "End\n" << endl;
00130
00131 return 0;
00132 }
00133
00134
00135
Copyright © 2000-2009 OpenCFD Ltd