Package cnuphys.swim
Class DefaultListener
java.lang.Object
cnuphys.swim.DefaultListener
- All Implemented Interfaces:
IRkListener
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a default listener that simply tracks the total number of steps taken and stores the last step. -
Method Summary
Modifier and TypeMethodDescriptionint
getCount()
Get the number of steps takendouble
Get the independent variable (e.g., path length) for the last step.double[]
Get the last state vector entries (e.g., [x,y,z, px.p, py/p, pz/p])void
nextStep
(double newS, double[] newY, double h) The integration has advanced one stepvoid
reset()
Call reset if you are going to use the same object again.
-
Constructor Details
-
DefaultListener
public DefaultListener()Create a default listener that simply tracks the total number of steps taken and stores the last step.
-
-
Method Details
-
nextStep
public void nextStep(double newS, double[] newY, double h) The integration has advanced one step- Specified by:
nextStep
in interfaceIRkListener
- Parameters:
newS
- the new value of the independent variable (e.g., path length)newY
- the new value of the dependent variable, e.g. often a vector with six elements (e.g., x, y, z, px/p, py/p, pz/p)h
- the stepsize used for this advance
-
reset
public void reset()Call reset if you are going to use the same object again. -
getIndependentVariable
public double getIndependentVariable()Get the independent variable (e.g., path length) for the last step.- Returns:
- the independent variable (e.g., path length) at the last step
-
getLastStateVector
public double[] getLastStateVector()Get the last state vector entries (e.g., [x,y,z, px.p, py/p, pz/p])- Returns:
- the last state vector
-
getCount
public int getCount()Get the number of steps taken- Returns:
- the count, i.e., the number of steps taken
-