1 | #ifndef MAD_GVAR_H |
---|
2 | #define MAD_GVAR_H |
---|
3 | |
---|
4 | /* Temporary file: global variables |
---|
5 | these variables will be split over their respective modules... |
---|
6 | */ |
---|
7 | |
---|
8 | extern int debuglevel; |
---|
9 | |
---|
10 | /* Global structure variables by type (alphabetic) */ |
---|
11 | |
---|
12 | extern struct char_array* aux_buff; /* temporary buffer for many purposes */ |
---|
13 | extern struct char_array* c_dum; |
---|
14 | extern struct char_array* c_join; |
---|
15 | extern struct char_array* work; |
---|
16 | extern struct char_array* l_wrk; |
---|
17 | |
---|
18 | extern struct char_array_list* char_buff; /* buffer for all sorts of strings */ |
---|
19 | |
---|
20 | extern struct char_p_array* tmp_p_array; /* temporary buffer for splits */ |
---|
21 | extern struct char_p_array* tmp_l_array; /* temporary buffer for special commands */ |
---|
22 | extern struct char_p_array* line_buffer; /* buffer for line expansion */ |
---|
23 | |
---|
24 | extern struct command* current_beam; /* current reference beam */ |
---|
25 | extern struct command* probe_beam; /* current beam */ |
---|
26 | extern struct command* options; /* current options */ |
---|
27 | extern struct command* plot_options; /* current plot options */ |
---|
28 | extern struct command* current_error; /* current error command */ |
---|
29 | extern struct command* current_correct; /* current correct command */ |
---|
30 | extern struct command* current_ibs; /* current ibs command */ |
---|
31 | extern struct command* current_touschek;/* current touschek command */ |
---|
32 | extern struct command* current_survey; /* current survey command */ |
---|
33 | extern struct command* current_ptc; /* current ptc command */ |
---|
34 | extern struct command* current_twiss; /* current twiss command */ |
---|
35 | extern struct command* current_command; /* current command clone */ |
---|
36 | extern struct command* current_gweight; /* current gweight clone */ |
---|
37 | extern struct command* current_weight; /* current weight clone */ |
---|
38 | extern struct command* current_match; /* current match comm. */ |
---|
39 | extern struct command* current_eopt ; /* to keep eoption command */ |
---|
40 | extern struct command* threader_par ; /* threader parameters */ |
---|
41 | |
---|
42 | extern struct command_list* beam_list; /* list of all beam commands */ |
---|
43 | extern struct command_list* beta0_list; /* list of user defined beta0s */ |
---|
44 | extern struct command_list* defined_commands; /* from dictionary */ |
---|
45 | extern struct command_list* error_select; /* current error select commands */ |
---|
46 | extern struct command_list* optics_select; /* current optics select commands */ |
---|
47 | extern struct command_list* optics_list; /* list of optics command/sequence */ |
---|
48 | extern struct command_list* savebeta_list; |
---|
49 | extern struct command_list* seqedit_select; /* current seqedit select commands */ |
---|
50 | extern struct command_list* save_select; /* current save select commands */ |
---|
51 | extern struct command_list* slice_select; /* current slice select commands */ |
---|
52 | extern struct command_list* stored_commands; /* list of stored commands */ |
---|
53 | extern struct command_list* stored_match_var; /* list of match vary commands */ |
---|
54 | extern struct command_list* stored_track_start;/* list of track start commands */ |
---|
55 | extern struct command_list* sector_select; /* current sectormap select commands */ |
---|
56 | |
---|
57 | extern struct command_list_list* table_deselect; /* list of table deselect lists */ |
---|
58 | extern struct command_list_list* table_select; /* list of all table select lists */ |
---|
59 | |
---|
60 | extern struct constraint_list* comm_constraints; /* for each constraint command */ |
---|
61 | extern struct double_array* cat_doubles; /* Polish: constant values */ |
---|
62 | extern struct double_array* doubles; /* doubles buffer */ |
---|
63 | extern struct double_array* twiss_deltas; /* for deltap loop in twiss command */ |
---|
64 | extern struct double_array* vary_vect; /* for matching */ |
---|
65 | extern struct double_array* vary_dvect; /* for matching */ |
---|
66 | extern struct double_array* fun_vect; /* for matching */ |
---|
67 | extern struct double_array* match_work[MATCH_WORK];/* work space for matching */ |
---|
68 | |
---|
69 | extern struct el_list* drift_list; |
---|
70 | extern struct el_list* element_list; |
---|
71 | extern struct el_list* base_type_list; |
---|
72 | extern struct el_list* selected_elements; |
---|
73 | |
---|
74 | extern struct expression* backup_expr; |
---|
75 | |
---|
76 | extern struct in_buff_list* in; /* list of all active input buffers */ |
---|
77 | extern struct in_buff_list* pro; /* list of active processing buffers */ |
---|
78 | |
---|
79 | extern struct int_array* deco; /* Polish: coded expression */ |
---|
80 | extern struct int_array* cat; /* Polish: catgories */ |
---|
81 | extern struct int_array* d_var; /* Polish: variable references */ |
---|
82 | extern struct int_array* oper; /* Polish: operator references */ |
---|
83 | extern struct int_array* func; /* Polish: function references */ |
---|
84 | extern struct int_array* s_range; /* starts of ranges */ |
---|
85 | extern struct int_array* e_range; /* ends of ranges */ |
---|
86 | extern struct int_array* sd_range; /* starts of deselect ranges */ |
---|
87 | extern struct int_array* ed_range; /* ends of deselect ranges */ |
---|
88 | extern struct int_array* match_i_work[MATCH_WORK]; /* int work space for matching */ |
---|
89 | |
---|
90 | extern struct in_cmd* this_cmd; /* contains command just read */ |
---|
91 | extern struct in_cmd* local_twiss[2]; |
---|
92 | extern struct in_cmd* embedded_twiss_cmd; /* current plot command */ |
---|
93 | |
---|
94 | extern struct in_cmd_list* buffered_cmds; |
---|
95 | |
---|
96 | extern struct macro_list* line_list; |
---|
97 | extern struct macro_list* macro_list; |
---|
98 | |
---|
99 | extern struct name_list* expr_chunks; |
---|
100 | extern struct name_list* occ_list; |
---|
101 | extern struct name_list* sxf_list; |
---|
102 | |
---|
103 | extern struct node* prev_node; |
---|
104 | extern struct node* current_node; |
---|
105 | extern struct node* debug_node; |
---|
106 | |
---|
107 | extern struct node_list* selected_ranges; /* filled by some select commands */ |
---|
108 | extern struct node_list* sector_ranges; /* filled by the sectormap select command */ |
---|
109 | |
---|
110 | extern struct sequence* current_sequ; /* pointer to currently used sequence */ |
---|
111 | extern struct sequence* edit_sequ; /* pointer to sequence being edited */ |
---|
112 | |
---|
113 | extern struct sequence_list* sequences; /* pointer to sequence list */ |
---|
114 | extern struct sequence_list* match_sequs; /* pointer to sequence list for match */ |
---|
115 | |
---|
116 | extern struct table* aperture_table; /* current aperture table */ |
---|
117 | extern struct table* ibs_table; /* current ibs table */ |
---|
118 | extern struct table* touschek_table; /* current touschek table */ |
---|
119 | extern struct table* summ_table; /* current twiss summary table */ |
---|
120 | extern struct table* twiss_table; /* current twiss table */ |
---|
121 | extern struct table* twiss_table_beam1; /* current twiss table beam1 */ |
---|
122 | extern struct table* twiss_table_beam2; /* current twiss table beam2 */ |
---|
123 | extern struct table* twiss_sector_table; /* used for sectormap */ |
---|
124 | extern struct table* ptc_twiss_summary_table; /* holds summary data after one turn */ |
---|
125 | extern struct table* map_table; /* added for twiss_input_table */ |
---|
126 | extern struct table_list* table_register; |
---|
127 | extern struct table_list* moments_tables;/* tables for moments */ |
---|
128 | |
---|
129 | extern struct table* embedded_twiss_table;/* current twiss table */ |
---|
130 | extern struct table* normal_results; /* ptc table containing the selected high order functions (such as dx,qx,anhx etc.) */ |
---|
131 | |
---|
132 | extern struct table* errors_dipole; |
---|
133 | extern struct table* errors_field; |
---|
134 | extern struct table* errors_total; |
---|
135 | extern struct table* errors_read; /* table needed for IO of errors with PTC */ |
---|
136 | |
---|
137 | extern struct table* survey_table; /* current survey table */ |
---|
138 | extern struct table* corr_table; /* corrector table after orbit correction */ |
---|
139 | extern struct table* corr_table1; /* corrector table after orbit correction, beam 1 for two rings */ |
---|
140 | extern struct table* corr_table2; /* corrector table after orbit correction, beam 2 for two rings */ |
---|
141 | extern struct table* mon_table; /* monitor table after orbit correction */ |
---|
142 | extern struct table* orbit_table; /* orbit positions at monitors */ |
---|
143 | extern struct table* sodd_table_70; /* sodd output table detune_1_end */ |
---|
144 | extern struct table* sodd_table_71; /* sodd output table detune_1_all */ |
---|
145 | extern struct table* sodd_table_72; /* sodd output table detune_2_end */ |
---|
146 | extern struct table* sodd_table_73; /* sodd output table detune_2_all */ |
---|
147 | extern struct table* sodd_table_74; /* sodd output table distort_1_f_end */ |
---|
148 | extern struct table* sodd_table_75; /* sodd output table distort_1_h_end */ |
---|
149 | extern struct table* sodd_table_76; /* sodd output table distort_1_f_all */ |
---|
150 | extern struct table* sodd_table_77; /* sodd output table distort_1_h_all */ |
---|
151 | extern struct table* sodd_table_78; /* sodd output table distort_2_f_end */ |
---|
152 | extern struct table* sodd_table_79; /* sodd output table distort_2_h_end */ |
---|
153 | extern struct table* target_table; /* current target table */ |
---|
154 | extern struct table* model_table; /* current model table */ |
---|
155 | extern struct table* orbin_table; /* current orbit table */ |
---|
156 | |
---|
157 | |
---|
158 | extern struct table_list* optics_tables; /* contains optics tables from last twiss */ |
---|
159 | extern struct table_list* table_register; /* contains all tables */ |
---|
160 | |
---|
161 | extern struct table_list_list* all_table_lists; /* all table lists are entered here */ |
---|
162 | |
---|
163 | extern struct variable* current_variable; /* set by act_value (table access) */ |
---|
164 | extern struct var_list* variable_list; |
---|
165 | |
---|
166 | extern struct orb_cor* correct_orbit; /* information and links for orbit correction */ |
---|
167 | extern struct orb_cor2* correct_orbit1; /* information and links for orbit correction */ |
---|
168 | extern struct orb_cor2* correct_orbit2; /* information and links for orbit correction */ |
---|
169 | extern struct orb_cor2* correct_orbit12; /* information and links for orbit correction */ |
---|
170 | |
---|
171 | extern double corrl; /* global limit for orbit corrector strength */ |
---|
172 | |
---|
173 | extern struct table* efield_table; /* field errors in table form */ |
---|
174 | extern FILE* fddata; |
---|
175 | extern FILE* fcdata; |
---|
176 | extern FILE* ftdata; |
---|
177 | extern FILE* fgdata; |
---|
178 | |
---|
179 | extern struct char_p_array* sdds_pat; /* array for selected sdds patterns */ |
---|
180 | |
---|
181 | extern FILE* debug_file; /* for debug output */ |
---|
182 | extern FILE* stamp_file; /* for debug output */ |
---|
183 | extern FILE* out_file; /* for table output */ |
---|
184 | extern FILE* prt_file; /* for echo output */ |
---|
185 | extern FILE* sec_file; /* for sector output in "embedded" twiss */ |
---|
186 | extern FILE* tab_file; /* for table input */ |
---|
187 | |
---|
188 | /* Global simple variables by type */ |
---|
189 | |
---|
190 | extern char quote; /* current open single or double quote */ |
---|
191 | extern char int_format[20], /* current integer format */ |
---|
192 | float_format[20], /* current float format */ |
---|
193 | string_format[20]; /* current string format */ |
---|
194 | extern char var_form[1000]; /* buffer for the user-controlled formats */ |
---|
195 | extern char blank[]; |
---|
196 | extern char none[]; |
---|
197 | extern char one_string[]; |
---|
198 | extern char aptwfile[FNAME_L]; |
---|
199 | extern char* aux_char_pt; /* for debug purposes */ |
---|
200 | extern char* exx; |
---|
201 | extern char* current_link_group; |
---|
202 | extern char* current_range; /* currently used range, or NULL */ |
---|
203 | extern char* title; |
---|
204 | extern char* match_seqs[2]; |
---|
205 | extern char* match_beta[2]; |
---|
206 | extern char* match_range[2]; |
---|
207 | extern char* track_filename; /* track module file name start */ |
---|
208 | extern char* track_fileext; /* track module file name extension */ |
---|
209 | extern char track_plot_filename[NAME_L];/* plot module: output postscript file name in track mode */ |
---|
210 | |
---|
211 | extern double pi, twopi, degrad, raddeg, e, clight, hbar; |
---|
212 | extern double penalty; |
---|
213 | extern double match_tol; |
---|
214 | extern double orbit0[6]; |
---|
215 | extern double disp0[6]; |
---|
216 | extern double sxf_suml; |
---|
217 | extern double track_deltap; |
---|
218 | extern double oneturnmat[36]; |
---|
219 | extern double fintx_plot; /* to save the value of fintx for the reset_interpolation routine */ |
---|
220 | |
---|
221 | extern const double zero; |
---|
222 | extern const double one; |
---|
223 | extern const double two; |
---|
224 | extern const double ten_p_3; |
---|
225 | extern const double ten_p_6; |
---|
226 | extern const double ten_p_9; |
---|
227 | extern const double ten_p_12; |
---|
228 | extern const double ten_m_3; |
---|
229 | extern const double ten_m_6; |
---|
230 | extern const double ten_m_9; |
---|
231 | extern const double ten_m_12; |
---|
232 | extern const double ten_m_15; |
---|
233 | extern const double ten_m_16; |
---|
234 | extern const double ten_m_19; |
---|
235 | |
---|
236 | extern int add_error_opt; /* ADD error option, set with eoption */ |
---|
237 | extern int backup_type; |
---|
238 | |
---|
239 | extern int embedded_flag; /* flag (= 1 when entering routine pro_embedded_twiss, 0 at exit) */ |
---|
240 | extern int min_order; /* minimum required order */ |
---|
241 | extern int print_correct_opt; /* PRINT options for orbit correction */ |
---|
242 | extern int debug_correct_opt; /* DEBUG options for orbit correction */ |
---|
243 | extern int assign_start; /* flag for multiple assign statements */ |
---|
244 | extern int aux_count; /* for debug purposes */ |
---|
245 | extern int beam_info; /* flag to print beam information once */ |
---|
246 | extern int c_range_end; /* node count of current range end */ |
---|
247 | extern int c_range_start; /* node count of current range start */ |
---|
248 | extern int curr_obs_points; /* current number of observation points */ |
---|
249 | extern int current_calls; /* call counter in match */ |
---|
250 | extern int current_call_lim; /* current call limit in match */ |
---|
251 | extern int current_const; /* current constraint number in match */ |
---|
252 | extern int default_beam_saved; /* flag to avoid multiple save of default beam */ |
---|
253 | extern int edit_is_on; /* != 0 if inside current sequence edit */ |
---|
254 | extern int final_message; /* set to 1 when end message written */ |
---|
255 | extern int group_is_on; /* true when inside group */ |
---|
256 | extern int guess_flag; /* != 0 if coguess read */ |
---|
257 | extern int in_stop; /* input buffer stop flag */ |
---|
258 | extern int inbuf_level; /* input buffer level */ |
---|
259 | extern int init_warn; /* intialisation warning level */ |
---|
260 | extern int interactive; /* non-zero if interactive */ |
---|
261 | extern int irn_rand[NR_RAND]; /* for random generator */ |
---|
262 | extern int keep_tw_print; /* previous twiss print flag (match) */ |
---|
263 | extern int loop_cnt; /* used to detect infinite loops */ |
---|
264 | extern int match_calls; /* command call limit in match */ |
---|
265 | extern int match_is_on; /* true when inside match command */ |
---|
266 | extern int match_num_beta; |
---|
267 | extern int match_num_range; |
---|
268 | extern int match_num_seqs; |
---|
269 | extern int mig_strategy; /* migrad strategy (match) */ |
---|
270 | extern int jac_strategy; /* jacobian strategy (match) */ |
---|
271 | extern int jac_repeat; /* jacobian repeat (match) */ |
---|
272 | extern double jac_cool; /* jacobian cool factor (match) */ |
---|
273 | extern double jac_balance; /* jacobian balance cool factor (match) */ |
---|
274 | extern double jac_random; /* jacobian random factor (match) */ |
---|
275 | extern int jac_bisec; /* jacobian bisec factor (match) */ |
---|
276 | extern double jac_cond; /* jacobian svd cond. num (match) */ |
---|
277 | extern int new_name_count; /* to make internal names */ |
---|
278 | extern int next_rand; /* for random generator */ |
---|
279 | extern int plots_made; /* set to 1 if plots are made */ |
---|
280 | extern int polish_cnt; /* used to detect infinite loops */ |
---|
281 | extern int print_match_summary; /* activate the print option in the |
---|
282 | 'mtgeti' and 'collect' routines (mtgeti->mtgetc) */ |
---|
283 | extern int quote_toggle; /* for quote strings on input */ |
---|
284 | extern int return_flag; /* 1 when "return" read */ |
---|
285 | extern int scrap_count; /* running counter to make things unique */ |
---|
286 | extern int seqedit_install; /* counter for seqedit installs */ |
---|
287 | extern int seqedit_move; /* counter for seqedit moves */ |
---|
288 | extern int seqedit_remove; /* counter for seqedit removes */ |
---|
289 | extern int sequ_is_on; /* != 0 if inside current sequence decl. */ |
---|
290 | extern int stamp_flag; /* checks for extern double delete when != 0 */ |
---|
291 | extern int start_cnt; /* counter for start commands */ |
---|
292 | extern int start_var; /* start of variables after predefined constants */ |
---|
293 | extern int total_const; /* total no. of constraints in match */ |
---|
294 | extern int total_vars; /* total no. of variables in match */ |
---|
295 | extern int track_is_on; /* true when inside track command */ |
---|
296 | extern int track_start_cnt; /* counter for track start commands */ |
---|
297 | extern int twiss_success; /* set by twiss module to 1 if OK */ |
---|
298 | extern int use_count; /* incremented by 1 every time use is executed */ |
---|
299 | extern int vary_cnt; /* counter for vary commands */ |
---|
300 | extern int watch_flag; /* produces debug output when != 0 */ |
---|
301 | |
---|
302 | extern int na_err, /* current no. of alignment errors */ |
---|
303 | nf_err, /* current no. of field errors */ |
---|
304 | indent, /* current indentation count */ |
---|
305 | b_level, /* current brace level */ |
---|
306 | sxf_elem_cnt, /* element count */ |
---|
307 | tag_flag, /* if > 0, tag = parent name written */ |
---|
308 | tag_cnt, /* if > 0, tag = specified type code |
---|
309 | written for selected types only */ |
---|
310 | sxf_align_cnt, /* element with align errors count */ |
---|
311 | sxf_field_cnt, /* element with field errors count */ |
---|
312 | stop_flag, /* 1 if stop condition */ |
---|
313 | occnt_add, /* flag for element name modification */ |
---|
314 | b_indent[100], /* list of indents */ |
---|
315 | add_indent[]; |
---|
316 | |
---|
317 | extern double |
---|
318 | guess_orbit[6], |
---|
319 | al_errors[ALIGN_MAX], |
---|
320 | fd_errors[FIELD_MAX]; |
---|
321 | |
---|
322 | extern char |
---|
323 | line[MADX_LINE_MAX], |
---|
324 | tag_type[MAX_TAG][16], |
---|
325 | tag_code[MAX_TAG][16]; |
---|
326 | |
---|
327 | time_t last_time, |
---|
328 | start_time; |
---|
329 | |
---|
330 | extern char filenames[100][500]; |
---|
331 | extern int currentline[100]; |
---|
332 | |
---|
333 | extern double** trackstrarpositions; /* two dimensional array with track positions*/ |
---|
334 | |
---|
335 | #endif // MAD_STR_H |
---|
336 | |
---|
337 | |
---|