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" 154 Info<<
"Output write precision set to " << prec <<
endl;
164 if (importName == exportName)
167 <<
"Output file would overwrite input file." <<
nl 171 const word readFileType
176 const word writeFileType
183 if (!hasReadWriteTypes(readFileType, writeFileType))
186 <<
"Unsupported file format(s)" <<
nl 191 scalar scaleFactor(0);
193 Info<<
"Reading : " << importName <<
endl;
194 triSurface surf(importName, readFileType, scaleFactor);
198 Info<<
"scale input " << scaleFactor <<
nl;
199 surf.scalePoints(scaleFactor);
204 surf.writeStats(
Info);
209 Info<<
"Cleaning up surface" <<
endl;
212 Info<<
"After cleaning up surface:" <<
endl;
213 surf.writeStats(
Info);
217 const bool sortByRegion =
args.
found(
"group");
220 Info<<
"Reordering faces into groups; one per region." <<
endl;
224 Info<<
"Maintaining face ordering" <<
endl;
227 Info<<
"writing " << exportName <<
endl;
229 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)
virtual int precision() const
Get precision of output field.
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 INVALID.
bool has_ext() const
Various checks for extensions.
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 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)
bool found(const word &optName) const
Return true if the named option is found.