op_d2sdtet2.C

00001 /*
00002  *   Copyright (c) 1999-2000 Jean-Alain Marck
00003  *   Copyright (c) 1999-2001 Eric Gourgoulhon
00004  *
00005  *   This file is part of LORENE.
00006  *
00007  *   LORENE is free software; you can redistribute it and/or modify
00008  *   it under the terms of the GNU General Public License as published by
00009  *   the Free Software Foundation; either version 2 of the License, or
00010  *   (at your option) any later version.
00011  *
00012  *   LORENE is distributed in the hope that it will be useful,
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *   GNU General Public License for more details.
00016  *
00017  *   You should have received a copy of the GNU General Public License
00018  *   along with LORENE; if not, write to the Free Software
00019  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 
00024 char op_d2dtet2_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/op_d2sdtet2.C,v 1.4 2009/10/09 14:00:54 j_novak Exp $" ;
00025 
00026 /*
00027  * Ensemble des routines de base pour la derivation seconde par rapport a theta
00028  * (Utilisation interne)
00029  * 
00030  *  void _d2sdtet2_XXXX(Tbl * t, int & b)
00031  *  t   pointeur sur le Tbl d'entree-sortie
00032  *  b   base spectrale
00033  * 
00034  */
00035 
00036 /*
00037  * $Id: op_d2sdtet2.C,v 1.4 2009/10/09 14:00:54 j_novak Exp $
00038  * $Log: op_d2sdtet2.C,v $
00039  * Revision 1.4  2009/10/09 14:00:54  j_novak
00040  * New bases T_cos and T_SIN.
00041  *
00042  * Revision 1.3  2006/03/10 12:45:38  j_novak
00043  * Use of C++-style cast.
00044  *
00045  * Revision 1.2  2004/11/23 15:16:01  m_forot
00046  *
00047  * Added the bases for the cases without any equatorial symmetry
00048  *  (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
00049  *
00050  * Revision 1.1.1.1  2001/11/20 15:19:29  e_gourgoulhon
00051  * LORENE
00052  *
00053  * Revision 2.4  2000/10/04  11:50:20  eric
00054  * Ajout d' abort() dans le cas non prevu.
00055  *
00056  * Revision 2.3  2000/02/24  16:40:42  eric
00057  * Initialisation a zero du tableau xo avant le calcul.
00058  *
00059  * Revision 2.2  1999/11/15  16:37:44  eric
00060  * Tbl::dim est desormais un Dim_tbl et non plus un Dim_tbl*.
00061  *
00062  * Revision 2.1  1999/03/01  15:06:00  eric
00063  * *** empty log message ***
00064  *
00065  * Revision 2.0  1999/02/23  11:23:09  hyc
00066  * *** empty log message ***
00067  *
00068  *
00069  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/op_d2sdtet2.C,v 1.4 2009/10/09 14:00:54 j_novak Exp $
00070  *
00071  */
00072 
00073 // Headers Lorene
00074 #include "tbl.h"
00075 
00076 // Routine pour les cas non prevus
00077 //--------------------------------
00078 void _d2sdtet2_pas_prevu(Tbl* , int & b) {
00079     cout << "Unknown theta basis in Mtbl_cf::d2sdt2() !" << endl ;
00080     cout << " basis: " << hex << b << endl ;
00081     abort() ; 
00082 }
00083 
00084 // cas T_COS
00085 //----------
00086 void _d2sdtet2_t_cos(Tbl* tb, int &)
00087 {
00088 
00089     // Peut-etre rien a faire ?
00090     if (tb->get_etat() == ETATZERO) {
00091     return ;
00092     }
00093     
00094     // Protection
00095     assert(tb->get_etat() == ETATQCQ) ;
00096     
00097     // Pour le confort
00098     int nr = (tb->dim).dim[0] ;     // Nombre
00099     int nt = (tb->dim).dim[1] ;     //   de points
00100     int np = (tb->dim).dim[2] ;     //      physiques REELS
00101     np = np - 2 ;           // Nombre de points physiques
00102     
00103     // Variables statiques
00104     static double* cx = 0 ;
00105     static int nt_pre =0 ;
00106 
00107     // Test sur nt pour initialisation eventuelle
00108     if (nt > nt_pre) {
00109     nt_pre = nt ;
00110     cx = reinterpret_cast<double*>(realloc(cx, nt * sizeof(double))) ;
00111     for (int i=0 ; i<nt ; i++) {
00112         cx[i] = - double(i * i) ;
00113         }
00114     }
00115 
00116     // pt. sur le tableau de double resultat
00117     double* xo = new double[(tb->dim).taille] ;
00118 
00119     // Initialisation a zero :
00120     for (int i=0; i<(tb->dim).taille; i++) {
00121     xo[i] = 0 ; 
00122     }    
00123     
00124     // On y va...
00125     double* xi = tb->t ;
00126     double* xci = xi ;  // Pointeurs
00127     double* xco = xo ;  //  courants
00128     
00129     // k = 0
00130     for (int j=0 ; j<nt ; j++) {
00131         for (int i=0 ; i<nr ; i++ ) {
00132         *xco = cx[j] * (*xci) ;
00133         xci++ ;
00134         xco++ ;
00135         }   // Fin de la boucle sur r
00136     }   // Fin de la boucle sur theta
00137 
00138     // k = 1
00139     xci += nr*nt ;
00140     xco += nr*nt ;
00141     
00142     // k >= 2
00143     int borne_phi = np + 1 ; 
00144     if (np == 1) borne_phi = 1 ; 
00145     
00146     for (int k=2 ; k<borne_phi ; k++) {
00147     for (int j=0 ; j<nt ; j++) {
00148         for (int i=0 ; i<nr ; i++ ) {
00149         *xco = cx[j] * (*xci) ;
00150         xci++ ;
00151         xco++ ;
00152         }   // Fin de la boucle sur r
00153     }   // Fin de la boucle sur theta
00154     }   // Fin de la boucle sur phi
00155 
00156     // On remet les choses la ou il faut
00157     delete [] tb->t ;
00158     tb->t = xo ;
00159     
00160     // base de developpement
00161     // inchangee
00162 }
00163 
00164 // cas T_SIN
00165 //----------
00166 void _d2sdtet2_t_sin(Tbl* tb, int &)
00167 {
00168 
00169     // Peut-etre rien a faire ?
00170     if (tb->get_etat() == ETATZERO) {
00171     return ;
00172     }
00173     
00174     // Protection
00175     assert(tb->get_etat() == ETATQCQ) ;
00176     
00177     // Pour le confort
00178     int nr = (tb->dim).dim[0] ;     // Nombre
00179     int nt = (tb->dim).dim[1] ;     //   de points
00180     int np = (tb->dim).dim[2] ;     //      physiques REELS
00181     np = np - 2 ;           // Nombre de points physiques
00182     
00183     // Variables statiques
00184     static double* cx = 0 ;
00185     static int nt_pre =0 ;
00186 
00187     // Test sur nt pour initialisation eventuelle
00188     if (nt > nt_pre) {
00189     nt_pre = nt ;
00190     cx = reinterpret_cast<double*>(realloc(cx, nt * sizeof(double))) ;
00191     for (int i=0 ; i<nt ; i++) {
00192         cx[i] = - double(i * i) ;
00193     }
00194     }
00195 
00196     // pt. sur le tableau de double resultat
00197     double* xo = new double[(tb->dim).taille] ;
00198     
00199     // Initialisation a zero :
00200     for (int i=0; i<(tb->dim).taille; i++) {
00201     xo[i] = 0 ; 
00202     }
00203     
00204     // On y va...
00205     double* xi = tb->t ;
00206     double* xci = xi ;  // Pointeurs
00207     double* xco = xo ;  //  courants
00208     
00209     int borne_phi = np + 1 ; 
00210     if (np == 1) borne_phi = 1 ; 
00211     
00212     for (int k=0 ; k< borne_phi ; k++) {
00213     for (int j=0 ; j<nt ; j++) {
00214         for (int i=0 ; i<nr ; i++ ) {
00215         *xco = cx[j] * (*xci) ;
00216         xci++ ;
00217         xco++ ;
00218         }   // Fin de la boucle sur r
00219     }   // Fin de la boucle sur theta
00220     }   // Fin de la boucle sur phi
00221 
00222     // On remet les choses la ou il faut
00223     delete [] tb->t ;
00224     tb->t = xo ;
00225     
00226     // base de developpement
00227     // inchangee
00228 }
00229 
00230 // cas T_COS_P
00231 //------------
00232 void _d2sdtet2_t_cos_p(Tbl* tb, int &)
00233 {
00234 
00235     // Peut-etre rien a faire ?
00236     if (tb->get_etat() == ETATZERO) {
00237     return ;
00238     }
00239     
00240     // Protection
00241     assert(tb->get_etat() == ETATQCQ) ;
00242     
00243     // Pour le confort
00244     int nr = (tb->dim).dim[0] ;     // Nombre
00245     int nt = (tb->dim).dim[1] ;     //   de points
00246     int np = (tb->dim).dim[2] ;     //      physiques REELS
00247     np = np - 2 ;           // Nombre de points physiques
00248     
00249     // Variables statiques
00250     static double* cx = 0 ;
00251     static int nt_pre =0 ;
00252 
00253     // Test sur nt pour initialisation eventuelle
00254     if (nt > nt_pre) {
00255     nt_pre = nt ;
00256     cx = reinterpret_cast<double*>(realloc(cx, nt * sizeof(double))) ;
00257     for (int i=0 ; i<nt ; i++) {
00258         cx[i] = - (2*i) * (2*i) ;
00259         }
00260     }
00261 
00262     // pt. sur le tableau de double resultat
00263     double* xo = new double[(tb->dim).taille] ;
00264 
00265     // Initialisation a zero :
00266     for (int i=0; i<(tb->dim).taille; i++) {
00267     xo[i] = 0 ; 
00268     }    
00269     
00270     // On y va...
00271     double* xi = tb->t ;
00272     double* xci = xi ;  // Pointeurs
00273     double* xco = xo ;  //  courants
00274     
00275     // k = 0
00276     for (int j=0 ; j<nt ; j++) {
00277         for (int i=0 ; i<nr ; i++ ) {
00278         *xco = cx[j] * (*xci) ;
00279         xci++ ;
00280         xco++ ;
00281         }   // Fin de la boucle sur r
00282     }   // Fin de la boucle sur theta
00283 
00284     // k = 1
00285     xci += nr*nt ;
00286     xco += nr*nt ;
00287     
00288     // k >= 2
00289     int borne_phi = np + 1 ; 
00290     if (np == 1) borne_phi = 1 ; 
00291     
00292     for (int k=2 ; k<borne_phi ; k++) {
00293     for (int j=0 ; j<nt ; j++) {
00294         for (int i=0 ; i<nr ; i++ ) {
00295         *xco = cx[j] * (*xci) ;
00296         xci++ ;
00297         xco++ ;
00298         }   // Fin de la boucle sur r
00299     }   // Fin de la boucle sur theta
00300     }   // Fin de la boucle sur phi
00301 
00302     // On remet les choses la ou il faut
00303     delete [] tb->t ;
00304     tb->t = xo ;
00305     
00306     // base de developpement
00307     // inchangee
00308 }
00309 
00310 // cas T_SIN_P
00311 //------------
00312 void _d2sdtet2_t_sin_p(Tbl* tb, int &)
00313 {
00314 
00315     // Peut-etre rien a faire ?
00316     if (tb->get_etat() == ETATZERO) {
00317     return ;
00318     }
00319     
00320     // Protection
00321     assert(tb->get_etat() == ETATQCQ) ;
00322     
00323     // Pour le confort
00324     int nr = (tb->dim).dim[0] ;     // Nombre
00325     int nt = (tb->dim).dim[1] ;     //   de points
00326     int np = (tb->dim).dim[2] ;     //      physiques REELS
00327     np = np - 2 ;           // Nombre de points physiques
00328     
00329     // Variables statiques
00330     static double* cx = 0 ;
00331     static int nt_pre =0 ;
00332 
00333     // Test sur nt pour initialisation eventuelle
00334     if (nt > nt_pre) {
00335     nt_pre = nt ;
00336     cx = reinterpret_cast<double*>(realloc(cx, nt * sizeof(double))) ;
00337     for (int i=0 ; i<nt ; i++) {
00338         cx[i] = - (2*i) * (2*i) ;
00339     }
00340     }
00341 
00342     // pt. sur le tableau de double resultat
00343     double* xo = new double[(tb->dim).taille] ;
00344     
00345     // Initialisation a zero :
00346     for (int i=0; i<(tb->dim).taille; i++) {
00347     xo[i] = 0 ; 
00348     }
00349     
00350     // On y va...
00351     double* xi = tb->t ;
00352     double* xci = xi ;  // Pointeurs
00353     double* xco = xo ;  //  courants
00354     
00355     int borne_phi = np + 1 ; 
00356     if (np == 1) borne_phi = 1 ; 
00357     
00358     for (int k=0 ; k< borne_phi ; k++) {
00359     for (int j=0 ; j<nt ; j++) {
00360         for (int i=0 ; i<nr ; i++ ) {
00361         *xco = cx[j] * (*xci) ;
00362         xci++ ;
00363         xco++ ;
00364         }   // Fin de la boucle sur r
00365     }   // Fin de la boucle sur theta
00366     }   // Fin de la boucle sur phi
00367 
00368     // On remet les choses la ou il faut
00369     delete [] tb->t ;
00370     tb->t = xo ;
00371     
00372     // base de developpement
00373     // inchangee
00374 }
00375 
00376 // cas T_SIN_I
00377 //------------
00378 void _d2sdtet2_t_sin_i(Tbl* tb, int &)
00379 {
00380 
00381     // Peut-etre rien a faire ?
00382     if (tb->get_etat() == ETATZERO) {
00383     return ;
00384     }
00385     
00386     // Protection
00387     assert(tb->get_etat() == ETATQCQ) ;
00388     
00389     // Pour le confort
00390     int nr = (tb->dim).dim[0] ;     // Nombre
00391     int nt = (tb->dim).dim[1] ;     //   de points
00392     int np = (tb->dim).dim[2] ;     //      physiques REELS
00393     np = np - 2 ;           // Nombre de points physiques
00394     
00395     // Variables statiques
00396     static double* cx = 0 ;
00397     static int nt_pre =0 ;
00398 
00399     // Test sur nt pour initialisation eventuelle
00400     if (nt > nt_pre) {
00401     nt_pre = nt ;
00402     cx = reinterpret_cast<double*>(realloc(cx, nt * sizeof(double))) ;
00403     for (int i=0 ; i<nt ; i++) {
00404         cx[i] = - (2*i+1) * (2*i+1) ;
00405     }
00406     }
00407 
00408     // pt. sur le tableau de double resultat
00409     double* xo = new double[(tb->dim).taille] ;
00410     
00411     // Initialisation a zero :
00412     for (int i=0; i<(tb->dim).taille; i++) {
00413     xo[i] = 0 ; 
00414     }
00415     
00416     // On y va...
00417     double* xi = tb->t ;
00418     double* xci = xi ;  // Pointeurs
00419     double* xco = xo ;  //  courants
00420     
00421     int borne_phi = np + 1 ; 
00422     if (np == 1) borne_phi = 1 ; 
00423     
00424     for (int k=0 ; k< borne_phi ; k++) {
00425     for (int j=0 ; j<nt ; j++) {
00426         for (int i=0 ; i<nr ; i++ ) {
00427         *xco = cx[j] * (*xci) ;
00428         xci++ ;
00429         xco++ ;
00430         }   // Fin de la boucle sur r
00431     }   // Fin de la boucle sur theta
00432     }   // Fin de la boucle sur phi
00433 
00434     // On remet les choses la ou il faut
00435     delete [] tb->t ;
00436     tb->t = xo ;
00437     
00438     // base de developpement
00439     // inchangee
00440 }
00441 
00442 // cas T_COS_I
00443 //------------
00444 void _d2sdtet2_t_cos_i(Tbl* tb, int &)
00445 {
00446 
00447     // Peut-etre rien a faire ?
00448     if (tb->get_etat() == ETATZERO) {
00449     return ;
00450     }
00451     
00452     // Protection
00453     assert(tb->get_etat() == ETATQCQ) ;
00454     
00455     // Pour le confort
00456     int nr = (tb->dim).dim[0] ;     // Nombre
00457     int nt = (tb->dim).dim[1] ;     //   de points
00458     int np = (tb->dim).dim[2] ;     //      physiques REELS
00459     np = np - 2 ;           // Nombre de points physiques
00460     
00461     // Variables statiques
00462     static double* cx = 0 ;
00463     static int nt_pre =0 ;
00464 
00465     // Test sur nt pour initialisation eventuelle
00466     if (nt > nt_pre) {
00467     nt_pre = nt ;
00468     cx = reinterpret_cast<double*>(realloc(cx, nt * sizeof(double))) ;
00469     for (int i=0 ; i<nt ; i++) {
00470         cx[i] = - (2*i+1) * (2*i+1) ;
00471     }
00472     }
00473 
00474     // pt. sur le tableau de double resultat
00475     double* xo = new double[(tb->dim).taille] ;
00476     
00477     // Initialisation a zero :
00478     for (int i=0; i<(tb->dim).taille; i++) {
00479     xo[i] = 0 ; 
00480     }
00481     
00482     // On y va...
00483     double* xi = tb->t ;
00484     double* xci = xi ;  // Pointeurs
00485     double* xco = xo ;  //  courants
00486     
00487     int borne_phi = np + 1 ; 
00488     if (np == 1) borne_phi = 1 ; 
00489     
00490     for (int k=0 ; k< borne_phi ; k++) {
00491     for (int j=0 ; j<nt ; j++) {
00492         for (int i=0 ; i<nr ; i++ ) {
00493         *xco = cx[j] * (*xci) ;
00494         xci++ ;
00495         xco++ ;
00496         }   // Fin de la boucle sur r
00497     }   // Fin de la boucle sur theta
00498     }   // Fin de la boucle sur phi
00499 
00500     // On remet les choses la ou il faut
00501     delete [] tb->t ;
00502     tb->t = xo ;
00503     
00504     // base de developpement
00505     // inchangee
00506 }
00507 
00508 // cas T_COSSIN_CP
00509 //----------------
00510 void _d2sdtet2_t_cossin_cp(Tbl* tb, int &)
00511 {
00512 
00513     // Peut-etre rien a faire ?
00514     if (tb->get_etat() == ETATZERO) {
00515     return ;
00516     }
00517     
00518     // Protection
00519     assert(tb->get_etat() == ETATQCQ) ;
00520     
00521     // Pour le confort
00522     int nr = (tb->dim).dim[0] ;     // Nombre
00523     int nt = (tb->dim).dim[1] ;     //   de points
00524     int np = (tb->dim).dim[2] ;     //      physiques REELS
00525     np = np - 2 ;           // Nombre de points physiques
00526     
00527     // Variables statiques
00528     static double* cxp = 0 ;
00529     static double* cxi = 0 ;
00530     static int nt_pre =0 ;
00531 
00532     // Test sur nt pour initialisation eventuelle
00533     if (nt > nt_pre) {
00534     nt_pre = nt ;
00535     cxp = reinterpret_cast<double*>(realloc(cxp, nt * sizeof(double))) ;
00536     cxi = reinterpret_cast<double*>(realloc(cxi, nt * sizeof(double))) ;
00537     for (int i=0 ; i<nt ; i++) {
00538         cxp[i] = - (2*i) * (2*i) ;
00539         cxi[i] = - (2*i+1) * (2*i+1) ;
00540     }
00541     }
00542 
00543     // pt. sur le tableau de double resultat
00544     double* xo = new double[(tb->dim).taille] ;
00545     
00546     // Initialisation a zero :
00547     for (int i=0; i<(tb->dim).taille; i++) {
00548     xo[i] = 0 ; 
00549     }
00550     
00551     // On y va...
00552     double* xi = tb->t ;
00553     double* xci = xi ;  // Pointeurs
00554     double* xco = xo ;  //  courants
00555     
00556     // Partie cos(pair)
00557     int k ;
00558     for (k=0 ; k<np+1 ; k += 4) {
00559      for (int m=0 ; m<2 ; m++) {
00560     for (int j=0 ; j<nt ; j++) {
00561         for (int i=0 ; i<nr ; i++ ) {
00562         *xco = cxp[j] * (*xci) ;
00563         xci++ ;
00564         xco++ ;
00565         }   // Fin de la boucle sur r
00566     }   // Fin de la boucle sur theta
00567      }    // Fin de la boucle intermediaire
00568     xci += 2*nr*nt ;
00569     xco += 2*nr*nt ;
00570     }   // Fin de la boucle sur phi
00571 
00572     // Partie sin(impair)
00573     xci = xi + 2*nr*nt ;
00574     xco = xo + 2*nr*nt ;
00575     for (k=2 ; k<np+1 ; k += 4) {
00576      for (int m=0 ; m<2 ; m++) {
00577     for (int j=0 ; j<nt ; j++) {
00578         for (int i=0 ; i<nr ; i++ ) {
00579         *xco = cxi[j] * (*xci) ;
00580         xci++ ;
00581         xco++ ;
00582         }   // Fin de la boucle sur r
00583     }   // Fin de la boucle sur theta
00584      }    // Fin de la boucle intermediaire
00585     xci += 2*nr*nt ;
00586     xco += 2*nr*nt ;
00587     }   // Fin de la boucle sur phi
00588 
00589     // On remet les choses la ou il faut
00590     delete [] tb->t ;
00591     tb->t = xo ;
00592     
00593     // base de developpement
00594     // inchangee
00595 }
00596 
00597 // cas T_COSSIN_SP
00598 //----------------
00599 void _d2sdtet2_t_cossin_sp(Tbl* tb, int &)
00600 {
00601 
00602     // Peut-etre rien a faire ?
00603     if (tb->get_etat() == ETATZERO) {
00604     return ;
00605     }
00606     
00607     // Protection
00608     assert(tb->get_etat() == ETATQCQ) ;
00609     
00610     // Pour le confort
00611     int nr = (tb->dim).dim[0] ;     // Nombre
00612     int nt = (tb->dim).dim[1] ;     //   de points
00613     int np = (tb->dim).dim[2] ;     //      physiques REELS
00614     np = np - 2 ;           // Nombre de points physiques
00615     
00616     // Variables statiques
00617     static double* cxp = 0 ;
00618     static double* cxi = 0 ;
00619     static int nt_pre =0 ;
00620 
00621     // Test sur nt pour initialisation eventuelle
00622     if (nt > nt_pre) {
00623     nt_pre = nt ;
00624     cxp = reinterpret_cast<double*>(realloc(cxp, nt * sizeof(double))) ;
00625     cxi = reinterpret_cast<double*>(realloc(cxi, nt * sizeof(double))) ;
00626     for (int i=0 ; i<nt ; i++) {
00627         cxp[i] = - (2*i) * (2*i) ;
00628         cxi[i] = - (2*i+1) * (2*i+1) ;
00629     }
00630     }
00631 
00632     // pt. sur le tableau de double resultat
00633     double* xo = new double[(tb->dim).taille] ;
00634     
00635     // Initialisation a zero :
00636     for (int i=0; i<(tb->dim).taille; i++) {
00637     xo[i] = 0 ; 
00638     }
00639     
00640     // On y va...
00641     double* xi = tb->t ;
00642     double* xci = xi ;  // Pointeurs
00643     double* xco = xo ;  //  courants
00644     
00645     // Partie sin(pair)
00646     int k ;
00647     for (k=0 ; k<np+1 ; k += 4) {
00648      for (int m=0 ; m<2 ; m++) {
00649     for (int j=0 ; j<nt ; j++) {
00650         for (int i=0 ; i<nr ; i++ ) {
00651         *xco = cxp[j] * (*xci) ;
00652         xci++ ;
00653         xco++ ;
00654         }   // Fin de la boucle sur r
00655     }   // Fin de la boucle sur theta
00656      }    // Fin de la boucle intermediaire
00657     xci += 2*nr*nt ;
00658     xco += 2*nr*nt ;
00659     }   // Fin de la boucle sur phi
00660 
00661     // Partie cos(impair)
00662     xci = xi + 2*nr*nt ;
00663     xco = xo + 2*nr*nt ;
00664     for (k=2 ; k<np+1 ; k += 4) {
00665      for (int m=0 ; m<2 ; m++) {
00666     for (int j=0 ; j<nt ; j++) {
00667         for (int i=0 ; i<nr ; i++ ) {
00668         *xco = cxi[j] * (*xci) ;
00669         xci++ ;
00670         xco++ ;
00671         }   // Fin de la boucle sur r
00672     }   // Fin de la boucle sur theta
00673      }    // Fin de la boucle intermediaire
00674     xci += 2*nr*nt ;
00675     xco += 2*nr*nt ;
00676     }   // Fin de la boucle sur phi
00677 
00678     // On remet les choses la ou il faut
00679     delete [] tb->t ;
00680     tb->t = xo ;
00681     
00682     // base de developpement
00683     // inchangee
00684 }
00685 
00686 // cas T_COSSIN_SI
00687 //----------------
00688 void _d2sdtet2_t_cossin_si(Tbl* tb, int &)
00689 {
00690 
00691     // Peut-etre rien a faire ?
00692     if (tb->get_etat() == ETATZERO) {
00693     return ;
00694     }
00695     
00696     // Protection
00697     assert(tb->get_etat() == ETATQCQ) ;
00698     
00699     // Pour le confort
00700     int nr = (tb->dim).dim[0] ;     // Nombre
00701     int nt = (tb->dim).dim[1] ;     //   de points
00702     int np = (tb->dim).dim[2] ;     //      physiques REELS
00703     np = np - 2 ;           // Nombre de points physiques
00704     
00705     // Variables statiques
00706     static double* cxp = 0 ;
00707     static double* cxi = 0 ;
00708     static int nt_pre =0 ;
00709 
00710     // Test sur nt pour initialisation eventuelle
00711     if (nt > nt_pre) {
00712     nt_pre = nt ;
00713     cxp = reinterpret_cast<double*>(realloc(cxp, nt * sizeof(double))) ;
00714     cxi = reinterpret_cast<double*>(realloc(cxi, nt * sizeof(double))) ;
00715     for (int i=0 ; i<nt ; i++) {
00716         cxp[i] = - (2*i) * (2*i) ;
00717         cxi[i] = - (2*i+1) * (2*i+1) ;
00718     }
00719     }
00720 
00721     // pt. sur le tableau de double resultat
00722     double* xo = new double[(tb->dim).taille] ;
00723     
00724     // Initialisation a zero :
00725     for (int i=0; i<(tb->dim).taille; i++) {
00726     xo[i] = 0 ; 
00727     }
00728     
00729     // On y va...
00730     double* xi = tb->t ;
00731     double* xci = xi ;  // Pointeurs
00732     double* xco = xo ;  //  courants
00733     
00734     // Partie sin(impair)
00735     int k ;
00736     for (k=0 ; k<np+1 ; k += 4) {
00737      for (int m=0 ; m<2 ; m++) {
00738     for (int j=0 ; j<nt ; j++) {
00739         for (int i=0 ; i<nr ; i++ ) {
00740         *xco = cxi[j] * (*xci) ;
00741         xci++ ;
00742         xco++ ;
00743         }   // Fin de la boucle sur r
00744     }   // Fin de la boucle sur theta
00745      }    // Fin de la boucle intermediaire
00746     xci += 2*nr*nt ;
00747     xco += 2*nr*nt ;
00748     }   // Fin de la boucle sur phi
00749 
00750     // Partie cos(pair)
00751     xci = xi + 2*nr*nt ;
00752     xco = xo + 2*nr*nt ;
00753     for (k=2 ; k<np+1 ; k += 4) {
00754      for (int m=0 ; m<2 ; m++) {
00755     for (int j=0 ; j<nt ; j++) {
00756         for (int i=0 ; i<nr ; i++ ) {
00757         *xco = cxp[j] * (*xci) ;
00758         xci++ ;
00759         xco++ ;
00760         }   // Fin de la boucle sur r
00761     }   // Fin de la boucle sur theta
00762      }    // Fin de la boucle intermediaire
00763     xci += 2*nr*nt ;
00764     xco += 2*nr*nt ;
00765     }   // Fin de la boucle sur phi
00766 
00767     // On remet les choses la ou il faut
00768     delete [] tb->t ;
00769     tb->t = xo ;
00770     
00771     // base de developpement
00772     // inchangee
00773 }
00774 
00775 // cas T_COSSIN_C
00776 //----------------
00777 void _d2sdtet2_t_cossin_c(Tbl* tb, int &)
00778 {
00779 
00780     // Peut-etre rien a faire ?
00781     if (tb->get_etat() == ETATZERO) {
00782     return ;
00783     }
00784     
00785     // Protection
00786     assert(tb->get_etat() == ETATQCQ) ;
00787     
00788     // Pour le confort
00789     int nr = (tb->dim).dim[0] ;     // Nombre
00790     int nt = (tb->dim).dim[1] ;     //   de points
00791     int np = (tb->dim).dim[2] ;     //      physiques REELS
00792     np = np - 2 ;           // Nombre de points physiques
00793     
00794     // Variables statiques
00795     static double* cxp = 0 ;
00796     static double* cxi = 0 ;
00797     static int nt_pre =0 ;
00798 
00799     // Test sur nt pour initialisation eventuelle
00800     if (nt > nt_pre) {
00801     nt_pre = nt ;
00802     cxp = reinterpret_cast<double*>(realloc(cxp, nt * sizeof(double))) ;
00803     cxi = reinterpret_cast<double*>(realloc(cxi, nt * sizeof(double))) ;
00804     for (int i=0 ; i<nt ; i++) {
00805         cxp[i] = - i*i ;
00806         cxi[i] = - i*i ;
00807     }
00808     }
00809 
00810     // pt. sur le tableau de double resultat
00811     double* xo = new double[(tb->dim).taille] ;
00812     
00813     // Initialisation a zero :
00814     for (int i=0; i<(tb->dim).taille; i++) {
00815     xo[i] = 0 ; 
00816     }
00817     
00818     // On y va...
00819     double* xi = tb->t ;
00820     double* xci = xi ;  // Pointeurs
00821     double* xco = xo ;  //  courants
00822     
00823     // Partie cos(pair)
00824     int k ;
00825     for (k=0 ; k<np+1 ; k += 4) {
00826      for (int m=0 ; m<2 ; m++) {
00827     for (int j=0 ; j<nt ; j++) {
00828         for (int i=0 ; i<nr ; i++ ) {
00829         *xco = cxp[j] * (*xci) ;
00830         xci++ ;
00831         xco++ ;
00832         }   // Fin de la boucle sur r
00833     }   // Fin de la boucle sur theta
00834      }    // Fin de la boucle intermediaire
00835     xci += 2*nr*nt ;
00836     xco += 2*nr*nt ;
00837     }   // Fin de la boucle sur phi
00838 
00839     // Partie sin(impair)
00840     xci = xi + 2*nr*nt ;
00841     xco = xo + 2*nr*nt ;
00842     for (k=2 ; k<np+1 ; k += 4) {
00843      for (int m=0 ; m<2 ; m++) {
00844     for (int j=0 ; j<nt ; j++) {
00845         for (int i=0 ; i<nr ; i++ ) {
00846         *xco = cxi[j] * (*xci) ;
00847         xci++ ;
00848         xco++ ;
00849         }   // Fin de la boucle sur r
00850     }   // Fin de la boucle sur theta
00851      }    // Fin de la boucle intermediaire
00852     xci += 2*nr*nt ;
00853     xco += 2*nr*nt ;
00854     }   // Fin de la boucle sur phi
00855 
00856     // On remet les choses la ou il faut
00857     delete [] tb->t ;
00858     tb->t = xo ;
00859     
00860     // base de developpement
00861     // inchangee
00862 }
00863 
00864 // cas T_COSSIN_S
00865 //----------------
00866 void _d2sdtet2_t_cossin_s(Tbl* tb, int &)
00867 {
00868 
00869     // Peut-etre rien a faire ?
00870     if (tb->get_etat() == ETATZERO) {
00871     return ;
00872     }
00873     
00874     // Protection
00875     assert(tb->get_etat() == ETATQCQ) ;
00876     
00877     // Pour le confort
00878     int nr = (tb->dim).dim[0] ;     // Nombre
00879     int nt = (tb->dim).dim[1] ;     //   de points
00880     int np = (tb->dim).dim[2] ;     //      physiques REELS
00881     np = np - 2 ;           // Nombre de points physiques
00882     
00883     // Variables statiques
00884     static double* cxp = 0 ;
00885     static double* cxi = 0 ;
00886     static int nt_pre =0 ;
00887 
00888     // Test sur nt pour initialisation eventuelle
00889     if (nt > nt_pre) {
00890     nt_pre = nt ;
00891     cxp = reinterpret_cast<double*>(realloc(cxp, nt * sizeof(double))) ;
00892     cxi = reinterpret_cast<double*>(realloc(cxi, nt * sizeof(double))) ;
00893     for (int i=0 ; i<nt ; i++) {
00894         cxp[i] = - i*i ;
00895         cxi[i] = - i*i ;
00896     }
00897     }
00898 
00899     // pt. sur le tableau de double resultat
00900     double* xo = new double[(tb->dim).taille] ;
00901     
00902     // Initialisation a zero :
00903     for (int i=0; i<(tb->dim).taille; i++) {
00904     xo[i] = 0 ; 
00905     }
00906     
00907     // On y va...
00908     double* xi = tb->t ;
00909     double* xci = xi ;  // Pointeurs
00910     double* xco = xo ;  //  courants
00911     
00912     // Partie sin(pair)
00913     int k ;
00914     for (k=0 ; k<np+1 ; k += 4) {
00915      for (int m=0 ; m<2 ; m++) {
00916     for (int j=0 ; j<nt ; j++) {
00917         for (int i=0 ; i<nr ; i++ ) {
00918         *xco = cxp[j] * (*xci) ;
00919         xci++ ;
00920         xco++ ;
00921         }   // Fin de la boucle sur r
00922     }   // Fin de la boucle sur theta
00923      }    // Fin de la boucle intermediaire
00924     xci += 2*nr*nt ;
00925     xco += 2*nr*nt ;
00926     }   // Fin de la boucle sur phi
00927 
00928     // Partie cos(impair)
00929     xci = xi + 2*nr*nt ;
00930     xco = xo + 2*nr*nt ;
00931     for (k=2 ; k<np+1 ; k += 4) {
00932      for (int m=0 ; m<2 ; m++) {
00933     for (int j=0 ; j<nt ; j++) {
00934         for (int i=0 ; i<nr ; i++ ) {
00935         *xco = cxi[j] * (*xci) ;
00936         xci++ ;
00937         xco++ ;
00938         }   // Fin de la boucle sur r
00939     }   // Fin de la boucle sur theta
00940      }    // Fin de la boucle intermediaire
00941     xci += 2*nr*nt ;
00942     xco += 2*nr*nt ;
00943     }   // Fin de la boucle sur phi
00944 
00945     // On remet les choses la ou il faut
00946     delete [] tb->t ;
00947     tb->t = xo ;
00948     
00949     // base de developpement
00950     // inchangee
00951 }

Generated on Tue Feb 7 01:35:18 2012 for LORENE by  doxygen 1.4.6