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