Debian Codegraph @

School05/Monday/grid_uniform.C

raw
1 /*
2 * Definition of class Grid_uniform
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_uniform.C,v 1.2 2014/10/06 15:09:48 j_novak Exp $
28 * $Log: grid_uniform.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_uniform.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
46 #include "grid.h"
47
48 //----------------------//
49 // Standard constructor //
50 //----------------------//
51
52 Grid_uniform::Grid_uniform(int nb_nodes) : Grid(nb_nodes) {
53
54 for (int i=0; i<=nn; i++) xx[i] = -1. + 2 * double(i) / double(nn) ;
55
56 }
57
58
59 //--------------------//
60 // Copy constructor //
61 //--------------------//
62
63 Grid_uniform::Grid_uniform(const Grid_uniform& gi) : Grid(gi) {}
64
65
66 //--------------//
67 // Destructor //
68 //--------------//
69
70 Grid_uniform::~Grid_uniform() {}
71
72
73 //--------------//
74 // Assignment //
75 //--------------//
76
77 void Grid_uniform::operator=(const Grid_uniform& gi) {
78
79 Grid::operator=(gi) ;
80 }
81
82
83
84 //-----------//
85 // Display //
86 //-----------//
87
88 ostream& operator<<(ostream& ost, const Grid_uniform& xn) {
89
90 ost << "Uniform grid : " ;
91 int nn = xn.n() ;
92 ost << "number of nodes : " << nn + 1 << endl ;
93 for (int i=0; i<=nn; i++) {
94 ost << " x(" << i << ") = " << xn(i) << endl ;
95 }
96
97 return ost ;
98 }
99