Package cnuphys.swim

Class DefaultRhoStopper

java.lang.Object
cnuphys.swim.DefaultRhoStopper
All Implemented Interfaces:
IStopper

public class DefaultRhoStopper extends Object implements IStopper
This stopper is to stop at a fixed value of the cylindrical coordinate rho. It can also be considered a cylindrical stopper if the cylinder is centered on the z axis.
Author:
heddle
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultRhoStopper(double[] uo, double s0, double sMax, double rho0, double targetRho, double accuracy)
    Rho stopper that doesn't check max R (does check max path length)
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Did we cross the boundary
    double
    Get the final path length in meters
    double[]
    Get the final value of the state vector
    double
    Get the current value of rho
    boolean
    Did we pas the max path length?
    void
    setFinalT(double finalT)
    Set the final independent variable (typically path length in meters)
    boolean
    stopIntegration(double s, double[] u)
    Given the current state of the integration, should we stop?
    boolean
    terminateIntegration(double t, double[] y)
    Generally this is the same as stop integration.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultRhoStopper

      public DefaultRhoStopper(double[] uo, double s0, double sMax, double rho0, double targetRho, double accuracy)
      Rho stopper that doesn't check max R (does check max path length)
      Parameters:
      uo - starting state vector
      s0 - starting path length in meters
      sMax - maximal path length in meters
      targetRho - stopping rho in meters
      accuracy - the accuracy in meters
      normalDirection - if going smaller to larger rho
  • Method Details

    • passedSmax

      public boolean passedSmax()
      Did we pas the max path length?
      Returns:
      true if we crossed the boundary
    • crossedBoundary

      public boolean crossedBoundary()
      Did we cross the boundary
      Returns:
      true if we crossed the boundary
    • getRho

      public double getRho()
      Get the current value of rho
      Returns:
      the current value of rho
    • stopIntegration

      public boolean stopIntegration(double s, double[] u)
      Description copied from interface: IStopper
      Given the current state of the integration, should we stop? This allows the integration to stop, for example, if some distance from the origin has been exceeded or if the independent variable passes some threshold. It won't be precise, because the check may not happen on every step, but it should be close.
      Specified by:
      stopIntegration in interface IStopper
      Parameters:
      s - the current value of the independent variable (typically pathlength)
      u - the current state vector (typically [x, y, z, vx, vy, vz])
      Returns:
      true if we should stop now.
    • getFinalT

      public double getFinalT()
      Get the final path length in meters
      Specified by:
      getFinalT in interface IStopper
      Returns:
      the final path length in meters
    • setFinalT

      public void setFinalT(double finalT)
      Description copied from interface: IStopper
      Set the final independent variable (typically path length in meters)
      Specified by:
      setFinalT in interface IStopper
      Parameters:
      finalT - the final independent variable (typically path length in meters)
    • getFinalU

      public double[] getFinalU()
      Get the final value of the state vector
      Returns:
    • terminateIntegration

      public boolean terminateIntegration(double t, double[] y)
      Generally this is the same as stop integration. So most will just return stopIntegration(). But sometimes stop just means we reset and integrate more. For example, with a fixed rho integrator we "stop" when we cross the rho boundary however we are not done unless we are within tolerance. If we are within tolerance (on either side) we are really done!
      Specified by:
      terminateIntegration in interface IStopper
      Parameters:
      t - the current value of the independent variable (typically pathlength)
      y - the current state vector (typically [x, y, z, vx, vy, vz])
      Returns:
      true if we should stop now.