source: TRACY3/branches/tracy3-3.10.1b/tracy/tracy/inc/tracy.h @ 23

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

Clean version of Tracy: SoleilVersion at the end of 2011.Use this clean version to find the correct dipole fringe field to have the correct FMAP and FMAPDP of ThomX. Modified files: tpsa_lin.cc, soleillib.cc, prtmfile.cc, rdmfile.cc, read_script.cc, physlib.cc, tracy.cc, t2lat.cc, t2elem.cc, naffutils.cc in /tracy/tracy/src folder; naffutils.h, tracy_global.h, physlib.h, tracy.h, read_script.h, solielilib.h, t2elem.h in /tracy/tracy.inc folder; soltracy.cc in tracy/tools folder

  • Property svn:executable set to *
File size: 4.3 KB
Line 
1/* Tracy-2
2
3   J. Bengtsson, CBP, LBL      1990 - 1994   Pascal version
4                 SLS, PSI      1995 - 1997
5   M. Boege      SLS, PSI      1998          C translation
6   L. Nadolski   SOLEIL        2002          Link to NAFF, Radia field maps
7   J. Bengtsson  NSLS-II, BNL  2004 -       
8
9*/
10
11// Intel compiler
12#ifndef __APPLE_CC__
13#pragma warning (disable:193)
14#pragma warning (disable:981)
15#pragma warning (disable:1572)
16#endif
17// LSN
18
19#define DOF    (ss_dim/2)
20
21// defined in math.h
22//#define M_PI   3.14159265358979323846  // pi
23
24#ifndef LONG_MAX
25# define LONG_MAX   ((long)(((unsigned long) -1) >> 1))
26# define LONG_MIN   (~LONG_MAX)
27#endif
28
29#define debug           false
30
31#define S_SIZE 200  // max size for file name of a lattice file
32
33#define nv_             6
34
35#define mnp             400
36
37// maximum number of LEGO blocks (Cell_nLoc)
38#define Cell_nLocMax    8000
39
40// maximum number of families for Elem_NFam
41#define Elem_nFamMax    3000
42
43// maximum number of kids */
44#define nKidMax         1000
45
46#define DBNameLen       39
47
48#define NameLength      150  // maximum length of identifiers
49#define SymbolLength    15   // maximum length of element name
50
51#define blankname       "               "
52
53#define maxincl         5
54#define maxfil          10
55#define bigvectmax      4096
56
57#define HOMmax          30
58
59#define maxtransfmat    2000
60#define maxkicks        5
61
62
63const double  c0    = 2.99792458e8;             // speed of light in vacuum
64const double  q_e   = 1.60217733e-19;                // electron charge
65const double  m_e   = 0.51099906e6;             // electron rest mass [eV]
66const double  mu_0  = 4.0*M_PI*1e-7;            // permittivity of free space
67const double  eps_0 = 1.0/(sqr(c0)*mu_0);       // permeability of free space
68const double  r_e   = q_e/(4.0*M_PI*eps_0*m_e); // classical electron radius
69const double  h_bar = 6.58211899e-16;           // reduced Planck constant [eV]
70
71// const double  max_ampl = 10.0; // [m]   nsrl-ii
72const double  max_ampl = 1.0; // [m]    soleil
73
74
75enum pthicktype { thick = 0, thin = 1 };
76
77enum PartsKind { drift = 0, Wigl = 1, Mpole = 2, Cavity = 3, marker = 4,
78                 undef = 5, Insertion = 6, FieldMap = 7,
79                 Spreader = 8, Recombiner = 9, Solenoid = 10 };
80
81enum { All = 0, Dip = 1, Quad = 2, Sext = 3, Oct = 4, Dec = 5, Dodec = 6 };
82
83enum { Horizontal = 1, Vertical = 2 };
84
85enum { Meth_Linear = 0, Meth_First = 1, Meth_Second = 2, Meth_Fourth = 4,
86       Meth_genfun = 5 };
87
88typedef double svdarray[mnp];
89typedef double svdmat[mnp][mnp];
90
91typedef char str80[80];
92
93typedef char alfa_[NameLength];
94
95typedef long   iVector2[2];
96typedef double Vector2[2];
97typedef double Vector3[3];
98
99#define fitvectmax      200
100typedef long   fitvect[fitvectmax];
101
102typedef char partsName[NameLength];
103
104typedef char DBNameType[DBNameLen];
105
106typedef double mpolArray[HOMmax+HOMmax+1];
107
108
109typedef struct statusrec{
110  bool tuneflag, chromflag, codflag, mapflag, passflag, overflag, chambre;
111  int lossplane; /* lost in: horizontal    1
112                                     vertical      2
113                                         longitudinal  3 */
114} statusrec;
115
116
117extern bool  stable;
118extern bool  ErrFlag;
119extern bool  trace, cellconcat, traceID;
120
121extern double  Fdrift1, Fkick1, Fdrift2, Fkick2, crad, cfluc;
122
123extern str80  finame,   /* input  data file  */
124              foname,   /* output data file */
125              fname;    /* temp file name */
126
127extern FILE  *fi,       /* lattice input  file  */
128             *fo,       /* lattice output file */
129             *psin[],   /* program input file */
130             *psout,              /* program output file*/
131             *prr[];   /* prr[1] : input, prr[2] : output */
132
133extern statusrec status;
134
135
136extern int P_eof(FILE *f);
137
138extern int P_eoln(FILE *f);
139
140extern void GDiag(int n, double C, Matrix &A, Matrix &Ainv, Matrix &R,
141                  Matrix &M, double &Omega, double &Yalphac);
142extern void NormEigenVec(Matrix &Vr, Matrix &Vi, double *wr, double *wi,
143                         Matrix &t6a);
144
145extern void EigenVal(double (*Ai)[mnp], long n, double *wr, double *wi);
146
147extern void t2init(void);
148
149/****** for orbit correction *********/
150extern void prt_gcmat(int bpm, int corr, int plane);
151
152extern void gcmat(int bpm, int corr, int plane);
153
154extern void lsoc(int niter, int bpm, int corr, int plane);
155
156
157/**** same as asctime in C without the \n at the end****/
158char *asctime2(const struct tm *timeptr);
159struct tm* GetTime(void);
160uint32_t stampstop(uint32_t start);
161uint32_t stampstart(void);
Note: See TracBrowser for help on using the repository browser.