star3ToFoam.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Application
25  star3ToFoam
26 
27 Description
28  Converts a Star-CD (v3) pro-STAR mesh into OpenFOAM format.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #include "argList.H"
33 #include "Time.H"
34 #include "starMesh.H"
35 
36 using namespace Foam;
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 int main(int argc, char *argv[])
41 {
43  (
44  "convert pro-STAR (v3) mesh to OpenFOAM"
45  );
46 
48  argList::validArgs.append("pro-STAR prefix");
50  (
51  "scale",
52  "factor",
53  "geometry scaling factor - default is 1"
54  );
55 
56  argList args(argc, argv);
57 
58  if (!args.check())
59  {
60  FatalError.exit();
61  }
62 
63  const scalar scaleFactor = args.optionLookupOrDefault("scale", 1.0);
64 
65  #include "createTime.H"
66 
67  starMesh makeMesh(args[1], runTime, scaleFactor);
68 
69  // Set the precision of the points data to 10
71 
72  Info<< "Writing mesh" << endl;
73  makeMesh.writeMesh();
74 
75  Info<< "\nEnd\n" << endl;
76 
77  return 0;
78 }
79 
80 
81 // ************************************************************************* //
error FatalError
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
static unsigned int defaultPrecision()
Return the default precision.
Definition: IOstream.H:461
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
static void noParallel()
Remove the parallel options.
Definition: argList.C:148
static SLList< string > validArgs
A list of valid (mandatory) arguments.
Definition: argList.H:154
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
Definition: error.C:168
T optionLookupOrDefault(const word &opt, const T &deflt) const
Read a value from the named option if present.
Definition: argListI.H:237
Extract command arguments and options from the supplied argc and argv parameters. ...
Definition: argList.H:102
static void addOption(const word &opt, const string &param="", const string &usage="")
Add to an option to validOptions with usage information.
Definition: argList.C:95
A messy mesh class which supports the possibility of creating a shapeMesh for regular Star meshes (no...
Definition: starMesh.H:67
messageStream Info
bool check(bool checkArgs=true, bool checkOpts=true) const
Check argument list.
Definition: argList.C:1246
static void addNote(const string &)
Add extra notes for the usage information.
Definition: argList.C:126
Foam::argList args(argc, argv)
Namespace for OpenFOAM.