1 | function z=multipole(fname,L,PolynomA,PolynomB,method) |
---|
2 | |
---|
3 | % MULTIPOLE('FAMILYNAME',Length [m],PolynomA,PolynomB,'METHOD') |
---|
4 | % creates a new family in the FAMLIST - a structure with fields |
---|
5 | % FamName family name |
---|
6 | % Length length[m] |
---|
7 | % ElemData.PolynomA= skew [dipole quad sext oct]; |
---|
8 | % ElemData.PolynomB= normal [dipole quad sext oct]; |
---|
9 | % PassMethod name of the function to use for tracking |
---|
10 | % |
---|
11 | % internally the additional structure fields are set: |
---|
12 | % |
---|
13 | % NumIntSteps Number of integration steps |
---|
14 | % MaxOrder |
---|
15 | % R1 6 x 6 rotation matrix at the entrance |
---|
16 | % R2 6 x 6 rotation matrix at the entrance |
---|
17 | % T1 6 x 1 translation at entrance |
---|
18 | % T2 6 x 1 translation at exit4 |
---|
19 | % |
---|
20 | % returns assigned address in the FAMLIST that uniquely identifies |
---|
21 | % the family |
---|
22 | |
---|
23 | |
---|
24 | ElemData.FamName = fname; % add check for identical family names |
---|
25 | ElemData.Length = L; |
---|
26 | ElemData.MaxOrder = 3; |
---|
27 | ElemData.NumIntSteps = 10; |
---|
28 | ElemData.R1 = diag(ones(6,1)); |
---|
29 | ElemData.R2 = diag(ones(6,1)); |
---|
30 | ElemData.T1 = zeros(1,6); |
---|
31 | ElemData.T2 = zeros(1,6); |
---|
32 | ElemData.PolynomA= PolynomA; |
---|
33 | ElemData.PolynomB= PolynomB; |
---|
34 | ElemData.BendingAngle = PolynomB(1); |
---|
35 | ElemData.PassMethod=method; |
---|
36 | |
---|
37 | global FAMLIST |
---|
38 | z = length(FAMLIST)+1; % number of declare families including this one |
---|
39 | FAMLIST{z}.FamName = fname; |
---|
40 | FAMLIST{z}.NumKids = 0; |
---|
41 | FAMLIST{z}.KidsList= []; |
---|
42 | FAMLIST{z}.ElemData= ElemData; |
---|
43 | |
---|