source: PSPA/madxPSPA/src/mad_node.h @ 430

Last change on this file since 430 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 4.3 KB
Line 
1#ifndef MAD_NODE_H
2#define MAD_NODE_H
3
4// types
5
6struct element;
7struct command;
8struct sequence;
9struct expression;
10struct constraint_list;
11struct double_array;
12struct name_list;
13
14struct 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
58struct 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
71struct node* new_node(char* name);
72struct node* clone_node(struct node*, int flag);
73struct node* delete_node(struct node*);
74struct node* expand_node(struct node*, struct sequence* top, struct sequence* seq, double position);
75void         dump_node(struct node*);
76int          advance_node(void);
77void         node_name(char* name, int* l);
78double       node_value(char* par);
79
80struct node_list* new_node_list(int length);
81struct node_list* delete_node_list(struct node_list*);
82struct node*      delete_node_ring(struct node*);
83//void              grow_node_list(struct node_list* p);
84void              add_to_node_list(struct node*, int inf, struct node_list*);
85
86double  get_node_pos(struct node*, struct sequence*); /* recursive */
87double  hidden_node_pos(char* name, struct sequence*);
88void    link_in_front(struct node*, struct node* el);
89void    resequence_nodes(struct sequence*);
90void    store_node_value(char* par, double* value);
91void    store_node_vector(char* par, int* length, double* vector);
92int     count_nodes(struct sequence*);
93void    current_node_name(char* name, int* lg);
94int     get_node_count(struct node*);
95double  line_nodes(struct char_p_array* flat);
96void    node_string(char* key, char* string, int* l);
97int     remove_one(struct node*);
98void    replace_one(struct node*, struct element*);
99int     retreat_node(void);
100void    set_node_bv(struct sequence*);
101void    set_new_position(struct sequence*);
102int     advance_to_pos(char* table, int* t_pos);
103
104#endif // MAD_NODE_H
105
Note: See TracBrowser for help on using the repository browser.