Debian Codegraph @

Test/test_pgplot.C

raw
1 /*
2 * Test code for Lorene class Tbl and PGPLOT
3 */
4
5 /*
6 * Copyright (c) 2001 Eric Gourgoulhon
7 *
8 * This file is part of LORENE.
9 *
10 * LORENE is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * LORENE is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with LORENE; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26 /*
27 * $Id: test_pgplot.C,v 1.5 2014/10/13 08:54:08 j_novak Exp $
28 * $Log: test_pgplot.C,v $
29 * Revision 1.5 2014/10/13 08:54:08 j_novak
30 * Lorene classes and functions now belong to the namespace Lorene.
31 *
32 * Revision 1.4 2014/10/06 15:07:36 j_novak
33 * Modified #include directives to use c++ syntax.
34 *
35 * Revision 1.3 2008/09/22 19:08:56 j_novak
36 * Minor modifs.
37 *
38 * Revision 1.2 2002/10/16 14:37:19 j_novak
39 * Reorganization of #include instructions of standard C++, in order to
40 * use experimental version 3 of gcc.
41 *
42 * Revision 1.1.1.1 2001/11/20 15:19:31 e_gourgoulhon
43 * LORENE
44 *
45 *
46 * $Header: /cvsroot/Lorene/Test/test_pgplot.C,v 1.5 2014/10/13 08:54:08 j_novak Exp $
47 *
48 */
49
50 // C headers:
51 #include <cmath>
52
53 // Lorene headers
54 #include "tbl.h"
55 #include "graphique.h"
56
57 using namespace Lorene ;
58
59 int main() {
60
61 int np = 100 ;
62
63 Tbl a(np) ;
64 a.set_etat_qcq() ;
65
66 double h = 2*M_PI / double(np-1) ;
67
68 for (int i=0; i<np; i++) {
69 a.set(i) = sin(h*i) ;
70 }
71
72 float* uutab = new float[np] ;
73
74 for (int i=0; i<np; i++) {
75 uutab[i] = float(a(i)) ;
76 }
77
78
79 float xmin = 0. ;
80 float xmax = float(2*M_PI) ;
81
82 des_profile(uutab, np, xmin, xmax, "x", "sin(x)", "Test") ;
83
84 delete [] uutab ;
85
86 return EXIT_SUCCESS ;
87
88 }