op_mult_xp1.C

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

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