Changeset 32 in TRACY3 for trunk/tracy/tracy/src/t2ring.cc


Ignore:
Timestamp:
Apr 9, 2014, 3:50:11 PM (10 years ago)
Author:
zhangj
Message:

active the transport of the twiss functions and orbits of the transfer line.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tracy/tracy/src/t2ring.cc

    r11 r32  
    196196
    197197   Purpose:
    198      Computes Twiss parameters alpha and beta from the matrix Ascr
     198     Assign the Twiss parameters alpha and beta from the matrix Ascr
     199       to alpha & beta.
    199200       
    200201       M oneturn matrix    (A and M are symplectic)
     
    218219
    219220   Return:
    220        none
     221       alpha, beta.
    221222
    222223   Global variables:
     
    233234void getprm(Matrix &Ascr, Vector2 &alpha, Vector2 &beta)
    234235{
    235   int  i, j;
     236  int  i=0, j=0;
    236237
    237238  for (i = 1; i <= 2; i++) {
     
    253254       i0     first element
    254255       i1     last element
    255        ring   true if a ring
     256       ring   true if a ring, false is a transfer line
    256257       chroma true if compute chromaticities
    257258       dP     energy offset
     
    278279                  bool ring, double dP)
    279280{
    280   long int  i;
    281   int       j, k;
     281  long int  i=0L;
     282  int       j=0, k=0;
    282283  Vector2   nu1, dnu;
    283   Vector    xref;
    284   Matrix    Ascr0, Ascr1;
     284  Vector    xref;                   /*6*1 vector*/
     285  Matrix    Ascr0, Ascr1;           /*6*6 matrix*/
    285286  CellType  *cellp;
    286287
    287288  if (dP != globval.dPparticle) Cell_SetdP(dP);
    288289
    289   /* Init */ 
     290  /* Initize the phase */ 
    290291  for (j = 0; j <= 1; j++)
    291     nu1[j] = 0.0;
    292 
    293   /* get alpha beta for i0 */ 
     292    nu1[j] = 0.0;  /*phase advance*/
     293
     294  /* get alpha & beta for i0 */ 
    294295  cellp = &Cell[i0];
    295   getprm(Ascr, cellp->Alpha, cellp->Beta);
    296   memcpy(cellp->Nu, nu1, sizeof(Vector2));
     296  getprm(Ascr, cellp->Alpha, cellp->Beta);  /*initialize the alpha & beta functions */
     297  memcpy(cellp->Nu, nu1, sizeof(Vector2));  /*initialize the phase advance*/
    297298  CopyMat(n+1, Ascr, Ascr0); CopyVec(n+2L, globval.CODvect, xref);
    298299
     
    301302    /* Ascr1=Elem_M*Ascr0 */
    302303    /* xref =Elem(xref)   */
    303     Elem_Pass_M(i, xref, Ascr1);
     304    Elem_Pass_M(i, xref, Ascr1);   /* transport orbit & optic matrix */
    304305
    305306    cellp = &Cell[i];
    306307    /* get alpha and beta for element i */
    307308    getprm(Ascr1, cellp->Alpha, cellp->Beta);
     309    /*save the orbit at the end of the lattice elment*/
     310    CopyVec(ss_dim, xref,cellp->CODvect);
    308311
    309312    for (j = 0; j <= 1; j++) {
     
    861864                Vector2 &etap, Vector &codvect)
    862865{
    863   long i, j, lastpos;
    864   double sb;
    865   Matrix Ascr;
     866  long i=0L, j=0L, lastpos=0L;
     867  double sb=0.0;
     868  Matrix Ascr; /* 6*6 transfer matrix*/
    866869
    867870  UnitMat(6L, Ascr);
Note: See TracChangeset for help on using the changeset viewer.