Class ElementMapping

java.lang.Object
xal.sim.scenario.ElementMapping
Direct Known Subclasses:
DefaultElementMapping, FileBasedElementMapping, JElsElementMapping

public abstract class ElementMapping extends Object
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 Details

    • elementMap

      protected Map<String,Class<? extends IComponent>> elementMap
      The map of hardware type identifier string to modeling element class types.
    • bolSubsectionCtrOrigin

      protected boolean bolSubsectionCtrOrigin
      default set for SNS
    • bolDebug

      protected boolean bolDebug
      use type outs for debugging
    • bolDivMags

      protected boolean bolDivMags
      create center markers for thick magnets when true
  • Constructor Details

    • ElementMapping

      public ElementMapping()
  • Method Details

    • getDefaultElementType

      public abstract Class<? extends IComponent> 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

      public abstract Class<? extends IComposite> 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

      public abstract Class<? extends IComponent> getDriftType()
    • getRfCavityDriftType

      public abstract Class<? extends IComponent> getRfCavityDriftType()
    • createDefaultDrift

      public abstract IComponent createDefaultDrift(String name, double len) throws ModelException
      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 space
      len - length of drift space (meters)
      freq - design frequency of the enclosing RF cavity
      mode - 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

      public Class<? extends IComponent> getModelElementType(AcceleratorNode node)

      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 an AcceleratorSeq type them and an association exists in this mapping, then that modeling element will be returned (but empty).

      · If the given node is of type AcceleratorSeq 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 getModelElementType(AcceleratorNode) then the result is cast to a an IComposite type. If this casting fails a ClassCastException is thrown. However, unlike getModelElementType(AcceleratorNode), if no entry is found a 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

      protected void putMap(String key, Class<? extends IComponent> value)
      Adds a converter to the list that's used by default implementation.
      Parameters:
      key - node type
      value - the converter
    • removeMap

      protected void removeMap(String key)
      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), else false 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, else false to stop debugging output.
    • isMagnetDivided

      public boolean isMagnetDivided()
      If the value here is true 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. If true 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