valeur_mult_st.C

00001 /*
00002  * Multiplication by sin(theta)
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_st_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_st.C,v 1.3 2009/10/09 14:01:06 j_novak Exp $" ;
00033 
00034 /*
00035  * $Id: valeur_mult_st.C,v 1.3 2009/10/09 14:01:06 j_novak Exp $
00036  * $Log: valeur_mult_st.C,v $
00037  * Revision 1.3  2009/10/09 14:01:06  j_novak
00038  * New bases T_cos and T_SIN.
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.4  1999/11/30  12:44:54  eric
00048  * Valeur::base est desormais du type Base_val et non plus Base_val*.
00049  *
00050  * Revision 1.3  1999/11/24  09:33:41  eric
00051  * Modif commentaires.
00052  *
00053  * Revision 1.2  1999/11/23  16:17:55  eric
00054  * Reorganisation du calcul dans le cas ETATZERO.
00055  *
00056  * Revision 1.1  1999/11/23  14:31:41  novak
00057  * Initial revision
00058  *
00059  *
00060  * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_st.C,v 1.3 2009/10/09 14:01:06 j_novak Exp $
00061  *
00062  */
00063 
00064 
00065 // Headers C
00066 #include <assert.h>
00067 
00068 // Headers Lorene
00069 #include "mtbl_cf.h"
00070 #include "valeur.h"
00071 
00072 // Local prototypes
00073 void _mult_st_pas_prevu (Tbl*, int&) ;
00074 void _mult_st_t_cos (Tbl*, int&) ;
00075 void _mult_st_t_sin (Tbl*, int&) ;
00076 void _mult_st_t_sin_p (Tbl*, int&) ;
00077 void _mult_st_t_sin_i (Tbl*, int&) ;
00078 void _mult_st_t_cos_i (Tbl*, int&) ;
00079 void _mult_st_t_cos_p (Tbl*, int&) ;
00080 void _mult_st_t_cossin_si (Tbl*, int&) ;
00081 void _mult_st_t_cossin_ci (Tbl*, int&) ;
00082 void _mult_st_t_cossin_cp (Tbl*, int&) ;
00083 void _mult_st_t_cossin_sp (Tbl*, int&) ;
00084 void _mult_st_t_cossin_c (Tbl*, int&) ;
00085 void _mult_st_t_cossin_s (Tbl*, int&) ;
00086 
00087 // Version membre d'un Valeur
00088 // --------------------------
00089 
00090 const Valeur& Valeur::mult_st() const {
00091 
00092     // Protection
00093     assert(etat != ETATNONDEF) ;
00094 
00095     // Peut-etre rien a faire ?
00096     if (p_mult_st != 0x0) {
00097     return *p_mult_st ;
00098     }
00099     
00100     // ... si, il faut bosser
00101 
00102     p_mult_st = new Valeur(mg) ;
00103 
00104     if (etat == ETATZERO) {
00105     p_mult_st->set_etat_zero() ; 
00106     }
00107     else {
00108     assert(etat == ETATQCQ) ; 
00109     p_mult_st->set_etat_cf_qcq() ;
00110     Mtbl_cf* cfp = p_mult_st->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
00111                     // cree par le set_etat_cf_qcq()
00112 
00113     // Initialisation de *cfp : recopie des coef. de la fonction
00114     if (c_cf == 0x0) {
00115         coef() ;
00116     }
00117     *cfp = *c_cf ;  
00118  
00119     cfp->mult_st() ;    // calcul 
00120     
00121     p_mult_st->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
00122     }
00123 
00124     // Termine
00125     return *p_mult_st ;
00126 }
00127 
00128 
00129 
00130 // Version membre d'un Mtbl_cf
00131 // ---------------------------
00132 
00133 void Mtbl_cf::mult_st() {
00134 
00135 // Routines de derivation
00136 static void (*_mult_st[MAX_BASE])(Tbl *, int &) ;
00137 static int nap = 0 ;
00138 
00139     // Premier appel
00140     if (nap==0) {
00141     nap = 1 ;
00142     for (int i=0 ; i<MAX_BASE ; i++) {
00143         _mult_st[i] = _mult_st_pas_prevu ;
00144     }
00145     // Les routines existantes
00146     _mult_st[T_COS >> TRA_T] = _mult_st_t_cos ;
00147     _mult_st[T_SIN >> TRA_T] = _mult_st_t_sin ;
00148     _mult_st[T_COS_P >> TRA_T] = _mult_st_t_cos_p ;
00149     _mult_st[T_COS_I >> TRA_T] = _mult_st_t_cos_i ;
00150     _mult_st[T_SIN_P >> TRA_T] = _mult_st_t_sin_p ;
00151     _mult_st[T_SIN_I >> TRA_T] = _mult_st_t_sin_i ;
00152     _mult_st[T_COSSIN_SI >> TRA_T] = _mult_st_t_cossin_si ;
00153     _mult_st[T_COSSIN_CI >> TRA_T] = _mult_st_t_cossin_ci ;
00154     _mult_st[T_COSSIN_CP >> TRA_T] = _mult_st_t_cossin_cp ;
00155     _mult_st[T_COSSIN_SP >> TRA_T] = _mult_st_t_cossin_sp ;
00156     _mult_st[T_COSSIN_C >> TRA_T] = _mult_st_t_cossin_c ;
00157     _mult_st[T_COSSIN_S >> TRA_T] = _mult_st_t_cossin_s ;
00158     }
00159 
00160     // Debut de la routine 
00161 
00162     // Protection
00163     assert(etat == ETATQCQ) ;
00164     
00165     // Boucle sur les zones
00166     int base_t ;
00167     for (int l=0 ; l<nzone ; l++) {
00168     base_t = (base.b[l] & MSQ_T) >> TRA_T ;
00169     assert(t[l] != 0x0) ;
00170     _mult_st[base_t](t[l], base.b[l]) ;
00171     }
00172 }

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