mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: consolidate surfaceFormats for reading/writing triSurface (issue #294)
- eliminates previous code duplication and improves maintainability
This commit is contained in:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user