valeur_dsdp.C

00001 /*
00002  * Computation of d/dphi
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_dsdp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_dsdp.C,v 1.2 2012/01/17 15:08:16 j_penner Exp $" ;
00033 
00034 /*
00035  * $Id: valeur_dsdp.C,v 1.2 2012/01/17 15:08:16 j_penner Exp $
00036  * $Log: valeur_dsdp.C,v $
00037  * Revision 1.2  2012/01/17 15:08:16  j_penner
00038  * using MAX_BASE_2 for the phi coordinate
00039  *
00040  * Revision 1.1.1.1  2001/11/20 15:19:27  e_gourgoulhon
00041  * LORENE
00042  *
00043  * Revision 2.10  2000/10/04  12:50:53  eric
00044  * Ajout de la base P_COSSIN_I.
00045  *
00046  * Revision 2.9  1999/11/30  12:43:52  eric
00047  * Valeur::base est desormais du type Base_val et non plus Base_val*.
00048  *
00049  * Revision 2.8  1999/11/23  16:16:44  eric
00050  * Reorganisation du calcul dans le cas ETATZERO.
00051  *
00052  * Revision 2.7  1999/11/19  09:30:46  eric
00053  * La valeur de retour est desormais const Valeur &.
00054  *
00055  * Revision 2.6  1999/10/28  07:59:37  eric
00056  * Modif commentaires.
00057  *
00058  * Revision 2.5  1999/10/18  13:41:24  eric
00059  * Suppression de l'argument base dans les routines de derivation des mtbl_cf.
00060  *
00061  * Revision 2.4  1999/09/07  15:46:22  phil
00062  * correction des bases
00063  *
00064  * Revision 2.3  1999/03/01  15:09:01  eric
00065  * *** empty log message ***
00066  *
00067  * Revision 2.2  1999/02/23  11:26:27  hyc
00068  * *** empty log message ***
00069  *
00070  *
00071  * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_dsdp.C,v 1.2 2012/01/17 15:08:16 j_penner Exp $
00072  *
00073  */
00074 
00075 // Headers C
00076 #include <assert.h>
00077 
00078 // Headers Lorene
00079 #include "mtbl_cf.h"
00080 #include "valeur.h"
00081 
00082 // Prototypage 
00083 void _dsdphi_pas_prevu(Tbl *, int &) ;
00084 void _dsdphi_p_cossin(Tbl *, int &) ;
00085 void _dsdphi_p_cossin_p(Tbl *, int &) ;
00086 void _dsdphi_p_cossin_i(Tbl *, int &) ;
00087 
00088 // Version membre d'un Valeur
00089 // --------------------------
00090 
00091 const Valeur& Valeur::dsdp() const {
00092 
00093     // Protection
00094     assert(etat != ETATNONDEF) ;
00095 
00096     // Peut-etre rien a faire ?
00097     if (p_dsdp != 0x0) {
00098     return *p_dsdp ;
00099     }
00100     
00101     // ... si, il faut bosser
00102 
00103     p_dsdp = new Valeur(mg) ;
00104 
00105     if (etat == ETATZERO) {
00106     p_dsdp->set_etat_zero() ; 
00107     }
00108     else {
00109     assert(etat == ETATQCQ) ; 
00110     p_dsdp->set_etat_cf_qcq() ;
00111     Mtbl_cf* cfp = p_dsdp->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
00112                     // cree par le set_etat_cf_qcq()
00113 
00114     // Initialisation de *cfp : recopie des coef. de la fonction
00115     if (c_cf == 0x0) {
00116         coef() ;
00117     }
00118     *cfp = *c_cf ;  
00119  
00120     cfp->dsdp() ;   // calcul 
00121     
00122     p_dsdp->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
00123     }
00124 
00125     // Termine
00126     return *p_dsdp ;
00127 }
00128 
00129 // Version membre d'un Mtbl_cf
00130 // ---------------------------
00131 
00132 void Mtbl_cf::dsdp() {
00133 
00134 // Routines de derivation
00135 static void (*_dsdphi[MAX_BASE_2])(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_2 ; i++) {
00142         _dsdphi[i] = _dsdphi_pas_prevu ;
00143     }
00144     // Les routines existantes
00145         _dsdphi[P_COSSIN >> TRA_P] = _dsdphi_p_cossin ;
00146         _dsdphi[P_COSSIN_P >> TRA_P] = _dsdphi_p_cossin_p ;
00147         _dsdphi[P_COSSIN_I >> TRA_P] = _dsdphi_p_cossin_i ;
00148     }
00149 
00150     //- Debut de la routine -
00151 
00152     // Protection
00153     assert(etat == ETATQCQ) ;
00154     
00155     // Boucle sur les zones
00156     for (int l=0 ; l<nzone ; l++) {
00157     int base_p = (base.b[l] & MSQ_P) >> TRA_P ;
00158     assert(t[l] != 0x0) ;
00159     _dsdphi[base_p](t[l], base.b[l]) ;
00160     }
00161 }

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