Package cnuphys.swim
Class DefaultPlaneStopper
java.lang.Object
cnuphys.swim.DefaultPlaneStopper
- All Implemented Interfaces:
IStopper
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultPlaneStopper
(double s0, double rMax, double sMax, Plane plane, double accuracy, int side) Plane stopper that checks Rmax (and sMax)DefaultPlaneStopper
(double s0, double sMax, Plane plane, double accuracy, int side) Plane stopper that doesn't check max R (does check max path length) -
Method Summary
Modifier and TypeMethodDescriptiondouble
Get the final independent variable (typically path length in meters)int
getSide()
Get the current sidevoid
setFinalT
(double finalT) Set the final independent variable (typically path length in meters)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.
-
Constructor Details
-
DefaultPlaneStopper
Plane stopper that doesn't check max R (does check max path length)- Parameters:
s0
- starting path length in meterssMax
- maximal path length in metersplane
- the planeaccuracy
- the accuracy in metersside
- the starting side. Set to any number > 100 if not known.
-
DefaultPlaneStopper
public DefaultPlaneStopper(double s0, double rMax, double sMax, Plane plane, double accuracy, int side) Plane stopper that checks Rmax (and sMax)- Parameters:
s0
- starting path length in metersrMax
- maximal radius in meterssMax
- maximal path length in metersplane
- the planeaccuracy
- the accuracy in metersside
- the starting side. Set to any number > 100 if not known.
-
-
Method Details
-
getSide
public int getSide()Get the current side- Returns:
- the current side
-
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()Description copied from interface:IStopper
Get the final independent variable (typically 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) -
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.
-