Grid Class Reference
[Grids]

Set of nodes in the interval [-1,1]. More...

#include <grid.h>

Inheritance diagram for Grid:

Grid_Chebyshev_Gauss Grid_Chebyshev_GL Grid_Legendre_Gauss Grid_Legendre_GL Grid_uniform List of all members.

Public Member Functions

 Grid (int nb_nodes, double *xi)
 Standard constructor.
 Grid (const Grid &)
 Copy constructor.
virtual ~Grid ()
 Destructor.
void operator= (const Grid &)
 Assignment to another Grid.
int n () const
 returns N, i.e. the number of nodes - 1
double operator() (int i) const
 returns value of node no. i
void plot (int color=1, int nfig=0, double ymin=-1., double ymax=1., const char *title=0x0, const char *label_y=0x0, const char *device=0x0) const
 Graphical display of the node points.
double lagrange (int i, double x) const
 Lagrange polynomials (characteristic polynomials).
double nodal_polynomial (double x) const
 Nodal polynomial.
double interpole (double(*f)(double), double x) const
 Interpolation of a given function at the nodes.
double lebesgue_constant () const
 Computes (an approximate value of) the Lebesgue constant.

Protected Member Functions

 Grid (int nb_nodes)
 Constructor to be used only by derived classes (hence protected).

Protected Attributes

const int nn
 N = number of nodes - 1
double * xx
 Values of the nodes (pointer to an array of size nn+1).

Detailed Description

Set of nodes in the interval [-1,1].

()

Definition at line 48 of file grid.h.


Constructor & Destructor Documentation

Grid::Grid int  nb_nodes,
double *  xi
 

Standard constructor.

Parameters:
nb_nodes number of nodes
xi array of size nb_nodes containing the abscissas of the nodes

Definition at line 55 of file grid.C.

References nn, and xx.

Grid::Grid const Grid  ) 
 

Copy constructor.

Definition at line 83 of file grid.C.

References nn, and xx.

Grid::Grid int  nb_nodes  )  [protected]
 

Constructor to be used only by derived classes (hence protected).

Parameters:
nb_nodes number of nodes

Definition at line 95 of file grid.C.

References xx.

Grid::~Grid  )  [virtual]
 

Destructor.

Definition at line 110 of file grid.C.

References xx.


Member Function Documentation

double Grid::interpole double(*)(double)  f,
double  x
const
 

Interpolation of a given function at the nodes.

Parameters:
(*f)(double) function to be interpolated
x point x in [-1,1] where the interpolating polynomial associated with the nodes $x_i$ is to evaluated
Returns:
value of the interpolating polynomial at x

Definition at line 215 of file grid.C.

References lagrange(), nn, and xx.

double Grid::lagrange int  i,
double  x
const
 

Lagrange polynomials (characteristic polynomials).

The Lagrange polynomial no. i is the unique polynomial $\ell_i(x)$ of degree N such that $\ell_i(x_{j})=\delta_{ij}$. It is also called cardinal polynomial associated with the node $x_i$

Parameters:
i number of Lagrange polynomial $\ell_i$
x point x in [-1,1] where the Lagrange polynomial is to be evaluated
Returns:
value of $\ell_i(x)$

Definition at line 182 of file grid.C.

References xx.

double Grid::lebesgue_constant  )  const
 

Computes (an approximate value of) the Lebesgue constant.

Definition at line 231 of file grid.C.

References lagrange(), and nn.

int Grid::n  )  const
 

returns N, i.e. the number of nodes - 1

Definition at line 135 of file grid.C.

References nn.

double Grid::nodal_polynomial double  x  )  const
 

Nodal polynomial.

The nodal polynomoal is the unique polynomial of degree N + 1 and leading coefficient 1, the roots of which are the N +1 nodes $x_i$.

Parameters:
x point x in [-1,1] where the Lagrange polynomial is to be evaluated
Returns:
value of the nodal polynomial at x

Definition at line 199 of file grid.C.

References nn, and xx.

double Grid::operator() int  i  )  const
 

returns value of node no. i

Definition at line 141 of file grid.C.

References nn, and xx.

void Grid::operator= const Grid  ) 
 

Assignment to another Grid.

Definition at line 121 of file grid.C.

References nn, and xx.

void Grid::plot int  color = 1,
int  nfig = 0,
double  ymin = -1.,
double  ymax = 1.,
const char *  title = 0x0,
const char *  label_y = 0x0,
const char *  device = 0x0
const
 

Graphical display of the node points.

Parameters:
color color of the points (drawn as small circles) :
  • 0 : black (background)
  • 1 : white (default)
  • 2 : red
  • 3 : green
  • 4 : blue
  • 5 : cyan
  • 6 : magenta
  • 7 : yellow
  • 8 : orange
  • 9 : green + yellow
  • 10 : green + cyan
  • 11 : blue + cyan
  • 12 : blue + magenta
  • 13 : red + magenta
  • 14 : dark gray
  • 15 : light gray
nfig index of the figure (in the range [0,99]) to be used for the plot: if this figure does not exist, it will be created with the device name device provided by the last argument.
ymin lower bound on y of the graphical window (used only if a new figure must be created)
ymax upper bound on y of the graphical window (used only if a new figure must be created)
title title of the figure (used only if a new figure must be created)
label_y y legend of the figure (used only if a new figure must be created)
device type of graphical device (default value = 0x0, will result in interactive choice) (used only if a new figure must be created)

Definition at line 165 of file grid.C.

References plot_point(), and xx.


Member Data Documentation

const int Grid::nn [protected]
 

N = number of nodes - 1

Definition at line 53 of file grid.h.

double* Grid::xx [protected]
 

Values of the nodes (pointer to an array of size nn+1).

Definition at line 54 of file grid.h.


The documentation for this class was generated from the following files:
Generated on Tue Dec 6 14:48:44 2011 for POLYNOM by  doxygen 1.4.6