Package org.orekit.propagation.events
Class FieldFunctionalDetector<T extends CalculusFieldElement<T>>
- java.lang.Object
-
- org.orekit.propagation.events.FieldAbstractDetector<FieldFunctionalDetector<T>,T>
-
- org.orekit.propagation.events.FieldFunctionalDetector<T>
-
- Type Parameters:
T
- the type of numbers this detector uses.
- All Implemented Interfaces:
FieldEventDetector<T>
public class FieldFunctionalDetector<T extends CalculusFieldElement<T>> extends FieldAbstractDetector<FieldFunctionalDetector<T>,T>
A detector that implements theg(FieldSpacecraftState)
function using a lambda that can be set usingwithFunction(Function)
.For example, to create a simple date detector use:
FieldFunctionalDetector<T> d = new FieldFunctionalDetector<>(field) .withGFunction((s) -> s.getDate().durationFrom(triggerDate)) .withMaxCheck(field.getZero().add(1e10));
- Since:
- 10.2
- Author:
- Evan Ward
-
-
Field Summary
-
Fields inherited from class org.orekit.propagation.events.FieldAbstractDetector
DEFAULT_MAX_ITER, DEFAULT_MAXCHECK, DEFAULT_THRESHOLD
-
-
Constructor Summary
Constructors Modifier Constructor Description FieldFunctionalDetector(Field<T> field)
Create an event detector with the default values.protected
FieldFunctionalDetector(FieldAdaptableInterval<T> maxCheck, T threshold, int maxIter, FieldEventHandler<T> handler, Function<FieldSpacecraftState<T>,T> function)
Private constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FieldFunctionalDetector<T>
create(FieldAdaptableInterval<T> newMaxCheck, T newThreshold, int newMaxIter, FieldEventHandler<T> newHandler)
Build a new instance.T
g(FieldSpacecraftState<T> s)
Compute the value of the switching function.Function<FieldSpacecraftState<T>,T>
getFunction()
Get the switching function.FieldFunctionalDetector<T>
withFunction(Function<FieldSpacecraftState<T>,T> newGFunction)
Create a new event detector with a new g function, keeping all other attributes the same.-
Methods inherited from class org.orekit.propagation.events.FieldAbstractDetector
getHandler, getMaxCheckInterval, getMaxIterationCount, getThreshold, init, isForward, withHandler, withMaxCheck, withMaxCheck, withMaxIter, withThreshold
-
-
-
-
Constructor Detail
-
FieldFunctionalDetector
public FieldFunctionalDetector(Field<T> field)
Create an event detector with the default values. These areFieldAbstractDetector.DEFAULT_MAXCHECK
,FieldAbstractDetector.DEFAULT_THRESHOLD
,FieldAbstractDetector.DEFAULT_MAX_ITER
,ContinueOnEvent
, and a g function that is identically unity.- Parameters:
field
- on which this detector is defined.
-
FieldFunctionalDetector
protected FieldFunctionalDetector(FieldAdaptableInterval<T> maxCheck, T threshold, int maxIter, FieldEventHandler<T> handler, Function<FieldSpacecraftState<T>,T> function)
Private constructor.- Parameters:
maxCheck
- maximum checking intervalthreshold
- convergence threshold (s)maxIter
- maximum number of iterations in the event time searchhandler
- event handler to call at event occurrencesfunction
- the switching function.
-
-
Method Detail
-
g
public T g(FieldSpacecraftState<T> s)
Description copied from class:FieldAbstractDetector
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:
g
in interfaceFieldEventDetector<T extends CalculusFieldElement<T>>
- Specified by:
g
in classFieldAbstractDetector<FieldFunctionalDetector<T extends CalculusFieldElement<T>>,T extends CalculusFieldElement<T>>
- Parameters:
s
- the current state information: date, kinematics, attitude- Returns:
- value of the switching function
-
create
protected FieldFunctionalDetector<T> create(FieldAdaptableInterval<T> newMaxCheck, T newThreshold, int newMaxIter, FieldEventHandler<T> newHandler)
Description copied from class:FieldAbstractDetector
Build a new instance.- Specified by:
create
in classFieldAbstractDetector<FieldFunctionalDetector<T extends CalculusFieldElement<T>>,T extends CalculusFieldElement<T>>
- Parameters:
newMaxCheck
- maximum checking intervalnewThreshold
- 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
-
withFunction
public FieldFunctionalDetector<T> withFunction(Function<FieldSpacecraftState<T>,T> newGFunction)
Create a new event detector with a new g function, keeping all other attributes the same. It is recommended to useFieldAbstractDetector.withMaxCheck(FieldAdaptableInterval)
andFieldAbstractDetector.withThreshold(CalculusFieldElement)
to set appropriate values for this g function.- Parameters:
newGFunction
- the new g function.- Returns:
- a new detector with the new g function.
-
getFunction
public Function<FieldSpacecraftState<T>,T> getFunction()
Get the switching function.- Returns:
- the function used in
g(FieldSpacecraftState)
.
-
-