00001 /* 00002 * Definition of class Grid_Chebyshev_Gauss 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_chebyshev_gauss.C,v 1.1 2005/11/14 01:56:58 e_gourgoulhon Exp $ 00028 * $Log: grid_chebyshev_gauss.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_chebyshev_gauss.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 //----------------------// 00047 // Standard constructor // 00048 //----------------------// 00049 00050 Grid_Chebyshev_Gauss::Grid_Chebyshev_Gauss(int nb_nodes) : Grid(nb_nodes) { 00051 00052 double h = M_PI / double(2*(nn+1)) ; 00053 00054 for (int i=0; i<=nn; i++) xx[i] = - cos( h * (2*i+1) ) ; 00055 00056 } 00057 00058 00059 //--------------------// 00060 // Copy constructor // 00061 //--------------------// 00062 00063 Grid_Chebyshev_Gauss::Grid_Chebyshev_Gauss(const Grid_Chebyshev_Gauss& gi) : Grid(gi) {} 00064 00065 00066 //--------------// 00067 // Destructor // 00068 //--------------// 00069 00070 Grid_Chebyshev_Gauss::~Grid_Chebyshev_Gauss() {} 00071 00072 00073 //--------------// 00074 // Assignment // 00075 //--------------// 00076 00077 void Grid_Chebyshev_Gauss::operator=(const Grid_Chebyshev_Gauss& gi) { 00078 00079 Grid::operator=(gi) ; 00080 } 00081 00082 00083 00084 //-----------// 00085 // Display // 00086 //-----------// 00087 00088 ostream& operator<<(ostream& ost, const Grid_Chebyshev_Gauss& xn) { 00089 00090 ost << "Chebyshev Gauss nodes : " ; 00091 int nn = xn.n() ; 00092 ost << "number of nodes : " << nn + 1 << endl ; 00093 for (int i=0; i<=nn; i++) { 00094 ost << " x(" << i << ") = " << xn(i) << endl ; 00095 } 00096 00097 return ost ; 00098 } 00099