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;
019    
020    import org.apache.commons.math3.exception.DimensionMismatchException;
021    import org.apache.commons.math3.exception.MaxCountExceededException;
022    import org.apache.commons.math3.exception.NoBracketingException;
023    import org.apache.commons.math3.exception.NumberIsTooSmallException;
024    
025    /** This interface represents a first order integrator for
026     * differential equations.
027    
028     * <p>The classes which are devoted to solve first order differential
029     * equations should implement this interface. The problems which can
030     * be handled should implement the {@link
031     * FirstOrderDifferentialEquations} interface.</p>
032     *
033     * @see FirstOrderDifferentialEquations
034     * @see org.apache.commons.math3.ode.sampling.StepHandler
035     * @see org.apache.commons.math3.ode.events.EventHandler
036     * @version $Id: FirstOrderIntegrator.java 1416643 2012-12-03 19:37:14Z tn $
037     * @since 1.2
038     */
039    
040    public interface FirstOrderIntegrator extends ODEIntegrator {
041    
042      /** Integrate the differential equations up to the given time.
043       * <p>This method solves an Initial Value Problem (IVP).</p>
044       * <p>Since this method stores some internal state variables made
045       * available in its public interface during integration ({@link
046       * #getCurrentSignedStepsize()}), it is <em>not</em> thread-safe.</p>
047       * @param equations differential equations to integrate
048       * @param t0 initial time
049       * @param y0 initial value of the state vector at t0
050       * @param t target time for the integration
051       * (can be set to a value smaller than <code>t0</code> for backward integration)
052       * @param y placeholder where to put the state vector at each successful
053       *  step (and hence at the end of integration), can be the same object as y0
054       * @return stop time, will be the same as target time if integration reached its
055       * target, but may be different if some {@link
056       * org.apache.commons.math3.ode.events.EventHandler} stops it at some point.
057       * @exception DimensionMismatchException if arrays dimension do not match equations settings
058       * @exception NumberIsTooSmallException if integration step is too small
059       * @exception MaxCountExceededException if the number of functions evaluations is exceeded
060       * @exception NoBracketingException if the location of an event cannot be bracketed
061       */
062      double integrate (FirstOrderDifferentialEquations equations,
063                        double t0, double[] y0, double t, double[] y)
064          throws DimensionMismatchException, NumberIsTooSmallException,
065                 MaxCountExceededException, NoBracketingException;
066    
067    }