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.math3.ode.sampling; 019 020 021 /** 022 * This interface represents a handler that should be called after 023 * each successful fixed step. 024 025 * <p>This interface should be implemented by anyone who is interested 026 * in getting the solution of an ordinary differential equation at 027 * fixed time steps. Objects implementing this interface should be 028 * wrapped within an instance of {@link StepNormalizer} that itself 029 * is used as the general {@link StepHandler} by the integrator. The 030 * {@link StepNormalizer} object is called according to the integrator 031 * internal algorithms and it calls objects implementing this 032 * interface as necessary at fixed time steps.</p> 033 * 034 * @see StepHandler 035 * @see StepNormalizer 036 * @version $Id: FixedStepHandler.java 1416643 2012-12-03 19:37:14Z tn $ 037 * @since 1.2 038 */ 039 040 public interface FixedStepHandler { 041 042 /** Initialize step handler at the start of an ODE integration. 043 * <p> 044 * This method is called once at the start of the integration. It 045 * may be used by the step handler to initialize some internal data 046 * if needed. 047 * </p> 048 * @param t0 start value of the independent <i>time</i> variable 049 * @param y0 array containing the start value of the state vector 050 * @param t target time for the integration 051 */ 052 void init(double t0, double[] y0, double t); 053 054 /** 055 * Handle the last accepted step 056 * @param t time of the current step 057 * @param y state vector at t. For efficiency purposes, the {@link 058 * StepNormalizer} class reuses the same array on each call, so if 059 * the instance wants to keep it across all calls (for example to 060 * provide at the end of the integration a complete array of all 061 * steps), it should build a local copy store this copy. 062 * @param yDot derivatives of the state vector state vector at t. 063 * For efficiency purposes, the {@link StepNormalizer} class reuses 064 * the same array on each call, so if 065 * the instance wants to keep it across all calls (for example to 066 * provide at the end of the integration a complete array of all 067 * steps), it should build a local copy store this copy. 068 * @param isLast true if the step is the last one 069 */ 070 void handleStep(double t, double[] y, double[] yDot, boolean isLast); 071 072 }