23char mat_cossinc_leg_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/mat_cossinc_leg.C,v 1.7 2014/10/13 08:53:13 j_novak Exp $" ;
106int loch_mat_cossinc_leg = 0 ;
111double* mat_cossinc_leg(
int np,
int nt) {
114static double* tab[NMAX] ;
115static int nb_dejafait = 0 ;
116static int np_dejafait[NMAX] ;
118static int nt_dejafait[NMAX] ;
121int i, indice, j, j2, m, l ;
128 for ( i=0 ; i < nb_dejafait ; i++ ) {
129 if ( (np_dejafait[i] == np) && (nt_dejafait[i] == nt) ) indice = i ;
135 if ( nb_dejafait >= NMAX ) {
136 cout <<
"mat_cossinc_leg: nb_dejafait >= NMAX : "
137 << nb_dejafait <<
" <-> " << NMAX << endl ;
141 indice = nb_dejafait ;
143 np_dejafait[indice] = np ;
144 nt_dejafait[indice] = nt ;
146 tab[indice] =
new double[(np/2+1)*nt*nt] ;
154 int nt2m1 = nt2 - 1 ;
162 double* yy =
new double[nt2] ;
163 double* cost =
new double[nt*nt2] ;
164 double* sint =
new double[nt*nt2] ;
169 double dt = M_PI / double((nt2-1)) ;
170 for (j=0; j<nt; j++) {
171 for (j2=0; j2<nt2; j2++) {
172 double theta = j2*dt ;
173 cost[nt2*j + j2] =
cos( j * theta ) ;
174 sint[nt2*j + j2] =
sin( j * theta ) ;
183 for (m=0; m < np/2+1 ; m++) {
187 double* leg = legendre_norm(m, nt) ;
192 for (l=m; l<nt; l++) {
194 int parite = 1 - 2*((l-m)%2) ;
196 for (j=0; j<nt; j++) {
200 for (j2=0; j2<nt; j2++) {
201 yy[nt2m1-j2] = cost[nt2*j + j2] *
202 leg[nt2* (l-m) + 2*j2] ;
205 for (j2=nt; j2<nt2; j2++) {
206 yy[nt2m1-j2] = cost[nt2*j + j2] *
207 parite * leg[nt2* (l-m) + 2*nt2 -2 -2*j2] ;
212 cfrcheb(deg, deg, yy, deg, yy) ;
213 tab[indice][ nt*nt* m + nt*l + j] =
214 int1d_cheb(nt2, yy) ;
227 for (l=m; l<nt; l++) {
229 int parite = 1 - 2*((l-m)%2) ;
231 for (j=0; j<nt; j++) {
235 for (j2=0; j2<nt; j2++) {
236 yy[nt2m1-j2] = sint[nt2*j + j2] *
237 leg[nt2* (l-m) + 2*j2] ;
241 for (j2=nt; j2<nt2; j2++) {
242 yy[nt2m1-j2] = sint[nt2*j + j2] *
243 parite * leg[nt2* (l-m) + 2*nt2 -2 - 2*j2] ;
249 cfrcheb(deg, deg, yy, deg, yy) ;
251 tab[indice][ nt*nt* m + nt*l + j] =
252 int1d_cheb(nt2, yy) ;
Cmp sin(const Cmp &)
Sine.
Cmp cos(const Cmp &)
Cosine.