surfaceToFMS.C 2.24 KB
Newer Older
Franjo's avatar
Franjo committed
1
2
3
4
5
6
7
8
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | cfMesh: A library for mesh generation
   \\    /   O peration     |
    \\  /    A nd           | Author: Franjo Juretic (franjo.juretic@c-fields.com)
     \\/     M anipulation  | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
Andrew Heather's avatar
Andrew Heather committed
9
    This file is part of OpenFOAM.
Franjo's avatar
Franjo committed
10

Andrew Heather's avatar
Andrew Heather committed
11
12
13
14
    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
Franjo's avatar
Franjo committed
15

Andrew Heather's avatar
Andrew Heather committed
16
    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
Franjo's avatar
Franjo committed
17
18
19
20
21
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
Andrew Heather's avatar
Andrew Heather committed
22
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
Franjo's avatar
Franjo committed
23
24

Description
Andrew Heather's avatar
Andrew Heather committed
25
    Reads the specified surface and writes it in the fms format.
Franjo's avatar
Franjo committed
26
27
28
29
30
31
32
33
34
35
36
37
38
39

\*---------------------------------------------------------------------------*/

#include "argList.H"
#include "IFstream.H"
#include "fileName.H"
#include "triSurf.H"
#include "demandDrivenData.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
using namespace Foam;

int main(int argc, char *argv[])
{
Mark Olesen's avatar
Mark Olesen committed
40
41
42
43
44
45
    argList::addNote
    (
        "(cfmesh)\n"
        "Reads the specified surface and writes it in the fms format"
    );

Franjo's avatar
Franjo committed
46
47
48
    argList::noParallel();
    argList::validArgs.clear();
    argList::validArgs.append("input surface file");
Mark Olesen's avatar
Mark Olesen committed
49

Franjo's avatar
Franjo committed
50
51
    argList args(argc, argv);

Mark Olesen's avatar
Mark Olesen committed
52
    const fileName inFileName(args[1]);
Andrew Heather's avatar
Andrew Heather committed
53
    if (inFileName.ext() == "fms")
Mark Olesen's avatar
Mark Olesen committed
54
    {
55
56
        FatalErrorInFunction
            << "trying to convert a fms file to itself" << nl
Franjo's avatar
Franjo committed
57
            << exit(FatalError);
Mark Olesen's avatar
Mark Olesen committed
58
    }
Franjo's avatar
Franjo committed
59
60
61

    fileName outFileName(inFileName.lessExt()+".fms");

62
    const Module::triSurf surface(inFileName);
Franjo's avatar
Franjo committed
63
64
65

    surface.writeSurface(outFileName);

Andrew Heather's avatar
Andrew Heather committed
66
    Info<< "End\n" << endl;
Franjo's avatar
Franjo committed
67
68
69
70
71
72

    return 0;
}


// ************************************************************************* //