valeur_mult_x.C

00001 /*
00002  * Computation of x*Id
00003  *
00004  * for:
00005  *   - Valeur
00006  *   - Mtbl_cf
00007  */
00008 
00009 /*
00010  *   Copyright (c) 1999-2001 Jerome Novak
00011  *   Copyright (c) 1999-2001 Eric Gourgoulhon
00012  *
00013  *   This file is part of LORENE.
00014  *
00015  *   LORENE is free software; you can redistribute it and/or modify
00016  *   it under the terms of the GNU General Public License as published by
00017  *   the Free Software Foundation; either version 2 of the License, or
00018  *   (at your option) any later version.
00019  *
00020  *   LORENE is distributed in the hope that it will be useful,
00021  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  *   GNU General Public License for more details.
00024  *
00025  *   You should have received a copy of the GNU General Public License
00026  *   along with LORENE; if not, write to the Free Software
00027  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028  *
00029  */
00030 
00031 
00032 char valeur_mult_x_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_x.C,v 1.3 2008/08/27 08:52:55 jl_cornou Exp $" ;
00033 
00034 /*
00035  * $Id: valeur_mult_x.C,v 1.3 2008/08/27 08:52:55 jl_cornou Exp $
00036  * $Log: valeur_mult_x.C,v $
00037  * Revision 1.3  2008/08/27 08:52:55  jl_cornou
00038  * Added Jacobi(0,2) polynomials case
00039  *
00040  * Revision 1.2  2004/11/23 15:17:19  m_forot
00041  * Added the bases for the cases without any equatorial symmetry
00042  *  (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
00043  *
00044  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00045  * LORENE
00046  *
00047  * Revision 1.5  1999/11/30  12:45:07  eric
00048  * Valeur::base est desormais du type Base_val et non plus Base_val*.
00049  *
00050  * Revision 1.4  1999/11/24  09:34:16  eric
00051  * Modif commentaires.
00052  *
00053  * Revision 1.3  1999/11/23  16:18:04  eric
00054  * Reorganisation du calcul dans le cas ETATZERO.
00055  *
00056  * Revision 1.2  1999/11/19  09:31:21  eric
00057  * La valeur de retour est desormais const Valeur &.
00058  *
00059  * Revision 1.1  1999/11/16  13:37:24  novak
00060  * Initial revision
00061  *
00062  *
00063  * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_x.C,v 1.3 2008/08/27 08:52:55 jl_cornou Exp $
00064  *
00065  */
00066 
00067 // Headers C
00068 #include <assert.h>
00069 
00070 // Headers Lorene
00071 #include "mtbl_cf.h"
00072 #include "valeur.h"
00073 
00074 // Local prototypes
00075 void _mult_x_pas_prevu(Tbl *, int &) ;
00076 void _mult_x_r_chebp(Tbl *, int &) ;
00077 void _mult_x_r_chebi(Tbl *, int &) ;
00078 void _mult_x_r_chebpim_p(Tbl *, int &) ;
00079 void _mult_x_r_chebpim_i(Tbl *, int &) ;
00080 void _mult_xm1_cheb(Tbl *, int&) ;
00081 void _mult_x_identite (Tbl *, int &) ;
00082 void _mult_x_r_chebpi_p(Tbl *, int &) ;
00083 void _mult_x_r_chebpi_i(Tbl *, int &) ;
00084 void _mult_x_r_jaco02(Tbl *, int &) ;
00085 
00086 // Version membre d'un Valeur
00087 // --------------------------
00088 
00089 const Valeur& Valeur::mult_x() const {
00090 
00091     // Protection
00092     assert(etat != ETATNONDEF) ;
00093 
00094     // Peut-etre rien a faire ?
00095     if (p_mult_x != 0x0) {
00096     return *p_mult_x ;
00097     }
00098     
00099     // ... si, il faut bosser
00100 
00101     p_mult_x = new Valeur(mg) ;
00102 
00103     if (etat == ETATZERO) {
00104     p_mult_x->set_etat_zero() ; 
00105     }
00106     else {
00107     assert(etat == ETATQCQ) ; 
00108     p_mult_x->set_etat_cf_qcq() ;
00109     Mtbl_cf* cfp = p_mult_x->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
00110                     // cree par le set_etat_cf_qcq()
00111 
00112     // Initialisation de *cfp : recopie des coef. de la fonction
00113     if (c_cf == 0x0) {
00114         coef() ;
00115     }
00116     *cfp = *c_cf ;  
00117  
00118     cfp->mult_x() ; // calcul 
00119     
00120     p_mult_x->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
00121     }
00122 
00123    // Termine
00124     return *p_mult_x ;
00125 }
00126 
00127 
00128 
00129 // Version membre d'un Mtbl_cf
00130 // ---------------------------
00131 
00132 void Mtbl_cf::mult_x() {
00133 
00134 // Routines de derivation
00135 static void (*_mult_x[MAX_BASE])(Tbl *, int &) ;
00136 static int nap = 0 ;
00137 
00138     // Premier appel
00139     if (nap==0) {
00140     nap = 1 ;
00141     for (int i=0 ; i<MAX_BASE ; i++) {
00142         _mult_x[i] = _mult_x_pas_prevu ;
00143     }
00144     // Les routines existantes
00145     _mult_x[R_CHEB >> TRA_R] = _mult_x_identite ;
00146     _mult_x[R_CHEBU >> TRA_R] = _mult_xm1_cheb ;
00147     _mult_x[R_CHEBP >> TRA_R] = _mult_x_r_chebp ;
00148     _mult_x[R_CHEBI >> TRA_R] = _mult_x_r_chebi ;
00149     _mult_x[R_CHEBPIM_P >> TRA_R] = _mult_x_r_chebpim_p ;
00150     _mult_x[R_CHEBPIM_I >> TRA_R] = _mult_x_r_chebpim_i ;
00151     _mult_x[R_CHEBPI_P >> TRA_R] = _mult_x_r_chebpi_p ;
00152     _mult_x[R_CHEBPI_I >> TRA_R] = _mult_x_r_chebpi_i ;
00153     _mult_x[R_JACO02 >> TRA_R] = _mult_x_r_jaco02 ;
00154     }
00155 
00156     // Debut de la routine 
00157 
00158     // Protection
00159     assert(etat == ETATQCQ) ;
00160     
00161     // Boucle sur les zones
00162     int base_r ;
00163     for (int l=0 ; l<nzone ; l++) {
00164     base_r = (base.b[l] & MSQ_R) >> TRA_R ;
00165     assert(t[l] != 0x0) ;
00166     _mult_x[base_r](t[l], base.b[l]) ;
00167     }
00168 }

Generated on Tue Feb 7 01:35:21 2012 for LORENE by  doxygen 1.4.6