Debian Codegraph @

C++/Source/Valeur/valeur_sx.C

raw
1 /*
2 * Computation of 1/x
3 *
4 * for:
5 * - Valeur
6 * - Mtbl_cf
7 */
8
9 /*
10 * Copyright (c) 1999-2000 Jean-Alain Marck
11 * Copyright (c) 1999-2001 Eric Gourgoulhon
12 *
13 * This file is part of LORENE.
14 *
15 * LORENE is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * LORENE is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with LORENE; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 *
29 */
30
31
32 char valeur_sx_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_sx.C,v 1.7 2015/03/09 10:32:27 j_novak Exp $" ;
33
34 /*
35 * $Id: valeur_sx.C,v 1.7 2015/03/09 10:32:27 j_novak Exp $
36 * $Log: valeur_sx.C,v $
37 * Revision 1.7 2015/03/09 10:32:27 j_novak
38 * Inclusion of r-Legendre bases.
39 *
40 * Revision 1.6 2015/03/05 08:49:33 j_novak
41 * Implemented operators with Legendre bases.
42 *
43 * Revision 1.5 2014/10/13 08:53:51 j_novak
44 * Lorene classes and functions now belong to the namespace Lorene.
45 *
46 * Revision 1.4 2014/10/06 15:13:24 j_novak
47 * Modified #include directives to use c++ syntax.
48 *
49 * Revision 1.3 2007/12/14 10:19:35 jl_cornou
50 * *** empty log message ***
51 *
52 * Revision 1.2 2004/11/23 15:17:19 m_forot
53 * Added the bases for the cases without any equatorial symmetry
54 * (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
55 *
56 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
57 * LORENE
58 *
59 * Revision 2.5 1999/11/30 12:45:46 eric
60 * Valeur::base est desormais du type Base_val et non plus Base_val*.
61 *
62 * Revision 2.4 1999/11/23 16:18:55 eric
63 * Reorganisation du calcul dans le cas ETATZERO.
64 *
65 * Revision 2.3 1999/11/19 09:31:50 eric
66 * La valeur de retour est desormais const Valeur &.
67 *
68 * Revision 2.2 1999/10/28 08:00:45 eric
69 * Modif commentaires.
70 *
71 * Revision 2.1 1999/10/18 13:42:58 eric
72 * Suppression de l'argument base dans les routines de derivation des mtbl_cf.
73 *
74 * Revision 2.0 1999/04/26 14:59:31 phil
75 * *** empty log message ***
76 *
77 *
78 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_sx.C,v 1.7 2015/03/09 10:32:27 j_novak Exp $
79 *
80 */
81
82
83 // Headers C
84 #include <cassert>
85
86 // Headers Lorene
87 #include "mtbl_cf.h"
88 #include "valeur.h"
89
90 // Local prototypes
91 namespace Lorene {
92 void _sx_pas_prevu(Tbl *, int &) ;
93 void _sx_r_chebp(Tbl *, int &) ;
94 void _sx_r_chebi(Tbl *, int &) ;
95 void _sx_r_legp(Tbl *, int &) ;
96 void _sx_r_legi(Tbl *, int &) ;
97 void _sx_r_chebpim_p(Tbl *, int &) ;
98 void _sx_r_chebpim_i(Tbl *, int &) ;
99 void _sxm1_cheb(Tbl *, int&) ;
100 void _sx_identite (Tbl *, int &) ;
101 void _sx_r_chebpi_p(Tbl *, int &) ;
102 void _sx_r_chebpi_i(Tbl *, int &) ;
103 void _sxpun_r_jaco02(Tbl *, int &) ;
104 void _sx_r_legp(Tbl *, int &) ;
105 void _sx_r_legi(Tbl *, int &) ;
106
107 // Version membre d'un Valeur
108 // --------------------------
109
110 const Valeur& Valeur::sx() const {
111
112 // Protection
113 assert(etat != ETATNONDEF) ;
114
115 // Peut-etre rien a faire ?
116 if (p_sx != 0x0) {
117 return *p_sx ;
118 }
119
120 // ... si, il faut bosser
121
122 p_sx = new Valeur(mg) ;
123
124 if (etat == ETATZERO) {
125 p_sx->set_etat_zero() ;
126 }
127 else {
128 assert(etat == ETATQCQ) ;
129 p_sx->set_etat_cf_qcq() ;
130 Mtbl_cf* cfp = p_sx->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
131 // cree par le set_etat_cf_qcq()
132
133 // Initialisation de *cfp : recopie des coef. de la fonction
134 if (c_cf == 0x0) {
135 coef() ;
136 }
137 *cfp = *c_cf ;
138
139 cfp->sx() ; // calcul
140
141 p_sx->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
142 }
143
144 // Termine
145 return *p_sx ;
146 }
147
148
149
150 // Version membre d'un Mtbl_cf
151 // ---------------------------
152
153 void Mtbl_cf::sx() {
154
155 // Routines de derivation
156 static void (*_sx[MAX_BASE])(Tbl *, int &) ;
157 static int nap = 0 ;
158
159 // Premier appel
160 if (nap==0) {
161 nap = 1 ;
162 for (int i=0 ; i<MAX_BASE ; i++) {
163 _sx[i] = _sx_pas_prevu ;
164 }
165 // Les routines existantes
166 _sx[R_CHEB >> TRA_R] = _sx_identite ;
167 _sx[R_CHEBU >> TRA_R] = _sxm1_cheb ;
168 _sx[R_CHEBP >> TRA_R] = _sx_r_chebp ;
169 _sx[R_CHEBI >> TRA_R] = _sx_r_chebi ;
170 _sx[R_LEG >> TRA_R] = _sx_identite ;
171 _sx[R_LEGP >> TRA_R] = _sx_r_legp ;
172 _sx[R_LEGI >> TRA_R] = _sx_r_legi ;
173 _sx[R_CHEBPIM_P >> TRA_R] = _sx_r_chebpim_p ;
174 _sx[R_CHEBPIM_I >> TRA_R] = _sx_r_chebpim_i ;
175 _sx[R_CHEBPI_P >> TRA_R] = _sx_r_chebpi_p ;
176 _sx[R_CHEBPI_I >> TRA_R] = _sx_r_chebpi_i ;
177 _sx[R_JACO02 >> TRA_R] = _sxpun_r_jaco02 ;
178 _sx[R_LEG >> TRA_R] = _sx_identite ;
179 _sx[R_LEGP >> TRA_R] = _sx_r_legp ;
180 _sx[R_LEGI >> TRA_R] = _sx_r_legi ;
181 }
182
183 //- Debut de la routine -
184
185 // Protection
186 assert(etat == ETATQCQ) ;
187
188 // Boucle sur les zones
189 for (int l=0 ; l<nzone ; l++) {
190 int base_r = (base.b[l] & MSQ_R) >> TRA_R ;
191 assert(t[l] != 0x0) ;
192 _sx[base_r](t[l], base.b[l]) ;
193 }
194 }
195 }