Object-oriented Scientific Computing Library: Version 0.908
odestep.h
00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, Andrew W. Steiner
00005   
00006   This file is part of O2scl.
00007   
00008   O2scl is free software; you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License as published by
00010   the Free Software Foundation; either version 3 of the License, or
00011   (at your option) any later version.
00012   
00013   O2scl is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016   GNU General Public License for more details.
00017   
00018   You should have received a copy of the GNU General Public License
00019   along with O2scl. If not, see <http://www.gnu.org/licenses/>.
00020 
00021   -------------------------------------------------------------------
00022 */
00023 
00024 #ifndef O2SCL_ODESTEP_H
00025 #define O2SCL_ODESTEP_H
00026 
00027 #include <o2scl/funct.h>
00028 #include <o2scl/ovector_tlate.h>
00029 
00030 #ifndef DOXYGENP
00031 namespace o2scl {
00032 #endif
00033   
00034   /** \brief ODE stepper base [abstract base]
00035    */
00036   template<class func_t=funct, class vec_t=ovector_base> class odestep {
00037 
00038 #ifndef DOXGYENP
00039 
00040     protected:
00041     
00042     /** \brief The order of the ODE stepper
00043      */
00044     int order;
00045 
00046 #endif
00047     
00048     public:
00049 
00050     odestep() {
00051       order=0;
00052     }
00053 
00054     virtual ~odestep() {}
00055     
00056     /** \brief Return the order of the ODE stepper
00057         
00058         This is used, for example, by \ref gsl_astep to adaptively
00059         adjust the stepsize.
00060     */
00061     virtual int get_order() {
00062       return order;
00063     }
00064     
00065     /** \brief Perform an integration step
00066         
00067         Given initial value of the n-dimensional function in \c y and
00068         the derivative in \c dydx (which must generally be computed
00069         beforehand) at the point \c x, take a step of size \c h giving
00070         the result in \c yout, the uncertainty at \f$ x+h \f$ in \c
00071         yerr, and the new derivative at \f$ x+h \f$ in \c dydx_out
00072         using function \c derivs to calculate derivatives.
00073         Implementations which do not calculate \c yerr and/or \c
00074         dydx_out do not reference these variables so that a blank \c
00075         vec_t can be given. All of the current \o2 implementations
00076         allow \c yout=y and \c dydx_out=dydx if necessary
00077     */
00078     virtual int step(double x, double h, size_t n, vec_t &y, vec_t &dydx, 
00079                      vec_t &yout, vec_t &yerr, vec_t &dydx_out, 
00080                      func_t &derivs)=0;
00081     
00082   };
00083   
00084 #ifndef DOXYGENP
00085 }
00086 #endif
00087 
00088 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information). Project hosting by Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads .