1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2011 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
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 Converts a Star-CD (v4) pro-STAR mesh into OpenFOAM format.
31 - star4ToFoam [OPTION] ccmMesh\n
32 convert pro-STAR mesh to OpenFOAM
35 Write in ASCII format instead of binary
37 \param -scale \<factor\>\n
38 Specify an alternative geometry scaling factor.
39 The default is \b 0.001 (scale \em [mm] to \em [m]).
42 Treat any solid cells present just like fluid cells.
43 The default is to discard them.
46 - baffles are written as interfaces for later use
48 \*---------------------------------------------------------------------------*/
52 #include "STARCDMeshReader.H"
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 int main(int argc, char *argv[])
64 "convert pro-STAR (v4) mesh to OpenFOAM"
67 argList::noParallel();
68 argList::validArgs.append("pro-STAR prefix");
69 argList::addBoolOption
72 "write in ASCII instead of binary format"
78 "geometry scaling factor - default is 0.001 ([mm] to [m])"
80 argList::addBoolOption
83 "retain solid cells and treat them like fluid cells"
86 argList args(argc, argv);
87 Time runTime(args.rootPath(), args.caseName());
89 // default rescale from [mm] to [m]
90 scalar scaleFactor = args.optionLookupOrDefault("scale", 0.001);
96 meshReaders::STARCD::keepSolids = args.optionFound("solids");
98 // default to binary output, unless otherwise specified
99 IOstream::streamFormat format = IOstream::BINARY;
100 if (args.optionFound("ascii"))
102 format = IOstream::ASCII;
105 // increase the precision of the points data
106 IOstream::defaultPrecision(10);
108 // remove extensions and/or trailing '.'
109 const fileName prefix = fileName(args[1]).lessExt();
111 meshReaders::STARCD reader(prefix, runTime, scaleFactor);
113 autoPtr<polyMesh> mesh = reader.mesh(runTime);
114 reader.writeMesh(mesh, format);
117 Info<< "\nEnd\n" << endl;
122 // ************************************************************************* //