~ubuntu-branches/ubuntu/trusty/rheolef/trusty-proposed

« back to all changes in this revision

Viewing changes to nfem/tst/space_gen_tst.cc

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2010-06-12 09:08:59 UTC
  • Revision ID: james.westby@ubuntu.com-20100612090859-8gpm2gc7j3ab43et
Tags: upstream-5.89
ImportĀ upstreamĀ versionĀ 5.89

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
///
 
2
/// This file is part of Rheolef.
 
3
///
 
4
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
 
5
///
 
6
/// Rheolef is free software; you can redistribute it and/or modify
 
7
/// it under the terms of the GNU General Public License as published by
 
8
/// the Free Software Foundation; either version 2 of the License, or
 
9
/// (at your option) any later version.
 
10
///
 
11
/// Rheolef is distributed in the hope that it will be useful,
 
12
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
/// GNU General Public License for more details.
 
15
///
 
16
/// You should have received a copy of the GNU General Public License
 
17
/// along with Rheolef; if not, write to the Free Software
 
18
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
19
///
 
20
/// =========================================================================
 
21
/*Prog:space_gen
 
22
NAME: "space_gen" - output a P1-continuous finite element space 
 
23
SYNOPSIS:
 
24
   "space_gen" {-I'geodir'} 'mesh'[".geo"] {'domain-name'}*
 
25
DESCRIPTION:       
 
26
  Generate a 2d or 3d finite element space.
 
27
EXAMPLE: 
 
28
    enter command as:
 
29
 
 
30
    |  space_gen square.geo top left
 
31
OPTIONS:
 
32
    -I'geodir' add 'geodir' to the GEOPATH search path.
 
33
    See also "geo"(3) for GEOPATH mechanism. 
 
34
 
 
35
    'filename' specifies the name of the file containing
 
36
      the input mesh. The ".geo" extension is assumed.
 
37
 
 
38
    "-" read mesh on standard input instead on a file.
 
39
 
 
40
    'domain-name' specifies a valid domain name where the
 
41
    degrees of freedom are blocked.
 
42
AUTHOR: 
 
43
    LMC-IMAG, 38041 Grenoble cedex 9, France
 
44
    | Nicolas.Roquet@imag.fr
 
45
    | Pierre.Saramito@imag.fr
 
46
SEE ALSO:
 
47
    class "space"(3), class "geo"(3), class "base"(3)
 
48
DATE:
 
49
    16 june 1997
 
50
End:
 
51
*/
 
52
#include "rheolef/rheolef.h"
 
53
using namespace std;
 
54
 
 
55
void usage()
 
56
{
 
57
      cerr << "space_gen: usage: space_gen "
 
58
           << "{-Igeodir}*"
 
59
           << "-|mesh[.geo]"
 
60
           << "{domain-name}*"
 
61
           << endl;
 
62
      exit (1);
 
63
}
 
64
int main(int argc, char**argv)
 
65
{
 
66
    bool verbose = true;
 
67
    if (argc <= 1) usage();
 
68
    //
 
69
    // load geometry
 
70
    //
 
71
    geo g;  
 
72
    int io = 1; 
 
73
    while (argv [io][0] == '-' && argv [io][1] == 'I') {
 
74
        append_dir_to_rheo_path (argv[io]+2);
 
75
        io++;
 
76
    }
 
77
    if (strcmp (argv[io], "-") == 0) {
 
78
        // input geo on standard input
 
79
        cerr << "! space: geo on stdin\n";
 
80
        cin >> g;
 
81
      
 
82
    } else {
 
83
    
 
84
        // input geo on file
 
85
        g = geo(argv[io]);
 
86
    }
 
87
    //
 
88
    // block dof on boundary domains
 
89
    //
 
90
    space V (g, "P1");
 
91
    for (int i = io+1; i < argc; i++) {
 
92
 
 
93
      // block a domain
 
94
      cerr << "! space: block `" << argv[i] << "'\n";
 
95
      V.block (argv[i]);
 
96
    }
 
97
    //
 
98
    // output space
 
99
    //
 
100
    cout << V;
 
101
    return 0;
 
102
}