Class FieldAbstractDetector<D extends FieldEventDetector<T>,T extends org.hipparchus.RealFieldElement<T>>
- java.lang.Object
-
- org.orekit.propagation.events.FieldAbstractDetector<D,T>
-
- All Implemented Interfaces:
FieldEventDetector<T>
- Direct Known Subclasses:
FieldAltitudeDetector,FieldApsideDetector,FieldDateDetector,FieldEclipseDetector,FieldElevationDetector,FieldNodeDetector
public abstract class FieldAbstractDetector<D extends FieldEventDetector<T>,T extends org.hipparchus.RealFieldElement<T>> extends Object implements FieldEventDetector<T>
Common parts shared by several orbital events finders.- Author:
- Luc Maisonobe
- See Also:
Propagator.addEventDetector(EventDetector)
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_MAX_ITERDefault cmaximum number of iterations in the event time search.static doubleDEFAULT_MAXCHECKDefault maximum checking interval (s).static doubleDEFAULT_THRESHOLDDefault convergence threshold (s).
-
Constructor Summary
Constructors Modifier Constructor Description protectedFieldAbstractDetector(T maxCheck, T threshold, int maxIter, FieldEventHandler<? super D,T> handler)Build a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Dcreate(T newMaxCheck, T newThreshold, int newMaxIter, FieldEventHandler<? super D,T> newHandler)Build a new instance.FieldEventHandler.ActioneventOccurred(FieldSpacecraftState<T> s, boolean increasing)Handle the event.abstract Tg(FieldSpacecraftState<T> s)Compute the value of the switching function.FieldEventHandler<? super D,T>getHandler()Get the handler.TgetMaxCheckInterval()Get maximal time interval between switching function checks.intgetMaxIterationCount()Get maximal number of iterations in the event time search.TgetThreshold()Get the convergence threshold in the event time search.voidinit(FieldSpacecraftState<T> s0, FieldAbsoluteDate<T> t)Initialize event handler at the start of a propagation.booleanisForward()Check if the current propagation is forward or backward.FieldSpacecraftState<T>resetState(FieldSpacecraftState<T> oldState)Reset the state prior to continue propagation.DwithHandler(FieldEventHandler<? super D,T> newHandler)Setup the event handler to call at event occurrences.DwithMaxCheck(T newMaxCheck)Setup the maximum checking interval.DwithMaxIter(int newMaxIter)Setup the maximum number of iterations in the event time search.DwithThreshold(T newThreshold)Setup the convergence threshold.
-
-
-
Field Detail
-
DEFAULT_MAXCHECK
public static final double DEFAULT_MAXCHECK
Default maximum checking interval (s).- See Also:
- Constant Field Values
-
DEFAULT_THRESHOLD
public static final double DEFAULT_THRESHOLD
Default convergence threshold (s).- See Also:
- Constant Field Values
-
DEFAULT_MAX_ITER
public static final int DEFAULT_MAX_ITER
Default cmaximum number of iterations in the event time search.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FieldAbstractDetector
protected FieldAbstractDetector(T maxCheck, T threshold, int maxIter, FieldEventHandler<? super D,T> handler)
Build a new instance.- Parameters:
maxCheck- maximum checking interval (s)threshold- convergence threshold (s)maxIter- maximum number of iterations in the event time searchhandler- event handler to call at event occurrences
-
-
Method Detail
-
init
public void init(FieldSpacecraftState<T> s0, FieldAbsoluteDate<T> t)
Initialize event handler at the start of a propagation.This method is called once at the start of the propagation. It may be used by the event handler to initialize some internal data if needed.
The default implementation does nothing
- Specified by:
initin interfaceFieldEventDetector<D extends FieldEventDetector<T>>- Parameters:
s0- initial statet- target time for the integration
-
g
public abstract T g(FieldSpacecraftState<T> s)
Compute the value of the switching function. This function must be continuous (at least in its roots neighborhood), as the integrator will need to find its roots to locate the events.- Specified by:
gin interfaceFieldEventDetector<D extends FieldEventDetector<T>>- Parameters:
s- the current state information: date, kinematics, attitude- Returns:
- value of the switching function
-
getMaxCheckInterval
public T getMaxCheckInterval()
Get maximal time interval between switching function checks.- Specified by:
getMaxCheckIntervalin interfaceFieldEventDetector<D extends FieldEventDetector<T>>- Returns:
- maximal time interval (s) between switching function checks
-
getMaxIterationCount
public int getMaxIterationCount()
Get maximal number of iterations in the event time search.- Specified by:
getMaxIterationCountin interfaceFieldEventDetector<D extends FieldEventDetector<T>>- Returns:
- maximal number of iterations in the event time search
-
getThreshold
public T getThreshold()
Get the convergence threshold in the event time search.- Specified by:
getThresholdin interfaceFieldEventDetector<D extends FieldEventDetector<T>>- Returns:
- convergence threshold (s)
-
withMaxCheck
public D withMaxCheck(T newMaxCheck)
Setup the maximum checking interval.This will override a maximum checking interval if it has been configured previously.
- Parameters:
newMaxCheck- maximum checking interval (s)- Returns:
- a new detector with updated configuration (the instance is not changed)
- Since:
- 6.1
-
withMaxIter
public D withMaxIter(int newMaxIter)
Setup the maximum number of iterations in the event time search.This will override a number of iterations if it has been configured previously.
- Parameters:
newMaxIter- maximum number of iterations in the event time search- Returns:
- a new detector with updated configuration (the instance is not changed)
- Since:
- 6.1
-
withThreshold
public D withThreshold(T newThreshold)
Setup the convergence threshold.This will override a convergence threshold if it has been configured previously.
- Parameters:
newThreshold- convergence threshold (s)- Returns:
- a new detector with updated configuration (the instance is not changed)
- Since:
- 6.1
-
withHandler
public D withHandler(FieldEventHandler<? super D,T> newHandler)
Setup the event handler to call at event occurrences.This will override a handler if it has been configured previously.
- Parameters:
newHandler- event handler to call at event occurrences- Returns:
- a new detector with updated configuration (the instance is not changed)
- Since:
- 6.1
-
getHandler
public FieldEventHandler<? super D,T> getHandler()
Get the handler.- Returns:
- event handler to call at event occurrences
-
eventOccurred
public FieldEventHandler.Action eventOccurred(FieldSpacecraftState<T> s, boolean increasing)
Handle the event.- Specified by:
eventOccurredin interfaceFieldEventDetector<D extends FieldEventDetector<T>>- Parameters:
s- SpaceCraft state to be used in the evaluationincreasing- with the event occurred in an "increasing" or "decreasing" slope direction- Returns:
- the Action that the calling detector should pass back to the evaluation system
-
resetState
public FieldSpacecraftState<T> resetState(FieldSpacecraftState<T> oldState)
Reset the state prior to continue propagation.This method is called after the step handler has returned and before the next step is started, but only when
FieldEventDetector.eventOccurred(org.orekit.propagation.FieldSpacecraftState<T>, boolean)has itself returned theFieldEventHandler.Action.RESET_STATEindicator. It allows the user to reset the state for the next step, without perturbing the step handler of the finishing step. If theFieldEventDetector.eventOccurred(org.orekit.propagation.FieldSpacecraftState<T>, boolean)never returns theFieldEventHandler.Action.RESET_STATEindicator, this function will never be called, and it is safe to simply return null.The default implementation simply returns its argument.
- Specified by:
resetStatein interfaceFieldEventDetector<D extends FieldEventDetector<T>>- Parameters:
oldState- old state- Returns:
- new state
-
create
protected abstract D create(T newMaxCheck, T newThreshold, int newMaxIter, FieldEventHandler<? super D,T> newHandler)
Build a new instance.- Parameters:
newMaxCheck- maximum checking interval (s)newThreshold- convergence threshold (s)newMaxIter- maximum number of iterations in the event time searchnewHandler- event handler to call at event occurrences- Returns:
- a new instance of the appropriate sub-type
-
isForward
public boolean isForward()
Check if the current propagation is forward or backward.- Returns:
- true if the current propagation is forward
- Since:
- 7.2
-
-