Debian Codegraph @

C++/Source/Valeur/valeur_mult_ct.C

raw
1 /*
2 * Multiplication by cos(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_ct_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_ct.C,v 1.5 2014/10/13 08:53:50 j_novak Exp $" ;
33
34 /*
35 * $Id: valeur_mult_ct.C,v 1.5 2014/10/13 08:53:50 j_novak Exp $
36 * $Log: valeur_mult_ct.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:23 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:45 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:02 eric
57 * Modif commentaires.
58 *
59 * Revision 1.2 1999/11/23 16:17:47 eric
60 * Reorganisation du calcul dans le cas ETATZERO.
61 *
62 * Revision 1.1 1999/11/23 14:31:28 novak
63 * Initial revision
64 *
65 *
66 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_ct.C,v 1.5 2014/10/13 08:53:50 j_novak Exp $
67 *
68 */
69
70
71
72 // Headers C
73 #include <cassert>
74
75 // Headers Lorene
76 #include "mtbl_cf.h"
77 #include "valeur.h"
78
79 // Local prototypes
80 namespace Lorene {
81 void _mult_ct_pas_prevu (Tbl*, int&) ;
82 void _mult_ct_t_cos (Tbl*, int&) ;
83 void _mult_ct_t_sin (Tbl*, int&) ;
84 void _mult_ct_t_sin_p (Tbl*, int&) ;
85 void _mult_ct_t_sin_i (Tbl*, int&) ;
86 void _mult_ct_t_cos_i (Tbl*, int&) ;
87 void _mult_ct_t_cos_p (Tbl*, int&) ;
88 void _mult_ct_t_cossin_si (Tbl*, int&) ;
89 void _mult_ct_t_cossin_ci (Tbl*, int&) ;
90 void _mult_ct_t_cossin_cp (Tbl*, int&) ;
91 void _mult_ct_t_cossin_sp (Tbl*, int&) ;
92 void _mult_ct_t_cossin_c (Tbl*, int&) ;
93 void _mult_ct_t_cossin_s (Tbl*, int&) ;
94
95 // Version membre d'un Valeur
96 // --------------------------
97
98 const Valeur& Valeur::mult_ct() const {
99
100 // Protection
101 assert(etat != ETATNONDEF) ;
102
103 // Peut-etre rien a faire ?
104 if (p_mult_ct != 0x0) {
105 return *p_mult_ct ;
106 }
107
108 // ... si, il faut bosser
109
110 p_mult_ct = new Valeur(mg) ;
111
112 if (etat == ETATZERO) {
113 p_mult_ct->set_etat_zero() ;
114 }
115 else {
116 assert(etat == ETATQCQ) ;
117 p_mult_ct->set_etat_cf_qcq() ;
118 Mtbl_cf* cfp = p_mult_ct->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
119 // cree par le set_etat_cf_qcq()
120
121 // Initialisation de *cfp : recopie des coef. de la fonction
122 if (c_cf == 0x0) {
123 coef() ;
124 }
125 *cfp = *c_cf ;
126
127 cfp->mult_ct() ; // calcul
128
129 p_mult_ct->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
130 }
131
132 // Termine
133 return *p_mult_ct ;
134 }
135
136
137
138 // Version membre d'un Mtbl_cf
139 // ---------------------------
140
141 void Mtbl_cf::mult_ct() {
142
143 // Routines de derivation
144 static void (*_mult_ct[MAX_BASE])(Tbl *, int &) ;
145 static int nap = 0 ;
146
147 // Premier appel
148 if (nap==0) {
149 nap = 1 ;
150 for (int i=0 ; i<MAX_BASE ; i++) {
151 _mult_ct[i] = _mult_ct_pas_prevu ;
152 }
153 // Les routines existantes
154 _mult_ct[T_COS >> TRA_T] = _mult_ct_t_cos ;
155 _mult_ct[T_SIN >> TRA_T] = _mult_ct_t_sin ;
156 _mult_ct[T_COS_P >> TRA_T] = _mult_ct_t_cos_p ;
157 _mult_ct[T_COS_I >> TRA_T] = _mult_ct_t_cos_i ;
158 _mult_ct[T_SIN_P >> TRA_T] = _mult_ct_t_sin_p ;
159 _mult_ct[T_SIN_I >> TRA_T] = _mult_ct_t_sin_i ;
160 _mult_ct[T_COSSIN_SI >> TRA_T] = _mult_ct_t_cossin_si ;
161 _mult_ct[T_COSSIN_CI >> TRA_T] = _mult_ct_t_cossin_ci ;
162 _mult_ct[T_COSSIN_CP >> TRA_T] = _mult_ct_t_cossin_cp ;
163 _mult_ct[T_COSSIN_SP >> TRA_T] = _mult_ct_t_cossin_sp ;
164 _mult_ct[T_COSSIN_C >> TRA_T] = _mult_ct_t_cossin_c ;
165 _mult_ct[T_COSSIN_S >> TRA_T] = _mult_ct_t_cossin_s ;
166 }
167
168 // Debut de la routine
169
170 // Protection
171 assert(etat == ETATQCQ) ;
172
173 // Boucle sur les zones
174 int base_t ;
175 for (int l=0 ; l<nzone ; l++) {
176 base_t = (base.b[l] & MSQ_T) >> TRA_T ;
177 assert(t[l] != 0x0) ;
178 _mult_ct[base_t](t[l], base.b[l]) ;
179 }
180 }
181 }