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 /** 00034 \brief ODE stepper base [abstract base] 00035 00036 \note This base class does not actually perform any ODE solving 00037 use gsl_rkck or gsl_rk8pd. 00038 */ 00039 template<class param_t, class func_t, class vec_t=ovector_base> 00040 class odestep { 00041 00042 #ifndef DOXGYENP 00043 00044 protected: 00045 00046 /// The order of the ODE stepper 00047 int order; 00048 00049 #endif 00050 00051 public: 00052 00053 odestep() { 00054 order=0; 00055 } 00056 00057 virtual ~odestep() {} 00058 00059 /// Return the order of the ODE stepper 00060 virtual int get_order() { 00061 return order; 00062 } 00063 00064 /** 00065 \brief Perform an integration step 00066 00067 Given initial value of the n-dimensional function in \c y 00068 and the derivative in \c dydx (which must generally be 00069 computed beforehand) at the point \c x, take a step of size 00070 \c h giving the result in \c yout, the uncertainty in \c 00071 yerr, and the new derivative in \c dydx_out (at \c x+h) 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 implementations allow \c 00076 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, param_t &pa, 00080 func_t &derivs)=0; 00081 00082 }; 00083 00084 #ifndef DOXYGENP 00085 } 00086 #endif 00087 00088 #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