56int main(
int argc,
char *argv[])
60 "Clean surface by removing baffles, sliver faces,"
61 " collapsing small edges, etc."
64 argList::noParallel();
65 argList::addArgument(
"input",
"The input surface file");
66 argList::addArgument(
"length",
"The min length");
67 argList::addArgument(
"quality",
"The min quality");
68 argList::addArgument(
"output",
"The output surface file");
70 argList::addBoolOption
73 "Suppress surface checking/cleanup on the input surface"
75 argList::addOptionCompat(
"no-clean", {
"noClean", -2006});
81 "Input geometry scaling factor"
86 const auto minLen =
args.
get<scalar>(2);
87 const auto minQuality =
args.
get<scalar>(3);
90 Info<<
"Reading surface " << inFileName <<
nl
91 <<
"Collapsing all triangles with" <<
nl
92 <<
" edges or heights < " << minLen <<
nl
93 <<
" quality < " << minQuality <<
nl
94 <<
"Writing result to " << outFileName <<
nl <<
endl;
97 Info<<
"Reading surface from " << inFileName <<
" ..." <<
nl <<
endl;
104 surf.writeStats(Info);
108 Info<<
"Removing duplicate and illegal triangles ..." <<
nl <<
endl;
112 Info<<
"Collapsing triangles to edges ..." <<
nl <<
endl;
118 if (nEdgeCollapse == 0)
125 const label nSplitEdge =
collapseBase(surf, minLen, minQuality);
134 <<
"Resulting surface:" <<
endl;
135 surf.writeStats(Info);
138 <<
"Writing refined surface to " << outFileName <<
" ..." <<
endl;
139 surf.
write(outFileName);
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
Extract command arguments and options from the supplied argc and argv parameters.
T get(const label index) const
Get a value from the argument at index.
bool found(const word &optName) const
Return true if the named option is found.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
A class for handling file names.
Triangulated surface description with patch information.
Routines collapse sliver triangles by splitting the base edge.
label collapseBase(triSurface &surf, const scalar minLen, const scalar minQuality)
Keep collapsing all triangles whose height is < minLen or quality < minQ.
Routines to collapse small edges.
label collapseEdge(triSurface &surf, const scalar minLen)
Keep collapsing all edges < minLen.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
constexpr char nl
The newline '\n' character (0x0a)
Foam::argList args(argc, argv)