99int main(
int argc,
char *argv[])
103 "Checks validity of a mesh"
112 "Skip checking the mesh topology"
117 "Include bounding box checks"
122 "Include extra topology checks"
127 "Write volFields with mesh quality parameters"
131 "writeAllSurfaceFields",
132 "Write surfaceFields with mesh quality parameters"
138 "Write volFields with selected mesh quality parameters"
143 "Read user-defined mesh quality criteria from system/meshQualityDict"
149 "Reconstruct and write all faceSets and cellSets in selected format"
154 "Write bad edges (possibly relevant for finite-area) in vtk format"
161 "Write checks to file in dictionary or JSON format"
171 const bool noTopology =
args.found(
"noTopology");
172 const bool allGeometry =
args.found(
"allGeometry");
173 const bool allTopology =
args.found(
"allTopology");
174 const bool meshQuality =
args.found(
"meshQuality");
175 const bool optWriteEdges =
args.found(
"write-edges");
177 const word surfaceFormat =
args.getOrDefault<
word>(
"writeSets",
"");
178 const bool writeSets = surfaceFormat.size();
203 if (
args.found(
"writeChecks"))
209 const bool writeFaceFields =
args.found(
"writeAllSurfaceFields");
211 if (
args.found(
"writeFields"))
213 selectedFields =
args.getList<
word>(
"writeFields");
214 const wordHashSet badFields(selectedFields - allFields);
216 if (!badFields.empty())
219 <<
"Illegal field(s): "
226 else if (
args.found(
"writeAllFields"))
228 selectedFields = allFields;
230 else if (writeFaceFields)
233 <<
"Option 'writeAllSurfaceFields' only valid in combination"
234 <<
" with 'writeFields' or 'writeAllFields'"
239 Info<<
"Check mesh..." <<
nl;
245 <<
"Disabling all topology checks." <<
nl;
250 <<
"Enabling all (cell, face, edge, point) topology checks." <<
nl;
255 <<
"Enabling all geometry checks." <<
nl;
260 <<
"Enabling user-defined geometry checks." <<
nl;
265 <<
"Reconstructing and writing " << surfaceFormat
266 <<
" representation of all faceSets and cellSets." <<
nl;
268 if (selectedFields.
size())
271 <<
"Writing mesh quality as fields "
277 <<
"Writing any bad edges in vtk format" <<
nl;
318 runTime.setTime(timeDirs[timei], timei);
346 label nFailedChecks = 0;
380 if (nFailedChecks == 0)
386 Info<<
"\nFailed " << nFailedChecks <<
" mesh checks.\n"
422 Info<<
"\nFailed " << nFailedChecks <<
" mesh checks.\n"
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
label size() const noexcept
The number of elements in table.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
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....
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
static autoPtr< coordSetWriter > New(const word &writeFormat)
Return a reference to the selected writer.
readUpdateState
Enumeration defining the state of the mesh after a read update.
static autoPtr< surfaceWriter > New(const word &writeType)
Select construct a surfaceWriter.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options and also set the runTime to the first i...
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.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
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, const bool writeBadEdges=false)
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< instant > instantList
List of instants.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent 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)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
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.
writeChecksFormatType writeChecksFormat(writeChecksFormatType::none)
const Enum< writeChecksFormatType > writeChecksFormatTypeNames