Пример #1
0
  /**
   * Method called just before integration.
   *
   * <p>The default implementation does nothing, it may be specialized in subclasses.
   *
   * @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);
      }
    }
  }
Пример #2
0
  /** {@inheritDoc} */
  @Override
  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);
      }
    }
  }