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 Reads an OpenFOAM mesh and writes a pro-STAR (v4) bnd/cel/vrt format.
31 - foamToStarMesh [OPTION] \n
32 Reads an OpenFOAM mesh and writes a pro-STAR (v4) bnd/cel/vrt format.
35 Suppress writing the \c .bnd file
37 \param -scale \<factor\>\n
38 Specify an alternative geometry scaling factor.
39 The default is \b 1000 (scale \em [m] to \em [mm]).
42 The cellTable information available in the files
43 \c constant/cellTable and \c constant/polyMesh/cellTableId
44 will be used if available. Otherwise the cellZones are used when
45 creating the cellTable information.
48 Foam::cellTable, Foam::meshWriter and Foam::meshWriters::STARCD
50 \*---------------------------------------------------------------------------*/
53 #include "timeSelector.H"
56 #include "STARCDMeshWriter.H"
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 int main(int argc, char *argv[])
67 "read OpenFOAM mesh and write a pro-STAR (v4) bnd/cel/vrt format"
69 argList::noParallel();
70 timeSelector::addOptions();
76 "geometry scaling factor - default is 1000 ([m] to [mm])"
78 argList::addBoolOption
81 "suppress writing a boundary (.bnd) file"
84 # include "setRootCase.H"
85 # include "createTime.H"
87 instantList timeDirs = timeSelector::select0(runTime, args);
89 fileName exportName = meshWriter::defaultMeshName;
90 if (args.optionFound("case"))
92 exportName += '-' + args.globalCaseName();
95 // default: rescale from [m] to [mm]
96 scalar scaleFactor = 1000;
97 if (args.optionReadIfPresent("scale", scaleFactor))
105 # include "createPolyMesh.H"
107 forAll(timeDirs, timeI)
109 runTime.setTime(timeDirs[timeI], timeI);
111 # include "getTimeIndex.H"
113 polyMesh::readUpdateState state = mesh.readUpdate();
115 if (!timeI || state != polyMesh::UNCHANGED)
117 meshWriters::STARCD writer(mesh, scaleFactor);
119 if (args.optionFound("noBnd"))
124 fileName meshName(exportName);
125 if (state != polyMesh::UNCHANGED)
127 meshName += '_' + runTime.timeName();
130 writer.write(meshName);
136 Info<< "End\n" << endl;
141 // ************************************************************************* //