00001 /* 00002 * Computation of 1/x^2 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 * Copyright (c) 1999-2001 Philippe Grandclement 00013 * 00014 * This file is part of LORENE. 00015 * 00016 * LORENE is free software; you can redistribute it and/or modify 00017 * it under the terms of the GNU General Public License as published by 00018 * the Free Software Foundation; either version 2 of the License, or 00019 * (at your option) any later version. 00020 * 00021 * LORENE is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 * GNU General Public License for more details. 00025 * 00026 * You should have received a copy of the GNU General Public License 00027 * along with LORENE; if not, write to the Free Software 00028 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00029 * 00030 */ 00031 00032 00033 char valeur_sx2_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_sx2.C,v 1.2 2004/11/23 15:17:20 m_forot Exp $" ; 00034 00035 /* 00036 * $Id: valeur_sx2.C,v 1.2 2004/11/23 15:17:20 m_forot Exp $ 00037 * $Log: valeur_sx2.C,v $ 00038 * Revision 1.2 2004/11/23 15:17:20 m_forot 00039 * Added the bases for the cases without any equatorial symmetry 00040 * (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I). 00041 * 00042 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon 00043 * LORENE 00044 * 00045 * Revision 2.8 1999/11/30 12:46:01 eric 00046 * Valeur::base est desormais du type Base_val et non plus Base_val*. 00047 * 00048 * Revision 2.7 1999/11/23 16:19:22 eric 00049 * Reorganisation du calcul dans le cas ETATZERO. 00050 * 00051 * Revision 2.6 1999/11/19 09:32:02 eric 00052 * La valeur de retour est desormais const Valeur &. 00053 * 00054 * Revision 2.5 1999/10/28 08:00:57 eric 00055 * Modif commentaires. 00056 * 00057 * Revision 2.4 1999/10/18 13:43:07 eric 00058 * Suppression de l'argument base dans les routines de derivation des mtbl_cf. 00059 * 00060 * Revision 2.3 1999/04/28 10:10:59 phil 00061 * *** empty log message *** 00062 * 00063 * Revision 2.2 1999/04/26 17:15:57 phil 00064 * *** empty log message *** 00065 * 00066 * Revision 2.1 1999/04/26 17:14:20 phil 00067 * *** empty log message *** 00068 * 00069 * Revision 2.0 1999/04/26 17:13:09 phil 00070 * *** empty log message *** 00071 * 00072 * Revision 2.0 1999/04/26 14:59:31 phil 00073 * *** empty log message *** 00074 * 00075 * 00076 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_sx2.C,v 1.2 2004/11/23 15:17:20 m_forot Exp $ 00077 * 00078 */ 00079 00080 00081 // Headers C 00082 #include <assert.h> 00083 00084 // Headers Lorene 00085 #include "mtbl_cf.h" 00086 #include "valeur.h" 00087 00088 // Local prototypes: 00089 void _sx2_pas_prevu(Tbl *, int &) ; 00090 void _sx2_r_chebu(Tbl *, int &) ; 00091 void _sx2_r_chebp(Tbl *, int &) ; 00092 void _sx2_r_chebi(Tbl *, int &) ; 00093 void _sx2_r_chebpim_p(Tbl *, int &) ; 00094 void _sx2_r_chebpim_i(Tbl *, int &) ; 00095 void _sx2_identite (Tbl *, int &) ; 00096 void _sx2_r_chebpi_p(Tbl *, int &) ; 00097 void _sx2_r_chebpi_i(Tbl *, int &) ; 00098 00099 // Version membre d'un Valeur 00100 // -------------------------- 00101 00102 const Valeur& Valeur::sx2() const { 00103 00104 // Protection 00105 assert(etat != ETATNONDEF) ; 00106 00107 // Peut-etre rien a faire ? 00108 if (p_sx2 != 0x0) { 00109 return *p_sx2 ; 00110 } 00111 00112 // ... si, il faut bosser 00113 00114 p_sx2 = new Valeur(mg) ; 00115 00116 if (etat == ETATZERO) { 00117 p_sx2->set_etat_zero() ; 00118 } 00119 else { 00120 assert(etat == ETATQCQ) ; 00121 p_sx2->set_etat_cf_qcq() ; 00122 Mtbl_cf* cfp = p_sx2->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre 00123 // cree par le set_etat_cf_qcq() 00124 00125 // Initialisation de *cfp : recopie des coef. de la fonction 00126 if (c_cf == 0x0) { 00127 coef() ; 00128 } 00129 *cfp = *c_cf ; 00130 00131 cfp->sx2() ; // calcul 00132 00133 p_sx2->base = cfp->base ; // On remonte la base de sortie au niveau Valeur 00134 } 00135 00136 // Termine 00137 return *p_sx2 ; 00138 } 00139 00140 00141 00142 // Version membre d'un Mtbl_cf 00143 // --------------------------- 00144 \ 00145 void Mtbl_cf::sx2() { 00146 00147 // Routines de derivation 00148 static void (*_sx2[MAX_BASE])(Tbl *, int &) ; 00149 static int nap = 0 ; 00150 00151 // Premier appel 00152 if (nap==0) { 00153 nap = 1 ; 00154 for (int i=0 ; i<MAX_BASE ; i++) { 00155 _sx2[i] = _sx2_pas_prevu ; 00156 } 00157 // Les routines existantes 00158 _sx2[R_CHEB >> TRA_R] = _sx2_identite ; 00159 _sx2[R_CHEBU >> TRA_R] = _sx2_r_chebu ; 00160 _sx2[R_CHEBP >> TRA_R] = _sx2_r_chebp ; 00161 _sx2[R_CHEBI >> TRA_R] = _sx2_r_chebi ; 00162 _sx2[R_CHEBPIM_P >> TRA_R] = _sx2_r_chebpim_p ; 00163 _sx2[R_CHEBPIM_I >> TRA_R] = _sx2_r_chebpim_i ; 00164 _sx2[R_CHEBPI_P >> TRA_R] = _sx2_r_chebpi_p ; 00165 _sx2[R_CHEBPI_I >> TRA_R] = _sx2_r_chebpi_i ; 00166 } 00167 00168 //- Debut de la routine - 00169 00170 // Protection 00171 assert(etat == ETATQCQ) ; 00172 00173 // Boucle sur les zones 00174 for (int l=0 ; l<nzone ; l++) { 00175 int base_r = (base.b[l] & MSQ_R) >> TRA_R ; 00176 assert(t[l] != 0x0) ; 00177 _sx2[base_r](t[l], base.b[l]) ; 00178 } 00179 }
1.4.6