ortho_poly.h

00001 /*
00002  * Declaration of class Ortho_poly and derived classes
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: ortho_poly.h,v 1.1 2005/11/14 01:57:00 e_gourgoulhon Exp $
00028  * $Log: ortho_poly.h,v $
00029  * Revision 1.1  2005/11/14 01:57:00  e_gourgoulhon
00030  * First version
00031  *
00032  *
00033  * $Header: /cvsroot/Lorene/School05/Monday/ortho_poly.h,v 1.1 2005/11/14 01:57:00 e_gourgoulhon Exp $
00034  *
00035  */
00036 
00037 #ifndef __ORTHO_POLY_H_ 
00038 #define __ORTHO_POLY_H_ 
00039 
00040 class Grid ; 
00041 
00042             //----------------------------------//
00043             //          class Ortho_poly        //
00044             //----------------------------------//
00045 
00052 class Ortho_poly {
00053 
00054     // Data : 
00055     // -----
00056     protected:
00057         const int nn ; 
00058         
00061         mutable const Grid* p_gauss_nodes ; 
00062 
00065         mutable double* p_gauss_weights ; 
00066 
00071         mutable double* p_gauss_gamma ; 
00072 
00075         mutable const Grid* p_gauss_lobatto_nodes ; 
00076         
00079         mutable double* p_gauss_lobatto_weights ; 
00080 
00085         mutable double* p_gauss_lobatto_gamma ; 
00086 
00087         
00088     // Constructors - Destructor
00089     // -------------------------
00090     protected:
00091         Ortho_poly(const Ortho_poly& ) ; 
00092         
00096         Ortho_poly(int ni) ;
00097          
00098     public:
00099         virtual ~Ortho_poly() ;         
00100  
00101     // Mutators / assignment
00102     // ---------------------
00103     public:
00105         void operator=(const Ortho_poly&)  ;    
00106     
00107     // Accessors
00108     // ---------
00109     public:
00110         int n() const ; 
00111         
00112     // Computation
00113     // -----------
00114     public: 
00120         virtual double weight(double x) const = 0 ; 
00121 
00129         virtual double operator()(int i, double x) const = 0 ; 
00130         
00132         virtual const Grid& gauss_nodes() const = 0 ;
00133         
00139         virtual double gauss_weight(int i) const = 0 ;
00140         
00146         virtual double gauss_gamma(int i) const = 0 ;
00147 
00149         virtual const Grid& gauss_lobatto_nodes() const = 0 ;
00150         
00156         virtual double gauss_lobatto_weight(int i) const = 0 ;
00157         
00163         virtual double gauss_lobatto_gamma(int i) const = 0 ;
00164 
00174         void coef_interpolant_Gauss(double (*f)(double), double* cf) const ;  
00175 
00185         void coef_interpolant_GL(double (*f)(double), double* cf) const ;  
00186 
00199         virtual void coef_projection(double (*f)(double), double* cf) const = 0 ;  
00200 
00214         double series(const double* a, double x) const ;  
00215 
00216 };
00217     
00218             //----------------------------------//
00219             //      class Chebyshev_poly        //
00220             //----------------------------------//
00221 
00227 class Chebyshev_poly : public Ortho_poly {
00228         
00229     // Constructors - Destructor
00230     // -------------------------
00231     public:
00235         Chebyshev_poly(int ni ) ; 
00236         
00237         Chebyshev_poly(const Chebyshev_poly& ) ; 
00238         
00239     public:
00240         virtual ~Chebyshev_poly() ;         
00241  
00242     // Mutators / assignment
00243     // ---------------------
00244     public:
00246         void operator=(const Chebyshev_poly&) ; 
00247     
00248             
00249     // Computation
00250     // -----------
00251     public: 
00257         virtual double weight(double x) const ; 
00258 
00266         virtual double operator()(int i, double x) const ; 
00267 
00269         virtual const Grid& gauss_nodes() const ;
00270         
00276         virtual double gauss_weight(int i) const ;
00277         
00282         virtual double gauss_gamma(int i) const ;
00283 
00285         virtual const Grid& gauss_lobatto_nodes() const ;
00286         
00292         virtual double gauss_lobatto_weight(int i) const ;
00293         
00298         virtual double gauss_lobatto_gamma(int i) const ;
00299 
00310         void coef_interpolant_GL_FFT(double (*f)(double), double* cf) const ;  
00311 
00324         virtual void coef_projection(double (*f)(double), double* cf) const  ;  
00325 
00326 };
00327     
00329 ostream& operator<<(ostream& , const Chebyshev_poly& ) ;    
00330 
00331 
00332             //----------------------------------//
00333             //      class Legendre_poly        //
00334             //----------------------------------//
00335 
00341 class Legendre_poly : public Ortho_poly {
00342         
00343     // Constructors - Destructor
00344     // -------------------------
00345     public:
00349         Legendre_poly(int ni ) ; 
00350         
00351         Legendre_poly(const Legendre_poly& ) ; 
00352         
00353     public:
00354         virtual ~Legendre_poly() ;          
00355  
00356     // Mutators / assignment
00357     // ---------------------
00358     public:
00360         void operator=(const Legendre_poly&) ;  
00361     
00362             
00363     // Computation
00364     // -----------
00365     public: 
00371         virtual double weight(double x) const ; 
00372 
00380         virtual double operator()(int i, double x) const ; 
00381 
00383         virtual const Grid& gauss_nodes() const ;
00384         
00390         virtual double gauss_weight(int i) const ;
00391         
00396         virtual double gauss_gamma(int i) const ;
00397 
00399         virtual const Grid& gauss_lobatto_nodes() const ;
00400         
00406         virtual double gauss_lobatto_weight(int i) const ;
00407         
00412         virtual double gauss_lobatto_gamma(int i) const ;
00413 
00426         virtual void coef_projection(double (*f)(double), double* cf) const  ;  
00427 
00428 };
00429     
00431 ostream& operator<<(ostream& , const Legendre_poly& ) ; 
00432 
00433 
00434 #endif
00435 

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