Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
applications
utilities
mesh
manipulation
checkMesh
checkMesh.C
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
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
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
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
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
Application
25
checkMesh
26
27
Description
28
Checks validity of a mesh
29
30
Usage
31
32
- checkMesh [OPTIONS]
33
34
@param -noTopology \n
35
Do not check mesh-topology.
36
37
@param -allTopology \n
38
More extensive topology checks.
39
40
@param -allGeometry \n
41
More extensive geometry checks.
42
43
@param -region <name>\n
44
Only apply to named mesh region.
45
46
@param -latestTime \n
47
Only apply to latest time step.
48
49
@param -time <time>\n
50
Apply only to specific time.
51
52
@param -case <dir>\n
53
Case directory.
54
55
@param -parallel \n
56
Run in parallel.
57
58
@param -help \n
59
Display help message.
60
61
@param -doc \n
62
Display Doxygen API documentation page for this application.
63
64
@param -srcDoc \n
65
Display Doxygen source documentation page for this application.
66
67
\*---------------------------------------------------------------------------*/
68
69
#include <
OpenFOAM/argList.H
>
70
#include <
OpenFOAM/timeSelector.H
>
71
#include <
OpenFOAM/Time.H
>
72
73
#include <
OpenFOAM/polyMesh.H
>
74
#include <
OpenFOAM/globalMeshData.H
>
75
76
#include "
printMeshStats.H
"
77
#include "
checkTopology.H
"
78
#include "
checkGeometry.H
"
79
80
using namespace
Foam;
81
82
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
83
84
int
main
(
int
argc,
char
*argv[])
85
{
86
timeSelector::addOptions
();
87
# include <
OpenFOAM/addRegionOption.H
>
88
argList::validOptions
.
insert
(
"noTopology"
,
""
);
89
argList::validOptions
.
insert
(
"allGeometry"
,
""
);
90
argList::validOptions
.
insert
(
"allTopology"
,
""
);
91
92
# include <
OpenFOAM/setRootCase.H
>
93
# include <
OpenFOAM/createTime.H
>
94
instantList
timeDirs
=
timeSelector::select0
(runTime,
args
);
95
# include <
OpenFOAM/createNamedPolyMesh.H
>
96
97
const
bool
noTopology =
args
.
optionFound
(
"noTopology"
);
98
const
bool
allGeometry =
args
.
optionFound
(
"allGeometry"
);
99
const
bool
allTopology =
args
.
optionFound
(
"allTopology"
);
100
101
forAll
(timeDirs, timeI)
102
{
103
runTime.setTime(timeDirs[timeI], timeI);
104
105
polyMesh::readUpdateState
state =
mesh
.
readUpdate
();
106
107
if
108
(
109
!timeI
110
|| state ==
polyMesh::TOPO_CHANGE
111
|| state ==
polyMesh::TOPO_PATCH_CHANGE
112
)
113
{
114
Info
<<
"Time = "
<< runTime.timeName() <<
nl
<<
endl
;
115
116
// Clear mesh before checking
117
mesh
.
clearOut
();
118
119
// Reconstruct globalMeshData
120
mesh
.
globalData
();
121
122
printMeshStats
(
mesh
, allTopology);
123
124
label noFailedChecks = 0;
125
126
if
(!noTopology)
127
{
128
noFailedChecks +=
checkTopology
(
mesh
, allTopology, allGeometry);
129
}
130
131
noFailedChecks +=
checkGeometry
(
mesh
, allGeometry);
132
133
// Note: no reduction in noFailedChecks necessary since is
134
// counter of checks, not counter of failed cells,faces etc.
135
136
if
(noFailedChecks == 0)
137
{
138
Info
<<
"\nMesh OK.\n"
<<
endl
;
139
}
140
else
141
{
142
Info
<<
"\nFailed "
<< noFailedChecks <<
" mesh checks.\n"
143
<<
endl
;
144
}
145
}
146
else
if
(state ==
polyMesh::POINTS_MOVED
)
147
{
148
Info
<<
"Time = "
<< runTime.timeName() <<
nl
<<
endl
;
149
150
label nFailedChecks =
checkGeometry
(
mesh
, allGeometry);
151
152
if
(nFailedChecks)
153
{
154
Info
<<
"\nFailed "
<< nFailedChecks <<
" mesh checks.\n"
155
<<
endl
;
156
}
157
else
158
{
159
Info
<<
"\nMesh OK.\n"
<<
endl
;
160
}
161
}
162
}
163
164
Info
<<
"End\n"
<<
endl
;
165
166
return
0;
167
}
168
169
170
// ************************ vim: set sw=4 sts=4 et: ************************ //