source: MML/trunk/machine/SOLEIL/common/naff/nafflib/modnaff.h

Last change on this file was 17, checked in by zhangj, 10 years ago

To have a stable version on the server.

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#include <stdio.h>
2/*#include <malloc.h>*/
3#include <math.h>
4#include <float.h>
5#include <stdlib.h>
6
7/*--------*/
8/* define */
9/*--------*/
10#define BOOL int
11#define FALSE 0
12#define TRUE  1
13#define Myyerror printf
14#define MAX(x,y) ((x)<(y)?(y):(x))
15
16
17/*#ifdef FUNCINLINEEXTERN_MUSTBEINLIB*/
18#define INLINE_EXTERN static inline
19/*#else
20#define INLINE_EXTERN inline extern
21#endif *//*FUNCINLINEEXTERN_MUSTBEINLIB*/
22
23 
24/*---------------------*/
25/*routine d'allocation */
26/*---------------------*/
27#define SYSCHECKMALLOCSIZE(variable, type, size) \
28  if ((variable=(type*)malloc(sizeof(type)*(size)))==NULL)\
29  { printf("error : malloc failed!\n"); exit(1);}
30
31#define SYSCHECKMALLOC(variable, type) \
32  if ((variable=(type*)malloc(sizeof(type)))==NULL)\
33  { printf("error : malloc failed!\n"); exit(1);}
34
35#define DIM2(prow,row,col,type,l) \
36  {\
37  register type *pdata;\
38  int I;\
39  SYSCHECKMALLOCSIZE(pdata, type,(row) * (col));\
40  SYSCHECKMALLOCSIZE(prow, type *,(row));\
41  for (I = 0; I < (row); I++)\
42     {\
43     prow[I] = pdata;\
44     pdata += col;\
45     }\
46  }
47
48#define SYSFREE(variable) free(variable)
49#define HFREE2(variable) {SYSFREE(*variable); SYSFREE(variable);}
50
51/*---------*/
52/*structure*/
53/*--------*/
54struct complexe {
55                double reel,imag;
56                };
57typedef struct complexe t_complexe;
58
59/* v0.96 M. GASTINEAU 18/12/98 : ajout */
60/*liste des frequences pour NAF */
61struct list_fenetre_naf
62{
63 double                   dFreqMin; /* frequence minimale */
64 double                   dFreqMax; /* frequence maximale */
65 int                      iNbTerme; /* nombre de termes a rechercher */
66 struct list_fenetre_naf *suivant; /*fenetre suivante */
67};
68/* v0.96 M. GASTINEAU 18/12/98 : fin ajout */
69
70typedef struct list_fenetre_naf t_list_fenetre_naf; /* v0.96 M. GASTINEAU 18/12/98 : ajout */   
71
72/*v0.96 M. GASTINEAU 04/09/98 : ajout pour la gestion de naf */
73/* pour le role de ces champs, cf. modnaff.c */
74struct stnaf
75{
76 /*champ utilise par modnaff.c */
77 FILE *NFPRT;
78 double EPSM; 
79 int NTERM,KTABS,NFS;
80 int ICPLX,IW,ISEC;
81 int NERROR,IPRT;
82
83 double *TFS;
84 t_complexe *ZAMP;
85 t_complexe **ZALP; /*tableau a deux dimensions*/
86 t_complexe *ZTABS;
87
88 double DTOUR,UNIANG,FREFON;
89 double XH,T0;
90 
91 /*autre champ utilise en tant que flag */
92 double m_dneps; /*equivaut a DNEPS */
93 int m_iNbLineToIgnore; /*nombre de lignes a ignorer en debut du fichier des solutions */
94 BOOL m_bFSTAB; /*=TRUE => sauve le tableau ZTABS.*/
95 /* v0.96 M. GASTINEAU 06/01/99 : ajout */
96 t_list_fenetre_naf *m_pListFen; /*liste des fenetres */
97 /* v0.96 M. GASTINEAU 06/01/99 : fin ajout */
98};
99
100typedef struct stnaf t_naf;
101/*v0.96 M. GASTINEAU 04/09/98 : fin ajout */
102
103
104/*-----------------*/
105/*variable globale */
106/*-----------------*/
107extern t_naf g_NAFVariable;
108extern double pi;
109
110
111/*-----------------*/
112/* public functions*/
113/*-----------------*/
114void naf_initnaf_notab();
115void naf_cleannaf_notab();
116void naf_initnaf();
117void naf_cleannaf();
118BOOL naf_mftnaf(int NBTERM, double EPS);
119void naf_prtabs(int KTABS, t_complexe *ZTABS, int IPAS);
Note: See TracBrowser for help on using the repository browser.