1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Converts from one surface mesh format to another
32 - surfaceConvert inputFile outputFile [OPTION]
35 Perform some surface checking/cleanup on the input surface
37 @param -scale \<scale\> \n
38 Specify a scaling factor for writing the files
41 Orders faces by region
44 The filename extensions are used to determine the file format type.
46 \*---------------------------------------------------------------------------*/
50 #include "triSurface.H"
52 #include "OSspecific.H"
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 int main(int argc, char *argv[])
62 argList::noParallel();
63 argList::validArgs.clear();
64 argList::validArgs.append("inputFile");
65 argList::validArgs.append("outputFile");
66 argList::validOptions.insert("clean", "");
67 argList::validOptions.insert("scale", "scale");
68 argList::validOptions.insert("group", "");
70 argList args(argc, argv);
71 const stringList& params = args.additionalArgs();
73 fileName importName(params[0]);
74 fileName exportName(params[1]);
76 if (importName == exportName)
78 FatalErrorIn(args.executable())
79 << "Output file " << exportName << " would overwrite input file."
83 Info<< "Reading : " << importName << endl;
84 triSurface surf(importName);
86 Info<< "Read surface:" << endl;
87 surf.writeStats(Info);
90 if (args.optionFound("clean"))
92 Info<< "Cleaning up surface" << endl;
95 Info<< "After cleaning up surface:" << endl;
96 surf.writeStats(Info);
100 bool sortByRegion = args.optionFound("group");
104 Info<< "Reordering faces into groups; one per region." << endl;
108 Info<< "Maintaining face ordering" << endl;
111 Info<< "writing " << exportName;
113 scalar scaleFactor = 0;
114 if (args.optionReadIfPresent("scale", scaleFactor) && scaleFactor > 0)
116 Info<< " with scaling " << scaleFactor;
117 surf.scalePoints(scaleFactor);
121 surf.write(exportName, sortByRegion);
123 Info<< "\nEnd\n" << endl;
128 // ************************************************************************* //