surfaceToFMS.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25  Reads the specified surface and writes it in the fms format.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "argList.H"
30 #include "IFstream.H"
31 #include "fileName.H"
32 #include "triSurf.H"
33 #include "demandDrivenData.H"
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // Main program:
37 using namespace Foam;
38 
39 int main(int argc, char *argv[])
40 {
42  argList::validArgs.clear();
43  argList::validArgs.append("input surface file");
44  argList args(argc, argv);
45 
46  const fileName inFileName(args.args()[1]);
47  if( inFileName.ext() == "fms" )
48  FatalError << "trying to convert a fms file to itself"
49  << exit(FatalError);
50 
51  fileName outFileName(inFileName.lessExt()+".fms");
52 
53  const triSurf surface(inFileName);
54 
55  surface.writeSurface(outFileName);
56 
57  Info << "End\n" << endl;
58 
59  return 0;
60 }
61 
62 
63 // ************************************************************************* //
Foam::argList::validArgs
static SLList< string > validArgs
A list of valid (mandatory) arguments.
Definition: argList.H:143
triSurf.H
Foam::argList::args
const stringList & args() const
Return arguments.
Definition: argListI.H:66
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::argList
Extract command arguments and options from the supplied argc and argv parameters.
Definition: argList.H:97
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::fileName::lessExt
fileName lessExt() const
Return file name without extension (part before last .)
Definition: fileName.C:313
Foam::Info
messageStream Info
argList.H
fileName.H
IFstream.H
Foam::FatalError
error FatalError
Foam::fileName::ext
word ext() const
Return file name extension (part after last .)
Definition: fileName.C:329
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::surface
Definition: surface.H:55
Foam::argList::noParallel
static void noParallel()
Remove the parallel options.
Definition: argList.C:161
args
Foam::argList args(argc, argv)
Foam::triSurf
Definition: triSurf.H:59
main
int main(int argc, char *argv[])
Definition: surfaceToFMS.C:39