diff --git a/tracy/tracy/src/prtmfile.cc b/tracy/tracy/src/prtmfile.cc index a1ddb11a7239bf1f3405a77f849362411e1eb212..181fbd5b8fa43d00d7beb1df89b1a82588f3874b 100644 --- a/tracy/tracy/src/prtmfile.cc +++ b/tracy/tracy/src/prtmfile.cc @@ -27,35 +27,38 @@ name, family no, kid no, element no type code, integration method, no of integration steps - apertures: xmin, xmax, ymin, ymax + vacuum apertures: xmin, xmax, ymin, ymax The following lines follows depending on element type. type - drift: L + 1) drift: L - multipole: hor., ver. displacement, roll angle (design), roll angle (error); - L, 1/rho, entrance angle, exit angle, apertures[4]; - no of nonzero multipole coeff. - n, b , a - n n - ... + 2) multipole: + a.) hor., ver. displacement, roll angle (design), roll angle (error); + b.) L, 1/rho, entrance angle, exit angle, totoal magnet gap[m]; + c.) number of orders with nonzero field components, design field order + d.) The last lines are the nonzero multipole components, + the format is: + n, Bn , An + where n is the field order, Bn is the upright + field component, Bn is the skew field component - wiggler: L [m], lambda [m] + 3) wiggler: L [m], lambda [m] no of harmonics harm no, kxV [1/m], BoBrhoV [1/m], kxH, BoBrhoH, phi ... - cavity: cavity voltage/beam energy [eV], omega/c, beam energy [eV] + 4) cavity: cavity voltage/beam energy [eV], omega/c, beam energy [eV] - thin kick: hor., ver. displacement, roll angle (total) + 5) thin kick: hor., ver. displacement, roll angle (total) no of nonzero multipole coeff. n, b , a n n ... - kick_map: order <file name> +6) kick_map: order <file name> */ @@ -71,7 +74,38 @@ #define wiggler_ 4 #define kick_map_ 6 +/****************************************************************************** +void prtName(FILE *fp, const int i, + const int type, const int method, const int N) + Purpose: + Print out the general imformation of an element to a file + + Input: + i index number in the whole lattice + type predfined integer number for different type of element + Type codes: + marker -1 + drift 0 + multipole 1 + cavity 2 + thin kick 3 + wiggler 4 + kick_map 6 + + method integrated method + N number of integration steps of the element + + Output: + Output to the file as the first 3 lines in file "fp": + + L1: element name, family index, kid index, element index in the whole lattice + L2: type code, integration method, number of integration steps + L3: vacuum apertures: xmin, xmax, ymin, ymax + + Comments: + Called by prtmfile() +******************************************************************************/ void prtName(FILE *fp, const int i, const int type, const int method, const int N) { @@ -83,15 +117,35 @@ void prtName(FILE *fp, const int i, Cell[i].maxampl[Y_][0], Cell[i].maxampl[Y_][1]); } +/****************************************************************************** +void prtHOM(FILE *fp, const int n_design, const mpolArray PB, const int Order) + Purpose: + Print out all field component for multipole to a file + + Input: + fp file name + n_design design order of multipole + PB multipole field components arry, format is: n Bn An + Order maximum order of multipole + + Output: + None + + Comments: + Called by prtmfile() +******************************************************************************/ void prtHOM(FILE *fp, const int n_design, const mpolArray PB, const int Order) { - int i, nmpole; + int i = 0, nmpole = 0; + + for (i = 1; i <= Order; i++){ + if ((PB[HOMmax-i] != 0.0) || (PB[HOMmax+i] != 0.0)) + nmpole++; + } - nmpole = 0; - for (i = 1; i <= Order; i++) - if ((PB[HOMmax-i] != 0.0) || (PB[HOMmax+i] != 0.0)) nmpole++; fprintf(fp, " %2d %2d\n", nmpole, n_design); + for (i = 1; i <= Order; i++) { if ((PB[HOMmax-i] != 0.0) || (PB[HOMmax+i] != 0.0)) fprintf(fp, "%3d %23.16e %23.16e\n", i, PB[HOMmax+i], PB[HOMmax-i]);