use of org.hipparchus.ode.sampling.ODEStepHandler in project Orekit by CS-SI.
the class DSSTPropagator method afterIntegration.
/**
* {@inheritDoc}
*/
@Override
protected void afterIntegration() throws OrekitException {
// remove the special short periodics step handler if added before
if (!isMeanOrbit()) {
final List<ODEStepHandler> preserved = new ArrayList<ODEStepHandler>();
final ODEIntegrator integrator = getIntegrator();
for (final ODEStepHandler sp : integrator.getStepHandlers()) {
if (!(sp instanceof ShortPeriodicsHandler)) {
preserved.add(sp);
}
}
// clear the list
integrator.clearStepHandlers();
// add back the step handlers that were important for the user
for (final ODEStepHandler sp : preserved) {
integrator.addStepHandler(sp);
}
}
}
use of org.hipparchus.ode.sampling.ODEStepHandler in project Orekit by CS-SI.
the class DSSTPropagator method beforeIntegration.
/**
* Method called just before integration.
* <p>
* The default implementation does nothing, it may be specialized in subclasses.
* </p>
* @param initialState initial state
* @param tEnd target date at which state should be propagated
* @exception OrekitException if hook cannot be run
*/
@Override
protected void beforeIntegration(final SpacecraftState initialState, final AbsoluteDate tEnd) throws OrekitException {
// compute common auxiliary elements
final AuxiliaryElements aux = new AuxiliaryElements(initialState.getOrbit(), I);
// check if only mean elements must be used
final boolean meanOnly = isMeanOrbit();
// initialize all perturbing forces
final List<ShortPeriodTerms> shortPeriodTerms = new ArrayList<ShortPeriodTerms>();
for (final DSSTForceModel force : forceModels) {
shortPeriodTerms.addAll(force.initialize(aux, meanOnly));
}
mapper.setShortPeriodTerms(shortPeriodTerms);
// if required, insert the special short periodics step handler
if (!meanOnly) {
final ShortPeriodicsHandler spHandler = new ShortPeriodicsHandler(forceModels);
final Collection<ODEStepHandler> stepHandlers = new ArrayList<ODEStepHandler>();
stepHandlers.add(spHandler);
final ODEIntegrator integrator = getIntegrator();
final Collection<ODEStepHandler> existing = integrator.getStepHandlers();
stepHandlers.addAll(existing);
integrator.clearStepHandlers();
// add back the existing handlers after the short periodics one
for (final ODEStepHandler sp : stepHandlers) {
integrator.addStepHandler(sp);
}
}
}
Aggregations