View Javadoc
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.migration.ode.sampling;
24  
25  import org.hipparchus.ode.ODEStateAndDerivative;
26  import org.hipparchus.ode.sampling.ODEFixedStepHandler;
27  
28  /**
29   * This interface represents a handler that should be called after
30   * each successful fixed step.
31  
32   * <p>This interface should be implemented by anyone who is interested
33   * in getting the solution of an ordinary differential equation at
34   * fixed time steps. Objects implementing this interface should be
35   * wrapped within an instance of {@link org.hipparchus.ode.sampling.StepNormalizer} that itself
36   * is used as the general {@link StepHandler} by the integrator. The
37   * {@link org.hipparchus.ode.sampling.StepNormalizer} object is called according to the integrator
38   * internal algorithms and it calls objects implementing this
39   * interface as necessary at fixed time steps.</p>
40   *
41   * @see StepHandler
42   * @see org.hipparchus.ode.sampling.StepNormalizer
43   * @deprecated as of 1.0, replaced with {@link ODEFixedStepHandler}
44   */
45  @Deprecated
46  public interface FixedStepHandler extends ODEFixedStepHandler {
47  
48      /** {@inheritDoc}} */
49      @Override
50      default void init(final ODEStateAndDerivative initialState, final double finalTime) {
51          init(initialState.getTime(), initialState.getPrimaryState(), finalTime);
52      }
53  
54      /** {@inheritDoc}} */
55      @Override
56      default void handleStep(final ODEStateAndDerivative state, final boolean isLast) {
57          handleStep(state.getTime(), state.getPrimaryState(), state.getPrimaryDerivative(), isLast);
58      }
59  
60      /** Initialize step handler at the start of an ODE integration.
61       * <p>
62       * This method is called once at the start of the integration. It
63       * may be used by the step handler to initialize some internal data
64       * if needed.
65       * </p>
66       * @param t0 start value of the independent <i>time</i> variable
67       * @param y0 array containing the start value of the state vector
68       * @param t target time for the integration
69       */
70      void init(double t0, double[] y0, double t);
71  
72      /**
73       * Handle the last accepted step
74       * @param t time of the current step
75       * @param y state vector at t. For efficiency purposes, the {@link
76       * org.hipparchus.ode.sampling.StepNormalizer} class reuses the same array on each call, so if
77       * the instance wants to keep it across all calls (for example to
78       * provide at the end of the integration a complete array of all
79       * steps), it should build a local copy store this copy.
80       * @param yDot derivatives of the state vector state vector at t.
81       * For efficiency purposes, the {@link org.hipparchus.ode.sampling.StepNormalizer} class reuses
82       * the same array on each call, so if
83       * the instance wants to keep it across all calls (for example to
84       * provide at the end of the integration a complete array of all
85       * steps), it should build a local copy store this copy.
86       * @param isLast true if the step is the last one
87       */
88      void handleStep(double t, double[] y, double[] yDot, boolean isLast);
89  
90  }