1 | #ifndef MAD_NODE_H |
---|
2 | #define MAD_NODE_H |
---|
3 | |
---|
4 | // types |
---|
5 | |
---|
6 | struct element; |
---|
7 | struct command; |
---|
8 | struct sequence; |
---|
9 | struct expression; |
---|
10 | struct constraint_list; |
---|
11 | struct double_array; |
---|
12 | struct name_list; |
---|
13 | |
---|
14 | struct node /* the sequence is a linked list of nodes */ |
---|
15 | { |
---|
16 | char name[NAME_L]; |
---|
17 | char* base_name; /* basic type */ |
---|
18 | struct node* previous; |
---|
19 | struct node* next; |
---|
20 | int share; /* 0 normal, 1 if shared */ |
---|
21 | int occ_cnt; /* element occurrence count at node */ |
---|
22 | int obs_point; /* observation point number (tracking) */ |
---|
23 | int sel_err; /* error select flag */ |
---|
24 | int sel_sector; /* sectormap select flag */ |
---|
25 | int con_cnt; /* constraint counter */ |
---|
26 | int enable; /* flag for correctors and monitors: 0 off, 1 on */ |
---|
27 | int moved; /* temporary flag during sequence editing */ |
---|
28 | int stamp; |
---|
29 | double pass_flag; /* set to 1 at first pass of use-triggered survey */ |
---|
30 | double position; /* s position in sequence [m] */ |
---|
31 | double at_value; |
---|
32 | double length; |
---|
33 | double dipole_bv; /* +1 or -1 (if beam_bv AND element_bv) */ |
---|
34 | double other_bv; /* equal to beam_bv (+1 or -1) */ |
---|
35 | double chkick; /* calculated by orbit correction module */ |
---|
36 | double cvkick; /* calculated by orbit correction module */ |
---|
37 | double match_data[74]; /* array for fast access to twiss data for match */ |
---|
38 | double surv_data[7]; /* x,y,z,theta,phi,psi,s for use with survey */ |
---|
39 | struct expression* at_expr; |
---|
40 | char* from_name; |
---|
41 | struct element* p_elem; /* pointer to element if any */ |
---|
42 | struct sequence* p_sequ; /* pointer to sequence if any */ |
---|
43 | struct double_array* p_al_err; /* pointer to alignment error array */ |
---|
44 | struct double_array* p_fd_err; /* pointer to field error array */ |
---|
45 | struct command* savebeta; /* pointer to savebeta command if any */ |
---|
46 | struct constraint_list* cl; /* pointer to constraint list during match */ |
---|
47 | struct double_array* obs_orbit; /* for track observation point */ |
---|
48 | struct double_array* orbit_ref; /* for threader orbit + cum. matrix */ |
---|
49 | /* RF-Multipole errors (EFCOMP) */ |
---|
50 | struct double_array* p_ph_err; /* pointer to rf-multipole phase error array AL: */ |
---|
51 | /* RF-Multipoles */ |
---|
52 | double rfm_volt; /* volt of the main rf-multipole field AL: */ |
---|
53 | double rfm_freq; /* frequency of the rf-multipole fields AL: */ |
---|
54 | int rfm_harmon; /* harmonic number of the rf-multipole fields AL: */ |
---|
55 | double rfm_lag; /* lag of the rf-multipole fields AL: */ |
---|
56 | }; |
---|
57 | |
---|
58 | struct node_list /* contains list of node pointers sorted by name */ |
---|
59 | { |
---|
60 | int stamp; |
---|
61 | char name[NAME_L]; |
---|
62 | int max, /* max. pointer array size */ |
---|
63 | curr; /* current occupation */ |
---|
64 | struct name_list* list; /* index list of node (!) names */ |
---|
65 | /* node_name = el_name:occ_cnt */ |
---|
66 | struct node** nodes; /* node pointer list */ |
---|
67 | }; |
---|
68 | |
---|
69 | // interface |
---|
70 | |
---|
71 | struct node* new_node(char* name); |
---|
72 | struct node* clone_node(struct node*, int flag); |
---|
73 | struct node* delete_node(struct node*); |
---|
74 | struct node* expand_node(struct node*, struct sequence* top, struct sequence* seq, double position); |
---|
75 | void dump_node(struct node*); |
---|
76 | int advance_node(void); |
---|
77 | void node_name(char* name, int* l); |
---|
78 | double node_value(char* par); |
---|
79 | |
---|
80 | struct node_list* new_node_list(int length); |
---|
81 | struct node_list* delete_node_list(struct node_list*); |
---|
82 | struct node* delete_node_ring(struct node*); |
---|
83 | //void grow_node_list(struct node_list* p); |
---|
84 | void add_to_node_list(struct node*, int inf, struct node_list*); |
---|
85 | |
---|
86 | double get_node_pos(struct node*, struct sequence*); /* recursive */ |
---|
87 | double hidden_node_pos(char* name, struct sequence*); |
---|
88 | void link_in_front(struct node*, struct node* el); |
---|
89 | void resequence_nodes(struct sequence*); |
---|
90 | void store_node_value(char* par, double* value); |
---|
91 | void store_node_vector(char* par, int* length, double* vector); |
---|
92 | int count_nodes(struct sequence*); |
---|
93 | void current_node_name(char* name, int* lg); |
---|
94 | int get_node_count(struct node*); |
---|
95 | double line_nodes(struct char_p_array* flat); |
---|
96 | void node_string(char* key, char* string, int* l); |
---|
97 | int remove_one(struct node*); |
---|
98 | void replace_one(struct node*, struct element*); |
---|
99 | int retreat_node(void); |
---|
100 | void set_node_bv(struct sequence*); |
---|
101 | void set_new_position(struct sequence*); |
---|
102 | int advance_to_pos(char* table, int* t_pos); |
---|
103 | |
---|
104 | #endif // MAD_NODE_H |
---|
105 | |
---|