grid_legendre_gl.C

00001 /*
00002  * Definition of class Grid_Legendre_GL
00003  */
00004  
00005 /*
00006  *   Copyright (c) 2005 Eric Gourgoulhon
00007  *
00008  *   This file is part of LORENE.
00009  *
00010  *   LORENE is free software; you can redistribute it and/or modify
00011  *   it under the terms of the GNU General Public License as published by
00012  *   the Free Software Foundation; either version 2 of the License, or
00013  *   (at your option) any later version.
00014  *
00015  *   LORENE is distributed in the hope that it will be useful,
00016  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *   GNU General Public License for more details.
00019  *
00020  *   You should have received a copy of the GNU General Public License
00021  *   along with LORENE; if not, write to the Free Software
00022  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  */
00025 
00026 /*
00027  * $Id: grid_legendre_gl.C,v 1.1 2005/11/14 01:56:58 e_gourgoulhon Exp $
00028  * $Log: grid_legendre_gl.C,v $
00029  * Revision 1.1  2005/11/14 01:56:58  e_gourgoulhon
00030  * First version
00031  *
00032  *
00033  * $Header: /cvsroot/Lorene/School05/Monday/grid_legendre_gl.C,v 1.1 2005/11/14 01:56:58 e_gourgoulhon Exp $
00034  *
00035  */
00036 
00037 #include <iostream>
00038 
00039 using namespace std ;
00040 
00041 #include <stdlib.h>
00042 #include <math.h>
00043 
00044 #include "grid.h"
00045 
00046 void legendre_nodes_weight_GL(int n, double* coloc, double* weight, 
00047                               double prec = 1.e-12, int itemax = 100) ; 
00048      
00049 
00050 //----------------------//
00051 // Standard constructor //
00052 //----------------------//
00053 
00054 Grid_Legendre_GL::Grid_Legendre_GL(int nb_nodes) : Grid(nb_nodes) {
00055     
00056     double* weights = new double[nn+1] ;
00057     
00058     double precis = 1.e-12 ;    // required precision
00059     int nitermax = 200 ;     // Maximum number of iterations
00060     
00061     legendre_nodes_weight_GL(nn+1, xx, weights, precis, nitermax) ; 
00062     
00063     delete [] weights ; 
00064 }
00065 
00066 
00067 //--------------------//
00068 //  Copy constructor  //
00069 //--------------------//
00070 
00071 Grid_Legendre_GL::Grid_Legendre_GL(const Grid_Legendre_GL& gi) : Grid(gi) {}
00072 
00073 
00074 //--------------//
00075 //  Destructor  //
00076 //--------------//
00077 
00078 Grid_Legendre_GL::~Grid_Legendre_GL() {}
00079 
00080 
00081 //--------------//
00082 //  Assignment  //
00083 //--------------//
00084 
00085 void Grid_Legendre_GL::operator=(const Grid_Legendre_GL& gi) {
00086 
00087     Grid::operator=(gi) ;     
00088 }
00089 
00090 
00091 
00092 //-----------//
00093 //  Display  //
00094 //-----------//
00095 
00096 ostream& operator<<(ostream& ost, const Grid_Legendre_GL& xn) {
00097 
00098     ost << "Legendre Gauss-Lobatto nodes : " ;
00099     int nn = xn.n() ; 
00100     ost << "number of nodes : " << nn + 1 << endl ; 
00101     for (int i=0; i<=nn; i++) {
00102         ost << "   x(" << i << ") = " << xn(i) << endl ; 
00103     }
00104     
00105     return ost ; 
00106 }
00107 

Generated on Tue Dec 6 14:48:44 2011 for POLYNOM by  doxygen 1.4.6