93int main(
int argc,
char *argv[])
97 "Checks validity of a mesh"
100 timeSelector::addOptions();
103 argList::addBoolOption
106 "Skip checking the mesh topology"
108 argList::addBoolOption
111 "Include bounding box checks"
113 argList::addBoolOption
116 "Include extra topology checks"
118 argList::addBoolOption
121 "Write volFields with mesh quality parameters"
123 argList::addBoolOption
125 "writeAllSurfaceFields",
126 "Write surfaceFields with mesh quality parameters"
132 "Write volFields with selected mesh quality parameters"
134 argList::addBoolOption
137 "Read user-defined mesh quality criteria from system/meshQualityDict"
143 "Reconstruct and write all faceSets and cellSets in selected format"
152 const bool noTopology =
args.
found(
"noTopology");
153 const bool allGeometry =
args.
found(
"allGeometry");
154 const bool allTopology =
args.
found(
"allTopology");
155 const bool meshQuality =
args.
found(
"meshQuality");
158 const bool writeSets = surfaceFormat.size();
181 const bool writeFaceFields =
args.
found(
"writeAllSurfaceFields");
186 const wordHashSet badFields(selectedFields - allFields);
188 if (!badFields.empty())
191 <<
"Illegal field(s) " <<
flatOutput(badFields.sortedToc())
193 <<
"Valid fields are " <<
flatOutput(allFields.sortedToc())
194 <<
nl <<
exit(FatalError);
199 selectedFields = allFields;
201 else if (writeFaceFields)
204 <<
"Option 'writeAllSurfaceFields' only valid in combination"
205 <<
" with 'writeFields' or 'writeAllFields'"
206 <<
nl <<
exit(FatalError);
212 Info<<
"Disabling all topology checks." <<
nl <<
endl;
216 Info<<
"Enabling all (cell, face, edge, point) topology checks."
221 Info<<
"Enabling all geometry checks." <<
nl <<
endl;
225 Info<<
"Enabling user-defined geometry checks." <<
nl <<
endl;
229 Info<<
"Reconstructing and writing " << surfaceFormat
231 <<
" of all faceSets and cellSets." <<
nl <<
endl;
233 if (selectedFields.
size())
235 Info<<
"Writing mesh quality as fields " << selectedFields <<
nl
268 surfWriter = surfaceWriter::New(surfaceFormat);
269 setWriter = coordSetWriter::New(coordSetWriters::vtkWriter::typeName);
275 runTime.setTime(timeDirs[timeI], timeI);
288 || state == polyMesh::TOPO_CHANGE
289 || state == polyMesh::TOPO_PATCH_CHANGE
303 label nFailedChecks = 0;
336 if (nFailedChecks == 0)
342 Info<<
"\nFailed " << nFailedChecks <<
" mesh checks.\n"
351 else if (state == polyMesh::POINTS_MOVED)
376 Info<<
"\nFailed " << nFailedChecks <<
" mesh checks.\n"
label size() const noexcept
The number of elements in table.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label size() const noexcept
The number of elements in the list.
bool found(const word &optName) const
Return true if the named option is found.
List< T > getList(const label index) const
Get a List of values from the argument at index.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
readUpdateState
Enumeration defining the state of the mesh after a read update.
A class for handling words, derived from Foam::string.
Foam::PtrList< Foam::fvMesh > meshes(regionNames.size())
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int system(const std::string &command, const bool bg=false)
Execute the specified command via the shell.
label checkMeshQuality(const polyMesh &mesh, const dictionary &dict, autoPtr< surfaceWriter > &writer)
label checkGeometry(const polyMesh &mesh, const bool allGeometry, autoPtr< surfaceWriter > &surfWriter, autoPtr< coordSetWriter > &setWriter)
label checkTopology(const polyMesh &mesh, const bool allTopology, const bool allGeometry, autoPtr< surfaceWriter > &surfWriter, autoPtr< coordSetWriter > &setWriter)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
void writeFields(const fvMesh &mesh, const wordHashSet &selectedFields, const bool writeFaceFields)
errorManipArg< error, int > exit(error &err, const int errNo=1)
void printMeshStats(const polyMesh &mesh, const bool allTopology)
constexpr char nl
The newline '\n' character (0x0a)
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.