1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
28 Convert between edgeMesh formats
30 \*---------------------------------------------------------------------------*/
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 int main(int argc, char *argv[])
47 "Convert between edgeMesh formats"
49 argList::noParallel();
50 argList::validArgs.append("inputFile");
51 argList::validArgs.append("outputFile");
56 "geometry scaling factor - default is 1"
59 argList args(argc, argv);
60 Time runTime(args.rootPath(), args.caseName());
62 const fileName importName = args[1];
63 const fileName exportName = args[2];
65 // disable inplace editing
66 if (importName == exportName)
68 FatalErrorIn(args.executable())
69 << "Output file " << exportName << " would overwrite input file."
73 // check that reading/writing is supported
76 !edgeMesh::canReadType(importName.ext(), true)
77 || !edgeMesh::canWriteType(exportName.ext(), true)
83 edgeMesh mesh(importName);
85 Info<< "\nRead edgeMesh " << importName << nl;
86 mesh.writeStats(Info);
88 << "\nwriting " << exportName;
90 scalar scaleFactor = 0;
91 if (args.optionReadIfPresent("scale", scaleFactor) && scaleFactor > 0)
93 Info<< " with scaling " << scaleFactor << endl;
94 mesh.scalePoints(scaleFactor);
98 Info<< " without scaling" << endl;
101 mesh.write(exportName);
102 mesh.writeStats(Info);
105 Info<< "\nEnd\n" << endl;
111 // ************************************************************************* //