op_sxpun.C

00001 /*
00002  *   Copyright (c) 1999-2000 Jean-Alain Marck
00003  *   Copyright (c) 1999-2001 Eric Gourgoulhon
00004  *   Copyright (c) 1999-2001 Philippe Grandclement
00005  *
00006  *   This file is part of LORENE.
00007  *
00008  *   LORENE is free software; you can redistribute it and/or modify
00009  *   it under the terms of the GNU General Public License as published by
00010  *   the Free Software Foundation; either version 2 of the License, or
00011  *   (at your option) any later version.
00012  *
00013  *   LORENE is distributed in the hope that it will be useful,
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *   GNU General Public License for more details.
00017  *
00018  *   You should have received a copy of the GNU General Public License
00019  *   along with LORENE; if not, write to the Free Software
00020  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00024 
00025 char op_sxpun_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/op_sxpun.C,v 1.4 2008/08/19 06:42:00 j_novak Exp $" ;
00026 
00027 /* 
00028  * Ensemble des routines de base de division par rapport a x+1
00029  * (Utilisation interne)
00030  * 
00031  *  void _sx_XXXX(Tbl * t, int & b)
00032  *  t   pointeur sur le Tbl d'entree-sortie
00033  *  b   base spectrale
00034  * 
00035  */
00036  
00037  /*
00038  * $Id: op_sxpun.C,v 1.4 2008/08/19 06:42:00 j_novak Exp $
00039  * $Log: op_sxpun.C,v $
00040  * Revision 1.4  2008/08/19 06:42:00  j_novak
00041  * Minor modifications to avoid warnings with gcc 4.3. Most of them concern
00042  * cast-type operations, and constant strings that must be defined as const char*
00043  *
00044  * Revision 1.3  2007/12/21 13:59:02  j_novak
00045  * Suppression of call to pow(-1, something).
00046  *
00047  * Revision 1.2  2007/12/20 09:11:08  jl_cornou
00048  * Correction of an error in op_sxpun about Jacobi(0,2) polynomials
00049  *
00050  * Revision 1.1  2007/12/11 15:42:23  jl_cornou
00051  * Premiere version des fonctions liees aux polynomes de Jacobi(0,2)
00052  *
00053  * Revision 1.2  2004/11/23 15:16:01  m_forot
00054  *
00055  * Added the bases for the cases without any equatorial symmetry
00056  *  (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
00057  *
00058  * Revision 1.1.1.1  2001/11/20 15:19:29  e_gourgoulhon
00059  * LORENE
00060  *
00061  * Revision 2.5  2000/09/07  12:50:48  phil
00062  * *** empty log message ***
00063  *
00064  * Revision 2.4  2000/02/24  16:42:59  eric
00065  * Initialisation a zero du tableau xo avant le calcul.
00066  *
00067  * Revision 2.3  1999/11/15  16:39:17  eric
00068  * Tbl::dim est desormais un Dim_tbl et non plus un Dim_tbl*.
00069  *
00070  * Revision 2.2  1999/10/18  13:40:11  eric
00071  * Suppression de la routine _sx_r_chebu car doublon avec _sxm1_cheb.
00072  *
00073  * Revision 2.1  1999/09/13  11:35:42  phil
00074  * gestion des cas k==1 et k==np
00075  *
00076  * Revision 2.0  1999/04/26  14:59:42  phil
00077  * *** empty log message ***
00078  *
00079  *
00080  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/op_sxpun.C,v 1.4 2008/08/19 06:42:00 j_novak Exp $
00081  *
00082  */
00083 
00084  // Fichier includes
00085 #include "tbl.h"
00086 #include <math.h>
00087 
00088         //-----------------------------------
00089         // Routine pour les cas non prevus --
00090         //-----------------------------------
00091 
00092 void _sxpun_pas_prevu(Tbl * tb, int& base) {
00093     cout << "sxpun pas prevu..." << endl ;
00094     cout << "Tbl: " << tb << " base: " << base << endl ;
00095     abort () ;
00096     exit(-1) ;
00097 }
00098 
00099             //-------------
00100             // Identite ---
00101             //-------------
00102 
00103 void _sxpun_identite(Tbl* , int& ) {
00104     return ;
00105 }
00106 
00107             //--------------
00108             // cas R_JACO02-
00109             //--------------
00110 
00111 void _sxpun_r_jaco02(Tbl* tb, int&)
00112     {
00113     // Peut-etre rien a faire ?
00114     if (tb->get_etat() == ETATZERO) {
00115     return ;
00116     }
00117     
00118 
00119     // Pour le confort
00120     int nr = (tb->dim).dim[0] ;     // Nombre
00121     int nt = (tb->dim).dim[1] ;     //   de points
00122     int np = (tb->dim).dim[2] ;     //      physiques REELS
00123     np = np - 2 ;           // Nombre de points physiques
00124     
00125     // pt. sur le tableau de double resultat
00126     double* xo = new double [tb->get_taille()];
00127     
00128     // Initialisation a zero :
00129     for (int i=0; i<tb->get_taille(); i++) {
00130     xo[i] = 0 ; 
00131     }
00132     
00133     // On y va...
00134     double* xi = tb->t ;
00135     double* xci = xi ;  // Pointeurs
00136     double* xco = xo ;  //  courants
00137 
00138     int borne_phi = np + 1 ; 
00139     if (np == 1) {
00140     borne_phi = 1 ; 
00141     }
00142     
00143     for (int k=0 ; k< borne_phi ; k++)
00144     if (k==1) {
00145         xci += nr*nt ;
00146         xco += nr*nt ;
00147     }
00148     else {
00149     for (int j=0 ; j<nt ; j++) {
00150 
00151         xco[nr-1] = 0 ;
00152             double somme ;
00153             for (int i = 0 ; i < nr-1 ; i++) {
00154             somme = 0 ;
00155             for (int m = i+1 ; m < nr ; m++) {
00156             int signe = ((m-1-i)%2 == 0 ? 1 : -1) ; 
00157             somme += signe*((m+1)*(m+2)/double((i+1)*(i+2))-(i+1)*(i+2)/double((m+1)*(m+2)))*xci[m] ;
00158             }
00159         xco[i] = (2*i+3)/double(4)*somme ;
00160         }   
00161     
00162         xci += nr ;
00163         xco += nr ;
00164     }   // Fin de la boucle sur theta
00165     }   // Fin de la boucle sur phi
00166     
00167     // On remet les choses la ou il faut
00168     delete [] tb->t ;
00169     tb->t = xo ;
00170     
00171     // base de developpement
00172     // inchangée
00173 }
00174 

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