Class FieldMap

java.lang.Object
xal.extension.jels.smf.impl.FieldMap
Direct Known Subclasses:
MagFieldMap2D, MagFieldMap3D, RfFieldMap1D, RfFieldMap3D

public abstract class FieldMap extends Object
This abstract class implements convenience method to load TraceWin-type field map files. The constructor of subclasses should use the File manipulation methods provided by this class to load all field components. Then they should implement the getFieldAt().

To avoid having several instances for the same field map, it is recommended to use the FieldMapFactory method, that will select the right FieldMap subclass and make sure the field map is loaded only once.

Author:
Juan F. Esteban Müller <JuanF.EstebanMuller@ess.eu>
  • Field Details

    • electricField

      protected HashMap<String,FieldMap.FieldComponent<?>> electricField
    • magneticField

      protected HashMap<String,FieldMap.FieldComponent<?>> magneticField
    • LOGGER

      protected static final Logger LOGGER
    • numberOfPoints

      protected int numberOfPoints
    • length

      protected double length
    • sliceLength

      protected double sliceLength
    • longitudinalPositions

      protected double[] longitudinalPositions
    • fieldIntegral

      protected double fieldIntegral
  • Constructor Details

    • FieldMap

      public FieldMap()
  • Method Details

    • getNumberOfPoints

      public int getNumberOfPoints()
    • setNumberOfPoints

      public void setNumberOfPoints(int numberOfPoints)
    • recalculateSliceLength

      protected final void recalculateSliceLength()
    • isCoupled

      public boolean isCoupled()
    • setCoupled

      protected final void setCoupled(boolean coupled)
    • getFieldAt

      public abstract FieldMapPoint getFieldAt(double position)
      This method should use the fieldComponents HashMap to calculate the field components at a given position.
      Parameters:
      position - Position along the element [m].
      Returns:
      FieldMapPoint
    • saveFieldMap

      public abstract void saveFieldMap(String path, String filename) throws IOException, URISyntaxException
      Saves the fieldmap files.
      Parameters:
      path -
      filename -
      Throws:
      IOException
      URISyntaxException
    • getLength

      public double getLength()
      This method returns the length of the field map.
      Returns:
    • getSliceLength

      public double getSliceLength()
      This method returns the length of each slice of the field map.
      Returns:
    • getLongitudinalPositions

      public double[] getLongitudinalPositions()
      This method returns the longitudinal positions at which the field map is defined.
      Returns:
    • getFieldMapPointPositions

      public List<Double> getFieldMapPointPositions(double start, double dblLen)
      This method returns the field map points within an interval. If there is any field map point at the start position, it returns the point twice. The reason is that the first point is used to calculate the first drift space.
      Parameters:
      start -
      dblLen -
      Returns:
    • loadFile1D

      protected final FieldMap.FieldComponent<double[]> loadFile1D(String path, String name)
      Loads fieldComponent from a 1D fieldmap file.
      Parameters:
      path - path to the file
      name -
      Returns:
    • loadFile2D

      protected final FieldMap.FieldComponent<double[][]> loadFile2D(String path, String name)
      Loads fieldComponent from a 2D fieldmap file.
      Parameters:
      path - path to the file
      name -
      Returns:
    • loadFile3D

      protected final FieldMap.FieldComponent<double[][][]> loadFile3D(String path, String name)
      Loads fieldComponent from a 3D fieldmap file.
      Parameters:
      path - path to the file
      name -
      Returns:
    • saveFile1D

      protected final void saveFile1D(String path, String name, FieldMap.FieldComponent<double[]> fieldComponent) throws IOException, URISyntaxException
      Saves given fieldComponent to a file for 1D fieldmaps.
      Parameters:
      path - path to the file
      Throws:
      IOException
      URISyntaxException
    • saveFile2D

      protected final void saveFile2D(String path, String name, FieldMap.FieldComponent<double[][]> fieldComponent) throws IOException, URISyntaxException
      Saves given fieldComponent to a file for 2D fieldmaps.
      Parameters:
      path - path to the file
      Throws:
      IOException
      URISyntaxException
    • saveFile3D

      protected final void saveFile3D(String path, String name, FieldMap.FieldComponent<double[][][]> fieldComponent) throws IOException, URISyntaxException
      Saves given fieldComponent to a file for 3D fieldmaps.
      Parameters:
      path - path to the file
      Throws:
      IOException
      URISyntaxException
    • getFieldIntegral

      public double getFieldIntegral()