BUG: createBaffles.C: converting coupled faces into baffles
[OpenFOAM-2.0.x.git] / applications / utilities / mesh / conversion / kivaToFoam / kivaToFoam.C
blobb574b1525d4e28fc8d6df7f580e3069029f595d9
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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/>.
24 Application
25     kivaToFoam
27 Description
28     Converts a KIVA3v grid to OpenFOAM format
30 \*---------------------------------------------------------------------------*/
32 #include "argList.H"
33 #include "Time.H"
34 #include "polyMesh.H"
35 #include "IFstream.H"
36 #include "OFstream.H"
37 #include "cellShape.H"
38 #include "cellModeller.H"
39 #include "preservePatchTypes.H"
40 #include "emptyPolyPatch.H"
41 #include "wallPolyPatch.H"
42 #include "symmetryPolyPatch.H"
43 #include "wedgePolyPatch.H"
44 #include "oldCyclicPolyPatch.H"
45 #include "unitConversion.H"
47 using namespace Foam;
49 //- Supported KIVA versions
50 enum kivaVersions
52     kiva3,
53     kiva3v
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 // Main program:
59 int main(int argc, char *argv[])
61     argList::noParallel();
62     argList::addOption
63     (
64         "file",
65         "name",
66         "specify alternative input file name - default is otape17"
67     );
68     argList::addOption
69     (
70         "version",
71         "version",
72         "specify kiva version [kiva3|kiva3v] - default is '3v'"
73     );
74     argList::addOption
75     (
76         "zHeadMin",
77         "scalar",
78         "minimum z-height for transferring liner faces to cylinder-head"
79     );
81 #   include "setRootCase.H"
82 #   include "createTime.H"
84     const fileName kivaFileName =
85         args.optionLookupOrDefault<fileName>("file", "otape17");
87     kivaVersions kivaVersion = kiva3v;
88     if (args.optionFound("version"))
89     {
90         const word versionName = args["version"];
92         if (versionName == "kiva3")
93         {
94             kivaVersion = kiva3;
95         }
96         else if (versionName == "kiva3v")
97         {
98             kivaVersion = kiva3v;
99         }
100         else
101         {
102             FatalErrorIn("main(int argc, char *argv[])")
103                 << "KIVA file version " << versionName << " not supported"
104                 << exit(FatalError);
106             args.printUsage();
107             FatalError.exit(1);
108         }
109     }
111     scalar zHeadMin = -GREAT;
112     args.optionReadIfPresent("zHeadMin", zHeadMin);
114 #   include "readKivaGrid.H"
116     Info<< "End\n" << endl;
118     return 0;
122 // ************************************************************************* //