Package cnuphys.swim

Class DefaultListener

java.lang.Object
cnuphys.swim.DefaultListener
All Implemented Interfaces:
IRkListener

public class DefaultListener extends Object implements IRkListener
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a default listener that simply tracks the total number of steps taken and stores the last step.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get the number of steps taken
    double
    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 step
    void
    Call reset if you are going to use the same object again.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 interface IRkListener
      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