Class CompositeField

All Implemented Interfaces:
IMagField, Serializable, Cloneable, Iterable<IMagField>, Collection<IMagField>, List<IMagField>, RandomAccess
Direct Known Subclasses:
RotatedCompositeField

public class CompositeField extends ArrayList<IMagField> implements IMagField
A composition of multiple magnetic field maps. The resulting magnetic field at a given point is the sum of the constituent fields at that point.
See Also:
  • Constructor Details

    • CompositeField

      public CompositeField()
  • Method Details

    • isZeroField

      public final boolean isZeroField()
      Checks whether the field has been set to always return zero.
      Specified by:
      isZeroField in interface IMagField
      Returns:
      true if the field is set to return zero.
    • add

      public boolean add(IMagField field)
      Specified by:
      add in interface Collection<IMagField>
      Specified by:
      add in interface List<IMagField>
      Overrides:
      add in class ArrayList<IMagField>
    • getName

      public String getName()
      Description copied from interface: IMagField
      Get the name of the field
      Specified by:
      getName in interface IMagField
      Returns:
      the name, e.e. "Torus"
    • hasTorus

      public boolean hasTorus()
      Check whether we have a torus field
      Returns:
      true if we have a torus
    • hasSolenoid

      public boolean hasSolenoid()
      Check whether we have a solenoid field
      Returns:
      true if we have a solenoid
    • hasTransverseSolenoid

      public boolean hasTransverseSolenoid()
      Check whether we have a transverse solenoid field
      Returns:
      true if we have a transverse solenoid
    • getB1

      public float getB1(int index)
      Description copied from interface: IMagField
      Get B1 at a given index.
      Specified by:
      getB1 in interface IMagField
      Parameters:
      index - the index into the field buffer.
      Returns:
      the B1 at the given index.
    • getB2

      public float getB2(int index)
      Description copied from interface: IMagField
      Get B2 at a given index.
      Specified by:
      getB2 in interface IMagField
      Parameters:
      index - the index into the field buffer.
      Returns:
      the B2 at the given index.
    • getB3

      public float getB3(int index)
      Description copied from interface: IMagField
      Get B3 at a given index.
      Specified by:
      getB3 in interface IMagField
      Parameters:
      index - the index into the field buffer.
      Returns:
      the B3 at the given index.
    • getMaxFieldMagnitude

      public float getMaxFieldMagnitude()
      Description copied from interface: IMagField
      Obtain the maximum field magnitude of any point in the map.
      Specified by:
      getMaxFieldMagnitude in interface IMagField
      Returns:
      the maximum field magnitude in the units of the map.
    • getScaleFactor

      public double getScaleFactor()
      Description copied from interface: IMagField
      Get the scale factor
      Specified by:
      getScaleFactor in interface IMagField
      Returns:
      the scale factor
    • printConfiguration

      public void printConfiguration(PrintStream ps)
      Print the current configuration
      Specified by:
      printConfiguration in interface IMagField
      Parameters:
      ps - the print stream
    • contains

      public boolean contains(double x, double y, double z)
      Description copied from interface: IMagField
      Checks whether the field boundary contain the given point.
      Specified by:
      contains in interface IMagField
      Parameters:
      x - the x coordinate in cm
      y - the y coordinate in cm
      z - the z coordinate in cm
      Returns:
      true if the field contains the given point