Debian Codegraph @

C++/Source/Valeur/valeur_mult_st.C

raw
1 /*
2 * Multiplication by sin(theta)
3 *
4 * for:
5 * - Valeur
6 * - Mtbl_cf
7 */
8
9 /*
10 * Copyright (c) 1999-2001 Jerome Novak
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_mult_st_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_st.C,v 1.5 2014/10/13 08:53:50 j_novak Exp $" ;
33
34 /*
35 * $Id: valeur_mult_st.C,v 1.5 2014/10/13 08:53:50 j_novak Exp $
36 * $Log: valeur_mult_st.C,v $
37 * Revision 1.5 2014/10/13 08:53:50 j_novak
38 * Lorene classes and functions now belong to the namespace Lorene.
39 *
40 * Revision 1.4 2014/10/06 15:13:24 j_novak
41 * Modified #include directives to use c++ syntax.
42 *
43 * Revision 1.3 2009/10/09 14:01:06 j_novak
44 * New bases T_cos and T_SIN.
45 *
46 * Revision 1.2 2004/11/23 15:17:19 m_forot
47 * Added the bases for the cases without any equatorial symmetry
48 * (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
49 *
50 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
51 * LORENE
52 *
53 * Revision 1.4 1999/11/30 12:44:54 eric
54 * Valeur::base est desormais du type Base_val et non plus Base_val*.
55 *
56 * Revision 1.3 1999/11/24 09:33:41 eric
57 * Modif commentaires.
58 *
59 * Revision 1.2 1999/11/23 16:17:55 eric
60 * Reorganisation du calcul dans le cas ETATZERO.
61 *
62 * Revision 1.1 1999/11/23 14:31:41 novak
63 * Initial revision
64 *
65 *
66 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_st.C,v 1.5 2014/10/13 08:53:50 j_novak Exp $
67 *
68 */
69
70
71 // Headers C
72 #include <cassert>
73
74 // Headers Lorene
75 #include "mtbl_cf.h"
76 #include "valeur.h"
77
78 // Local prototypes
79 namespace Lorene {
80 void _mult_st_pas_prevu (Tbl*, int&) ;
81 void _mult_st_t_cos (Tbl*, int&) ;
82 void _mult_st_t_sin (Tbl*, int&) ;
83 void _mult_st_t_sin_p (Tbl*, int&) ;
84 void _mult_st_t_sin_i (Tbl*, int&) ;
85 void _mult_st_t_cos_i (Tbl*, int&) ;
86 void _mult_st_t_cos_p (Tbl*, int&) ;
87 void _mult_st_t_cossin_si (Tbl*, int&) ;
88 void _mult_st_t_cossin_ci (Tbl*, int&) ;
89 void _mult_st_t_cossin_cp (Tbl*, int&) ;
90 void _mult_st_t_cossin_sp (Tbl*, int&) ;
91 void _mult_st_t_cossin_c (Tbl*, int&) ;
92 void _mult_st_t_cossin_s (Tbl*, int&) ;
93
94 // Version membre d'un Valeur
95 // --------------------------
96
97 const Valeur& Valeur::mult_st() const {
98
99 // Protection
100 assert(etat != ETATNONDEF) ;
101
102 // Peut-etre rien a faire ?
103 if (p_mult_st != 0x0) {
104 return *p_mult_st ;
105 }
106
107 // ... si, il faut bosser
108
109 p_mult_st = new Valeur(mg) ;
110
111 if (etat == ETATZERO) {
112 p_mult_st->set_etat_zero() ;
113 }
114 else {
115 assert(etat == ETATQCQ) ;
116 p_mult_st->set_etat_cf_qcq() ;
117 Mtbl_cf* cfp = p_mult_st->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
118 // cree par le set_etat_cf_qcq()
119
120 // Initialisation de *cfp : recopie des coef. de la fonction
121 if (c_cf == 0x0) {
122 coef() ;
123 }
124 *cfp = *c_cf ;
125
126 cfp->mult_st() ; // calcul
127
128 p_mult_st->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
129 }
130
131 // Termine
132 return *p_mult_st ;
133 }
134
135
136
137 // Version membre d'un Mtbl_cf
138 // ---------------------------
139
140 void Mtbl_cf::mult_st() {
141
142 // Routines de derivation
143 static void (*_mult_st[MAX_BASE])(Tbl *, int &) ;
144 static int nap = 0 ;
145
146 // Premier appel
147 if (nap==0) {
148 nap = 1 ;
149 for (int i=0 ; i<MAX_BASE ; i++) {
150 _mult_st[i] = _mult_st_pas_prevu ;
151 }
152 // Les routines existantes
153 _mult_st[T_COS >> TRA_T] = _mult_st_t_cos ;
154 _mult_st[T_SIN >> TRA_T] = _mult_st_t_sin ;
155 _mult_st[T_COS_P >> TRA_T] = _mult_st_t_cos_p ;
156 _mult_st[T_COS_I >> TRA_T] = _mult_st_t_cos_i ;
157 _mult_st[T_SIN_P >> TRA_T] = _mult_st_t_sin_p ;
158 _mult_st[T_SIN_I >> TRA_T] = _mult_st_t_sin_i ;
159 _mult_st[T_COSSIN_SI >> TRA_T] = _mult_st_t_cossin_si ;
160 _mult_st[T_COSSIN_CI >> TRA_T] = _mult_st_t_cossin_ci ;
161 _mult_st[T_COSSIN_CP >> TRA_T] = _mult_st_t_cossin_cp ;
162 _mult_st[T_COSSIN_SP >> TRA_T] = _mult_st_t_cossin_sp ;
163 _mult_st[T_COSSIN_C >> TRA_T] = _mult_st_t_cossin_c ;
164 _mult_st[T_COSSIN_S >> TRA_T] = _mult_st_t_cossin_s ;
165 }
166
167 // Debut de la routine
168
169 // Protection
170 assert(etat == ETATQCQ) ;
171
172 // Boucle sur les zones
173 int base_t ;
174 for (int l=0 ; l<nzone ; l++) {
175 base_t = (base.b[l] & MSQ_T) >> TRA_T ;
176 assert(t[l] != 0x0) ;
177 _mult_st[base_t](t[l], base.b[l]) ;
178 }
179 }
180 }