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
19 import org.orekit.frames.Frame;
20 import org.orekit.propagation.SpacecraftState;
21 import org.orekit.time.AbsoluteDate;
22 import org.orekit.utils.PVCoordinatesProvider;
23 import org.orekit.utils.TimeStampedPVCoordinates;
24
25 /** This interface is a space-dynamics aware step interpolator.
26 *
27 * <p>It mirrors the <code>ODEStateInterpolator</code> interface from <a
28 * href="https://hipparchus.org/">Hipparchus</a> but
29 * provides a space-dynamics interface to the methods.</p>
30 * @author Luc Maisonobe
31 */
32 public interface OrekitStepInterpolator extends PVCoordinatesProvider {
33
34 /**
35 * Get the state at previous grid point date.
36 * @return state at previous grid point date
37 */
38 SpacecraftState getPreviousState();
39
40 /**
41 * Determines if the {@link #getPreviousState() previous state} is computed directly
42 * by the integrator, or if it is calculated using {@link #getInterpolatedState(AbsoluteDate)
43 * interpolation}.
44 *
45 * <p> Typically the previous state is directly computed by the integrator, but when
46 * events are detected the steps are shortened so that events occur on step boundaries
47 * which means the previous state may be computed by the interpolator.
48 *
49 * @return {@code true} if the previous state was calculated by the interpolator and
50 * false if it was computed directly by the integrator.
51 */
52 boolean isPreviousStateInterpolated();
53
54 /**
55 * Get the state at current grid point date.
56 * @return state at current grid point date
57 */
58 SpacecraftState getCurrentState();
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 */
78 SpacecraftState getInterpolatedState(AbsoluteDate date);
79
80 /** Check is integration direction is forward in date.
81 * @return true if integration is forward in date
82 */
83 boolean isForward();
84
85 /** Create a new restricted version of the instance.
86 * <p>
87 * The instance is not changed at all.
88 * </p>
89 * @param newPreviousState start of the restricted step
90 * @param newCurrentState end of the restricted step
91 * @return restricted version of the instance
92 * @see #getPreviousState()
93 * @see #getCurrentState()
94 * @since 9.0
95 */
96 OrekitStepInterpolator restrictStep(SpacecraftState newPreviousState, SpacecraftState newCurrentState);
97
98 /** {@inheritDoc}
99 * @since 12.0
100 */
101 @Override
102 default TimeStampedPVCoordinates getPVCoordinates(final AbsoluteDate date, final Frame frame) {
103 return getInterpolatedState(date).getPVCoordinates(frame);
104 }
105
106 }