List of usage examples for org.apache.commons.math3.ode AbstractIntegrator clearStepHandlers
public void clearStepHandlers()
From source file:org.orekit.propagation.semianalytical.dsst.DSSTPropagator.java
/** Method called just before integration. * <p>//from w ww . j a v a 2s .c o m * 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 for (final DSSTForceModel force : mapper.getForceModels()) { force.initialize(aux, meanOnly); } // if required, insert the special short periodics step handler if (!meanOnly) { final InterpolationGrid grid = new VariableStepInterpolationGrid(INTERPOLATION_POINTS_PER_STEP); final ShortPeriodicsHandler spHandler = new ShortPeriodicsHandler(grid); final Collection<StepHandler> stepHandlers = new ArrayList<StepHandler>(); stepHandlers.add(spHandler); final AbstractIntegrator integrator = getIntegrator(); final Collection<StepHandler> existing = integrator.getStepHandlers(); stepHandlers.addAll(existing); integrator.clearStepHandlers(); // add back the existing handlers after the short periodics one for (final StepHandler sp : stepHandlers) { integrator.addStepHandler(sp); } } }
From source file:org.orekit.propagation.semianalytical.dsst.DSSTPropagator.java
/** {@inheritDoc} */ @Override// ww w .j a v a 2 s . co m protected void afterIntegration() throws OrekitException { // remove the special short periodics step handler if added before if (!isMeanOrbit()) { final List<StepHandler> preserved = new ArrayList<StepHandler>(); final AbstractIntegrator integrator = getIntegrator(); for (final StepHandler 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 StepHandler sp : preserved) { integrator.addStepHandler(sp); } } }