Changeset 32 in TRACY3 for trunk/tracy/tracy/src/t2ring.cc
- Timestamp:
- Apr 9, 2014, 3:50:11 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tracy/tracy/src/t2ring.cc
r11 r32 196 196 197 197 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. 199 200 200 201 M oneturn matrix (A and M are symplectic) … … 218 219 219 220 Return: 220 none221 alpha, beta. 221 222 222 223 Global variables: … … 233 234 void getprm(Matrix &Ascr, Vector2 &alpha, Vector2 &beta) 234 235 { 235 int i , j;236 int i=0, j=0; 236 237 237 238 for (i = 1; i <= 2; i++) { … … 253 254 i0 first element 254 255 i1 last element 255 ring true if a ring 256 ring true if a ring, false is a transfer line 256 257 chroma true if compute chromaticities 257 258 dP energy offset … … 278 279 bool ring, double dP) 279 280 { 280 long int i ;281 int j , k;281 long int i=0L; 282 int j=0, k=0; 282 283 Vector2 nu1, dnu; 283 Vector xref; 284 Matrix Ascr0, Ascr1; 284 Vector xref; /*6*1 vector*/ 285 Matrix Ascr0, Ascr1; /*6*6 matrix*/ 285 286 CellType *cellp; 286 287 287 288 if (dP != globval.dPparticle) Cell_SetdP(dP); 288 289 289 /* Init */290 /* Initize the phase */ 290 291 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 */ 294 295 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*/ 297 298 CopyMat(n+1, Ascr, Ascr0); CopyVec(n+2L, globval.CODvect, xref); 298 299 … … 301 302 /* Ascr1=Elem_M*Ascr0 */ 302 303 /* xref =Elem(xref) */ 303 Elem_Pass_M(i, xref, Ascr1); 304 Elem_Pass_M(i, xref, Ascr1); /* transport orbit & optic matrix */ 304 305 305 306 cellp = &Cell[i]; 306 307 /* get alpha and beta for element i */ 307 308 getprm(Ascr1, cellp->Alpha, cellp->Beta); 309 /*save the orbit at the end of the lattice elment*/ 310 CopyVec(ss_dim, xref,cellp->CODvect); 308 311 309 312 for (j = 0; j <= 1; j++) { … … 861 864 Vector2 &etap, Vector &codvect) 862 865 { 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*/ 866 869 867 870 UnitMat(6L, Ascr);
Note: See TracChangeset
for help on using the changeset viewer.