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 multx_1d_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/multx_1d.C,v 1.2 2002/10/16 14:36:58 j_novak Exp $" ; 00024 00025 /* 00026 * $Id: multx_1d.C,v 1.2 2002/10/16 14:36:58 j_novak Exp $ 00027 * $Log: multx_1d.C,v $ 00028 * Revision 1.2 2002/10/16 14:36:58 j_novak 00029 * Reorganization of #include instructions of standard C++, in order to 00030 * use experimental version 3 of gcc. 00031 * 00032 * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon 00033 * LORENE 00034 * 00035 * Revision 2.1 1999/07/08 09:54:30 phil 00036 * correction gestion memoire 00037 * 00038 * Revision 2.0 1999/07/07 10:15:40 phil 00039 * *** empty log message *** 00040 * 00041 * 00042 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/multx_1d.C,v 1.2 2002/10/16 14:36:58 j_novak Exp $ 00043 * 00044 */ 00045 00046 00047 // Includes 00048 #include <stdlib.h> 00049 00050 #include "headcpp.h" 00051 #include "type_parite.h" 00052 00053 00054 /* 00055 * Operateurs de multiplication par x 00056 * 00057 * Uniquement le cas R_CHEB 00058 * 00059 * Entree : 00060 * 00061 * int nr : nombre de points en r 00062 * tb contient les coefficients du developpement 00063 * evenetuellement e dans echelle 00064 * 00065 * Sortie : 00066 * tb contient les coefficients du resultat... 00067 */ 00068 00069 00070 //-------------------------------------- 00071 // Routine pour les cas non prevus ----- 00072 //-------------------------------------- 00073 00074 void _multx_1d_pas_prevu(int nr, double* tb, double *result) { 00075 cout << "multx pas prevu..." << endl ; 00076 cout << "Valeurs : " << tb << " " << result << endl ; 00077 cout << " nr : " << nr << endl ; 00078 abort() ; 00079 exit(-1) ; 00080 } 00081 00082 00083 //------------------ 00084 // cas R_CHEB --- 00085 //------------------ 00086 00087 void _multx_1d_r_cheb (int nr, double* tb, double* res) { 00088 00089 res[0] = tb[1]/2. ; 00090 res[1] = (2*tb[0]+tb[2])/2. ; 00091 res[nr-1] = tb[nr-2]/2. ; 00092 00093 for (int i=2 ; i<nr-1 ; i++) 00094 res[i] = (tb[i-1]+tb[i+1])/2. ; 00095 00096 } 00097 00098 00099 00100 // ---------------------- 00101 // La routine a appeler 00102 //----------------------- 00103 00104 void multx_1d(int nr, double **tb, int base_r) 00105 { 00106 00107 // Routines de derivation 00108 static void (*multx_1d[MAX_BASE])(int, double *, double *) ; 00109 static int nap = 0 ; 00110 00111 // Premier appel 00112 if (nap==0) { 00113 nap = 1 ; 00114 for (int i=0 ; i<MAX_BASE ; i++) { 00115 multx_1d[i] = _multx_1d_pas_prevu ; 00116 } 00117 // Les routines existantes 00118 multx_1d[R_CHEB >> TRA_R] = _multx_1d_r_cheb ; 00119 } 00120 00121 00122 double *result = new double[nr] ; 00123 multx_1d[base_r](nr, *tb, result) ; 00124 delete [] (*tb) ; 00125 (*tb) = result ; 00126 } 00127
1.4.6