source: TRACY3/branches/tracy3-3.10.1b/tracy/tracy/src/tracy.cc @ 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: 6.6 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#include "tracy_lib.h"
12
13#include "field.cc"
14
15#if ORDER == 1
16// linear TPSA
17#include "tpsa_lin.cc"
18#include "tpsa_lin_pm.cc"
19#else
20// interface to M. Berz' TPSA
21#include "tpsa_for_pm.cc"
22#endif
23
24#include "mathlib.cc"
25
26#include "ety.cc"
27#include "eigenv.cc"
28
29#include "t2lat.cc"
30#include "t2elem.cc"
31#include "t2cell.cc"
32#include "t2ring.cc"
33
34#include "pascalio.cc"
35
36#include "lsoc.cc" //for COD correction
37#include "prtmfile.cc"
38#include "rdmfile.cc"
39
40#include "fft.cc"
41
42#include "physlib.cc"
43
44#include "naffutils.cc"
45
46#include "modnaff.cc"
47#include "radia2tracy.cc"
48#include "soleillib.cc"
49
50#include "nsls-ii_lib.cc"
51
52/* new added since 2010 at soleil */
53#include "max4_lib.cc"
54#include "soleilcommon.cc"
55#include "read_script.cc"
56
57// Truncated Power Series Algebra (TPSA)
58const int nv_tps = ss_dim, // no of variables
59    nd_tps = 3, // no of degrees of freedom
60    ndpt_tps = 5, // index for delta, 0 for 6-D dynamics
61    iref_tps = 0; /* file with resonances to be excluded from
62 the map normal form: fort.7 */
63double eps_tps = 1e-25; // floating point truncation
64
65
66// instantiate templates
67
68template class ss_vect<double> ;
69
70template class ss_vect<tps> ;
71
72template void GtoL(ss_vect<double> &, Vector2 &, Vector2 &, const double,
73    const double, const double);
74
75template void GtoL(ss_vect<tps> &, Vector2 &, Vector2 &, const double,
76    const double, const double);
77
78template void
79    LtoG(ss_vect<tps> &, Vector2 &, Vector2 &, double, double, double);
80
81template void LtoG(ss_vect<double> &, Vector2 &, Vector2 &, double, double,
82    double);
83
84template void p_rot(double, ss_vect<double> &);
85
86template void p_rot(double, ss_vect<tps> &);
87
88template void get_B2(const double, const double[], const ss_vect<double> &,
89    double &, double &);
90
91template void get_B2(const double, const tps[], const ss_vect<tps> &, tps &,
92    tps &);
93
94template void radiate(ss_vect<double> &, const double, const double,
95    const double[]);
96
97template void radiate(ss_vect<tps> &, const double, const double, const tps[]);
98
99template void Drift(double, ss_vect<double> &);
100
101template void Drift(double, ss_vect<tps> &);
102
103template void bend_fringe(double, ss_vect<double> &);
104
105template void bend_fringe(double, ss_vect<tps> &);
106
107template static void EdgeFocus(double, double, double, ss_vect<double> &);
108
109template static void EdgeFocus(double, double, double, ss_vect<tps> &);
110
111template void quad_fringe(double, ss_vect<double> &);
112
113template void quad_fringe(double, ss_vect<tps> &);
114
115template void Drift_Pass(CellType &, ss_vect<double> &);
116
117template void Drift_Pass(CellType &, ss_vect<tps> &);
118
119template void thin_kick(int, double[], double, double, double,
120    ss_vect<double> &);
121
122template void thin_kick(int, double[], double, double, double, ss_vect<tps> &);
123
124template void Mpole_Pass(CellType &, ss_vect<double> &);
125
126template void Mpole_Pass(CellType &, ss_vect<tps> &);
127
128template void Marker_Pass(CellType &, ss_vect<double> &);
129
130template void Marker_Pass(CellType &, ss_vect<tps> &);
131
132template void Cav_Pass(CellType &, ss_vect<double> &);
133
134template void Cav_Pass(CellType &, ss_vect<tps> &);
135
136template void Wiggler_pass_EF(const elemtype &elem, ss_vect<double> &x);
137
138template void Wiggler_pass_EF(const elemtype &elem, ss_vect<tps> &x);
139
140template void Wiggler_pass_EF2(int nstep, double L, double kxV, double kxH,
141    double kz, double BoBrhoV, double BoBrhoH, double phi, ss_vect<double> &x);
142
143template void Wiggler_pass_EF2(int nstep, double L, double kxV, double kxH,
144    double kz, double BoBrhoV, double BoBrhoH, double phi, ss_vect<tps> &x);
145
146template void Wiggler_pass_EF3(const elemtype &elem, ss_vect<double> &x);
147
148template void Wiggler_pass_EF3(const elemtype &elem, ss_vect<tps> &x);
149
150template void Wiggler_Pass(CellType &, ss_vect<double> &);
151
152template void Wiggler_Pass(CellType &, ss_vect<tps> &);
153
154template void FieldMap_Pass(CellType &, ss_vect<double> &);
155
156template void FieldMap_Pass(CellType &, ss_vect<tps> &);
157
158template void sol_pass(const elemtype &, ss_vect<double> &);
159
160template void sol_pass(const elemtype &, ss_vect<tps> &);
161
162template void Solenoid_Pass(CellType &, ss_vect<double> &);
163
164template void Solenoid_Pass(CellType &, ss_vect<tps> &);
165
166template void LinearInterpolation2(double &, double &, double &, double &,
167    CellType &, bool &, int);
168
169template void LinearInterpolation2(tps &, tps &, tps &, tps &, CellType &,
170    bool &, int);
171
172template void SplineInterpolation2(double &, double &, double &, double &,
173    CellType &, bool &, int);
174
175template void SplineInterpolation2(tps &, tps &, tps &, tps &, CellType &,
176    bool &, int);
177
178template void spline(const double[], const double[], int const, double const,
179    const double, double[]);
180
181template void spline(const double[], const tps[], int const, double const,
182    const double, tps[]);
183
184template void splint(const double[], const double[], const double[], const int,
185    const double &, double &);
186
187template void splint(const double[], const double[], const double[], const int,
188    const tps &, tps &);
189
190template void splint(const double[], const tps[], const tps[], const int,
191    const tps &, tps &);
192
193template void splin2(const double[], const double[], double **, double **,
194    const int, const int, const double &, const double &, double &);
195
196template void splin2(const double[], const double[], double **, double **,
197    const int, const int, const tps &, const tps &, tps &);
198
199template void Insertion_Pass(CellType &, ss_vect<double> &);
200
201template void Insertion_Pass(CellType &, ss_vect<tps> &);
202
203template void Elem_Pass(const long, ss_vect<double> &);
204
205template void Elem_Pass(const long, ss_vect<tps> &);
206
207template void Cell_Pass(const long, const long, ss_vect<double> &, long &);
208
209template void Cell_Pass(const long, const long, ss_vect<tps> &, long &);
210
211/* Global variable used through the code */
212globvalrec globval;
213
214statusrec status;
215bool trace, traceID;
216bool cellconcat;
217
218/* Random stuff */
219long rseed0, rseed;
220double normcut_;
221
222double d_sign(double a, double b) {
223  double x;
224
225  x = (a >= 0 ? a : -a);
226  return (b >= 0 ? x : -x);
227}
228
229int P_eof(FILE *f) {
230  register int ch;
231
232  if (feof(f))
233    return 1;
234  if (f == stdin)
235    return 0; /* not safe to look-ahead on the keyboard! */
236  ch = getc(f);
237  if (ch == EOF)
238    return 1;
239  ungetc(ch, f);
240
241  return 0;
242}
243
244/* Check if at end of line (or end of entire file). */
245
246int P_eoln(FILE *f) {
247  register int ch;
248
249  ch = getc(f);
250  if (ch == EOF)
251    return 1;
252  ungetc(ch, f);
253  return (ch == '\n');
254}
Note: See TracBrowser for help on using the repository browser.