Package cnuphys.magfield
Class FieldProbe
java.lang.Object
cnuphys.magfield.FieldProbe
- All Implemented Interfaces:
IField
- Direct Known Subclasses:
CompositeProbe
,SolenoidProbe
,TorusProbe
,ZeroProbe
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected 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
ConstructorsConstructorDescriptionFieldProbe
(IMagField field) Create a probe, which is a thread safe way to use the field -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(double x, double y, double z) Check whether the field boundaries include the pointstatic FieldProbe
factory()
Get the appropriate probe for the active fieldstatic FieldProbe
Get the appropriate probe for the given fieldvoid
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.getField()
Get the underlying fieldfloat
Obtain the maximum field magnitude of any point in the map.getName()
Get the name of the fielddouble
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 boundarydouble
Get the minimum rho coordinate of the field boundaryprotected int
getSector
(double phi) Get the sector [1..6] from the phi valuedouble
getZMax()
Get the maximum z coordinate of the field boundarydouble
getZMin()
Get the minimum z coordinate of the field boundaryvoid
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.
-
Field Details
-
X
protected static final int X- See Also:
-
Y
protected static final int Y- See Also:
-
Z
protected static final int Z- See Also:
-
ROOT3OVER2
protected static final double ROOT3OVER2 -
cosSect
protected static final double[] cosSect -
sinSect
protected static final double[] sinSect -
_field
-
_name
-
q1Coordinate
Holds the grid info for the slowest changing coordinate. This is cloned from the field. -
q2Coordinate
Holds the grid info for the medium changing coordinate This is cloned from the field. -
q3Coordinate
Holds the grid info for the fastest changing coordinate This is cloned from the field.
-
-
Constructor Details
-
FieldProbe
Create a probe, which is a thread safe way to use the field- Parameters:
field
- the underlying field
-
-
Method Details
-
getField
Get the underlying field- Returns:
- the field that backs this probe
-
getName
Get the name of the field -
fieldMagnitude
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 interfaceIField
- Parameters:
x
- the x coordinate in cmy
- the y coordinate in cmz
- the z coordinate in cm- Returns:
- the magnitude of the field in kiloGauss.
-
getMaxFieldMagnitude
public float getMaxFieldMagnitude()Obtain the maximum field magnitude of any point in the map.- Specified by:
getMaxFieldMagnitude
in interfaceIField
- Returns:
- the maximum field magnitude in the units of the map.
-
isZeroField
public boolean isZeroField()Checks whether the field has been set to always return zero.- Specified by:
isZeroField
in interfaceIField
- Returns:
true
if the field is set to return zero.
-
getCompositeIndex
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 directionn2
- the index in the q2 directionn3
- the index in the q3 direction- Returns:
- the composite index (buffer offset)
-
field
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 interfaceIField
- Parameters:
sector
- the sector [1..6]x
- the x sector coordinate in cmy
- the y sector coordinate in cmz
- the z sector coordinate in cmresult
- 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
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. -
factory
Get the appropriate probe for the active field- Returns:
- the probe for the active field
-
factory
Get the appropriate probe for the given field- Returns:
- the probe for the given field
-
contains
public boolean contains(double x, double y, double z) Check whether the field boundaries include the point -
getSector
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
- Returns:
- the phiCoordinate
-
getRCoordinate
- Returns:
- the rCoordinate
-
getZCoordinate
- Returns:
- the zCoordinate
-
getZMax
public double getZMax()Get the maximum z coordinate of the field boundary- Returns:
- the maximum z coordinate of the field boundary
-
getZMin
public double getZMin()Get the minimum z coordinate of the field boundary- Returns:
- the minimum z coordinate of the field boundary
-
getRhoMax
public double getRhoMax()Get the maximum rho coordinate of the field boundary- Returns:
- the maximum rho coordinate of the field boundary
-
getRhoMin
public double getRhoMin()Get the minimum rho coordinate of the field boundary- Returns:
- the minimum rho coordinate of the field boundary
-
getPhiMax
public double getPhiMax()Get the maximum phi coordinate of the field boundary (deg)- Returns:
- the maximum phi coordinate of the field boundary
-
getPhiMin
public double getPhiMin()Get the minimum phi coordinate of the field boundary (deg)- Returns:
- the minimum phi coordinate of the field boundary
-
getB1
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
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
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.
-