Package org.orekit.propagation.events
Class FunctionalDetector
- java.lang.Object
-
- org.orekit.propagation.events.AbstractDetector<FunctionalDetector>
-
- org.orekit.propagation.events.FunctionalDetector
-
- All Implemented Interfaces:
Serializable
,EventDetector
public class FunctionalDetector extends AbstractDetector<FunctionalDetector>
A detector that implements theg(SpacecraftState)
function using a lambda that can be set usingwithFunction(ToDoubleFunction)
.For example, to create a simple date detector use:
FunctionalDetector d = new FunctionalDetector() .withGFunction((s) -> s.getDate().durationFrom(triggerDate)) .withMaxCheck(1e10);
- Since:
- 9.2
- Author:
- Evan Ward
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
FunctionalDetector.GFunction
Deprecated.UseToDoubleFunction
instead.
-
Field Summary
-
Fields inherited from class org.orekit.propagation.events.AbstractDetector
DEFAULT_MAX_ITER, DEFAULT_MAXCHECK, DEFAULT_THRESHOLD
-
-
Constructor Summary
Constructors Constructor Description FunctionalDetector()
Create an event detector with the default values.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected FunctionalDetector
create(double newMaxCheck, double newThreshold, int newMaxIter, EventHandler<? super FunctionalDetector> newHandler)
Build a new instance.double
g(SpacecraftState s)
Compute the value of the switching function.ToDoubleFunction<SpacecraftState>
getFunction()
Get the switching function.FunctionalDetector.GFunction
getGFunction()
Deprecated.usegetFunction()
instead.FunctionalDetector
withFunction(ToDoubleFunction<SpacecraftState> newGFunction)
Create a new event detector with a new g function, keeping all other attributes the same.FunctionalDetector
withGFunction(FunctionalDetector.GFunction newGFunction)
Deprecated.UsewithFunction(ToDoubleFunction)
instead.-
Methods inherited from class org.orekit.propagation.events.AbstractDetector
eventOccurred, getHandler, getMaxCheckInterval, getMaxIterationCount, getThreshold, init, isForward, resetState, withHandler, withMaxCheck, withMaxIter, withThreshold
-
-
-
-
Constructor Detail
-
FunctionalDetector
public FunctionalDetector()
Create an event detector with the default values. These areAbstractDetector.DEFAULT_MAXCHECK
,AbstractDetector.DEFAULT_THRESHOLD
,AbstractDetector.DEFAULT_MAX_ITER
,ContinueOnEvent
, and a g function that is identically unity.
-
-
Method Detail
-
g
public double g(SpacecraftState s)
Description copied from class:AbstractDetector
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 interfaceEventDetector
- Specified by:
g
in classAbstractDetector<FunctionalDetector>
- Parameters:
s
- the current state information: date, kinematics, attitude- Returns:
- value of the switching function
-
create
protected FunctionalDetector create(double newMaxCheck, double newThreshold, int newMaxIter, EventHandler<? super FunctionalDetector> newHandler)
Description copied from class:AbstractDetector
Build a new instance.- Specified by:
create
in classAbstractDetector<FunctionalDetector>
- 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
-
withFunction
public FunctionalDetector withFunction(ToDoubleFunction<SpacecraftState> newGFunction)
Create a new event detector with a new g function, keeping all other attributes the same. It is recommended to useAbstractDetector.withMaxCheck(double)
andAbstractDetector.withThreshold(double)
to set appropriate values for this g function.- Parameters:
newGFunction
- the new g function.- Returns:
- a new detector with the new g function.
-
withGFunction
@Deprecated public FunctionalDetector withGFunction(FunctionalDetector.GFunction newGFunction)
Deprecated.UsewithFunction(ToDoubleFunction)
instead. Will be removed in next major release.Create a new event detector with a new g function, keeping all other attributes the same. It is recommended to useAbstractDetector.withMaxCheck(double)
andAbstractDetector.withThreshold(double)
to set appropriate values for this g function.- Parameters:
newGFunction
- the new g function.- Returns:
- a new detector with the new g function.
-
getGFunction
@Deprecated public FunctionalDetector.GFunction getGFunction()
Deprecated.usegetFunction()
instead. Will be removed in next major release.Get the switching function.- Returns:
- the function used in
g(SpacecraftState)
.
-
getFunction
public ToDoubleFunction<SpacecraftState> getFunction()
Get the switching function.- Returns:
- the function used in
g(SpacecraftState)
.
-
-