23char mat_sinp_legmi_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/mat_sin_legmi.C,v 1.3 2014/10/13 08:53:14 j_novak Exp $" ;
91double* mat_sin_legmi(
int np,
int nt) {
94 static double* tab[NMAX] ;
95 static int nb_dejafait = 0 ;
96 static int np_dejafait[NMAX] ;
98 static int nt_dejafait[NMAX] ;
101 int i, indice, j, j2, m, l ;
105 for ( i=0 ; i < nb_dejafait ; i++ ) {
106 if ( (np_dejafait[i] == np) && (nt_dejafait[i] == nt) ) indice = i ;
112 if ( nb_dejafait >= NMAX ) {
113 cout <<
"mat_sinp_legii: nb_dejafait >= NMAX : "
114 << nb_dejafait <<
" <-> " << NMAX << endl ;
118 indice = nb_dejafait ;
120 np_dejafait[indice] = np ;
121 nt_dejafait[indice] = nt ;
123 tab[indice] =
new double[(np/2+1)*nt*nt] ;
124 for (
int qq=0; qq<nt*nt*(np/2+1); qq++)
125 tab[indice][qq] = -1.34 ;
133 int nt2m1 = nt2 - 1 ;
141 double* yy =
new double[nt2] ;
142 double* sint =
new double[nt*nt2];
147 double dt = M_PI / double(nt2-1) ;
148 for (j=0; j<nt-1; j++) {
149 for (j2=0; j2<nt2; j2++) {
150 double theta = j2*dt ;
151 sint[nt2*j + j2] =
sin( j * theta ) ;
160 int m_max = (np == 1) ? 1 : np-1 ;
162 for (m=1; m <= m_max ; m+=2) {
166 double* leg = legendre_norm(m, nt) ;
168 for (l=m; l<nt-1; l++) {
170 int parite = 1 - 2*((l-m)%2) ;
172 for (j=0; j<nt-1; j++) {
177 for (j2=0; j2<nt; j2++) {
178 yy[nt2m1-j2] = sint[nt2*j + j2] *
179 leg[nt2* (l-m) + 2*j2] ;
183 for (j2=nt; j2<nt2; j2++) {
184 yy[nt2m1-j2] = sint[nt2*j + j2] *
185 parite * leg[nt2* (l-m) + 2*nt2 -2 - 2*j2] ;
191 cfrcheb(deg, deg, yy, deg, yy) ;
195 tab[indice][ nt*nt* ((m-1)/2) + nt*l + j] =
196 int1d_cheb(nt2, yy) ;
Cmp sin(const Cmp &)
Sine.