1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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 a Star-CD (v4) pro-STAR mesh into OpenFOAM format.
32 - star4ToFoam [OPTION] ccmMesh\n
33 convert pro-STAR mesh to OpenFOAM
36 Write in ASCII format instead of binary
38 @param -scale \<factor\>\n
39 Specify an alternative geometry scaling factor.
40 The default is @b 0.001 (scale @em [mm] to @em [m]).
43 Treat any solid cells present just like fluid cells.
44 The default is to discard them.
47 - baffles are written as interfaces for later use
49 \*---------------------------------------------------------------------------*/
53 #include "STARCDMeshReader.H"
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 int main(int argc, char *argv[])
63 argList::noParallel();
64 argList::validArgs.append("pro-STAR prefix");
65 argList::validOptions.insert("ascii", "");
66 argList::validOptions.insert("scale", "scale");
67 argList::validOptions.insert("solids", "");
69 argList args(argc, argv);
70 Time runTime(args.rootPath(), args.caseName());
71 stringList const& params = args.additionalArgs();
73 // default rescale from [mm] to [m]
74 scalar scaleFactor = 0.001;
75 if (args.options().found("scale"))
77 scaleFactor = readScalar(IStringStream(args.options()["scale"])());
84 if (args.options().found("solids"))
86 meshReaders::STARCD::keepSolids = true;
89 // default to binary output, unless otherwise specified
90 IOstream::streamFormat format = IOstream::BINARY;
91 if (args.options().found("ascii"))
93 format = IOstream::ASCII;
96 // increase the precision of the points data
97 IOstream::defaultPrecision(10);
99 // remove extensions and/or trailing '.'
100 fileName prefix = fileName(params[0]).lessExt();
102 meshReaders::STARCD reader(prefix, runTime, scaleFactor);
104 autoPtr<polyMesh> mesh = reader.mesh(runTime);
105 reader.writeMesh(mesh, format);
108 Info<< "\nEnd\n" << endl;
113 // ************************************************************************* //