1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF 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 * https://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 18 /* 19 * This is not the original file distributed by the Apache Software Foundation 20 * It has been modified by the Hipparchus project 21 */ 22 23 package org.hipparchus.ode.sampling; 24 25 import org.hipparchus.CalculusFieldElement; 26 import org.hipparchus.ode.FieldODEStateAndDerivative; 27 28 /** 29 * This interface represents a handler that should be called after 30 * each successful step. 31 * 32 * <p>The ODE integrators compute the evolution of the state vector at 33 * some grid points that depend on their own internal algorithm. Once 34 * they have found a new grid point (possibly after having computed 35 * several evaluation of the derivative at intermediate points), they 36 * provide it to objects implementing this interface. These objects 37 * typically either ignore the intermediate steps and wait for the 38 * last one, store the points in an ephemeris, or forward them to 39 * specialized processing or output methods.</p> 40 * 41 * @see org.hipparchus.ode.FieldODEIntegrator 42 * @see FieldODEStateInterpolator 43 * @param <T> the type of the field elements 44 */ 45 46 public interface FieldODEStepHandler<T extends CalculusFieldElement<T>> { 47 48 /** Initialize step handler at the start of an ODE integration. 49 * <p> 50 * This method is called once at the start of the integration. It 51 * may be used by the step handler to initialize some internal data 52 * if needed. 53 * </p> 54 * <p> 55 * The default implementation does nothing. 56 * </p> 57 * @param initialState initial time, state vector and derivative 58 * @param finalTime target time for the integration 59 */ 60 default void init(FieldODEStateAndDerivative<T> initialState, T finalTime) { 61 // nothing by default 62 } 63 64 /** 65 * Handle the last accepted step. 66 * @param interpolator interpolator for the last accepted step 67 */ 68 void handleStep(FieldODEStateInterpolator<T> interpolator); 69 70 /** 71 * Finalize integration. 72 * @param finalState state at integration end 73 * @since 2.0 74 */ 75 default void finish(FieldODEStateAndDerivative<T> finalState) { 76 // nothing by default 77 } 78 79 }