xpundsdx_1d.C

00001 /*
00002  *   Copyright (c) 1999-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 xpundsdx_1d_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/xpundsdx_1d.C,v 1.1 2007/12/11 15:42:23 jl_cornou Exp $" ;
00024 
00025 /*
00026  * $Id: xpundsdx_1d.C,v 1.1 2007/12/11 15:42:23 jl_cornou Exp $
00027  * $Log: xpundsdx_1d.C,v $
00028  * Revision 1.1  2007/12/11 15:42:23  jl_cornou
00029  * Premiere version des fonctions liees aux polynomes de Jacobi(0,2)
00030  *
00031  * Revision 1.2  2002/10/16 14:37:11  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  1999/10/11  09:55:46  phil
00039  * *** empty log message ***
00040  *
00041  *
00042  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/xpundsdx_1d.C,v 1.1 2007/12/11 15:42:23 jl_cornou Exp $
00043  *
00044  */
00045  
00046  // Includes
00047 #include <stdlib.h>
00048 
00049 #include "headcpp.h"
00050 #include "type_parite.h"
00051 
00052 
00053 
00054         //----------------------------------
00055         // Routine pour les cas non prevus --
00056         //----------------------------------
00057 
00058 void _xpundsdx_1d_pas_prevu(int nr, double* tb, double *xo) {
00059     cout << "xpundsdx pas prevu..." << endl ;
00060     cout << "Nombre de points : " << nr << endl ;
00061     cout << "Valeurs : " << tb << "  " << xo <<endl ;
00062     abort() ;
00063     exit(-1) ;
00064 }
00065 
00066 
00067             //---------------
00068             // cas R_JACO02 -
00069             //---------------
00070 
00071 void _xpundsdx_1d_r_jaco02(int nr, double* tb, double *xo) {
00072     
00073     double somme ;
00074     for (int j = 0 ; j < nr-1 ; j++ ) {
00075     somme = j*tb[j] ;
00076     for (int n = j+1 ; n < nr ; n++ ) {
00077     somme+=(2*j+3)*tb[n];
00078     } // Fin de la boucle auxiliaire
00079     xo[j]=somme ;
00080     } // Fin de la boucle sur R
00081     xo[nr-1] = (nr-1)*tb[nr-1] ;
00082 }
00083 
00084         // ---------------------
00085         // La routine a appeler
00086         //----------------------
00087         
00088         
00089 void xpundsdx_1d(int nr, double** tb, int base_r)
00090 {
00091 
00092         // Routines de derivation
00093     static void (*xpundsdx_1d[MAX_BASE])(int, double*, double *) ;
00094     static int nap = 0 ;
00095 
00096         // Premier appel
00097     if (nap==0) {
00098     nap = 1 ;
00099     for (int i=0 ; i<MAX_BASE ; i++) {
00100         xpundsdx_1d[i] = _xpundsdx_1d_pas_prevu ;
00101     }
00102         // Les routines existantes
00103     xpundsdx_1d[R_JACO02 >> TRA_R] = _xpundsdx_1d_r_jaco02 ;
00104     }
00105     
00106     double *result = new double[nr] ;
00107     
00108     xpundsdx_1d[base_r](nr, *tb, result) ;
00109     
00110     delete [] (*tb) ;
00111     (*tb) = result ;
00112 }

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