Last change
on this file since 4 was
4,
checked in by zhangj, 10 years ago
|
Initial import--MML version from SOLEIL@2013
|
File size:
762 bytes
|
Line | |
---|
1 | function mergedrift(SPLITPOS) |
---|
2 | %MERGEDRIFT removes a lattice element and merges the two adjacent drift spaces |
---|
3 | % |
---|
4 | % MERGEDRIFT (SPLITPOS) removes an element located at SPLITPOS from the global lattice THERING |
---|
5 | % surrounded by two DRIFT spaces. The resulting drift has Length L0 = L1 + LSPLIT + L2; |
---|
6 | % Number of elements in THERING is thus reduced by 2 |
---|
7 | % |
---|
8 | % See also: SPLITDRIFT |
---|
9 | |
---|
10 | global THERING |
---|
11 | L0 = THERING{SPLITPOS-1}.Length + THERING{SPLITPOS+1}.Length + THERING{SPLITPOS}.Length; |
---|
12 | |
---|
13 | |
---|
14 | % make new (empty) THERING |
---|
15 | NEWN = length(THERING)-2; |
---|
16 | R = cell(1,NEWN); |
---|
17 | |
---|
18 | N0 = length(THERING); % number of elements in THERING before split |
---|
19 | |
---|
20 | for i = 1:(SPLITPOS-1) |
---|
21 | R{i} = THERING{i}; |
---|
22 | end |
---|
23 | |
---|
24 | R{SPLITPOS-1}.Length = L0; |
---|
25 | |
---|
26 | for i = SPLITPOS:NEWN |
---|
27 | R{i} = THERING{i+2}; |
---|
28 | end |
---|
29 | |
---|
30 | THERING = R; |
---|
Note: See
TracBrowser
for help on using the repository browser.