[4] | 1 | function z=solenoid(fname,L,KS,method) |
---|
| 2 | |
---|
| 3 | % z=solenoid('FAMILYNAME',Length [m],KS,'METHOD') |
---|
| 4 | % creates a new family in the FAMLIST - a structure with field |
---|
| 5 | % FamName family name |
---|
| 6 | % Length length[m] |
---|
| 7 | % KS solenoid strength KS [rad/m] |
---|
| 8 | % PassMethod name of the function to use for tracking |
---|
| 9 | % |
---|
| 10 | % function returns assigned address in the FAMLIST that uniquely identifies |
---|
| 11 | % the family |
---|
| 12 | % |
---|
| 13 | % Additional structures being set up (initialized to default values within this routine): |
---|
| 14 | % NumIntSteps Number of integration steps |
---|
| 15 | % MaxOrder |
---|
| 16 | % R1 6 x 6 rotation matrix at the entrance |
---|
| 17 | % R2 6 x 6 rotation matrix at the entrance |
---|
| 18 | % T1 6 x 1 translation at entrance |
---|
| 19 | % T2 6 x 1 translation at exit |
---|
| 20 | |
---|
| 21 | ElemData.FamName = fname; % add check for existing identical family names |
---|
| 22 | ElemData.Length = L; |
---|
| 23 | ElemData.K = KS; |
---|
| 24 | ElemData.MaxOrder = 3; |
---|
| 25 | ElemData.NumIntSteps = 10; |
---|
| 26 | ElemData.R1 = diag(ones(6,1)); |
---|
| 27 | ElemData.R2 = diag(ones(6,1)); |
---|
| 28 | ElemData.T1 = zeros(1,6); |
---|
| 29 | ElemData.T2 = zeros(1,6); |
---|
| 30 | ElemData.PassMethod=method; |
---|
| 31 | |
---|
| 32 | global FAMLIST |
---|
| 33 | z = length(FAMLIST)+1; % number of declare families including this one |
---|
| 34 | FAMLIST{z}.FamName = fname; |
---|
| 35 | FAMLIST{z}.NumKids = 0; |
---|
| 36 | FAMLIST{z}.KidsList= []; |
---|
| 37 | FAMLIST{z}.ElemData= ElemData; |
---|
| 38 | |
---|