00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006, 2007, 2008, 2009, 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/ovector_tlate.h> 00028 00029 #ifndef DOXYGENP 00030 namespace o2scl { 00031 #endif 00032 00033 /** \brief ODE stepper base [abstract base] 00034 */ 00035 template<class param_t, class func_t, class vec_t=ovector_base> 00036 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 /** 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 param_t &pa, func_t &derivs)=0; 00082 00083 }; 00084 00085 #ifndef DOXYGENP 00086 } 00087 #endif 00088 00089 #endif
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page