OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

kivaToFoam.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Application
00026     kivaToFoam
00027 
00028 Description
00029     Converts a KIVA3v grid to FOAM format
00030 
00031 \*---------------------------------------------------------------------------*/
00032 
00033 #include "argList.H"
00034 #include "Time.H"
00035 #include "polyMesh.H"
00036 #include "IFstream.H"
00037 #include "OFstream.H"
00038 #include "cellShape.H"
00039 #include "cellModeller.H"
00040 #include "preservePatchTypes.H"
00041 #include "emptyPolyPatch.H"
00042 #include "wallPolyPatch.H"
00043 #include "symmetryPolyPatch.H"
00044 #include "wedgePolyPatch.H"
00045 #include "cyclicPolyPatch.H"
00046 #include "mathematicalConstants.H"
00047 
00048 using namespace Foam;
00049 
00050 // Supported KIVA versions
00051 enum kivaVersions
00052 {
00053     kiva3,
00054     kiva3v
00055 };
00056 
00057 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00058 // Main program:
00059 
00060 int main(int argc, char *argv[])
00061 {
00062     argList::noParallel();
00063     argList::validOptions.insert("file", "fileName");
00064     argList::validOptions.insert("version", "[kiva3|kiva3v]");
00065     argList::validOptions.insert("zHeadMin", "scalar");
00066 
00067 #   include "setRootCase.H"
00068 #   include "createTime.H"
00069 
00070     fileName kivaFileName("otape17");
00071     if (args.optionFound("file"))
00072     {
00073         kivaFileName = args.option("file");
00074     }
00075 
00076     kivaVersions kivaVersion = kiva3v;
00077     if (args.optionFound("version"))
00078     {
00079         word kivaVersionName = args.option("version");
00080 
00081         if (kivaVersionName == "kiva3")
00082         {
00083             kivaVersion = kiva3;
00084         }
00085         else if (kivaVersionName == "kiva3v")
00086         {
00087             kivaVersion = kiva3v;
00088         }
00089         else
00090         {
00091             FatalErrorIn("main(int argc, char *argv[])")
00092                 << "KIVA file version " << kivaVersionName << " not supported"
00093                 << exit(FatalError);
00094 
00095             args.printUsage();
00096 
00097             FatalError.exit(1);
00098         }
00099     }
00100 
00101     scalar zHeadMin = -GREAT;
00102     args.optionReadIfPresent("zHeadMin", zHeadMin);
00103 
00104 #   include "readKivaGrid.H"
00105 
00106     Info << "End\n" << endl;
00107 
00108     return 0;
00109 }
00110 
00111 
00112 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd