0001 function Elem = atidtable_dat(fname, Nslice, filename, Energy, method)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 Elem.FamName = fname;
0025
0026 Elem.Nslice = Nslice;
0027 Elem.MaxOrder = 3;
0028 Elem.NumIntSteps = 10;
0029 Elem.R1 = diag(ones(6,1));
0030 Elem.R2 = diag(ones(6,1));
0031 Elem.T1 = zeros(1,6);
0032 Elem.T2 = zeros(1,6);
0033 Elem.PassMethod = method;
0034
0035
0036 factor=1/((Energy/0.299792458)^2);
0037 factor1=-1/((Energy/0.299792458));
0038
0039
0040 D=importdata(filename);
0041 if isfield(D,'Kick1x')
0042 x=(D.x)';
0043 y=(D.y)';
0044 xkick1=factor1*D.Kick1x;
0045 ykick1=factor1*D.Kick1y;
0046 xkick=factor*D.Kick2x;
0047 ykick=factor*D.Kick2y;
0048 L=D.Len;
0049 nn=size(xkick1);
0050 Ny=nn(1);
0051 Nx=nn(2);
0052
0053
0054 else
0055 [header_mat, data_mat]=mhdrload_bis(filename);
0056 L=data_mat(:,:,1);
0057 Nx=data_mat(:,:,2);
0058 Ny=data_mat(:,:,3);
0059 A = importdata(filename,' ',10);
0060 x=A.data;
0061 x=x(1,1:Nx);
0062 A = importdata(filename,' ',11);
0063 txkick=A.data;
0064 y=txkick(1:Ny,1);
0065 txkick=txkick(:,2:end);
0066 A=importdata(filename,' ',11+Ny+3);
0067 tykick=A.data;
0068 tykick=tykick(:,2:end);
0069 A=importdata(filename,' ',11+2*Ny+2*3);
0070 if isstruct(A)
0071 txkick1=A.data;
0072 txkick1=txkick1(:,2:end);
0073 else
0074 txkick1=0*txkick;
0075 end
0076 A=importdata(filename,' ',11+3*Ny+3*3);
0077 if isstruct(A)
0078 tykick1=A.data;
0079 tykick1=tykick1(:,2:end);
0080 else
0081 tykick1=0*tykick;
0082 end
0083
0084 xkick=factor*txkick;
0085 ykick=factor*tykick;
0086
0087 xkick1=factor1*txkick1;
0088 ykick1=factor1*tykick1;
0089
0090
0091 [y indy]=sort(y);
0092 [x indx]=sort(x);
0093 x=x';
0094 xkick=xkick(indy,indx);
0095 ykick=ykick(indy,indx);
0096
0097 end
0098
0099 Elem.Length= L;
0100 Elem.NumX = Ny;
0101 Elem.NumY = Nx;
0102 Elem.xtable = x;
0103 Elem.ytable = y;
0104 Elem.xkick = xkick;
0105 Elem.ykick = ykick;
0106 Elem.xkick1 = xkick1;
0107 Elem.ykick1 = ykick1;
0108 Elem.PolynomA= [0 0 0 0];
0109 Elem.PolynomB= [0 0 0 0];