Package cnuphys.swim
Class DefaultCylinderStopper
java.lang.Object
cnuphys.swim.DefaultCylinderStopper
- All Implemented Interfaces:
IStopper
This stopper is to stop at the boundary of an arbitrary cylinder
- Author:
- heddle
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCylinderStopper
(double[] u0, double s0, double sMax, Cylinder targetCylinder, double accuracy) Cylinder stopper that looks at boundary (does check max path length) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Did we cross the boundarydouble
Get the final path length in metersdouble[]
Get the final value of the state vectorboolean
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[] unew) Given the current state of the integration, should we stop?boolean
terminateIntegration
(double t, double[] y) Generally this is the same as stop integration.
-
Constructor Details
-
DefaultCylinderStopper
public DefaultCylinderStopper(double[] u0, double s0, double sMax, Cylinder targetCylinder, double accuracy) Cylinder stopper that looks at boundary (does check max path length)- Parameters:
u0
- starting state vectors0
- starting path length in meterssMax
- maximal path length in meterstargetCylinder
- target Cylinderaccuracy
- the accuracy in metersnormalDirection
-if going smaller to larger rho
-
-
Method Details
-
stopIntegration
public boolean stopIntegration(double s, double[] unew) 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)unew
- the current state vector (typically [x, y, z, vx, vy, vz])- Returns:
true
if we should stop now.
-
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
-
getFinalT
public double getFinalT()Get 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) -
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 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.
-