Package cnuphys.swim
Class DefaultZStopper
java.lang.Object
cnuphys.swim.DefaultZStopper
- All Implemented Interfaces:
IStopper
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultZStopper
(double s0, double sMax, double targetZ, double accuracy, boolean normalDirection) Z stopper that doesn't check max R (does check max path length)DefaultZStopper
(double s0, double rMax, double sMax, double targetZ, double accuracy, boolean normalDirection) Z stopper that checks Rmax (and sMax) -
Method Summary
Modifier and TypeMethodDescriptiondouble
Get the final path length in metersvoid
setAccuracy
(double accuracy) void
setFinalT
(double finalT) Set the final independent variable (typically path length in meters)void
setNormalDirection
(boolean normalDirection) void
setS0
(double s0) void
setSMax
(double sMax) void
setTargetZ
(double targetZ) boolean
stopIntegration
(double s, double[] y) Given the current state of the integration, should we stop?boolean
terminateIntegration
(double t, double[] y) Generally this is the same as stop integration.boolean
withinAccuracy
(double z, double accuracy) Is the current z within accuracy
-
Constructor Details
-
DefaultZStopper
public DefaultZStopper() -
DefaultZStopper
public DefaultZStopper(double s0, double sMax, double targetZ, double accuracy, boolean normalDirection) Z stopper that doesn't check max R (does check max path length)- Parameters:
s0
- starting path length in meterssMax
- maximal path length in meterstargetZ
- stopping Z in metersaccuracy
- the accuracy in metersnormalDirection
-if going smaller to larger z
-
DefaultZStopper
public DefaultZStopper(double s0, double rMax, double sMax, double targetZ, double accuracy, boolean normalDirection) Z stopper that checks Rmax (and sMax)- Parameters:
s0
- starting path length in metersrMax
- maximal radius in meterssMax
- maximal path length in meterstargetZ
- stopping Z in metersaccuracy
- the accuracy in metersnormalDirection
-if going smaller to larger z
-
-
Method Details
-
setS0
public void setS0(double s0) -
setSMax
public void setSMax(double sMax) -
setTargetZ
public void setTargetZ(double targetZ) -
setAccuracy
public void setAccuracy(double accuracy) -
setNormalDirection
public void setNormalDirection(boolean normalDirection) -
stopIntegration
public boolean stopIntegration(double s, double[] y) 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 interfaceIStopper
- Parameters:
s
- 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.
-
getFinalT
public double getFinalT()Get the final path length in meters -
withinAccuracy
public boolean withinAccuracy(double z, double accuracy) Is the current z within accuracy- Parameters:
z
- current zaccuracy
- accuracy- Returns:
true
if current z with accuracy
-
setFinalT
public void setFinalT(double finalT) Description copied from interface:IStopper
Set the final independent variable (typically path length in meters) -
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 Z integrator we "stop" when we cross the z 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 interfaceIStopper
- 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.
-