Object-oriented Scientific Computing Library: Version 0.910
ode_step.h
00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006-2012, 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_ODE_STEP_H
00025 #define O2SCL_ODE_STEP_H
00026 
00027 #include <o2scl/ovector_tlate.h>
00028 #include <o2scl/ode_funct.h>
00029 
00030 #ifndef DOXYGENP
00031 namespace o2scl {
00032 #endif
00033   
00034   /** \brief ODE stepper base [abstract base]
00035    */
00036   template<class func_t=ode_funct<>, class vec_t=ovector_base> 
00037     class ode_step {
00038 
00039 #ifndef DOXGYENP
00040 
00041     protected:
00042     
00043     /** \brief The order of the ODE stepper
00044      */
00045     int order;
00046 
00047 #endif
00048     
00049     public:
00050 
00051     ode_step() {
00052       order=0;
00053     }
00054 
00055     virtual ~ode_step() {}
00056     
00057     /** \brief Return the order of the ODE stepper
00058         
00059         This is used, for example, by \ref gsl_astep to adaptively
00060         adjust the stepsize.
00061     */
00062     virtual int get_order() {
00063       return order;
00064     }
00065     
00066     /** \brief Perform an integration step
00067         
00068         Given initial value of the n-dimensional function in \c y and
00069         the derivative in \c dydx (which must generally be computed
00070         beforehand) at the point \c x, take a step of size \c h giving
00071         the result in \c yout, the uncertainty at \f$ x+h \f$ in \c
00072         yerr, and the new derivative at \f$ x+h \f$ in \c dydx_out
00073         using function \c derivs to calculate derivatives.
00074         Implementations which do not calculate \c yerr and/or \c
00075         dydx_out do not reference these variables so that a blank \c
00076         vec_t can be given. All of the current \o2 implementations
00077         allow \c yout=y and \c dydx_out=dydx if necessary
00078     */
00079     virtual int step(double x, double h, size_t n, vec_t &y, vec_t &dydx, 
00080                      vec_t &yout, vec_t &yerr, vec_t &dydx_out, 
00081                      func_t &derivs)=0;
00082     
00083   };
00084   
00085 #ifndef DOXYGENP
00086 }
00087 #endif
00088 
00089 #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).

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.