valeur_mult_sp.C

00001 /*
00002  * Methods for multiplication by sin(phi) for classes
00003  *   - Valeur
00004  *   - Mtbl_cf
00005  */
00006 
00007 /*
00008  *   Copyright (c) 1999-2001 Eric Gourgoulhon
00009  *
00010  *   This file is part of LORENE.
00011  *
00012  *   LORENE is free software; you can redistribute it and/or modify
00013  *   it under the terms of the GNU General Public License as published by
00014  *   the Free Software Foundation; either version 2 of the License, or
00015  *   (at your option) any later version.
00016  *
00017  *   LORENE is distributed in the hope that it will be useful,
00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *   GNU General Public License for more details.
00021  *
00022  *   You should have received a copy of the GNU General Public License
00023  *   along with LORENE; if not, write to the Free Software
00024  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *
00026  */
00027 
00028 
00029 char valeur_mult_sp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_sp.C,v 1.2 2012/01/17 15:08:32 j_penner Exp $" ;
00030 
00031 /*
00032  * $Id: valeur_mult_sp.C,v 1.2 2012/01/17 15:08:32 j_penner Exp $
00033  * $Log: valeur_mult_sp.C,v $
00034  * Revision 1.2  2012/01/17 15:08:32  j_penner
00035  * using MAX_BASE_2 for the phi coordinate
00036  *
00037  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00038  * LORENE
00039  *
00040  * Revision 2.2  2000/09/18  10:15:20  eric
00041  * Ajout des bases P_COSSIN_P et P_COSSIN_I
00042  *
00043  * Revision 2.1  2000/09/11  15:04:04  eric
00044  * *** empty log message ***
00045  *
00046  * Revision 2.0  2000/09/11  13:54:00  eric
00047  * *** empty log message ***
00048  *
00049  *
00050  * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_sp.C,v 1.2 2012/01/17 15:08:32 j_penner Exp $
00051  *
00052  */
00053 
00054 // Headers C
00055 #include <assert.h>
00056 
00057 // Headers Lorene
00058 #include "mtbl_cf.h"
00059 #include "valeur.h"
00060 
00061 // Local prototypes
00062 void _mult_sp_pas_prevu(Tbl*, int&) ;
00063 void _mult_sp_p_cossin(Tbl*, int&) ;
00064 void _mult_sp_p_cossin_p(Tbl*, int&) ;
00065 void _mult_sp_p_cossin_i(Tbl*, int&) ;
00066 
00067 // Version membre d'un Valeur
00068 // --------------------------
00069 
00070 const Valeur& Valeur::mult_sp() const {
00071 
00072     // Protection
00073     assert(etat != ETATNONDEF) ;
00074 
00075     // Peut-etre rien a faire ?
00076     if (p_mult_sp != 0x0) {
00077     return *p_mult_sp ;
00078     }
00079     
00080     // ... si, il faut bosser
00081 
00082     p_mult_sp = new Valeur(mg) ;
00083 
00084     if (etat == ETATZERO) {
00085     p_mult_sp->set_etat_zero() ; 
00086     }
00087     else {
00088     assert(etat == ETATQCQ) ; 
00089     p_mult_sp->set_etat_cf_qcq() ;
00090     Mtbl_cf* cfp = p_mult_sp->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
00091                     // cree par le set_etat_cf_qcq()
00092 
00093     // Initialisation de *cfp : recopie des coef. de la fonction
00094     if (c_cf == 0x0) {
00095         coef() ;
00096     }
00097     *cfp = *c_cf ;  
00098  
00099     cfp->mult_sp() ;    // calcul 
00100     
00101     p_mult_sp->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
00102     }
00103 
00104     // Termine
00105     return *p_mult_sp ;
00106 }
00107 
00108 
00109 
00110 // Version membre d'un Mtbl_cf
00111 // ---------------------------
00112 
00113 void Mtbl_cf::mult_sp() {
00114 
00115 // Routines de derivation
00116 static void (*_mult_sp[MAX_BASE_2])(Tbl *, int &) ;
00117 static int nap = 0 ;
00118 
00119     // Premier appel
00120     if (nap==0) {
00121     nap = 1 ;
00122     for (int i=0 ; i<MAX_BASE_2 ; i++) {
00123         _mult_sp[i] = _mult_sp_pas_prevu ;
00124     }
00125     // Les routines existantes
00126     _mult_sp[P_COSSIN >> TRA_P] = _mult_sp_p_cossin ;
00127     _mult_sp[P_COSSIN_P >> TRA_P] = _mult_sp_p_cossin_p ;
00128     _mult_sp[P_COSSIN_I >> TRA_P] = _mult_sp_p_cossin_i ;
00129     }
00130 
00131     // Debut de la routine 
00132 
00133     // Protection
00134     assert(etat == ETATQCQ) ;
00135     
00136     // Boucle sur les zones
00137     for (int l=0 ; l<nzone ; l++) {
00138     int base_p = (base.b[l] & MSQ_P) >> TRA_P ;
00139     assert(t[l] != 0x0) ;
00140     _mult_sp[base_p](t[l], base.b[l]) ;
00141     }
00142 }

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