94int main(
int argc,
char *argv[])
98 "Export from surfMesh to various third-party surface formats"
101 argList::noParallel();
102 argList::addArgument(
"output",
"The output surface file");
104 argList::addBoolOption
107 "Perform some surface checking/cleanup on the input surface"
113 "Specify an alternative surface name when reading - "
114 "default is 'default'"
120 "Output format (default: use file extension)"
126 "Input geometry scaling factor"
132 "Output geometry scaling factor"
135 argList::addOptionCompat(
"read-scale", {
"scaleIn", 1912});
136 argList::addOptionCompat(
"write-scale", {
"scaleOut", 1912});
138 argList::addOption(
"dict",
"file",
"Alternative coordinateSystems");
144 "The source coordinate system, applied after '-read-scale'",
151 "The target coordinate system, applied before '-write-scale'",
161 const word writeFileType
167 if (!meshedSurface::canWriteType(writeFileType,
true))
170 <<
"Unsupported file format(s)" <<
nl
175 scalar scaleFactor(0);
183 IOobject ioCsys = IOobject::selectIO
187 coordinateSystems::typeName,
209 const auto* csPtr = globalCoords.cfind(csName);
214 <<
"Cannot find -from " << csName <<
nl
215 <<
"available coordinateSystems: "
226 const auto* csPtr = globalCoords.cfind(csName);
231 <<
"Cannot find -to " << csName <<
nl
232 <<
"available coordinateSystems: "
241 if (fromCsys && toCsys)
244 <<
"Only allowed '-from' or '-to' option at the moment."
257 IOobject::MUST_READ_IF_MODIFIED,
262 Info<<
"read surfMesh:\n " << smesh.objectPath() <<
endl;
271 Info<<
"scale input " << scaleFactor <<
nl;
272 surf.scalePoints(scaleFactor);
282 Info<<
"move points from coordinate system: "
283 << fromCsys->name() <<
endl;
285 surf.movePoints(tpf());
290 Info<<
"move points to coordinate system: "
291 << toCsys->name() <<
endl;
293 surf.movePoints(tpf());
298 Info<<
"scale output " << scaleFactor <<
endl;
299 surf.scalePoints(scaleFactor);
302 surf.writeStats(Info);
305 Info<<
"writing " << exportName <<
nl;
306 surf.write(exportName, writeFileType);
Defines the attributes of an object for which implicit objectRegistry management is supported,...
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (uses typeFilePath to find file) and check its info.
fileName objectPath() const
The complete path + object name.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
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.
const fileName & rootPath() const noexcept
Return root path.
bool found(const word &optName) const
Return true if the named option is found.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
const fileName & caseName() const noexcept
Return case name (parallel run) or global case (serial run)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A centralized collection of named coordinate systems.
A class for handling file names.
A surface mesh consisting of general polygon faces that has IO capabilities and a registry for storin...
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
word ext() const
Return file name extension (part after last .)
word lessExt() const
Return word without extension (part before last .)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
Foam::argList args(argc, argv)