ODEFixedStepHandler.java

  1. /*
  2.  * Licensed to the Hipparchus project 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 Hipparchus project 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. package org.hipparchus.ode.sampling;

  18. import org.hipparchus.ode.ODEStateAndDerivative;

  19. /**
  20.  * This interface represents a handler that should be called after
  21.  * each successful fixed step.

  22.  * <p>This interface should be implemented by anyone who is interested
  23.  * in getting the solution of an ordinary differential equation at
  24.  * fixed time steps. Objects implementing this interface should be
  25.  * wrapped within an instance of {@link StepNormalizer} that itself
  26.  * is used as the general {@link ODEStepHandler} by the integrator. The
  27.  * {@link StepNormalizer} object is called according to the integrator
  28.  * internal algorithms and it calls objects implementing this
  29.  * interface as necessary at fixed time steps.</p>
  30.  *
  31.  * @see ODEStepHandler
  32.  * @see StepNormalizer
  33.  */

  34. public interface ODEFixedStepHandler  {

  35.     /** Initialize step handler at the start of an ODE integration.
  36.      * <p>
  37.      * This method is called once at the start of the integration. It
  38.      * may be used by the step handler to initialize some internal data
  39.      * if needed.
  40.      * </p>
  41.      * <p>
  42.      * The default implementation does nothing.
  43.      * </p>
  44.      * @param initialState initial time, state vector and derivative
  45.      * @param finalTime target time for the integration
  46.      */
  47.     default void init(ODEStateAndDerivative initialState, double finalTime) {
  48.         // nothing by default
  49.     }

  50.     /**
  51.      * Handle the last accepted step
  52.      * @param state current state
  53.      * @param isLast true if the step is the last one
  54.      */
  55.     void handleStep(ODEStateAndDerivative state, boolean isLast);

  56. }