1 /* Copyright 2002-2019 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.propagation.SpacecraftState;
20 import org.orekit.time.AbsoluteDate;
21
22 /** This interface is a space-dynamics aware fixed size step handler.
23 *
24 * <p>It mirrors the <code>FixedStepHandler</code> interface from <a
25 * href="https://hipparchus.org/">Hipparchus</a> but provides
26 * a space-dynamics interface to the methods.</p>
27 * @author Luc Maisonobe
28 */
29 @FunctionalInterface
30 public interface OrekitFixedStepHandler {
31
32 /** Initialize step handler at the start of a propagation.
33 * <p>
34 * This method is called once at the start of the propagation. It
35 * may be used by the step handler to initialize some internal data
36 * if needed.
37 * </p>
38 * <p>
39 * The default implementation does nothing
40 * </p>
41 * @param s0 initial state
42 * @param t target time for the integration
43 * @deprecated as of 9.0, replaced by {@link #init(SpacecraftState, AbsoluteDate, double)}
44 */
45 @Deprecated
46 default void init(SpacecraftState s0, AbsoluteDate t) {
47 // nothing by default
48 }
49
50 /** Initialize step handler at the start of a propagation.
51 * <p>
52 * This method is called once at the start of the propagation. It
53 * may be used by the step handler to initialize some internal data
54 * if needed.
55 * </p>
56 * <p>
57 * The default implementation currently calls the deprecated
58 * {@link #init(SpacecraftState, AbsoluteDate)} which does nothing by
59 * default. When that method is removed the default implementation will do
60 * nothing.
61 * </p>
62 * @param s0 initial state
63 * @param t target time for the integration
64 * @param step the duration in seconds of the fixed step. This value is
65 * positive even if propagation is backwards.
66 * @since 9.0
67 */
68 default void init(SpacecraftState s0, AbsoluteDate t, double step) {
69 // as of 9.0, the default implementation calls the DEPRECATED version
70 // without a step size, which does nothing by default but may have
71 // been overridden by users
72 // When the deprecated version is removed, the default implementation
73 // will do nothing
74 init(s0, t);
75 }
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 */
81 void handleStep(SpacecraftState currentState, boolean isLast);
82
83 }