org.spaceroots.mantissa.ode
Class SwitchingFunctionsHandler
- java.lang.Object
-
- org.spaceroots.mantissa.ode.SwitchingFunctionsHandler
-
public class SwitchingFunctionsHandler extends java.lang.ObjectThis class handles severalswitching functionsduring integration.- See Also:
SwitchingFunction
-
-
Constructor Summary
Constructors Constructor and Description SwitchingFunctionsHandler()Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(SwitchingFunction function, double maxCheckInterval, double convergence)Add a switching function.booleanevaluateStep(StepInterpolator interpolator)Evaluate the impact of the proposed step on all handled switching functions.doublegetEventTime()Get the occurrence time of the first event triggered in the last evaluated step.booleanisEmpty()Check if the handler does not have any condition.booleanreset(double t, double[] y)Let the switching functions reset the state if they want.voidstepAccepted(double t, double[] y)Inform the switching functions that the step has been accepted by the integrator.booleanstop()Check if the integration should be stopped at the end of the current step.
-
-
-
Constructor Detail
-
SwitchingFunctionsHandler
public SwitchingFunctionsHandler()
Simple constructor. Create an empty handler
-
-
Method Detail
-
add
public void add(SwitchingFunction function, double maxCheckInterval, double convergence)
Add a switching function.- Parameters:
function- switching functionmaxCheckInterval- maximal time interval between switching function checks (this interval prevents missing sign changes in case the integration steps becomes very large)convergence- convergence threshold in the event time search
-
isEmpty
public boolean isEmpty()
Check if the handler does not have any condition.- Returns:
- true if handler is empty
-
evaluateStep
public boolean evaluateStep(StepInterpolator interpolator)
Evaluate the impact of the proposed step on all handled switching functions.- Parameters:
interpolator- step interpolator for the proposed step- Returns:
- true if at least one switching function triggers an event before the end of the proposed step (this implies the step should be rejected)
-
getEventTime
public double getEventTime()
Get the occurrence time of the first event triggered in the last evaluated step.- Returns:
- occurrence time of the first event triggered in the last evaluated step, or Double.NaN if no event is triggered
-
stepAccepted
public void stepAccepted(double t, double[] y)Inform the switching functions that the step has been accepted by the integrator.- Parameters:
t- value of the independant time variable at the end of the stepy- array containing the current value of the state vector at the end of the step
-
stop
public boolean stop()
Check if the integration should be stopped at the end of the current step.- Returns:
- true if the integration should be stopped
-
reset
public boolean reset(double t, double[] y)Let the switching functions reset the state if they want.- Parameters:
t- value of the independant time variable at the beginning of the next stepy- array were to put the desired state vector at the beginning of the next step- Returns:
- true if the integrator should reset the derivatives too
-
-
DataMelt 3.0 © DataMelt by jWork.ORG