Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef MAD_SEQ_H
0002 #define MAD_SEQ_H
0003 
0004 // types
0005 
0006 struct el_list;
0007 struct name_list;
0008 struct vector_list;
0009 struct constraint_list;
0010 struct node;
0011 struct node_list;
0012 struct expression;
0013 struct command;
0014 struct table;
0015 struct in_cmd;
0016 struct element;
0017 
0018 struct sequence
0019 {
0020   /* original sequence */
0021   char name[NAME_L];
0022   char export_name[NAME_L];
0023   char* refpos;                 /* reference position for insertion */
0024   char* next_sequ;              /* name of following sequence (only survey) */
0025   int ref_flag;                 /* -1 for exit, 0 for centre, 1 for entry */
0026   int share;                    /* 0 normal, 1 if shared */
0027   int nested;                   /* 0 flat, 1 if nested */
0028   int con_cnt;                  /* constraint counter */
0029   int stamp;
0030   int line;                     /* set to 1 if origin is a line */
0031   int add_pass;                 /* number of additional passes */
0032   int num_interp;               /* number of additonal rows in the twiss table */
0033   double length;                /* length as in declaration */
0034   struct expression* l_expr;    /* length expression as in declaration */
0035   struct node* start;           /* first node in sequence */
0036   struct node* end;             /* last node in sequence */
0037   struct node_list* nodes;      /* alphabetic list of nodes */
0038   struct el_list* cavities;     /* alphabetic list of cavities */
0039   struct el_list* crabcavities;     /* alphabetic list of crab cavities */
0040   struct command* beam;         /* pointer to beam attached */
0041   /* expanded sequence */
0042   int n_nodes;                  /* number of nodes when expanded */
0043   int start_node;               /* first node of current range in all_nodes */
0044   int pass_count;               /* number of executed passes */
0045   struct node* ex_start;        /* first node in expanded sequence */
0046   struct node* ex_end;          /* last node in expanded sequence */
0047   struct node* range_start;     /* first node of current range in sequence */
0048   struct node* range_end;       /* last node of current range in sequence */
0049   struct node** all_nodes;      /* sequential list of all nodes */
0050   struct node_list* ex_nodes;   /* alphabetic list of nodes (no drifts) */
0051   struct table* tw_table;       /* pointer to latest twiss table created */
0052   int           tw_valid;       /* true if current tw_table is valid */
0053   int           tw_centre;      /* true if twiss center option is triggered */        
0054   struct constraint_list* cl;   /* pointer to constraint list during match */
0055   struct vector_list* orbits;   /* pointer to list of stored orbits */
0056 };
0057 
0058 struct sequence_list /* contains list of sequence pointers sorted by name */
0059 {
0060   char name[NAME_L];
0061   int  max,                     /* max. pointer array size */
0062        curr;                    /* current occupation */
0063   struct name_list* list;       /* index list of names */
0064   struct sequence** sequs;      /* sequence pointer list */
0065   int stamp;
0066 };
0067 
0068 // interface
0069 
0070 struct node*     new_sequ_node(struct sequence*, int occ_cnt);
0071 struct sequence* new_sequence(const char* name, int ref);
0072 void             delete_sequence(struct sequence*);
0073 struct sequence_list* new_sequence_list(int length);
0074 struct sequence* find_sequence(const char* name, struct sequence_list*);
0075 
0076 void    use_sequ(struct in_cmd*);
0077 void    remove_from_sequ_list(struct sequence*, struct sequence_list*);
0078 double  sequence_length(struct sequence*);
0079 void    enter_sequence(struct in_cmd*);
0080 int     aperture_count(struct sequence*);
0081 void    enter_sequ_reference(struct in_cmd*, struct sequence*);
0082 void    exec_dumpsequ(struct in_cmd*);
0083 void    exec_save(struct in_cmd*);
0084 void    exec_extract(struct in_cmd*);
0085 void    expand_curr_sequ(int flag);
0086 void    add_to_sequ_list(struct sequence*, struct sequence_list*);
0087 void    reset_errors(struct sequence*);
0088 void    reset_sector(struct sequence*, int val);
0089 int     restart_sequ(void);
0090 void    seq_edit_main(struct in_cmd*);
0091 int     set_enable(const char* type, struct in_cmd*);
0092 void    set_sequence(char* name);
0093 int     set_cont_sequence(void);
0094 int     sequ_check_valid_twiss(struct sequence*);
0095 int     get_nnodes(void);
0096 int     get_ncavities(void);
0097 
0098 #endif // MAD_SEQ_H
0099