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  
19  import org.orekit.errors.OrekitException;
20  import org.orekit.propagation.SpacecraftState;
21  import org.orekit.time.AbsoluteDate;
22  
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 {
31  
32      /**
33       * Get the state at previous grid point date.
34       * @return state at previous grid point date
35       * @exception OrekitException if state cannot be retrieved
36       */
37      SpacecraftState getPreviousState() throws OrekitException;
38  
39      /**
40       * Determines if the {@link #getPreviousState() previous state} is computed directly
41       * by the integrator, or if it is calculated using {@link #getInterpolatedState(AbsoluteDate)
42       * interpolation}.
43       *
44       * <p> Typically the previous state is directly computed by the integrator, but when
45       * events are detected the steps are shortened so that events occur on step boundaries
46       * which means the previous state may be computed by the interpolator.
47       *
48       * @return {@code true} if the previous state was calculated by the interpolator and
49       * false if it was computed directly by the integrator.
50       */
51      boolean isPreviousStateInterpolated();
52  
53      /**
54       * Get the state at current grid point date.
55       * @return state at current grid point date
56       * @exception OrekitException if state cannot be retrieved
57       */
58      SpacecraftState getCurrentState() throws OrekitException;
59  
60      /**
61       * Determines if the {@link #getCurrentState() current state} is computed directly by
62       * the integrator, or if it is calculated using {@link #getInterpolatedState(AbsoluteDate)
63       * interpolation}.
64       *
65       * <p> Typically the current state is directly computed by the integrator, but when
66       * events are detected the steps are shortened so that events occur on step boundaries
67       * which means the current state may be computed by the interpolator.
68       *
69       * @return {@code true} if the current state was calculated by the interpolator and
70       * false if it was computed directly by the integrator.
71       */
72      boolean isCurrentStateInterpolated();
73  
74      /** Get the state at interpolated date.
75       * @param date date of the interpolated state
76       * @return state at interpolated date
77       * @exception OrekitException if underlying interpolator cannot handle
78       * the date
79       */
80      SpacecraftState getInterpolatedState(AbsoluteDate date)
81          throws OrekitException;
82  
83      /** Check is integration direction is forward in date.
84       * @return true if integration is forward in date
85       */
86      boolean isForward();
87  
88      /** Create a new restricted version of the instance.
89       * <p>
90       * The instance is not changed at all.
91       * </p>
92       * @param newPreviousState start of the restricted step
93       * @param newCurrentState end of the restricted step
94       * @return restricted version of the instance
95       * @exception OrekitException if state cannot be converted
96       * @see #getPreviousState()
97       * @see #getCurrentState()
98       * @since 9.0
99       */
100     OrekitStepInterpolator restrictStep(SpacecraftState newPreviousState, SpacecraftState newCurrentState)
101         throws OrekitException;
102 
103 }