Debian Codegraph @

School05/Monday/grid_legendre_gl.C

raw
1 /*
2 * Definition of class Grid_Legendre_GL
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_legendre_gl.C,v 1.2 2014/10/06 15:09:48 j_novak Exp $
28 * $Log: grid_legendre_gl.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_legendre_gl.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 void legendre_nodes_weight_GL(int n, double* coloc, double* weight,
50 double prec = 1.e-12, int itemax = 100) ;
51
52
53 //----------------------//
54 // Standard constructor //
55 //----------------------//
56
57 Grid_Legendre_GL::Grid_Legendre_GL(int nb_nodes) : Grid(nb_nodes) {
58
59 double* weights = new double[nn+1] ;
60
61 double precis = 1.e-12 ; // required precision
62 int nitermax = 200 ; // Maximum number of iterations
63
64 legendre_nodes_weight_GL(nn+1, xx, weights, precis, nitermax) ;
65
66 delete [] weights ;
67 }
68
69
70 //--------------------//
71 // Copy constructor //
72 //--------------------//
73
74 Grid_Legendre_GL::Grid_Legendre_GL(const Grid_Legendre_GL& gi) : Grid(gi) {}
75
76
77 //--------------//
78 // Destructor //
79 //--------------//
80
81 Grid_Legendre_GL::~Grid_Legendre_GL() {}
82
83
84 //--------------//
85 // Assignment //
86 //--------------//
87
88 void Grid_Legendre_GL::operator=(const Grid_Legendre_GL& gi) {
89
90 Grid::operator=(gi) ;
91 }
92
93
94
95 //-----------//
96 // Display //
97 //-----------//
98
99 ostream& operator<<(ostream& ost, const Grid_Legendre_GL& xn) {
100
101 ost << "Legendre Gauss-Lobatto nodes : " ;
102 int nn = xn.n() ;
103 ost << "number of nodes : " << nn + 1 << endl ;
104 for (int i=0; i<=nn; i++) {
105 ost << " x(" << i << ") = " << xn(i) << endl ;
106 }
107
108 return ost ;
109 }
110