Search in sources :

Example 1 with ODEStepHandler

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);
        }
    }
}
Also used : ODEIntegrator(org.hipparchus.ode.ODEIntegrator) ArrayList(java.util.ArrayList) ODEStepHandler(org.hipparchus.ode.sampling.ODEStepHandler)

Example 2 with ODEStepHandler

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);
        }
    }
}
Also used : ShortPeriodTerms(org.orekit.propagation.semianalytical.dsst.forces.ShortPeriodTerms) ODEIntegrator(org.hipparchus.ode.ODEIntegrator) ArrayList(java.util.ArrayList) ODEStepHandler(org.hipparchus.ode.sampling.ODEStepHandler) DSSTForceModel(org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel) AuxiliaryElements(org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements)

Aggregations

ArrayList (java.util.ArrayList)2 ODEIntegrator (org.hipparchus.ode.ODEIntegrator)2 ODEStepHandler (org.hipparchus.ode.sampling.ODEStepHandler)2 DSSTForceModel (org.orekit.propagation.semianalytical.dsst.forces.DSSTForceModel)1 ShortPeriodTerms (org.orekit.propagation.semianalytical.dsst.forces.ShortPeriodTerms)1 AuxiliaryElements (org.orekit.propagation.semianalytical.dsst.utilities.AuxiliaryElements)1