81 static bool hasReadWriteTypes(
const word& readType,
const word& writeType)
83 volatile bool good =
true;
101 int main(
int argc,
char *argv[])
105 "Convert between surface formats, using triSurface library components" 115 "Perform some surface checking/cleanup on the input surface" 120 "Reorder faces into groups; one per region" 126 "The input format (default: use file extension)" 132 "The output format (default: use file extension)" 138 "Input geometry scaling factor" 144 "The output precision" 155 Info<<
"Output write precision set to " << prec <<
endl;
167 if (importName == exportName)
170 <<
"Output file would overwrite input file." <<
nl 174 const word readFileType
179 const word writeFileType
186 if (!hasReadWriteTypes(readFileType, writeFileType))
189 <<
"Unsupported file format(s)" <<
nl 194 scalar scaleFactor(0);
196 Info<<
"Reading : " << importName <<
endl;
197 triSurface surf(importName, readFileType, scaleFactor);
201 Info<<
"scale input " << scaleFactor <<
nl;
202 surf.scalePoints(scaleFactor);
207 surf.writeStats(
Info);
212 Info<<
"Cleaning up surface" <<
endl;
213 surf.cleanup(optVerbose);
215 Info<<
"After cleaning up surface:" <<
endl;
216 surf.writeStats(
Info);
220 const bool sortByRegion =
args.
found(
"group");
223 Info<<
"Reordering faces into groups; one per region." <<
endl;
227 Info<<
"Maintaining face ordering" <<
endl;
230 Info<<
"writing " << exportName <<
endl;
232 surf.
write(exportName, writeFileType, sortByRegion);
static void addNote(const string ¬e)
Add extra notes for the usage information.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static unsigned int defaultPrecision() noexcept
Return the default precision.
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.
static bool canWriteType(const word &fileType, bool verbose=false)
Can we write this file format?
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
word ext() const
Return file name extension (part after last .)
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
bool has_ext() const
Various checks for extensions.
virtual int precision() const override
Get precision of output field.
A class for handling words, derived from Foam::string.
Extract command arguments and options from the supplied argc and argv parameters. ...
OSstream Sout
OSstream wrapped stdout (std::cout)
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.
static bool canReadType(const word &fileType, bool verbose=false)
Can we read this file format?
T get(const label index) const
Get a value from the argument at index.
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)
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
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.