Debian Codegraph @

School05/Monday/grid_chebyshev_gauss.C

raw
1 /*
2 * Definition of class Grid_Chebyshev_Gauss
3 */
4
5 /*
6 * Copyright (c) 2005 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: grid_chebyshev_gauss.C,v 1.2 2014/10/06 15:09:48 j_novak Exp $
28 * $Log: grid_chebyshev_gauss.C,v $
29 * Revision 1.2 2014/10/06 15:09:48 j_novak
30 * Modified #include directives to use c++ syntax.
31 *
32 * Revision 1.1 2005/11/14 01:56:58 e_gourgoulhon
33 * First version
34 *
35 *
36 * $Header: /cvsroot/Lorene/School05/Monday/grid_chebyshev_gauss.C,v 1.2 2014/10/06 15:09:48 j_novak Exp $
37 *
38 */
39
40 #include <iostream>
41
42 using namespace std ;
43
44 #include <cstdlib>
45 #include <cmath>
46
47 #include "grid.h"
48
49 //----------------------//
50 // Standard constructor //
51 //----------------------//
52
53 Grid_Chebyshev_Gauss::Grid_Chebyshev_Gauss(int nb_nodes) : Grid(nb_nodes) {
54
55 double h = M_PI / double(2*(nn+1)) ;
56
57 for (int i=0; i<=nn; i++) xx[i] = - cos( h * (2*i+1) ) ;
58
59 }
60
61
62 //--------------------//
63 // Copy constructor //
64 //--------------------//
65
66 Grid_Chebyshev_Gauss::Grid_Chebyshev_Gauss(const Grid_Chebyshev_Gauss& gi) : Grid(gi) {}
67
68
69 //--------------//
70 // Destructor //
71 //--------------//
72
73 Grid_Chebyshev_Gauss::~Grid_Chebyshev_Gauss() {}
74
75
76 //--------------//
77 // Assignment //
78 //--------------//
79
80 void Grid_Chebyshev_Gauss::operator=(const Grid_Chebyshev_Gauss& gi) {
81
82 Grid::operator=(gi) ;
83 }
84
85
86
87 //-----------//
88 // Display //
89 //-----------//
90
91 ostream& operator<<(ostream& ost, const Grid_Chebyshev_Gauss& xn) {
92
93 ost << "Chebyshev Gauss nodes : " ;
94 int nn = xn.n() ;
95 ost << "number of nodes : " << nn + 1 << endl ;
96 for (int i=0; i<=nn; i++) {
97 ost << " x(" << i << ") = " << xn(i) << endl ;
98 }
99
100 return ost ;
101 }
102