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