multxpun_1d.C

00001 /*
00002  *   Copyright (c) 2000-2001 Philippe Grandclement
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 multxpun_1d_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/multxpun_1d.C,v 1.1 2007/12/11 15:42:22 jl_cornou Exp $" ;
00024 
00025 /*
00026  * $Id: multxpun_1d.C,v 1.1 2007/12/11 15:42:22 jl_cornou Exp $
00027  * $Log: multxpun_1d.C,v $
00028  * Revision 1.1  2007/12/11 15:42:22  jl_cornou
00029  * Premiere version des fonctions liees aux polynomes de Jacobi(0,2)
00030  *
00031  * Revision 1.2  2002/10/16 14:37:07  j_novak
00032  * Reorganization of #include instructions of standard C++, in order to
00033  * use experimental version 3 of gcc.
00034  *
00035  * Revision 1.1.1.1  2001/11/20 15:19:29  e_gourgoulhon
00036  * LORENE
00037  *
00038  * Revision 2.0  2000/04/03  17:01:59  phil
00039  * *** empty log message ***
00040  *
00041  *
00042  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/multxpun_1d.C,v 1.1 2007/12/11 15:42:22 jl_cornou Exp $
00043  *
00044  */
00045 
00046 
00047 #include <stdlib.h>
00048 #include <math.h>
00049 
00050 #include "tbl.h"
00051 #include "type_parite.h"
00052 
00053 /*
00054  * Operateur :
00055  *  -R_JACO02 : (f-f(-1))*(x+1)
00056  * 
00057  *
00058  * Entree : coefficients de f dans tb
00059  *      nr : nombre de points en r
00060  *
00061  * Sortie : coefficient du resultat dans xo
00062  * 
00063  * 
00064  */
00065 
00066 
00067         //-----------------------------------
00068         // Routine pour les cas non prevus --
00069         //-----------------------------------
00070 
00071 void _multxpun_1d_pas_prevu(int nr, double* tb, double *res) {
00072     cout << "multxpun pas prevu..." << endl ;
00073     cout << " valeurs: " << tb << "   " << res << endl ;
00074     cout << "nr : " << nr << endl ;
00075     abort () ;
00076     exit(-1) ;
00077 }
00078 
00079             //---------------
00080             // cas R_JACO02 -
00081             //---------------
00082 
00083 void _multxpun_1d_r_jaco02 (int nr, double* tb, double *xo)
00084 {
00085     
00086     xo[nr-1] = 0 ;
00087     for (int i = 1 ; i < nr-1 ; i++) {
00088     xo[i] = i*(i+2)/double((i+1)*(2*i+1))*tb[i-1] + (i*i+3*i+3)/double((i+1)*(i+2))*tb[i] + (i+1)*(i+3)/double((i+2)*(2*i+5))*tb[i+1] ;
00089     }
00090     xo[0] = 1.5*tb[0] + 0.3*tb[1] ;
00091     xo[nr-1] = (nr*nr-1)/double((nr)*(2*nr-1))*tb[nr-2] + (1+1/double((nr)*(nr+1)))*tb[nr-1] ;
00092 }
00093 
00094             //----------------------------
00095             // La routine a appeler   ----
00096             //----------------------------
00097             
00098             
00099 void multxpun_1d(int nr, double **tb, int base_r)       // Version appliquee a this
00100 {
00101 
00102 // Routines de derivation
00103 static void (*multxpun_1d[MAX_BASE])(int, double *, double *) ;
00104 static int nap = 0 ;
00105 
00106     // Premier appel
00107     if (nap==0) {
00108     nap = 1 ;
00109     for (int i=0 ; i<MAX_BASE ; i++) {
00110         multxpun_1d[i] = _multxpun_1d_pas_prevu ;
00111     }
00112     // Les routines existantes
00113     multxpun_1d[R_JACO02 >> TRA_R] = _multxpun_1d_r_jaco02 ;
00114     }
00115     
00116     double *result = new double[nr] ;
00117     multxpun_1d[base_r](nr, *tb, result) ;
00118     
00119     delete [] (*tb) ;
00120     (*tb) = result ;
00121 }

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