valeur_sx.C

00001 /*
00002  * Computation of 1/x
00003  *
00004  * for:
00005  *   - Valeur
00006  *   - Mtbl_cf
00007  */
00008 
00009 /*
00010  *   Copyright (c) 1999-2000 Jean-Alain Marck
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_sx_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_sx.C,v 1.3 2007/12/14 10:19:35 jl_cornou Exp $" ;
00033 
00034 /*
00035  * $Id: valeur_sx.C,v 1.3 2007/12/14 10:19:35 jl_cornou Exp $
00036  * $Log: valeur_sx.C,v $
00037  * Revision 1.3  2007/12/14 10:19:35  jl_cornou
00038  * *** empty log message ***
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 2.5  1999/11/30  12:45:46  eric
00048  * Valeur::base est desormais du type Base_val et non plus Base_val*.
00049  *
00050  * Revision 2.4  1999/11/23  16:18:55  eric
00051  * Reorganisation du calcul dans le cas ETATZERO.
00052  *
00053  * Revision 2.3  1999/11/19  09:31:50  eric
00054  * La valeur de retour est desormais const Valeur &.
00055  *
00056  * Revision 2.2  1999/10/28  08:00:45  eric
00057  * Modif commentaires.
00058  *
00059  * Revision 2.1  1999/10/18  13:42:58  eric
00060  * Suppression de l'argument base dans les routines de derivation des mtbl_cf.
00061  *
00062  * Revision 2.0  1999/04/26  14:59:31  phil
00063  * *** empty log message ***
00064  *
00065  *
00066  * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_sx.C,v 1.3 2007/12/14 10:19:35 jl_cornou Exp $
00067  *
00068  */
00069 
00070 
00071 // Headers C
00072 #include <assert.h>
00073 
00074 // Headers Lorene
00075 #include "mtbl_cf.h"
00076 #include "valeur.h"
00077 
00078 // Local prototypes
00079 void _sx_pas_prevu(Tbl *, int &) ;
00080 void _sx_r_chebp(Tbl *, int &) ;
00081 void _sx_r_chebi(Tbl *, int &) ;
00082 void _sx_r_chebpim_p(Tbl *, int &) ;
00083 void _sx_r_chebpim_i(Tbl *, int &) ;
00084 void _sxm1_cheb(Tbl *, int&) ;
00085 void _sx_identite (Tbl *, int &) ;
00086 void _sx_r_chebpi_p(Tbl *, int &) ;
00087 void _sx_r_chebpi_i(Tbl *, int &) ;
00088 void _sxpun_r_jaco02(Tbl *, int &) ;
00089 
00090 // Version membre d'un Valeur
00091 // --------------------------
00092 
00093 const Valeur& Valeur::sx() const {
00094 
00095     // Protection
00096     assert(etat != ETATNONDEF) ;
00097 
00098     // Peut-etre rien a faire ?
00099     if (p_sx != 0x0) {
00100     return *p_sx ;
00101     }
00102     
00103     // ... si, il faut bosser
00104 
00105     p_sx = new Valeur(mg) ;
00106 
00107     if (etat == ETATZERO) {
00108     p_sx->set_etat_zero() ; 
00109     }
00110     else {
00111     assert(etat == ETATQCQ) ; 
00112     p_sx->set_etat_cf_qcq() ;
00113     Mtbl_cf* cfp = p_sx->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
00114                     // cree par le set_etat_cf_qcq()
00115 
00116     // Initialisation de *cfp : recopie des coef. de la fonction
00117     if (c_cf == 0x0) {
00118         coef() ;
00119     }
00120     *cfp = *c_cf ;  
00121  
00122     cfp->sx() ; // calcul 
00123     
00124     p_sx->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
00125     }
00126 
00127     // Termine
00128     return *p_sx ;
00129 }
00130 
00131 
00132 
00133 // Version membre d'un Mtbl_cf
00134 // ---------------------------
00135 
00136 void Mtbl_cf::sx() {
00137 
00138 // Routines de derivation
00139 static void (*_sx[MAX_BASE])(Tbl *, int &) ;
00140 static int nap = 0 ;
00141 
00142     // Premier appel
00143     if (nap==0) {
00144     nap = 1 ;
00145     for (int i=0 ; i<MAX_BASE ; i++) {
00146         _sx[i] = _sx_pas_prevu ;
00147     }
00148     // Les routines existantes
00149     _sx[R_CHEB >> TRA_R] = _sx_identite ;
00150     _sx[R_CHEBU >> TRA_R] = _sxm1_cheb ;
00151     _sx[R_CHEBP >> TRA_R] = _sx_r_chebp ;
00152     _sx[R_CHEBI >> TRA_R] = _sx_r_chebi ;
00153     _sx[R_CHEBPIM_P >> TRA_R] = _sx_r_chebpim_p ;
00154     _sx[R_CHEBPIM_I >> TRA_R] = _sx_r_chebpim_i ;
00155     _sx[R_CHEBPI_P >> TRA_R] = _sx_r_chebpi_p ;
00156     _sx[R_CHEBPI_I >> TRA_R] = _sx_r_chebpi_i ;
00157     _sx[R_JACO02 >> TRA_R] = _sxpun_r_jaco02 ;
00158     }
00159 
00160     //- Debut de la routine -
00161 
00162     // Protection
00163     assert(etat == ETATQCQ) ;
00164     
00165     // Boucle sur les zones
00166     for (int l=0 ; l<nzone ; l++) {
00167     int base_r = (base.b[l] & MSQ_R) >> TRA_R ;
00168     assert(t[l] != 0x0) ;
00169     _sx[base_r](t[l], base.b[l]) ;
00170     }
00171 }

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