LORENE
facto_ini.C
1/*
2 * Copyright (c) 1999-2000 Jean-Alain Marck
3 * Copyright (c) 1999-2001 Eric Gourgoulhon
4 *
5 * This file is part of LORENE.
6 *
7 * LORENE is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * LORENE is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with LORENE; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23
24
25
26
27/*
28 * Routine d'initialisation des tables de factorisation de n
29 * Version speciale FAX
30 *
31 * Entree:
32 * n nombre de degres de liberte
33 * Sortie:
34 * facto_ini pointeur int* sur la table de factorisation de n
35 *
36 * Cette routine doit etre entierement en zone critique
37 *
38 */
39
40/*
41 * $Id: facto_ini.C,v 1.6 2016/12/05 16:18:04 j_novak Exp $
42 * $Log: facto_ini.C,v $
43 * Revision 1.6 2016/12/05 16:18:04 j_novak
44 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
45 *
46 * Revision 1.5 2014/10/15 12:48:22 j_novak
47 * Corrected namespace declaration.
48 *
49 * Revision 1.4 2014/10/13 08:53:18 j_novak
50 * Lorene classes and functions now belong to the namespace Lorene.
51 *
52 * Revision 1.3 2014/10/06 15:18:47 j_novak
53 * Modified #include directives to use c++ syntax.
54 *
55 * Revision 1.2 2009/11/25 08:00:54 j_novak
56 * Removed a #pragma directive
57 *
58 * Revision 1.1 2004/12/21 17:06:01 j_novak
59 * Added all files for using fftw3.
60 *
61 * Revision 1.4 2003/01/31 10:31:24 e_gourgoulhon
62 * Suppressed the directive #include <malloc.h> for malloc is defined
63 * in <stdlib.h>
64 *
65 * Revision 1.3 2002/10/16 14:36:54 j_novak
66 * Reorganization of #include instructions of standard C++, in order to
67 * use experimental version 3 of gcc.
68 *
69 * Revision 1.2 2002/09/09 13:00:40 e_gourgoulhon
70 * Modification of declaration of Fortran 77 prototypes for
71 * a better portability (in particular on IBM AIX systems):
72 * All Fortran subroutine names are now written F77_* and are
73 * defined in the new file C++/Include/proto_f77.h.
74 *
75 * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon
76 * LORENE
77 *
78 * Revision 2.1 1999/11/24 16:21:27 eric
79 * Modif affichage.
80 *
81 * Revision 2.0 1999/02/22 15:38:52 hyc
82 * *** empty log message ***
83 *
84 *
85 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Coef/FFT991/facto_ini.C,v 1.6 2016/12/05 16:18:04 j_novak Exp $
86 *
87 */
88
89// headers du C
90#include <cmath>
91#include <cstdlib>
92
93// Prototypes of F77 subroutines
94#include "headcpp.h"
95#include "proto_f77.h"
96
97namespace Lorene {
98int *facto_ini( int n )
99{
100
101// Variables locales statiques
102// ---------------------------
103#define NMAX 30 /* Nombre maximun de dimensions differentes */
104static int *table_facto[NMAX] ; /* Tableau des pointeurs sur les tableaux */
105static int nwork = 0 ; /* Nombre de tableaux deja initialises */
106static int tbn[NMAX] ; /* Tableau des points deja initialises */
107static int trois = 3 ; // On aurait aime ecrire: "const int trois=3 ;"
108int indice ;
109
110{
111 // Ce nombre de points a-t-il deja ete utilise ?
112 int i ;
113 indice = -1 ;
114 for ( i=0 ; i < nwork ; i++ ) {
115 if ( tbn[i] == n ) indice = i ;
116 }
117
118// Initialisation si necessaire
119 if (indice == -1) { /* Il faut une nouvelle initialisation */
120 if ( nwork >= NMAX ) {
121 cout << "facto_ini : nwork >= NMAX !" << endl ;
122 abort() ;
123 }
124 indice = nwork ; nwork++ ; tbn[indice] = n ;
125
126 table_facto[indice] = (int *) malloc( sizeof(int) * 20 ) ;
127// table_facto[indice] = new int[20] ;
128 if ( table_facto[indice] == 0 ) {
129 cout << "facto_ini : malloc error !" << endl ;
130 abort() ;
131 }
132
133 F77_fax( table_facto[indice], &n, &trois ) ;
134 }
135
136} // Fin de zone critique
137
138 // Valeurs de retour
139 return table_facto[indice] ;
140
141}
142}
Lorene prototypes.
Definition app_hor.h:67