public class NumericalPropagatorDefinition extends DefinitionalObject
The definitional object that creates a NumericalPropagator
.
It consists of the overall propagation state which represents individual scalar,
vector, or custom parameters within
IntegrationElements
(get
) (which are integrated during propagation),
and the AuxiliaryElements
(get
) (which are not). It also contains
StateCorrectors
(get
) which correct the IntegrationElements and their derivatives
in between propagation steps, the Epoch
(get
/ set
) of the initial conditions,
and the Integrator
(get
/ set
) which integrates the IntegrationElements.
Call NumericalPropagatorDefinition.createPropagator()
in order to create the defined NumericalPropagator
.
Modifier | Constructor and Description |
---|---|
|
NumericalPropagatorDefinition()
Initializes a new instance.
|
protected |
NumericalPropagatorDefinition(NumericalPropagatorDefinition existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
Modifier and Type | Method and Description |
---|---|
void |
add(AuxiliaryStateElement auxiliaryElement)
Adds the given auxiliary element to the set of
AuxiliaryElements (get )
which will be computed during propagation and stored in the raw state output. |
void |
add(PropagationStateCorrector corrector)
|
void |
add(PropagationStateElement stateElement)
Adds the given state element to the set of
IntegrationElements (get )
to be integrated by the NumericalPropagator . |
protected boolean |
checkForSameDefinition(DefinitionalObject other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
protected boolean |
checkForSameDefinition(NumericalPropagatorDefinition other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
Object |
clone(CopyContext context)
Clones this object using the specified context.
|
protected int |
computeCurrentDefinitionHashCode()
Computes a hash code based on the current properties of this object.
|
NumericalPropagatorState |
createNumericalPropagatorState()
Creates a
NumericalPropagatorState based on the current settings of this
NumericalPropagatorDefinition . |
NumericalPropagatorState |
createNumericalPropagatorState(EvaluatorGroup group)
Creates a
NumericalPropagatorState based on the current settings of this
NumericalPropagatorDefinition . |
NumericalPropagator |
createPropagator()
Creates an object which can propagate the state over spans of time
or manually step the state from one time to the next.
|
NumericalPropagator |
createPropagator(boolean includeIntegrationInfo)
Creates an object which can propagate the state over spans of time
or manually step the state from one time to the next.
|
NumericalPropagator |
createPropagator(boolean includeIntegrationInfo,
EvaluatorGroup group)
Creates an object which can propagate the state over spans of time
or manually step the state from one time to the next.
|
NumericalPropagator |
createPropagator(EvaluatorGroup group)
Creates an object which can propagate the state over spans of time
or manually step the state from one time to the next.
|
NumericalPropagator |
createPropagatorWithoutComputingAuxiliaryState()
Creates an object which can propagate the state over spans of time
or manually step the state from one time to the next.
|
NumericalPropagator |
createPropagatorWithoutComputingAuxiliaryState(boolean includeIntegrationInfo)
Creates an object which can propagate the state over spans of time
or manually step the state from one time to the next.
|
NumericalPropagator |
createPropagatorWithoutComputingAuxiliaryState(boolean includeIntegrationInfo,
EvaluatorGroup group)
Creates an object which can propagate the state over spans of time
or manually step the state from one time to the next.
|
NumericalPropagator |
createPropagatorWithoutComputingAuxiliaryState(EvaluatorGroup group)
Creates an object which can propagate the state over spans of time
or manually step the state from one time to the next.
|
void |
enumerateDependencies(DependencyEnumerator enumerator)
Enumerates the dependencies of this object by calling
DependencyEnumerator#enumerate(T) for each object that this object directly depends upon. |
protected void |
freezeAggregatedObjects()
Called by
DefinitionalObject.freeze() to also freeze any objects that are considered to be a part of this object. |
Collection<AuxiliaryStateElement> |
getAuxiliaryElements()
Gets the collection of
AuxiliaryStateElements which together
define the auxiliary output from the propagator. |
boolean |
getComputeInitialConditionsOnCreation()
Gets or sets a value indicating whether
propagators created by this
definition will have the initial conditions of
their IncludeHighestDerivativeInOutput (get / set )
and auxiliary elements computed in their
CurrentState (get ) just after creation. |
JulianDate |
getEpoch()
Gets the time at which the initial conditions for each
PropagationStateElement are defined. |
Collection<PropagationStateElement> |
getIntegrationElements()
Gets the collection of
IntegrationStateElements which together
define the state for the numerical integrator. |
NumericalIntegrator |
getIntegrator()
|
PropagationStageParameter |
getPhaseParameter()
Gets a parameter which represents the propagation phase.
|
Collection<PropagationStateCorrector> |
getStateCorrectors()
Gets the collection of correctors which are called after each step but before values are recorded.
|
PropagationStateParameter |
getStateParameter()
Gets a parameter which represents the state during propagation.
|
boolean |
remove(AuxiliaryStateElement auxiliaryElement)
Remove the given auxiliary element from the propagation.
|
boolean |
remove(PropagationStateCorrector corrector)
Remove the given state corrector from the propagation.
|
boolean |
remove(PropagationStateElement stateElement)
Remove the given state element from the representation of the state.
|
void |
setComputeInitialConditionsOnCreation(boolean value)
Gets or sets a value indicating whether
propagators created by this
definition will have the initial conditions of
their IncludeHighestDerivativeInOutput (get / set )
and auxiliary elements computed in their
CurrentState (get ) just after creation. |
void |
setEpoch(JulianDate value)
Sets the time at which the initial conditions for each
PropagationStateElement are defined. |
void |
setIntegrator(NumericalIntegrator value)
|
void |
setPhaseParameter(PropagationStageParameter value)
Sets a parameter which represents the propagation phase.
|
void |
setStateParameter(PropagationStateParameter value)
Sets a parameter which represents the state during propagation.
|
areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, dictionaryItemsAreSameDefinition, freeze, getCollectionHashCode, getCollectionHashCode, getCollectionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDictionaryHashCode, getIsFrozen, isSameDefinition, throwIfFrozen
public NumericalPropagatorDefinition()
protected NumericalPropagatorDefinition(@Nonnull NumericalPropagatorDefinition existingInstance, @Nonnull CopyContext context)
See ICloneWithContext.clone(CopyContext)
for more information about how to implement this constructor
in a derived class.
existingInstance
- The existing instance to copy.context
- A CopyContext
that controls the depth of the copy.ArgumentNullException
- Thrown when existingInstance
or context
is null
.public Object clone(CopyContext context)
This method should be implemented to call a copy constructor on the class of the
object being cloned. The copy constructor should take the CopyContext
as a parameter
in addition to the existing instance to copy. The copy constructor should first call
CopyContext.addObjectMapping(T, T)
to identify the newly constructed instance
as a copy of the existing instance. It should then copy all fields, using
CopyContext.updateReference(T)
to copy any reference fields.
A typical implementation of ICloneWithContext
:
public static class MyClass implements ICloneWithContext {
public MyClass(MyClass existingInstance, CopyContext context) {
context.addObjectMapping(existingInstance, this);
someReference = context.updateReference(existingInstance.someReference);
}
@Override
public final Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
}
In general, all fields that are reference types should be copied with a call to
CopyContext.updateReference(T)
. There are a couple of exceptions:
If one of these exceptions applies, the CopyContext
should be given an opportunity
to update the reference before the reference is copied explicitly. Use
CopyContext.updateReference(T)
to update the reference. If CopyContext.updateReference(T)
returns
the original object, indicating that the context does not have a replacement registered,
then copy the object manually by invoking a Clone method, a copy constructor, or by manually
constructing a new instance and copying the values.
alwaysCopy = context.updateReference(existingInstance.alwaysCopy);
if (existingInstance.alwaysCopy != null && alwaysCopy == existingInstance.alwaysCopy) {
alwaysCopy = (AlwaysCopy) existingInstance.alwaysCopy.clone(context);
}
If you are implementing an evaluator (a class that implements IEvaluator
), the
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
method shares some responsibilities with the
copy context constructor. Code duplication can be avoided by doing the following:
CopyContext.updateReference(T)
. You should still call CopyContext.updateReference(T)
on any references to
non-evaluators.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as the last line in the constructor and pass it the
same CopyContext
passed to the constructor.
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
as normal. See the reference documentation for
IEvaluator.updateEvaluatorReferences(agi.foundation.infrastructure.CopyContext)
for more information on implementing that method.
public MyClass(MyClass existingInstance, CopyContext context) {
super(existingInstance, context);
someReference = context.updateReference(existingInstance.someReference);
evaluatorReference = existingInstance.evaluatorReference;
updateEvaluatorReferences(context);
}
@Override
public void updateEvaluatorReferences(CopyContext context) {
evaluatorReference = context.updateReference(evaluatorReference);
}
@Override
public Object clone(CopyContext context) {
return new MyClass(this, context);
}
private Object someReference;
private IEvaluator evaluatorReference;
clone
in interface ICloneWithContext
clone
in class DefinitionalObject
context
- The context to use to perform the copy.protected final boolean checkForSameDefinition(DefinitionalObject other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.checkForSameDefinition
in class DefinitionalObject
other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected boolean checkForSameDefinition(NumericalPropagatorDefinition other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected int computeCurrentDefinitionHashCode()
NumericalPropagatorDefinition.checkForSameDefinition(agi.foundation.infrastructure.DefinitionalObject)
method.computeCurrentDefinitionHashCode
in class DefinitionalObject
public void enumerateDependencies(DependencyEnumerator enumerator)
DependencyEnumerator#enumerate(T)
for each object that this object directly depends upon.
Derived classes which contain additional dependencies MUST override this method, call the base
implementation, and enumerate dependencies introduced by the derived class.enumerateDependencies
in interface IEnumerateDependencies
enumerateDependencies
in class DefinitionalObject
enumerator
- The enumerator that is informed of the dependencies of this object.protected void freezeAggregatedObjects()
DefinitionalObject.freeze()
to also freeze any objects that are considered to be a part of this object.
Derived classes which contain additional aggregated objects MUST override this method, call the base
implementation, and freeze aggregated objects introduced by the derived class. The objects that need to be
frozen in this method are frequently created in this object's constructor and are not settable via
properties.freezeAggregatedObjects
in class DefinitionalObject
@Nonnull public final JulianDate getEpoch()
PropagationStateElement
are defined.public final void setEpoch(@Nonnull JulianDate value)
PropagationStateElement
are defined.public final NumericalIntegrator getIntegrator()
public final void setIntegrator(NumericalIntegrator value)
public final PropagationStateParameter getStateParameter()
NumericalPropagator
inside their implementation in order to produce their values. In such cases, it may
be necessary to distinguish between the state of the exterior propagator and the
state of the interior propagator. In these cases, it is up to the user to ensure
that both the NumericalPropagatorDefinition
and all of its elements are configured with the same parameter.
Otherwise, the definition will throw an exception when creating its propagator.public final void setStateParameter(PropagationStateParameter value)
NumericalPropagator
inside their implementation in order to produce their values. In such cases, it may
be necessary to distinguish between the state of the exterior propagator and the
state of the interior propagator. In these cases, it is up to the user to ensure
that both the NumericalPropagatorDefinition
and all of its elements are configured with the same parameter.
Otherwise, the definition will throw an exception when creating its propagator.public final PropagationStageParameter getPhaseParameter()
NumericalPropagator
objects are running in the same EvaluatorGroup
,
such as when elements of a state require additional instances of a NumericalPropagator
inside their implementation in order to produce their values. In such cases, it may
be necessary to distinguish between the phase of the exterior propagator and the
phase of the interior propagator. In these cases, it is up to the user to ensure
that both the NumericalPropagatorDefinition
and all of its elements are configured with the same parameter.
Otherwise, the definition will throw an exception when creating its propagator.public final void setPhaseParameter(PropagationStageParameter value)
NumericalPropagator
objects are running in the same EvaluatorGroup
,
such as when elements of a state require additional instances of a NumericalPropagator
inside their implementation in order to produce their values. In such cases, it may
be necessary to distinguish between the phase of the exterior propagator and the
phase of the interior propagator. In these cases, it is up to the user to ensure
that both the NumericalPropagatorDefinition
and all of its elements are configured with the same parameter.
Otherwise, the definition will throw an exception when creating its propagator.public final boolean getComputeInitialConditionsOnCreation()
Gets or sets a value indicating whether propagators
created by this
definition
will have the initial conditions of
their IncludeHighestDerivativeInOutput
(get
/ set
)
and auxiliary elements
computed in their
CurrentState
(get
) just after creation.
This is set to true
by default, however in some advanced use cases part of the propagation state
is parameterized separately from the main propagator and not available for evaluation during the propagation creation
process.
If you are receiving exceptions from invalid parameterization during propagator creation setting this to
false
is a possible fix. In that case right after the NumericalPropagator
is created
its CurrentState
(get
) will have the correct initial state values that were
specified during the initialization of the state elements
. However, the indices
representing the auxiliary elements
, or the
IncludeHighestDerivativeInOutput
(get
/ set
) information of the state
elements if applicable, will read 0.0 instead of their actual value.
Once propagation begins, or Reset
is called the state array will have the correct values.
public final void setComputeInitialConditionsOnCreation(boolean value)
Gets or sets a value indicating whether propagators
created by this
definition
will have the initial conditions of
their IncludeHighestDerivativeInOutput
(get
/ set
)
and auxiliary elements
computed in their
CurrentState
(get
) just after creation.
This is set to true
by default, however in some advanced use cases part of the propagation state
is parameterized separately from the main propagator and not available for evaluation during the propagation creation
process.
If you are receiving exceptions from invalid parameterization during propagator creation setting this to
false
is a possible fix. In that case right after the NumericalPropagator
is created
its CurrentState
(get
) will have the correct initial state values that were
specified during the initialization of the state elements
. However, the indices
representing the auxiliary elements
, or the
IncludeHighestDerivativeInOutput
(get
/ set
) information of the state
elements if applicable, will read 0.0 instead of their actual value.
Once propagation begins, or Reset
is called the state array will have the correct values.
@Nonnull public final Collection<PropagationStateElement> getIntegrationElements()
IntegrationStateElements
which together
define the state for the numerical integrator.@Nonnull public final Collection<AuxiliaryStateElement> getAuxiliaryElements()
AuxiliaryStateElements
which together
define the auxiliary output from the propagator. These values are computed after each step based on
the calculations performed during integration but are not integrated themselves.@Nonnull public final Collection<PropagationStateCorrector> getStateCorrectors()
public final void add(PropagationStateElement stateElement)
IntegrationElements
(get
)
to be integrated by the NumericalPropagator
.stateElement
- The state element to add to the state.public final void add(AuxiliaryStateElement auxiliaryElement)
AuxiliaryElements
(get
)
which will be computed during propagation and stored in the raw state output.auxiliaryElement
- The auxiliary element to add to the propagation.public final void add(PropagationStateCorrector corrector)
StateCorrectors
(get
)
which will operate on some or all of the IntegrationElements
(get
)
during propagation.corrector
- The corrector to add to the propagation.public final boolean remove(PropagationStateElement stateElement)
stateElement
- The state element to remove from the state.true
if the state element was found and successfully removed; otherwise false
.public final boolean remove(AuxiliaryStateElement auxiliaryElement)
auxiliaryElement
- The auxiliary element to remove from propagation.true
if the auxiliary element was found and successfully removed; otherwise false
.public final boolean remove(PropagationStateCorrector corrector)
corrector
- The state corrector to remove from propagation.true
if the state corrector was found and successfully removed; otherwise false
.@Nonnull public final NumericalPropagator createPropagator()
@Nonnull public final NumericalPropagator createPropagator(boolean includeIntegrationInfo)
includeIntegrationInfo
- Indicates whether to store meta-data from the integrator in the output.@Nonnull public final NumericalPropagator createPropagator(@Nonnull EvaluatorGroup group)
group
- The group to use to create and parameterize all the evaluators
associated with the state for use during propagation.@Nonnull public final NumericalPropagator createPropagator(boolean includeIntegrationInfo, @Nonnull EvaluatorGroup group)
includeIntegrationInfo
- Indicates whether to store meta-data from the integrator in the output.group
- The group to use to create and parameterize all the evaluators
associated with the state for use during propagation.@Nonnull public final NumericalPropagator createPropagatorWithoutComputingAuxiliaryState()
Creates an object which can propagate the state over spans of time or manually step the state from one time to the next.
This method differs from the similar NumericalPropagatorDefinition.createPropagator()
in that
the resulting NumericalPropagator's
CurrentState
(get
) will have a zeroed auxiliary elements.
This can be necessary when working with advanced use cases where part of the propagation state
is parameterized separately from the main propagator, and thus unavailable for calculating initial auxiliary elements.
@Nonnull public final NumericalPropagator createPropagatorWithoutComputingAuxiliaryState(boolean includeIntegrationInfo)
Creates an object which can propagate the state over spans of time or manually step the state from one time to the next.
This method differs from the similar NumericalPropagatorDefinition.createPropagator(boolean)
in that
the resulting NumericalPropagator's
CurrentState
(get
) will have a zeroed auxiliary elements.
This can be necessary when working with advanced use cases where part of the propagation state
is parameterized separately from the main propagator, and thus unavailable for calculating initial auxiliary elements.
includeIntegrationInfo
- Indicates whether to store meta-data from the integrator in the output.@Nonnull public final NumericalPropagator createPropagatorWithoutComputingAuxiliaryState(@Nonnull EvaluatorGroup group)
Creates an object which can propagate the state over spans of time or manually step the state from one time to the next.
This method differs from the similar NumericalPropagatorDefinition.createPropagator(EvaluatorGroup)
in that
the resulting NumericalPropagator's
CurrentState
(get
) will have a zeroed auxiliary elements.
This can be necessary when working with advanced use cases where part of the propagation state
is parameterized separately from the main propagator, and thus unavailable for calculating initial auxiliary elements.
group
- The group to use to create and parameterize all the evaluators
associated with the state for use during propagation.@Nonnull public final NumericalPropagator createPropagatorWithoutComputingAuxiliaryState(boolean includeIntegrationInfo, @Nonnull EvaluatorGroup group)
Creates an object which can propagate the state over spans of time or manually step the state from one time to the next.
This method differs from the similar NumericalPropagatorDefinition.createPropagator(boolean,EvaluatorGroup)
in that
the resulting NumericalPropagator's
CurrentState
(get
) will have a zeroed auxiliary elements.
This can be necessary when working with advanced use cases where part of the propagation state
is parameterized separately from the main propagator, and thus unavailable for calculating initial auxiliary elements.
includeIntegrationInfo
- Indicates whether to store meta-data from the integrator in the output.group
- The group to use to create and parameterize all the evaluators
associated with the state for use during propagation.@Nonnull public final NumericalPropagatorState createNumericalPropagatorState()
NumericalPropagatorState
based on the current settings of this
NumericalPropagatorDefinition
.NumericalPropagatorState
representing the current settings of this
NumericalPropagatorDefinition
.@Nonnull public final NumericalPropagatorState createNumericalPropagatorState(@Nonnull EvaluatorGroup group)
NumericalPropagatorState
based on the current settings of this
NumericalPropagatorDefinition
.group
- The EvaluatorGroup
to use when initializing values in the
returned state.NumericalPropagatorState
representing the current settings of this
NumericalPropagatorDefinition
.