00001 /* 00002 * Copyright (c) 1999-2000 Jean-Alain Marck 00003 * Copyright (c) 1999-2001 Eric Gourgoulhon 00004 * 00005 * This file is part of LORENE. 00006 * 00007 * LORENE is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * LORENE is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with LORENE; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 */ 00022 00023 00024 char trigo_ini_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/FFT991/trigo_ini.C,v 1.1 2004/12/21 17:06:01 j_novak Exp $" ; 00025 00026 /* 00027 * Routine d'initialisation des tables trigo 00028 * Version speciale FAX 00029 * 00030 * Entree: 00031 * n nombre de degres de liberte 00032 * Sortie: 00033 * trigo_ini pointeur double* sur la table trigo 00034 * 00035 * Doit etre en zone critique 00036 */ 00037 00038 /* 00039 * $Id: trigo_ini.C,v 1.1 2004/12/21 17:06:01 j_novak Exp $ 00040 * $Log: trigo_ini.C,v $ 00041 * Revision 1.1 2004/12/21 17:06:01 j_novak 00042 * Added all files for using fftw3. 00043 * 00044 * Revision 1.5 2003/12/19 16:21:47 j_novak 00045 * Shadow hunt 00046 * 00047 * Revision 1.4 2003/01/31 10:31:24 e_gourgoulhon 00048 * Suppressed the directive #include <malloc.h> for malloc is defined 00049 * in <stdlib.h> 00050 * 00051 * Revision 1.3 2002/10/16 14:36:57 j_novak 00052 * Reorganization of #include instructions of standard C++, in order to 00053 * use experimental version 3 of gcc. 00054 * 00055 * Revision 1.2 2002/09/09 13:00:40 e_gourgoulhon 00056 * Modification of declaration of Fortran 77 prototypes for 00057 * a better portability (in particular on IBM AIX systems): 00058 * All Fortran subroutine names are now written F77_* and are 00059 * defined in the new file C++/Include/proto_f77.h. 00060 * 00061 * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon 00062 * LORENE 00063 * 00064 * Revision 2.1 1999/11/24 16:23:22 eric 00065 * Modif affichage. 00066 * 00067 * Revision 2.0 1999/02/22 15:29:33 hyc 00068 * *** empty log message *** 00069 * 00070 * 00071 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/FFT991/trigo_ini.C,v 1.1 2004/12/21 17:06:01 j_novak Exp $ 00072 * 00073 */ 00074 00075 // headers du C 00076 #include <math.h> 00077 #include <stdlib.h> 00078 00079 // Prototypes of F77 subroutines 00080 #include "headcpp.h" 00081 #include "proto_f77.h" 00082 00083 // Variable de loch 00084 int loch_trigo_ini = 0 ; 00085 00086 double *trigo_ini( int n ) 00087 { 00088 // Variables locales statiques 00089 // --------------------------- 00090 #define NMAX 30 /* Nombre maximun de dimensions differentes */ 00091 static double *table_trigo[NMAX] ; /* Tableau des pointeurs sur les tableaux */ 00092 static int nwork = 0 ; /* Nombre de tableaux deja initialises */ 00093 static int tbn[NMAX] ; /* Tableau des points deja initialises */ 00094 static int trois = 3 ; 00095 int indice ; 00096 00097 //#pragma critical (loch_trigo_ini) 00098 { 00099 // Ce nombre de points a-t-il deja ete utilise ? 00100 indice = -1 ; 00101 int i ; 00102 for ( i=0 ; i < nwork ; i++ ) { 00103 if ( tbn[i] == n ) indice = i ; 00104 } 00105 00106 // Initialisation 00107 if (indice == -1) { /* Il faut une nouvelle initialisation */ 00108 if ( nwork >= NMAX ) { 00109 cout << "trigo_ini : nwork >= NMAX !" << endl ; 00110 abort() ; 00111 } 00112 indice = nwork ; nwork++ ; tbn[indice] = n ; 00113 00114 // table_trigo[indice] = new double[3*n/2 + 1] ; 00115 table_trigo[indice] = (double *) malloc( sizeof(double) * (3*n/2 + 1) ) ; 00116 if ( table_trigo[indice] == 0 ) { 00117 cout << "trigo_ini : malloc error !" << endl ; 00118 abort() ; 00119 } 00120 00121 F77_fftrig( table_trigo[indice], &n, &trois ) ; 00122 } 00123 00124 } // Fin de zone critique 00125 00126 // Valeurs de retour 00127 return table_trigo[indice] ; 00128 }
1.4.6