00001 #include "Translate/XSIFParser.hpp"
00002
00003 using namespace std;
00004 using namespace BasicUtilities;
00005
00006
00007
00008
00009 XSIFParser::XSIFParser() : TranslateCore() {
00010 language = "XSIF";
00011 include_file_string = "call:filename";
00012 continuation_char = "&";
00013 c_style_format = false;
00014 knl_tn_style_multipoles = true;
00015 abbreviations_permitted = false;
00016 init_lists_xsif();
00017 init_lists_mad();
00018 init_lists_core();
00019 }
00020
00021
00022
00023
00024 void XSIFParser::init_lists_xsif () {
00025
00026 x_class_to_aml_map["mtwiss"] = "match";
00027
00028 StrVec mtwiss_attrib;
00029 mtwiss_attrib << "l" << "mux" << "betax" << "alphax" <<
00030 "muy" << "betay" << "alphay";
00031 map_element_to_attribs["mtwiss"] = mtwiss_attrib;
00032
00033 StrVec multipole_attrib;
00034 multipole_attrib << "l" << "tilt" << "k0l" << "k1l"
00035 << "k2l" << "k3l" << "k4l" << "k5l" << "k6l" << "k7l" << "k8l" << "k9l"
00036 << "k10l" << "k11l" << "k12l" << "k13l" << "k14l" << "k15l" << "k16l" << "k17l"
00037 << "k18l" << "k19l" << "k20l" << "t0" << "t1" << "t2" << "t3" << "t4"
00038 << "t5" << "t6" << "t7" << "t8" << "t9" << "t10" << "t11" << "t12"
00039 << "t13" << "t14" << "t15" << "t16" << "t17" << "t18" << "t19" << "t20"
00040 << "lrad" << "type" << "at";
00041 map_element_to_attribs["multipole"] = multipole_attrib;
00042
00043 StrVec matrix_attrib;
00044 matrix_attrib << "type";
00045 for (int i = 1; i < 7; i++) {
00046 ostringstream iss; iss << i;
00047 for (int j = 1; j < 7; j++) {
00048 ostringstream jss; jss << j;
00049 matrix_attrib << "r" + iss.str() + jss.str();
00050 for (int k = 1; k < 7; k++) {
00051 ostringstream kss; kss << k;
00052 matrix_attrib << "t" + iss.str() + jss.str() + kss.str();
00053 }
00054 }
00055 }
00056 map_element_to_attribs["matrix"] = matrix_attrib;
00057
00058 for (int i = 1; i < 7; i++) {
00059 ostringstream iss; iss << i;
00060 for (int j = 1; j < 7; j++) {
00061 ostringstream jss; jss << j;
00062 string rm = "matrix:r" + iss.str() + jss.str();
00063 string exp = "\"0 0 0 0 0 0\"";
00064 exp[2*j-1] = '1';
00065 string taylor = "taylor_map:term(i_out=" + iss.str() + ",exp=" + exp + ")@coef";
00066 register_attribute (rm, taylor);
00067 for (int k = 1; k < 7; k++) {
00068 ostringstream kss; kss << k;
00069 exp = "\"0 0 0 0 0 0\"";
00070 exp[2*j-1] = '1';
00071 if (j == k)
00072 exp[2*k-1] = '2';
00073 else
00074 exp[2*k-1] = '1';
00075 taylor = "taylor_map:term(i_out=" + iss.str() + ",exp=" + exp + ")@coef";
00076 string tm = "matrix:t" + iss.str() + jss.str() + kss.str();
00077 register_attribute (tm, taylor);
00078 }
00079 }
00080 }
00081
00082 map_element_to_attribs["matrix"] << "aperture";
00083 map_element_to_attribs["drift"] << "aperture";
00084 map_element_to_attribs["sbend"] << "aperture";
00085 map_element_to_attribs["rbend"] << "aperture";
00086 map_element_to_attribs["quadrupole"] << "aperture";
00087 map_element_to_attribs["sextupole"] << "aperture";
00088 map_element_to_attribs["octupole"] << "aperture";
00089 map_element_to_attribs["multipole"] << "aperture";
00090 map_element_to_attribs["solenoid"] << "aperture";
00091 map_element_to_attribs["hkicker"] << "aperture";
00092 map_element_to_attribs["vkicker"] << "aperture";
00093 map_element_to_attribs["kicker"] << "aperture";
00094 map_element_to_attribs["rfcavity"] << "aperture";
00095 map_element_to_attribs["lcavity"] << "aperture";
00096 map_element_to_attribs["elseparator"] << "aperture";
00097 map_element_to_attribs["monitor"] << "aperture";
00098 map_element_to_attribs["instrument"] << "aperture";
00099 map_element_to_attribs["beambeam"] << "aperture";
00100
00101 register_attribute("aperture", "aperture:xy_limit");
00102
00103
00104
00105 return;
00106
00107 }