Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:03

0001 #ifndef MAD_ELEM_H
0002 #define MAD_ELEM_H
0003 
0004 // types
0005 enum en_apertype{circle, ellipse, rectangle, lhcscreen, rectcircle, rectellipse, racetrack, octagon, custom, notdefined, custom_inter};
0006 enum track_enums{non_existing, enum_other_bv, enum_lrad, enum_noise, enum_angle, enum_time_var};
0007 struct node;
0008 struct name_list;
0009 struct command;
0010 struct command_parameter;
0011 
0012 struct element  /* each element is unique */
0013 {
0014   char name[NAME_L];
0015   int def_type;                 /* 0 if defined separately,
0016                                    1 if inside sequence */
0017   int bv;                       /* bv: 0 false, 1 true (invert angle for
0018                                    sequence bv = -1) */
0019   double length;
0020   struct command* def;          /* pointer to defining command */
0021   struct element* parent;       /* pointer to parent of element */
0022                                 /* *this for base_type elements (rbend etc.) */
0023   int stamp;
0024   struct element* base_type;    /* pointer to base_type of element */
0025                                 /* *this for base_type elements (rbend etc.) */
0026 
0027   struct aperture* aper;
0028   double *tt_attrib;
0029   double *tt_closed_x;
0030   double *tt_closed_y;
0031   struct multipole* multip;
0032   int perm_misalign;
0033 };
0034 
0035 struct aperture
0036 {
0037   enum en_apertype apertype;
0038   double *aper_offset;
0039   double *aperture;
0040   double *xlist;
0041   double *ylist;
0042   int length;
0043   int custom_inter;
0044 };
0045 struct multipole
0046 {
0047   int nn;
0048   int ns;
0049   double *knl;
0050   double *ksl;
0051 };
0052 
0053 struct el_list /* contains list of element pointers sorted by name */
0054 {
0055   int stamp;
0056   char name[NAME_L];
0057   int  max,                     /* max. pointer array size */
0058        curr;                    /* current occupation */
0059   struct name_list* list;       /* index list of names */
0060   struct element** elem;        /* element pointer list */
0061 };
0062 
0063 // interface
0064 
0065 struct element* make_element(const char* name, const char* parent, struct command*, int flag);
0066 struct element* clone_element(struct element*);
0067 struct element* delete_element(struct element*);
0068 void            update_element(struct element*, struct command* update);
0069 void            update_element_children(struct element*, struct command* update);
0070 
0071 void            dump_element(struct element*);
0072 void            export_el_def(struct element*, char* string, int noexpr);
0073 void            export_el_def_8(struct element*, char* string);
0074 
0075 struct el_list* new_el_list(int length);
0076 struct el_list* delete_el_list(struct el_list*);
0077 struct element* find_element(const char* name, struct el_list*);
0078 void            write_elems(struct el_list*, struct command_list*, FILE*, int noexpr);
0079 void            write_elems_8(struct el_list*, struct command_list*, FILE*);
0080 
0081 struct node*    new_elem_node(struct element*, int occ_cnt);
0082 void            make_elem_node(struct element*, int occ_cnt);
0083 char*           compound(char* e_name, int occ_cnt);
0084 
0085 void    enter_element(struct in_cmd*);
0086 void    element_name(char* name, int* l);
0087 double  element_value(const struct node*, const char* par);
0088 int     element_vector(const struct element*, const char* par, double* vector);
0089 
0090 int     belongs_to_class(struct element*, const char*);
0091 void    get_node_vector(const char* par, int* length, double* vector);
0092 int     el_par_vector(int* total, double* vect);
0093 double  el_par_value(const char* par, const struct element*);
0094 double  el_par_value_recurse(const char* par, const struct element*);
0095 void    fill_elem_var_list(struct element*, struct el_list*, struct var_list*);
0096 void    add_to_el_list(struct element**, int inf, struct el_list*, int flag);
0097 void    grow_el_list(struct el_list*);
0098 
0099 void    set_aperture_element(struct element *el, struct command* def);
0100 int     is_custom_set(void);
0101 void    update_node_aperture(void);
0102 void    check_for_update_in_seq(struct element* el, struct command* update, int nupdates);
0103 int     check_for_perm_misalign(struct node*, struct in_cmd* cmd);
0104 // used by mad_mkthin.c
0105 struct command_parameter* return_param(const char* par, const struct element*);
0106 struct command_parameter* return_param_recurse(const char* par, const struct element*);
0107 
0108 #endif // MAD_ELEM_H
0109