00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 char valeur_scost_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_scost.C,v 1.3 2009/10/10 18:28:11 j_novak Exp $" ;
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 #include <assert.h>
00069
00070
00071 #include "mtbl_cf.h"
00072 #include "valeur.h"
00073
00074
00075 void _scost_pas_prevu (Tbl*, int&) ;
00076 void _scost_t_cos (Tbl*, int&) ;
00077 void _scost_t_sin (Tbl*, int&) ;
00078 void _scost_t_sin_p (Tbl*, int&) ;
00079 void _scost_t_sin_i (Tbl*, int&) ;
00080 void _scost_t_cos_i (Tbl*, int&) ;
00081 void _scost_t_cos_p (Tbl*, int&) ;
00082 void _scost_t_cossin_si (Tbl*, int&) ;
00083 void _scost_t_cossin_ci (Tbl*, int&) ;
00084 void _scost_t_cossin_cp (Tbl*, int&) ;
00085 void _scost_t_cossin_sp (Tbl*, int&) ;
00086 void _scost_t_cossin_c (Tbl*, int&) ;
00087 void _scost_t_cossin_s (Tbl*, int&) ;
00088
00089
00090
00091
00092 const Valeur& Valeur::scost() const {
00093
00094
00095 assert(etat != ETATNONDEF) ;
00096
00097
00098 if (p_scost != 0x0) {
00099 return *p_scost ;
00100 }
00101
00102
00103
00104 p_scost = new Valeur(mg) ;
00105
00106 if (etat == ETATZERO) {
00107 p_scost->set_etat_zero() ;
00108 }
00109 else {
00110 assert(etat == ETATQCQ) ;
00111 p_scost->set_etat_cf_qcq() ;
00112 Mtbl_cf* cfp = p_scost->c_cf ;
00113
00114
00115
00116 if (c_cf == 0x0) {
00117 coef() ;
00118 }
00119 *cfp = *c_cf ;
00120
00121 cfp->scost() ;
00122
00123 p_scost->base = cfp->base ;
00124 }
00125
00126
00127 return *p_scost ;
00128 }
00129
00130
00131
00132
00133
00134
00135 void Mtbl_cf::scost() {
00136
00137
00138 static void (*_scost[MAX_BASE])(Tbl *, int &) ;
00139 static int nap = 0 ;
00140
00141
00142 if (nap==0) {
00143 nap = 1 ;
00144 for (int i=0 ; i<MAX_BASE ; i++) {
00145 _scost[i] = _scost_pas_prevu ;
00146 }
00147
00148 _scost[T_COS >> TRA_T] = _scost_t_cos ;
00149 _scost[T_SIN >> TRA_T] = _scost_t_sin ;
00150 _scost[T_COS_P >> TRA_T] = _scost_t_cos_p ;
00151 _scost[T_COS_I >> TRA_T] = _scost_t_cos_i ;
00152 _scost[T_SIN_P >> TRA_T] = _scost_t_sin_p ;
00153 _scost[T_SIN_I >> TRA_T] = _scost_t_sin_i ;
00154 _scost[T_COSSIN_SI >> TRA_T] = _scost_t_cossin_si ;
00155 _scost[T_COSSIN_CI >> TRA_T] = _scost_t_cossin_ci ;
00156 _scost[T_COSSIN_CP >> TRA_T] = _scost_t_cossin_cp ;
00157 _scost[T_COSSIN_SP >> TRA_T] = _scost_t_cossin_sp ;
00158 _scost[T_COSSIN_C >> TRA_T] = _scost_t_cossin_c ;
00159 _scost[T_COSSIN_S >> TRA_T] = _scost_t_cossin_s ;
00160 }
00161
00162
00163
00164
00165 assert(etat == ETATQCQ) ;
00166
00167
00168 int base_t ;
00169 for (int l=0 ; l<nzone ; l++) {
00170 base_t = (base.b[l] & MSQ_T) >> TRA_T ;
00171 assert(t[l] != 0x0) ;
00172 _scost[base_t](t[l], base.b[l]) ;
00173 }
00174 }