ENH: consolidate surfaceFormats for reading/writing triSurface (issue #294)

- eliminates previous code duplication and improves maintainability
This commit is contained in:
Mark Olesen
2017-11-20 14:55:36 +01:00
parent 5947f9a337
commit 3ef8906a66
111 changed files with 2646 additions and 4610 deletions

View File

@ -64,7 +64,7 @@ int main(int argc, char *argv[])
{
argList::addNote
(
"convert between surface formats"
"convert between surface formats, using triSurface library components"
);
argList::noParallel();
@ -96,16 +96,6 @@ int main(int argc, char *argv[])
argList args(argc, argv);
if (args.optionFound("writePrecision"))
{
label writePrecision = args.optionRead<label>("writePrecision");
IOstream::defaultPrecision(writePrecision);
Sout.precision(writePrecision);
Info<< "Output write precision set to " << writePrecision << endl;
}
const fileName importName = args[1];
const fileName exportName = args[2];
@ -116,6 +106,26 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
// Check that reading/writing is supported
if
(
!triSurface::canRead(importName, true)
|| !triSurface::canWriteType(exportName.ext(), true)
)
{
return 1;
}
if (args.optionFound("writePrecision"))
{
label writePrecision = args.optionRead<label>("writePrecision");
IOstream::defaultPrecision(writePrecision);
Sout.precision(writePrecision);
Info<< "Output write precision set to " << writePrecision << endl;
}
const scalar scaleFactor = args.optionLookupOrDefault<scalar>("scale", -1);
Info<< "Reading : " << importName << endl;