Debian Codegraph @

Test/test_fft.C

raw
1 /*
2 * Test code for LORENE class Valeur 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_fft.C,v 1.6 2014/10/13 08:54:08 j_novak Exp $
28 * $Log: test_fft.C,v $
29 * Revision 1.6 2014/10/13 08:54:08 j_novak
30 * Lorene classes and functions now belong to the namespace Lorene.
31 *
32 * Revision 1.5 2010/01/31 16:37:29 e_gourgoulhon
33 * The number of points is no longer asked to the user but set to 16.
34 *
35 * Revision 1.4 2005/11/02 13:04:28 p_grandclement
36 * small change in test_fft.C
37 *
38 * Revision 1.3 2003/09/09 08:24:43 j_novak
39 * *** empty log message ***
40 *
41 * Revision 1.2 2002/10/16 14:37:19 j_novak
42 * Reorganization of #include instructions of standard C++, in order to
43 * use experimental version 3 of gcc.
44 *
45 * Revision 1.1.1.1 2001/11/20 15:19:31 e_gourgoulhon
46 * LORENE
47 *
48 *
49 * $Header: /cvsroot/Lorene/Test/test_fft.C,v 1.6 2014/10/13 08:54:08 j_novak Exp $
50 *
51 */
52
53 // Lorene headers
54 #include "valeur.h"
55 #include "map.h"
56 #include "graphique.h"
57
58 using namespace Lorene ;
59
60 int main(){
61
62 // Nombre de points
63 // ----------------
64 int np ;
65 // cout << "Nombre de points ? " ;
66 // cin >> np ;
67 // cout << endl ;
68 //while ( cin.get()!='\n' ) ;
69
70 np = 16 ;
71
72 // Construction de la grille
73 // -------------------------
74 int nz = 1 ;
75 int nbr[] = {1} ;
76 int type_r[] = {RARE} ;
77 int nbt[] = {1} ;
78 int type_t = SYM ;
79 int nbp[] = {np} ;
80 int type_p = NONSYM ;
81
82 Mg3d mg(nz, nbr, type_r, nbt, type_t, nbp, type_p) ;
83
84 // Construction du mapping associe
85 // -------------------------------
86
87 double r_limits[] = {0,1} ;
88
89 Map_af mp(mg, r_limits) ;
90
91 // Phi
92 // ---
93
94 const Coord& phi = mp.phi ;
95
96 // Valeur de la fonction
97 // ---------------------
98
99 Valeur ff(mg) ;
100 ff = pow(cos(phi),5) ;
101
102 cout << "f : " << endl ;
103 cout << ff << endl ;
104
105 // Transformation de Fourier
106 // -------------------------
107
108 ff.std_base_scal() ; // definit la base spectrale a utiliser (Fourier)
109
110 ff.coef() ; // effectue la transformation de Fourier
111
112 cout << "Coefficients of the Fourier transform of f : " << endl ;
113
114 ff.affiche_seuil(cout) ;
115
116 // Dessin des coefficients de Fourier
117 // ----------------------------------
118 des_coef_phi(ff, 0, 0, 0, 1.e-14, "log|C_k|","Fourier coefficients") ;
119
120
121 // Fin du programme
122 // ----------------
123
124 return EXIT_SUCCESS ;
125
126 }