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;
019    
020    /** This interface represents a first order integrator for
021     * differential equations.
022    
023     * <p>The classes which are devoted to solve first order differential
024     * equations should implement this interface. The problems which can
025     * be handled should implement the {@link
026     * FirstOrderDifferentialEquations} interface.</p>
027     *
028     * @see FirstOrderDifferentialEquations
029     * @see org.apache.commons.math.ode.sampling.StepHandler
030     * @see org.apache.commons.math.ode.events.EventHandler
031     * @version $Revision: 811786 $ $Date: 2009-09-06 05:36:08 -0400 (Sun, 06 Sep 2009) $
032     * @since 1.2
033     */
034    
035    public interface FirstOrderIntegrator extends ODEIntegrator {
036    
037      /** Integrate the differential equations up to the given time.
038       * <p>This method solves an Initial Value Problem (IVP).</p>
039       * <p>Since this method stores some internal state variables made
040       * available in its public interface during integration ({@link
041       * #getCurrentSignedStepsize()}), it is <em>not</em> thread-safe.</p>
042       * @param equations differential equations to integrate
043       * @param t0 initial time
044       * @param y0 initial value of the state vector at t0
045       * @param t target time for the integration
046       * (can be set to a value smaller than <code>t0</code> for backward integration)
047       * @param y placeholder where to put the state vector at each successful
048       *  step (and hence at the end of integration), can be the same object as y0
049       * @return stop time, will be the same as target time if integration reached its
050       * target, but may be different if some {@link
051       * org.apache.commons.math.ode.events.EventHandler} stops it at some point.
052       * @throws IntegratorException if the integrator cannot perform integration
053       * @throws DerivativeException this exception is propagated to the caller if
054       * the underlying user function triggers one
055       */
056      double integrate (FirstOrderDifferentialEquations equations,
057                        double t0, double[] y0,
058                        double t, double[] y) throws DerivativeException, IntegratorException;
059    
060    }