Package xal.sim.scenario
Class ElementMapping
java.lang.Object
xal.sim.scenario.ElementMapping
- Direct Known Subclasses:
DefaultElementMapping
,FileBasedElementMapping
,JElsElementMapping
This is an abstract class to provide mapping from SMF nodes to online model
elements
- Since:
- Oct 3, 2013
- Version:
- Dec 5, 2014 Christopher K. Allen
- Author:
- Ivo List
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
use type outs for debuggingprotected boolean
create center markers for thick magnets when trueprotected boolean
default set for SNSprotected Map<String,
Class<? extends IComponent>> The map of hardware type identifier string to modeling element class types. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract IComponent
createDefaultDrift
(String name, double len) Different model may have different implementation of the drift element.abstract IComponent
createRfCavityDrift
(String name, double len, double freq, double mode) Creates a drift space within an RF cavity structure.abstract Class<? extends IComponent>
Default converter should produce a general model element like a Marker.abstract Class<? extends IComposite>
Returns the default class type used to model accelerator sequences.abstract Class<? extends IComponent>
Class<? extends IComponent>
Returns modeling element class type used to model the given node.Class<? extends IComposite>
getModelSequenceType
(AcceleratorSeq smfSeq) Returns the modeling element class type used to represent the given hardware accelerator sequence.abstract Class<? extends IComponent>
boolean
Get the debugging flag.boolean
If the value here istrue
then marker modeling elements are placed at the center of thick magnets when the model lattice is created.boolean
Returns whether or the origin of the axis of subsection is at the center of the sequence, normally it is located at the entrance of the sequence.protected void
putMap
(String key, Class<? extends IComponent> value) Adds a converter to the list that's used by default implementation.protected void
Removes a converter from the list.void
setDebug
(boolean bolDebug) Set flag to determine whether debugging information is sent to standard output.void
setDivideMagnetFlag
(boolean halfMag) Set flag to force lattice generator to place a permanent marker in the middle of every thick element.
-
Field Details
-
elementMap
The map of hardware type identifier string to modeling element class types. -
bolSubsectionCtrOrigin
protected boolean bolSubsectionCtrOrigindefault set for SNS -
bolDebug
protected boolean bolDebuguse type outs for debugging -
bolDivMags
protected boolean bolDivMagscreate center markers for thick magnets when true
-
-
Constructor Details
-
ElementMapping
public ElementMapping()
-
-
Method Details
-
getDefaultElementType
Default converter should produce a general model element like a Marker. It is used when no other class associations have been found.- Returns:
- default class type used when none is defined
-
getDefaultSequenceType
Returns the default class type used to model accelerator sequences. This value is used when none has been defined for a specific hardware sequence (e.g., a super conduction cavity, coupled cavity linac, etc.).- Returns:
- default class type used to model hardware sequences
- Since:
- Dec 5, 2014 @author Christopher K. Allen
-
getDriftType
-
getRfCavityDriftType
-
createDefaultDrift
Different model may have different implementation of the drift element.- Returns:
- drift model element
- Throws:
ModelException
-
createRfCavityDrift
public abstract IComponent createRfCavityDrift(String name, double len, double freq, double mode) throws ModelException Creates a drift space within an RF cavity structure. Such drifts have extra parameters needed to compute the probe's longitudinal phase advance. These parameters are derived from the cavity's design parameters and do not need to be synchronized.- Parameters:
name
- string identifier of the drift spacelen
- length of drift space (meters)freq
- design frequency of the enclosing RF cavitymode
- structure mode coupling the cavities within the tank- Returns:
- a new RF cavity drift space
- Throws:
ModelException
- an exception occurred while constructing the element- Since:
- Dec 3, 2014 @author Christopher K. Allen
-
getModelElementType
Returns modeling element class type used to model the given node. Default implementation traverses a list and returns first association for the given hardware type.
CKA NOTES:
· The implementation has changed to account for accelerator sequences.
· If the node being passed in is anAcceleratorSeq
type them and an association exists in this mapping, then that modeling element will be returned (but empty).
· If the given node is of typeAcceleratorSeq
and there is no association in this table this method returns the result of calling
.getDefaultSequenceType()
· If the given node is atomic (has no children) and there is no entry for it in the association table the result of calling
.getDefaultElementType()
- Parameters:
node
- hardware node being looked up- Returns:
- class type for the modeling element associated with the given hardware
- Throws:
IllegalAccessException
InstantiationException
-
getModelSequenceType
public Class<? extends IComposite> getModelSequenceType(AcceleratorSeq smfSeq) throws ClassCastException Returns the modeling element class type used to represent the given hardware accelerator sequence. Currently there are no special entry types in the mapping table, it is searched just as in
then the result is cast to a angetModelElementType(AcceleratorNode)
IComposite
type. If this casting fails aClassCastException
is thrown. However, unlike
, if no entry is found agetModelElementType(AcceleratorNode)
null
value is returned.- Parameters:
smfSeq
- accelerator hardware node to be cross referenced- Returns:
- the modeling sequence class type used to represent the given
accelerator node, or
null
if no class type entry is found - Throws:
ClassCastException
- the hardware sequence mapped to an incompatible model sequence element- Since:
- Dec 9, 2014
-
putMap
Adds a converter to the list that's used by default implementation.- Parameters:
key
- node typevalue
- the converter
-
removeMap
Removes a converter from the list. This method is useful if one wants to modify a given Mapping.- Parameters:
key
-
-
setDivideMagnetFlag
public void setDivideMagnetFlag(boolean halfMag) Set flag to force lattice generator to place a permanent marker in the middle of every thick element.- Parameters:
halfmag
-true
yes put the middle marker (default), elsefalse
for no middle markers.
-
setDebug
public void setDebug(boolean bolDebug) Set flag to determine whether debugging information is sent to standard output.- Parameters:
bolDebug
-true
for debugging output, elsefalse
to stop debugging output.
-
isMagnetDivided
public boolean isMagnetDivided()If the value here istrue
then marker modeling elements are placed at the center of thick magnets when the model lattice is created.- Returns:
- the flag to force lattice generator to place a permanent marker in the middle of every thick element.
-
isDebugging
public boolean isDebugging()Get the debugging flag. Iftrue
then debugging information is being sent to the standard output.- Returns:
true
if debugging information is being sent to standard output,false
when in normal operation.
-
isSubsectionAxisOriginCentered
public boolean isSubsectionAxisOriginCentered()Returns whether or the origin of the axis of subsection is at the center of the sequence, normally it is located at the entrance of the sequence.- Returns:
true
if the axis origin is at the center of the sequence,false
otherwise (likely at the sequence entrance)- Since:
- Jan 29, 2015 by Christopher K. Allen
-