001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    package org.apache.commons.math.ode.sampling;
019    
020    import org.apache.commons.math.ode.DerivativeException;
021    
022    /**
023     * This interface represents a handler that should be called after
024     * each successful fixed step.
025    
026     * <p>This interface should be implemented by anyone who is interested
027     * in getting the solution of an ordinary differential equation at
028     * fixed time steps. Objects implementing this interface should be
029     * wrapped within an instance of {@link StepNormalizer} that itself
030     * is used as the general {@link StepHandler} by the integrator. The
031     * {@link StepNormalizer} object is called according to the integrator
032     * internal algorithms and it calls objects implementing this
033     * interface as necessary at fixed time steps.</p>
034     *
035     * @see StepHandler
036     * @see StepNormalizer
037     * @version $Revision: 1073158 $ $Date: 2011-02-21 22:46:52 +0100 (lun. 21 f??vr. 2011) $
038     * @since 1.2
039     */
040    
041    public interface FixedStepHandler  {
042    
043      /**
044       * Handle the last accepted step
045       * @param t time of the current step
046       * @param y state vector at t. For efficiency purposes, the {@link
047       * StepNormalizer} class reuses the same array on each call, so if
048       * the instance wants to keep it across all calls (for example to
049       * provide at the end of the integration a complete array of all
050       * steps), it should build a local copy store this copy.
051       * @param yDot derivatives of the state vector state vector at t.
052       * For efficiency purposes, the {@link StepNormalizer} class reuses
053       * the same array on each call, so if
054       * the instance wants to keep it across all calls (for example to
055       * provide at the end of the integration a complete array of all
056       * steps), it should build a local copy store this copy.
057       * @param isLast true if the step is the last one
058       * @throws DerivativeException if some error condition is encountered
059       */
060      void handleStep(double t, double[] y, double[] yDot, boolean isLast) throws DerivativeException;
061    
062    }