/** * 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); } } }
/** {@inheritDoc} */ @Override protected StateMapper createMapper( final AbsoluteDate referenceDate, final double mu, final OrbitType orbitType, final PositionAngle positionAngleType, final AttitudeProvider attitudeProvider, final Frame frame) { // create a mapper with the common settings provided as arguments final MeanPlusShortPeriodicMapper newMapper = new MeanPlusShortPeriodicMapper(referenceDate, mu, attitudeProvider, frame); // copy the specific settings from the existing mapper if (mapper != null) { for (final DSSTForceModel forceModel : mapper.getForceModels()) { newMapper.addForceModel(forceModel); } newMapper.setSatelliteRevolution(mapper.getSatelliteRevolution()); newMapper.setInitialIsOsculating(mapper.initialIsOsculating()); } mapper = newMapper; return mapper; }
/** {@inheritDoc} */ @Override public void setAttitudeProvider(final AttitudeProvider attitudeProvider) { super.setAttitudeProvider(attitudeProvider); // Register the attitude provider for each force model for (final DSSTForceModel force : mapper.getForceModels()) { force.registerAttitudeProvider(attitudeProvider); } }