Package xal.extension.jels.smf.impl
Class FieldMap
java.lang.Object
xal.extension.jels.smf.impl.FieldMap
- Direct Known Subclasses:
MagFieldMap2D
,MagFieldMap3D
,RfFieldMap1D
,RfFieldMap3D
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>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Class to store a component of the fieldComponent. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HashMap<String,
FieldMap.FieldComponent<?>> protected double
protected double
protected static final Logger
protected double[]
protected HashMap<String,
FieldMap.FieldComponent<?>> protected int
protected double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract FieldMapPoint
getFieldAt
(double position) This method should use the fieldComponents HashMap to calculate the field components at a given position.double
getFieldMapPointPositions
(double start, double dblLen) This method returns the field map points within an interval.double
This method returns the length of the field map.double[]
This method returns the longitudinal positions at which the field map is defined.int
double
This method returns the length of each slice of the field map.boolean
protected final FieldMap.FieldComponent<double[]>
loadFile1D
(String path, String name) Loads fieldComponent from a 1D fieldmap file.protected final FieldMap.FieldComponent<double[][]>
loadFile2D
(String path, String name) Loads fieldComponent from a 2D fieldmap file.protected final FieldMap.FieldComponent<double[][][]>
loadFile3D
(String path, String name) Loads fieldComponent from a 3D fieldmap file.protected final void
abstract void
saveFieldMap
(String path, String filename) Saves the fieldmap files.protected final void
saveFile1D
(String path, String name, FieldMap.FieldComponent<double[]> fieldComponent) Saves given fieldComponent to a file for 1D fieldmaps.protected final void
saveFile2D
(String path, String name, FieldMap.FieldComponent<double[][]> fieldComponent) Saves given fieldComponent to a file for 2D fieldmaps.protected final void
saveFile3D
(String path, String name, FieldMap.FieldComponent<double[][][]> fieldComponent) Saves given fieldComponent to a file for 3D fieldmaps.protected final void
setCoupled
(boolean coupled) void
setNumberOfPoints
(int numberOfPoints)
-
Field Details
-
electricField
-
magneticField
-
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
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
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
Loads fieldComponent from a 1D fieldmap file.- Parameters:
path
- path to the filename
-- Returns:
-
loadFile2D
Loads fieldComponent from a 2D fieldmap file.- Parameters:
path
- path to the filename
-- Returns:
-
loadFile3D
Loads fieldComponent from a 3D fieldmap file.- Parameters:
path
- path to the filename
-- 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()
-