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 * 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 18 package org.apache.commons.math4.legacy.ode.sampling; 19 20 import org.apache.commons.math4.legacy.core.RealFieldElement; 21 import org.apache.commons.math4.legacy.ode.FieldODEStateAndDerivative; 22 23 /** This interface represents an interpolator over the last step 24 * during an ODE integration. 25 * 26 * <p>The various ODE integrators provide objects implementing this 27 * interface to the step handlers. These objects are often custom 28 * objects tightly bound to the integrator internal algorithms. The 29 * handlers can use these objects to retrieve the state vector at 30 * intermediate times between the previous and the current grid points 31 * (this feature is often called dense output).</p> 32 * 33 * @param <T> the type of the field elements 34 * @see org.apache.commons.math4.legacy.ode.FirstOrderFieldIntegrator 35 * @see FieldStepHandler 36 * @since 3.6 37 */ 38 39 public interface FieldStepInterpolator<T extends RealFieldElement<T>> { 40 41 /** 42 * Get the state at previous grid point time. 43 * @return state at previous grid point time 44 */ 45 FieldODEStateAndDerivative<T> getPreviousState(); 46 47 /** 48 * Get the state at current grid point time. 49 * @return state at current grid point time 50 */ 51 FieldODEStateAndDerivative<T> getCurrentState(); 52 53 /** 54 * Get the state at interpolated time. 55 * <p>Setting the time outside of the current step is allowed, but 56 * should be used with care since the accuracy of the interpolator will 57 * probably be very poor far from this step. This allowance has been 58 * added to simplify implementation of search algorithms near the 59 * step endpoints.</p> 60 * @param time time of the interpolated point 61 * @return state at interpolated time 62 */ 63 FieldODEStateAndDerivative<T> getInterpolatedState(T time); 64 65 /** Check if the natural integration direction is forward. 66 * <p>This method provides the integration direction as specified by 67 * the integrator itself, it avoid some nasty problems in 68 * degenerated cases like null steps due to cancellation at step 69 * initialization, step control or discrete events 70 * triggering.</p> 71 * @return true if the integration variable (time) increases during 72 * integration 73 */ 74 boolean isForward(); 75 }