Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BeamDynamics
matutil
Commits
fbe5c9a6
Commit
fbe5c9a6
authored
Sep 27, 2018
by
Simone Liuzzo
Browse files
repaired qaudrupole device name assignment in presence of QF8D splitted
parent
d6b66abc
Changes
1
Hide whitespace changes
Inline
Side-by-side
+ebs/@model/checklattice.m
View file @
fbe5c9a6
...
...
@@ -122,8 +122,28 @@ end
function
mach
=
adddevicenames
(
mach
)
fprintf
(
'Add device names...\n'
);
ind
=
atgetcells
(
mach
,
'Class'
,
'Quadrupole'
);
mach
(
ind
)
=
atsetfieldvalues
(
mach
(
ind
),
'Device'
,
ebs
.
qpname
(
1
:
sum
(
ind
)));
ind
=
find
(
atgetcells
(
mach
,
'Class'
,
'Quadrupole'
)
|
atgetcells
(
mach
,
'FamName'
,
'Q[FDIJ]\w*'
))
'
;
mach
(
ind
)
=
atsetfieldvalues
(
mach
(
ind
),
'Device'
,
''
);
% initialize Device field to empty
firstsliceQF8D
=
diff
(
ind
)
~=
1
;
% some QF8D are splitted, name first slice only!
indi
=
[
ind
(
firstsliceQF8D
)
ind
(
end
)];
% real number of Quads (removing overcount for splitted elements)
mach
(
indi
)
=
atsetfieldvalues
(
mach
(
indi
),
'Device'
,
ebs
.
qpname
(
1
:
length
(
indi
)));
mach
(
ind
(
end
:
-
1
:
1
))
=
nameunamedaslastnamed
(
mach
(
ind
(
end
:
-
1
:
1
)));
function
r
=
nameunamedaslastnamed
(
r
)
% name devices without a name with the name of the last device
% with a name
lastname
=
''
;
for
ii
=
1
:
length
(
r
)
if
~
isempty
(
r
{
ii
}
.
Device
)
lastname
=
r
{
ii
}
.
Device
;
else
r
{
ii
}
.
Device
=
lastname
;
end
end
end
ind
=
find
(
atgetcells
(
mach
,
'FamName'
,
'DQ\w*'
))
'
;
firstslicedq
=
diff
(
ind
)
~=
2
;
% some DQ are splitted, name first slice
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment