OrekitFixedStepHandler.java

  1. /* Copyright 2002-2018 CS Systèmes d'Information
  2.  * Licensed to CS Systèmes d'Information (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.propagation.sampling;

  18. import org.orekit.errors.OrekitException;
  19. import org.orekit.propagation.SpacecraftState;
  20. import org.orekit.time.AbsoluteDate;

  21. /** This interface is a space-dynamics aware fixed size step handler.
  22.  *
  23.  * <p>It mirrors the <code>FixedStepHandler</code> interface from <a
  24.  * href="https://hipparchus.org/">Hipparchus</a> but provides
  25.  * a space-dynamics interface to the methods.</p>
  26.  * @author Luc Maisonobe
  27.  */
  28. @FunctionalInterface
  29. public interface OrekitFixedStepHandler {

  30.     /** Initialize step handler at the start of a propagation.
  31.      * <p>
  32.      * This method is called once at the start of the propagation. It
  33.      * may be used by the step handler to initialize some internal data
  34.      * if needed.
  35.      * </p>
  36.      * <p>
  37.      * The default implementation does nothing
  38.      * </p>
  39.      * @param s0 initial state
  40.      * @param t target time for the integration
  41.      * @exception OrekitException if step handler cannot be initialized
  42.      * @deprecated as of 9.0, replaced by {@link #init(SpacecraftState, AbsoluteDate, double)}
  43.      */
  44.     @Deprecated
  45.     default void init(SpacecraftState s0, AbsoluteDate t)
  46.         throws OrekitException {
  47.         // nothing by default
  48.     }

  49.     /** Initialize step handler at the start of a propagation.
  50.      * <p>
  51.      * This method is called once at the start of the propagation. It
  52.      * may be used by the step handler to initialize some internal data
  53.      * if needed.
  54.      * </p>
  55.      * <p>
  56.      * The default implementation currently calls the deprecated
  57.      * {@link #init(SpacecraftState, AbsoluteDate)} which does nothing by
  58.      * default. When that method is removed the default implementation will do
  59.      * nothing.
  60.      * </p>
  61.      * @param s0 initial state
  62.      * @param t target time for the integration
  63.      * @param step the duration in seconds of the fixed step. This value is
  64.      *             positive even if propagation is backwards.
  65.      * @exception OrekitException if step handler cannot be initialized
  66.      * @since 9.0
  67.      */
  68.     default void init(SpacecraftState s0, AbsoluteDate t, double step)
  69.         throws OrekitException {
  70.         // as of 9.0, the default implementation calls the DEPRECATED version
  71.         // without a step size, which does nothing by default but may have
  72.         // been overridden by users
  73.         // When the deprecated version is removed, the default implementation
  74.         // will do nothing
  75.         init(s0, t);
  76.     }

  77.     /** Handle the current step.
  78.      * @param currentState current state at step time
  79.      * @param isLast if true, this is the last integration step
  80.      * @exception OrekitException if step cannot be handled
  81.      */
  82.     void handleStep(SpacecraftState currentState, boolean isLast)
  83.         throws OrekitException;

  84. }