Class FieldProbe

java.lang.Object
cnuphys.magfield.FieldProbe
All Implemented Interfaces:
IField
Direct Known Subclasses:
CompositeProbe, SolenoidProbe, TorusProbe, ZeroProbe

public abstract class FieldProbe extends Object implements IField
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    protected final IMagField
     
    protected String
     
    protected static final double[]
     
    protected GridCoordinate
    Holds the grid info for the slowest changing coordinate.
    protected GridCoordinate
    Holds the grid info for the medium changing coordinate This is cloned from the field.
    protected GridCoordinate
    Holds the grid info for the fastest changing coordinate This is cloned from the field.
    protected static final double
     
    protected static final double[]
     
    protected static final int
     
    protected static final int
     
    protected static final int
     
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    Create a probe, which is a thread safe way to use the field
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    boolean
    contains(double x, double y, double z)
    Check whether the field boundaries include the point
    static FieldProbe
    Get the appropriate probe for the active field
    static FieldProbe
    Get the appropriate probe for the given field
    void
    field(int sector, float x, float y, float z, float[] result)
    Obtain the magnetic field at a given location expressed in Cartesian coordinates in the sector (not lab or global) system.
    float
    fieldMagnitude(float x, float y, float z)
    Get the field magnitude in kiloGauss at a given location expressed in Cartesian coordinates.
    final float
    getB1(int index)
    Get B1 at a given composite index.
    final float
    getB2(int index)
    Get B2 at a given index.
    final float
    getB3(int index)
    Get B3 at a given composite index.
    final int
    getCompositeIndex(int n1, int n2, int n3)
    Get the composite index to take me to the correct place in the buffer.
    Get the underlying field
    float
    Obtain the maximum field magnitude of any point in the map.
    Get the name of the field
     
    double
    Get the maximum phi coordinate of the field boundary (deg)
    double
    Get the minimum phi coordinate of the field boundary (deg)
     
    double
    Get the maximum rho coordinate of the field boundary
    double
    Get the minimum rho coordinate of the field boundary
    protected int
    getSector(double phi)
    Get the sector [1..6] from the phi value
     
    double
    Get the maximum z coordinate of the field boundary
    double
    Get the minimum z coordinate of the field boundary
    void
    gradient(float x, float y, float z, float[] result)
    Obtain an approximation for the magnetic field gradient at a given location expressed in Cartesian coordinates.
    boolean
    Checks whether the field has been set to always return zero.

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface cnuphys.magfield.IField Link icon

    field
  • Field Details Link icon

    • X Link icon

      protected static final int X
      See Also:
    • Y Link icon

      protected static final int Y
      See Also:
    • Z Link icon

      protected static final int Z
      See Also:
    • ROOT3OVER2 Link icon

      protected static final double ROOT3OVER2
    • cosSect Link icon

      protected static final double[] cosSect
    • sinSect Link icon

      protected static final double[] sinSect
    • _field Link icon

      protected final IMagField _field
    • _name Link icon

      protected String _name
    • q1Coordinate Link icon

      protected GridCoordinate q1Coordinate
      Holds the grid info for the slowest changing coordinate. This is cloned from the field.
    • q2Coordinate Link icon

      protected GridCoordinate q2Coordinate
      Holds the grid info for the medium changing coordinate This is cloned from the field.
    • q3Coordinate Link icon

      protected GridCoordinate q3Coordinate
      Holds the grid info for the fastest changing coordinate This is cloned from the field.
  • Constructor Details Link icon

    • FieldProbe Link icon

      public FieldProbe(IMagField field)
      Create a probe, which is a thread safe way to use the field
      Parameters:
      field - the underlying field
  • Method Details Link icon

    • getField Link icon

      public IMagField getField()
      Get the underlying field
      Returns:
      the field that backs this probe
    • getName Link icon

      public String getName()
      Get the name of the field
      Specified by:
      getName in interface IField
      Returns:
      the name of the underlying field
    • fieldMagnitude Link icon

      public float fieldMagnitude(float x, float y, float z)
      Get the field magnitude in kiloGauss at a given location expressed in Cartesian coordinates.
      Specified by:
      fieldMagnitude in interface IField
      Parameters:
      x - the x coordinate in cm
      y - the y coordinate in cm
      z - the z coordinate in cm
      Returns:
      the magnitude of the field in kiloGauss.
    • getMaxFieldMagnitude Link icon

      public float getMaxFieldMagnitude()
      Obtain the maximum field magnitude of any point in the map.
      Specified by:
      getMaxFieldMagnitude in interface IField
      Returns:
      the maximum field magnitude in the units of the map.
    • isZeroField Link icon

      public boolean isZeroField()
      Checks whether the field has been set to always return zero.
      Specified by:
      isZeroField in interface IField
      Returns:
      true if the field is set to return zero.
    • getCompositeIndex Link icon

      public final int getCompositeIndex(int n1, int n2, int n3)
      Get the composite index to take me to the correct place in the buffer.
      Parameters:
      n1 - the index in the q1 direction
      n2 - the index in the q2 direction
      n3 - the index in the q3 direction
      Returns:
      the composite index (buffer offset)
    • field Link icon

      public void field(int sector, float x, float y, float z, float[] result)
      Obtain the magnetic field at a given location expressed in Cartesian coordinates in the sector (not lab or global) system. The field is returned as a Cartesian vector in kiloGauss.
      Specified by:
      field in interface IField
      Parameters:
      sector - the sector [1..6]
      x - the x sector coordinate in cm
      y - the y sector coordinate in cm
      z - the z sector coordinate in cm
      result - the result is a float array holding the retrieved field in kiloGauss. The 0,1 and 2 indices correspond to x, y, and z components.
    • gradient Link icon

      public void gradient(float x, float y, float z, float[] result)
      Obtain an approximation for the magnetic field gradient at a given location expressed in Cartesian coordinates. The field is returned as a Cartesian vector in kiloGauss/cm.
      Specified by:
      gradient in interface IField
      Parameters:
      x - the x coordinate in cm
      y - the y coordinate in cm
      z - the z coordinate in cm
      result - a float array holding the retrieved field in kiloGauss. The 0,1 and 2 indices correspond to x, y, and z components.
    • factory Link icon

      public static FieldProbe factory()
      Get the appropriate probe for the active field
      Returns:
      the probe for the active field
    • factory Link icon

      public static FieldProbe factory(IMagField field)
      Get the appropriate probe for the given field
      Returns:
      the probe for the given field
    • contains Link icon

      public boolean contains(double x, double y, double z)
      Check whether the field boundaries include the point
      Specified by:
      contains in interface IField
      Parameters:
      x - the x coordinate in the map units
      y - the y coordinate in the map units
      z - the z coordinate in the map units
      Returns:
      true if the point is included in the boundary of the field
    • getSector Link icon

      protected int getSector(double phi)
      Get the sector [1..6] from the phi value
      Parameters:
      phi - the value of phi in degrees
      Returns:
      the sector [1..6]
    • getPhiCoordinate Link icon

      public GridCoordinate getPhiCoordinate()
      Returns:
      the phiCoordinate
    • getRCoordinate Link icon

      public GridCoordinate getRCoordinate()
      Returns:
      the rCoordinate
    • getZCoordinate Link icon

      public GridCoordinate getZCoordinate()
      Returns:
      the zCoordinate
    • getZMax Link icon

      public double getZMax()
      Get the maximum z coordinate of the field boundary
      Returns:
      the maximum z coordinate of the field boundary
    • getZMin Link icon

      public double getZMin()
      Get the minimum z coordinate of the field boundary
      Returns:
      the minimum z coordinate of the field boundary
    • getRhoMax Link icon

      public double getRhoMax()
      Get the maximum rho coordinate of the field boundary
      Returns:
      the maximum rho coordinate of the field boundary
    • getRhoMin Link icon

      public double getRhoMin()
      Get the minimum rho coordinate of the field boundary
      Returns:
      the minimum rho coordinate of the field boundary
    • getPhiMax Link icon

      public double getPhiMax()
      Get the maximum phi coordinate of the field boundary (deg)
      Returns:
      the maximum phi coordinate of the field boundary
    • getPhiMin Link icon

      public double getPhiMin()
      Get the minimum phi coordinate of the field boundary (deg)
      Returns:
      the minimum phi coordinate of the field boundary
    • getB1 Link icon

      public final float getB1(int index)
      Get B1 at a given composite index.
      Parameters:
      index - the composite index.
      Returns:
      the B1 at the given index.
    • getB2 Link icon

      public final float getB2(int index)
      Get B2 at a given index.
      Parameters:
      index - the composite index.
      Returns:
      the B2 at the given composite index.
    • getB3 Link icon

      public final float getB3(int index)
      Get B3 at a given composite index.
      Parameters:
      index - the composite index.
      Returns:
      the B3 at the given composite index.