[430] | 1 | #ifndef MAD_SEQ_H |
---|
| 2 | #define MAD_SEQ_H |
---|
| 3 | |
---|
| 4 | // types |
---|
| 5 | |
---|
| 6 | struct el_list; |
---|
| 7 | struct name_list; |
---|
| 8 | struct vector_list; |
---|
| 9 | struct constraint_list; |
---|
| 10 | struct node; |
---|
| 11 | struct node_list; |
---|
| 12 | struct expression; |
---|
| 13 | struct command; |
---|
| 14 | struct table; |
---|
| 15 | struct in_cmd; |
---|
| 16 | |
---|
| 17 | struct sequence |
---|
| 18 | { |
---|
| 19 | /* original sequence */ |
---|
| 20 | char name[NAME_L]; |
---|
| 21 | char export_name[NAME_L]; |
---|
| 22 | char* refpos; /* reference position for insertion */ |
---|
| 23 | char* next_sequ; /* name of following sequence (only survey) */ |
---|
| 24 | int ref_flag; /* -1 for exit, 0 for centre, 1 for entry */ |
---|
| 25 | int share; /* 0 normal, 1 if shared */ |
---|
| 26 | int nested; /* 0 flat, 1 if nested */ |
---|
| 27 | int con_cnt; /* constraint counter */ |
---|
| 28 | int stamp; |
---|
| 29 | int line; /* set to 1 if origin is a line */ |
---|
| 30 | int add_pass; /* number of additional passes */ |
---|
| 31 | double length; /* length as in declaration */ |
---|
| 32 | struct expression* l_expr; /* length expression as in declaration */ |
---|
| 33 | struct node* start; /* first node in sequence */ |
---|
| 34 | struct node* end; /* last node in sequence */ |
---|
| 35 | struct node_list* nodes; /* alphabetic list of nodes */ |
---|
| 36 | struct el_list* cavities; /* alphabetic list of cavities */ |
---|
| 37 | struct el_list* crabcavities; /* alphabetic list of crab cavities */ |
---|
| 38 | struct command* beam; /* pointer to beam attached */ |
---|
| 39 | /* expanded sequence */ |
---|
| 40 | int n_nodes; /* number of nodes when expanded */ |
---|
| 41 | int start_node; /* first node of current range in all_nodes */ |
---|
| 42 | int pass_count; /* number of executed passes */ |
---|
| 43 | struct node* ex_start; /* first node in expanded sequence */ |
---|
| 44 | struct node* ex_end; /* last node in expanded sequence */ |
---|
| 45 | struct node* range_start; /* first node of current range in sequence */ |
---|
| 46 | struct node* range_end; /* last node of current range in sequence */ |
---|
| 47 | struct node** all_nodes; /* sequential list of all nodes */ |
---|
| 48 | struct node_list* ex_nodes; /* alphabetic list of nodes (no drifts) */ |
---|
| 49 | struct table* tw_table; /* pointer to latest twiss table created */ |
---|
| 50 | int tw_valid; /* true if current tw_table is valid */ |
---|
| 51 | struct constraint_list* cl; /* pointer to constraint list during match */ |
---|
| 52 | struct vector_list* orbits; /* pointer to list of stored orbits */ |
---|
| 53 | }; |
---|
| 54 | |
---|
| 55 | struct sequence_list /* contains list of sequence pointers sorted by name */ |
---|
| 56 | { |
---|
| 57 | char name[NAME_L]; |
---|
| 58 | int max, /* max. pointer array size */ |
---|
| 59 | curr; /* current occupation */ |
---|
| 60 | struct name_list* list; /* index list of names */ |
---|
| 61 | struct sequence** sequs; /* sequence pointer list */ |
---|
| 62 | int stamp; |
---|
| 63 | }; |
---|
| 64 | |
---|
| 65 | // interface |
---|
| 66 | |
---|
| 67 | struct node* new_sequ_node(struct sequence*, int occ_cnt); |
---|
| 68 | struct sequence* new_sequence(char* name, int ref); |
---|
| 69 | struct sequence* delete_sequence(struct sequence*); |
---|
| 70 | struct sequence_list* new_sequence_list(int length); |
---|
| 71 | |
---|
| 72 | void use_sequ(struct in_cmd*); |
---|
| 73 | void remove_from_sequ_list(struct sequence*, struct sequence_list*); |
---|
| 74 | double sequence_length(struct sequence*); |
---|
| 75 | void enter_sequence(struct in_cmd*); |
---|
| 76 | int aperture_count(struct sequence*); |
---|
| 77 | void enter_sequ_reference(struct in_cmd*, struct sequence*); |
---|
| 78 | void exec_dumpsequ(struct in_cmd*); |
---|
| 79 | void exec_save(struct in_cmd*); |
---|
| 80 | void exec_extract(struct in_cmd*); |
---|
| 81 | void expand_curr_sequ(int flag); |
---|
| 82 | void add_to_sequ_list(struct sequence*, struct sequence_list*); |
---|
| 83 | void reset_errors(struct sequence*); |
---|
| 84 | void reset_sector(struct sequence*, int val); |
---|
| 85 | int restart_sequ(void); |
---|
| 86 | void seq_edit_main(struct in_cmd*); |
---|
| 87 | int set_enable(char* type, struct in_cmd*); |
---|
| 88 | void set_sequence(char* name); |
---|
| 89 | int set_cont_sequence(void); |
---|
| 90 | int sequ_check_valid_twiss(struct sequence*); |
---|
| 91 | |
---|
| 92 | #endif // MAD_SEQ_H |
---|
| 93 | |
---|