OrekitStepInterpolator.java

  1. /* Copyright 2002-2025 CS GROUP
  2.  * Licensed to CS GROUP (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.frames.Frame;
  19. import org.orekit.propagation.SpacecraftState;
  20. import org.orekit.time.AbsoluteDate;
  21. import org.orekit.utils.PVCoordinatesProvider;
  22. import org.orekit.utils.TimeStampedPVCoordinates;

  23. /** This interface is a space-dynamics aware step interpolator.
  24.  *
  25.  * <p>It mirrors the <code>ODEStateInterpolator</code> interface from <a
  26.  * href="https://hipparchus.org/">Hipparchus</a> but
  27.  * provides a space-dynamics interface to the methods.</p>
  28.  * @author Luc Maisonobe
  29.  */
  30. public interface OrekitStepInterpolator extends PVCoordinatesProvider {

  31.     /**
  32.      * Get the state at previous grid point date.
  33.      * @return state at previous grid point date
  34.      */
  35.     SpacecraftState getPreviousState();

  36.     /**
  37.      * Determines if the {@link #getPreviousState() previous state} is computed directly
  38.      * by the integrator, or if it is calculated using {@link #getInterpolatedState(AbsoluteDate)
  39.      * interpolation}.
  40.      *
  41.      * <p> Typically the previous state is directly computed by the integrator, but when
  42.      * events are detected the steps are shortened so that events occur on step boundaries
  43.      * which means the previous state may be computed by the interpolator.
  44.      *
  45.      * @return {@code true} if the previous state was calculated by the interpolator and
  46.      * false if it was computed directly by the integrator.
  47.      */
  48.     boolean isPreviousStateInterpolated();

  49.     /**
  50.      * Get the state at current grid point date.
  51.      * @return state at current grid point date
  52.      */
  53.     SpacecraftState getCurrentState();

  54.     /**
  55.      * Determines if the {@link #getCurrentState() current state} is computed directly by
  56.      * the integrator, or if it is calculated using {@link #getInterpolatedState(AbsoluteDate)
  57.      * interpolation}.
  58.      *
  59.      * <p> Typically the current state is directly computed by the integrator, but when
  60.      * events are detected the steps are shortened so that events occur on step boundaries
  61.      * which means the current state may be computed by the interpolator.
  62.      *
  63.      * @return {@code true} if the current state was calculated by the interpolator and
  64.      * false if it was computed directly by the integrator.
  65.      */
  66.     boolean isCurrentStateInterpolated();

  67.     /** Get the state at interpolated date.
  68.      * @param date date of the interpolated state
  69.      * @return state at interpolated date
  70.      */
  71.     SpacecraftState getInterpolatedState(AbsoluteDate date);

  72.     /** Check is integration direction is forward in date.
  73.      * @return true if integration is forward in date
  74.      */
  75.     boolean isForward();

  76.     /** Create a new restricted version of the instance.
  77.      * <p>
  78.      * The instance is not changed at all.
  79.      * </p>
  80.      * @param newPreviousState start of the restricted step
  81.      * @param newCurrentState end of the restricted step
  82.      * @return restricted version of the instance
  83.      * @see #getPreviousState()
  84.      * @see #getCurrentState()
  85.      * @since 9.0
  86.      */
  87.     OrekitStepInterpolator restrictStep(SpacecraftState newPreviousState, SpacecraftState newCurrentState);

  88.     /** {@inheritDoc}
  89.      * @since 12.0
  90.      */
  91.     @Override
  92.     default TimeStampedPVCoordinates getPVCoordinates(final AbsoluteDate date, final Frame frame) {
  93.         return getInterpolatedState(date).getPVCoordinates(frame);
  94.     }

  95. }