public abstract class Probe<S extends ProbeState<S>> extends java.lang.Object implements IProbe, IArchive
Provides a base class implementation of the IProbe interface that is useful for
most standard probe types. This class provides most of the functionality necessary
for the implementation of the IProbe interface,
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
COMMENT_LABEL
element tag for comment data
|
static java.lang.String |
PROBE_LABEL
element tag for probe data
|
protected S |
stateCurrent
current state of the probe - defines the probe
|
protected static java.lang.String |
TEXT_LABEL
attribute tag for comment text
|
protected static java.lang.String |
TIME_LABEL
attribute tag for the time stamp
|
protected Trajectory<S> |
trajHist
Current probe trajHist
|
protected static java.lang.String |
TYPE_LABEL
attribute tag for probe type name
|
LightSpeed, Permittivity, UnitCharge
Modifier | Constructor and Description |
---|---|
protected |
Probe()
Creates a new instance of Probe.
|
protected |
Probe(IAlgorithm ifcAlg)
Creates a new instance of Probe.
|
|
Probe(Probe<S> probe)
Copy constructor for Probe.
|
Modifier and Type | Method and Description |
---|---|
void |
applyState(S state)
Apply the contents of ProbeState to update my current state.
|
S |
cloneCurrentProbeState()
This method returns a clone of the current state of this probe.
|
abstract Probe<S> |
copy()
Creates a deep copy of the probe
|
abstract S |
createEmptyProbeState()
Creates a new, blank
ProbeState of the appropriate species. |
abstract S |
createProbeState()
Captures the probe's state in a ProbeState of the appropriate species.
|
abstract Trajectory<S> |
createTrajectory()
Require concrete implementations to override this method to create a
Trajectory object of the appropriate species. |
protected void |
deepCopy(Probe<S> probe)
This is a convenience function for derived classes when implementing their
deepCopy() method.
|
IAlgorithm |
getAlgorithm()
Return the algorithm defining the probes dynamics.
|
IArchive |
getArchive()
Return the archiving interface for this object.
|
double |
getBeta()
Returns the probe velocity normalized to the speed of light.
|
java.lang.String |
getComment()
Returns the comment string associated with the probe
|
java.lang.String |
getCurrentElement()
Returns the id of the current lattice element that the probe is visiting.
|
java.lang.String |
getCurrentHardwareId()
Returns the identifier of the hardware modeled by the
element associated with this state.
|
double |
getGamma()
Returns the relativistic parameter corresponding to the probe
velocity.
|
double |
getKineticEnergy()
Return the kinetic energy of the probe.
|
double |
getMomentum()
Returns the momentum
|
double |
getPosition()
Returns the current beam-line position of the probe
|
double |
getSpeciesCharge()
Returns the charge of probe's particle species
|
java.lang.String |
getSpeciesName()
returns the species name
|
double |
getSpeciesRestEnergy()
Returns the rest energy of particle species
|
double |
getTime()
Return the time elapsed since the probe began propagation.
|
java.util.Date |
getTimestamp()
Returns the time stamp of the probe.
|
Trajectory<S> |
getTrajectory()
Get the state history of the probe.
|
void |
initialize()
Initializes the probe, resetting state as necessary.
|
protected void |
initializeFrom(Probe<S> probe)
Deprecated.
This method is only called from child class overrides
which are never called themselves.
|
void |
load(DataAdaptor daptSource)
Load the contents of a probe from an data archive represented by
a
DataAdaptor interface. |
static Probe<?> |
newProbeInitializedFrom(Probe<?> probeInit)
Clone factory method.
|
void |
performPostProcessing()
Deprecated.
I don't think this gets used.
|
static Probe<?> |
readFrom(DataAdaptor container)
Read the contents of the supplied
DataAdaptor and return
an instance of the appropriate Probe species. |
protected abstract S |
readStateFrom(DataAdaptor container)
Read the contents of the supplied
DataAdaptor and return
an instance of the appropriate Trajectory species. |
void |
reset()
Resets the probe to the saved initial state, if there is one and clears
the trajHist.
|
void |
save(DataAdaptor daSink)
Save the contents of a probe to a data archive represented by a
DataAdaptor interface. |
boolean |
setAlgorithm(IAlgorithm ifcAlg)
Set the algorithm defining the probes dynamics through elements
|
void |
setComment(java.lang.String strComment)
Provide a user comment associated with the probe
|
void |
setCurrentElement(java.lang.String id)
Set the current lattice element id.
|
void |
setCurrentHardwareId(java.lang.String strSmfId)
Sets the identifier of the hardware modeled by the
current element.
|
void |
setKineticEnergy(double W)
Set the current kinetic energy of the probe.
|
void |
setPosition(double s)
Set the current position of the probe along the beamline.
|
void |
setSpeciesCharge(double q)
Set the charge of the particle species in the beam
|
void |
setSpeciesName(java.lang.String name)
Set the species name
|
void |
setSpeciesRestEnergy(double Er)
Set the rest energy of a single particle in the beam
|
void |
setTime(double dblTime)
Set the current time since the probe began propagating
|
void |
setTimestamp(java.util.Date dateStamp)
Sets a time stamp for the probe.
|
void |
setTracking(boolean bolTrack)
Set particle trajHist tracking for probes.
|
void |
update()
Save the probe state into trajHist.
|
public static final java.lang.String PROBE_LABEL
protected static final java.lang.String TYPE_LABEL
protected static final java.lang.String TIME_LABEL
protected static final java.lang.String COMMENT_LABEL
protected static final java.lang.String TEXT_LABEL
protected S extends ProbeState<S> stateCurrent
protected Trajectory<S extends ProbeState<S>> trajHist
protected Probe()
protected Probe(IAlgorithm ifcAlg)
ifcAlg
- default dynamics algorithm for probepublic static Probe<?> readFrom(DataAdaptor container) throws ParsingException
DataAdaptor
and return
an instance of the appropriate Probe species.container
- DataAdaptor
to read a Probe fromParsingException
- error encountered reading the DataAdaptorpublic static Probe<?> newProbeInitializedFrom(Probe<?> probeInit)
Clone factory method. Creates a new Probe
object, of the appropriate
type, initialized to the argument Probe
.
probeInit
- Probe
object containing initial dataProbe
object initialized to argumentpublic abstract Trajectory<S> createTrajectory()
Trajectory
object of the appropriate species.Trajectory
of the appropriate species for this probe typepublic abstract S createProbeState()
public abstract S createEmptyProbeState()
ProbeState
of the appropriate species.ProbeState
protected abstract S readStateFrom(DataAdaptor container) throws ParsingException
DataAdaptor
and return
an instance of the appropriate Trajectory species.container
- DataAdaptor
to read a Trajectory fromParsingException
- error encountered reading the DataAdaptorpublic S cloneCurrentProbeState()
ProbeState
object is a representation of this
probe at the moment this method was called.public void applyState(S state)
state
- ProbeState
object containing new probe state data@Deprecated protected void initializeFrom(Probe<S> probe)
probe
- the probe from which to initialize this onepublic void reset()
Resets the probe to the saved initial state, if there is one and clears the trajHist.
public void setComment(java.lang.String strComment)
strComment
- user comment stringpublic void setTimestamp(java.util.Date dateStamp)
dateStamp
- time stamp for probepublic void setSpeciesName(java.lang.String name)
name
- the species namepublic boolean setAlgorithm(IAlgorithm ifcAlg)
ifcAlg
- object exposing the IAlgorithm interfacepublic void setTracking(boolean bolTrack)
bolTrack
- turn tracking on or offpublic java.lang.String getComment()
public java.util.Date getTimestamp()
public Trajectory<S> getTrajectory()
public double getMomentum()
public java.lang.String getSpeciesName()
getSpeciesName
in interface IProbe
public double getSpeciesCharge()
getSpeciesCharge
in interface IProbe
public double getSpeciesRestEnergy()
getSpeciesRestEnergy
in interface IProbe
public java.lang.String getCurrentElement()
getCurrentElement
in interface IProbe
public java.lang.String getCurrentHardwareId()
getCurrentHardwareId
in interface IProbe
IProbe.getCurrentHardwareId()
public double getPosition()
getPosition
in interface IProbe
public double getTime()
public double getKineticEnergy()
getKineticEnergy
in interface IProbe
public double getBeta()
public double getGamma()
public void setCurrentElement(java.lang.String id)
setCurrentElement
in interface IProbe
id
- element id of current lattice elementpublic void setCurrentHardwareId(java.lang.String strSmfId)
setCurrentHardwareId
in interface IProbe
strSmfId
- hardware ID of the current modeling elementIProbe.setCurrentHardwareId(java.lang.String)
public void setPosition(double s)
setPosition
in interface IProbe
s
- new probe position (meters)getPosition()
public void setTime(double dblTime)
public void setKineticEnergy(double W)
setKineticEnergy
in interface IProbe
W
- new probe kinetic energy (electron-volts)getKineticEnergy()
public void setSpeciesCharge(double q)
setSpeciesCharge
in interface IProbe
q
- species particle charge in units of positive electron chargeIProbe.getSpeciesCharge()
public void setSpeciesRestEnergy(double Er)
setSpeciesRestEnergy
in interface IProbe
Er
- particle rest energy (electron-volts)IProbe.getSpeciesRestEnergy()
public void initialize()
Initializes the probe, resetting state as necessary.
createProbeState()
method to which
created a new probe state representing the current state of the probe.
initialize
in interface IProbe
public void update() throws ModelException
update
in interface IProbe
ModelException
- an error occurred while trying to update the probe@Deprecated public void performPostProcessing()
performPostProcessing
in interface IProbe
public IAlgorithm getAlgorithm()
getAlgorithm
in interface IProbe
public IArchive getArchive()
getArchive
in interface IProbe
IArchive
public void load(DataAdaptor daptSource) throws DataFormatException
DataAdaptor
interface.load
in interface IArchive
daptSource
- data archive containing probe infoDataFormatException
- bad probe type, missing child data node, or bad number formatpublic void save(DataAdaptor daSink)
DataAdaptor
interface.protected void deepCopy(Probe<S> probe)
probe
- probe object whose Probe base is to be deep copied into this