56 int main(
int argc,
char *argv[])
60 "Clean surface by removing baffles, sliver faces," 61 " collapsing small edges, etc." 73 "Suppress surface checking/cleanup on the input surface" 82 "Input geometry scaling factor" 87 const auto minLen =
args.
get<scalar>(2);
88 const auto minQuality =
args.
get<scalar>(3);
93 Info<<
"Reading surface " << inFileName <<
nl 94 <<
"Collapsing all triangles with" <<
nl 95 <<
" edges or heights < " << minLen <<
nl 96 <<
" quality < " << minQuality <<
nl 97 <<
"Writing result to " << outFileName <<
nl <<
endl;
100 Info<<
"Reading surface from " << inFileName <<
" ..." <<
nl <<
endl;
107 surf.writeStats(
Info);
111 Info<<
"Removing duplicate and illegal triangles ..." <<
nl <<
endl;
112 surf.cleanup(optVerbose);
115 Info<<
"Collapsing triangles to edges ..." <<
nl <<
endl;
121 if (nEdgeCollapse == 0)
128 const label nSplitEdge =
collapseBase(surf, minLen, minQuality);
137 <<
"Resulting surface:" <<
endl;
138 surf.writeStats(
Info);
141 <<
"Writing refined surface to " << outFileName <<
" ..." <<
endl;
142 surf.
write(outFileName);
static void addNote(const string ¬e)
Add extra notes for the usage information.
label collapseBase(triSurface &surf, const scalar minLen, const scalar minQuality)
Keep collapsing all triangles whose height is < minLen or quality < minQ.
A class for handling file names.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
label collapseEdge(triSurface &surf, const scalar minLen)
Keep collapsing all edges < minLen.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void noParallel()
Remove the parallel options.
static void addOptionCompat(const word &optName, std::pair< const char *, int > compat)
Specify an alias for the option name.
Routines collapse sliver triangles by splitting the base edge.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
Extract command arguments and options from the supplied argc and argv parameters. ...
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
static void addVerboseOption(const string &usage="", bool advanced=false)
Enable a 'verbose' bool option, with usage information.
T get(const label index) const
Get a value from the argument at index.
Routines to collapse small edges.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Triangulated surface description with patch information.
Foam::argList args(argc, argv)
int verbose() const noexcept
Return the verbose flag.
bool found(const word &optName) const
Return true if the named option is found.