1 | /* Tracy-3 |
---|
2 | |
---|
3 | J. Bengtsson, BNL 2007 |
---|
4 | |
---|
5 | */ |
---|
6 | |
---|
7 | extern double cl_rad, q_fluct, I2, I4, I5; |
---|
8 | |
---|
9 | |
---|
10 | void getelem(long i, CellType *cellrec); |
---|
11 | |
---|
12 | void putelem(long i, CellType *cellrec); |
---|
13 | |
---|
14 | |
---|
15 | int GetnKid(const int Fnum1); |
---|
16 | |
---|
17 | long Elem_GetPos(const int Fnum1, const int Knum1); |
---|
18 | |
---|
19 | |
---|
20 | template<typename T> |
---|
21 | void GtoL(ss_vect<T> &X, Vector2 &S, Vector2 &R, |
---|
22 | const double c0, const double c1, const double s1); |
---|
23 | |
---|
24 | template<typename T> |
---|
25 | void LtoG(ss_vect<T> &X, Vector2 &S, Vector2 &R, |
---|
26 | double c0, double c1, double s1); |
---|
27 | |
---|
28 | template<typename T> |
---|
29 | void p_rot(double phi, ss_vect<T> &x); |
---|
30 | |
---|
31 | |
---|
32 | template<typename T> |
---|
33 | void get_B2(const double h_ref, const T B[], const ss_vect<T> &xp, |
---|
34 | T &B2_perp, T &B2_par); |
---|
35 | |
---|
36 | template<typename T> |
---|
37 | void radiate(ss_vect<T> &x, const double L, const double h_ref, const T B[]); |
---|
38 | |
---|
39 | template<typename T> |
---|
40 | void Drift(double L, ss_vect<T> &x); |
---|
41 | |
---|
42 | template<typename T> |
---|
43 | void bend_fringe(double hb, ss_vect<T> &x); |
---|
44 | |
---|
45 | template<typename T> |
---|
46 | static void EdgeFocus(double irho, double phi, double gap, ss_vect<T> &x); |
---|
47 | |
---|
48 | template<typename T> |
---|
49 | void quad_fringe(double b2, ss_vect<T> &x); |
---|
50 | |
---|
51 | |
---|
52 | template<typename T> |
---|
53 | void Drift_Pass(CellType &Cell, ss_vect<T> &x); |
---|
54 | |
---|
55 | template<typename T> |
---|
56 | void thin_kick(int Order, double MB[], double L, double h_bend, double h_ref, |
---|
57 | ss_vect<T> &x); |
---|
58 | |
---|
59 | template<typename T> |
---|
60 | void Mpole_Pass(CellType &Cell, ss_vect<T> &x); |
---|
61 | |
---|
62 | template<typename T> |
---|
63 | void Marker_Pass(CellType &Cell, ss_vect<T> &X); |
---|
64 | |
---|
65 | template<typename T> |
---|
66 | void Cav_Pass(CellType &Cell, ss_vect<T> &X); |
---|
67 | |
---|
68 | template<typename T> |
---|
69 | void Wiggler_pass_EF(const elemtype &elem, ss_vect<T> &x); |
---|
70 | |
---|
71 | template<typename T> |
---|
72 | void Wiggler_pass_EF2(int nstep, double L, double kxV, double kxH, double kz, |
---|
73 | double BoBrhoV, double BoBrhoH, double phi, |
---|
74 | ss_vect<T> &x); |
---|
75 | |
---|
76 | template<typename T> |
---|
77 | void Wiggler_pass_EF3(const elemtype &elem, ss_vect<T> &x); |
---|
78 | |
---|
79 | template<typename T> |
---|
80 | void Wiggler_Pass(CellType &Cell, ss_vect<T> &X); |
---|
81 | |
---|
82 | template<typename T> |
---|
83 | void FieldMap_Pass(CellType &Cell, ss_vect<T> &X); |
---|
84 | |
---|
85 | template<typename T> |
---|
86 | void Insertion_Pass(CellType &Cell, ss_vect<T> &x); |
---|
87 | |
---|
88 | template<typename T> |
---|
89 | void sol_pass(const elemtype &elem, ss_vect<T> &x); |
---|
90 | |
---|
91 | template<typename T> |
---|
92 | void Solenoid_Pass(CellType &Cell, ss_vect<T> &x); |
---|
93 | |
---|
94 | |
---|
95 | void Drift_SetMatrix(int Fnum1, int Knum1); |
---|
96 | |
---|
97 | void Insertion_SetMatrix(int Fnum1, int Knum1); |
---|
98 | |
---|
99 | |
---|
100 | void Mpole_SetPB(int Fnum1, int Knum1, int Order); |
---|
101 | |
---|
102 | void Wiggler_SetPB(int Fnum1, int Knum1, int Order); |
---|
103 | |
---|
104 | |
---|
105 | void GtoL_M(Matrix &X, Vector2 &T); |
---|
106 | |
---|
107 | void LtoG_M(Matrix &X, Vector2 &T); |
---|
108 | |
---|
109 | void Drift_Pass_M(CellType &Cell, Vector &xref, Matrix &X); |
---|
110 | |
---|
111 | void thin_kick_M(int Order, double MB[], double L, double irho, |
---|
112 | Vector &xref, Matrix &x); |
---|
113 | |
---|
114 | void Mpole_Pass_M(CellType &Cell, Vector &xref, Matrix &x); |
---|
115 | |
---|
116 | void Wiggler_Pass_M(CellType &Cell, Vector &xref, Matrix &x); |
---|
117 | |
---|
118 | void Insertion_Pass_M(CellType &Cell, Vector &xref, Matrix &M); |
---|
119 | |
---|
120 | |
---|
121 | void MulLsMat(Matrix &A, Matrix &B); |
---|
122 | |
---|
123 | void LinsTrans(Matrix &A, Vector &b); |
---|
124 | |
---|
125 | |
---|
126 | void Drift_Alloc(elemtype *Elem); |
---|
127 | |
---|
128 | void Mpole_Alloc(elemtype *Elem); |
---|
129 | |
---|
130 | void Cav_Alloc(elemtype *Elem); |
---|
131 | |
---|
132 | void Wiggler_Alloc(elemtype *Elem); |
---|
133 | |
---|
134 | void FieldMap_Alloc(elemtype *Elem, const bool alloc_fm); |
---|
135 | |
---|
136 | void Insertion_Alloc(elemtype *Elem); |
---|
137 | |
---|
138 | void Spreader_Alloc(elemtype *Elem); |
---|
139 | |
---|
140 | void Recombiner_Alloc(elemtype *Elem); |
---|
141 | |
---|
142 | void Solenoid_Alloc(elemtype *Elem); |
---|
143 | |
---|
144 | |
---|
145 | void SI_init(void); |
---|
146 | |
---|
147 | void Drift_Init(int Fnum1); |
---|
148 | |
---|
149 | void Mpole_Init(int Fnum1); |
---|
150 | |
---|
151 | void Wiggler_Init(int Fnum1); |
---|
152 | |
---|
153 | void FieldMap_Init(int Fnum1); |
---|
154 | |
---|
155 | void Cav_Init(int Fnum1); |
---|
156 | |
---|
157 | void Marker_Init(int Fnum1); |
---|
158 | |
---|
159 | void Insertion_Init(int Fnum1); |
---|
160 | |
---|
161 | void Spreader_Init(int Fnum1); |
---|
162 | |
---|
163 | void Recombiner_Init(int Fnum1); |
---|
164 | |
---|
165 | void Solenoid_Init(int Fnum1); |
---|
166 | |
---|
167 | |
---|
168 | void get_B(const char *file_name, FieldMapType *FM); |
---|
169 | |
---|
170 | double Elem_GetKval(int Fnum1, int Knum1, int Order); |
---|
171 | |
---|
172 | void Mpole_SetdS(int Fnum1, int Knum1); |
---|
173 | |
---|
174 | void Mpole_SetdT(int Fnum1, int Knum1); |
---|