\section{/home/peifer/diffit/modules/integrate\-RK.cc File Reference}
\label{integrateRK_8cc}\index{/home/peifer/diffit/modules/integrateRK.cc@{/home/peifer/diffit/modules/integrateRK.cc}}
{\tt \#include $<$math.h$>$}\par
{\tt \#include $<$iostream$>$}\par
{\tt \#include \char`\"{}../nr.h\char`\"{}}\par
{\tt \#include \char`\"{}../def.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf TINY}~1.0e-30
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void {\bf integrate\-RK} ({\bf Glob} $\ast$globs, double ystart[$\,$], double p[$\,$], long nvar, double x1, double x2, double eps, double h1, double hmin, long $\ast$nok, long $\ast$nbad, void($\ast$derivs)(double, double[$\,$], double[$\,$], double[$\,$]))
\end{CompactItemize}


\subsection{Define Documentation}
\index{integrateRK.cc@{integrate\-RK.cc}!TINY@{TINY}}
\index{TINY@{TINY}!integrateRK.cc@{integrate\-RK.cc}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define TINY~1.0e-30}\label{integrateRK_8cc_cf1c38f71f39386356edb151a131ad11}




Definition at line 8 of file integrate\-RK.cc.

\subsection{Function Documentation}
\index{integrateRK.cc@{integrate\-RK.cc}!integrateRK@{integrateRK}}
\index{integrateRK@{integrateRK}!integrateRK.cc@{integrate\-RK.cc}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void integrate\-RK ({\bf Glob} $\ast$ {\em globs}, double {\em ystart}[$\,$], double {\em p}[$\,$], long {\em nvar}, double {\em x1}, double {\em x2}, double {\em eps}, double {\em h1}, double {\em hmin}, long $\ast$ {\em nok}, long $\ast$ {\em nbad}, void($\ast$)(double, double[$\,$], double[$\,$], double[$\,$]) {\em derivs})}\label{integrateRK_8cc_c4791452e7bea19ec2a3ca9854c440e4}




Definition at line 19 of file integrate\-RK.cc.

References dvector(), Glob::maxstp, nrerror(), and SIGN.

Referenced by tabulate\-Values().

\footnotesize\begin{verbatim}22 {
23   long ode_fkmax = 0, ode_fkount = 0, ode_kmax = 0, ode_kount = 0;
24   double ode_dxsav = 0, *ode_fxp = 0, *ode_xp = 0, **ode_yp = 0;
25   long rkqs_ign = 0;
26   long nstp,i;
27   double xsav,x,hnext,hdid,h;
28   double *yscal,*y,*dydx;
29   long odeint_MAXSTP=globs->maxstp;
30 
31   yscal=dvector(1,nvar);
32   y=dvector(1,nvar);
33   dydx=dvector(1,nvar);
34   x=x1;
35   h=SIGN(h1,x2-x1);
36   *nok = (*nbad) = ode_kount = 0;
37   for (i=1;i<=nvar;i++) y[i]=ystart[i];
38   if (ode_dxsav<0) nrerror("odeint:dxsav<0");
39   if (ode_kmax>0 && ode_kount<ode_kmax-1) {
40      ode_xp[++ode_kount]=x;
41      for (i=1;i<=nvar;i++) ode_yp[i][ode_kount]=y[i];
42      xsav=x;
43   } /* save first point, w.h. 19.03.99 */
44   for (nstp=1;nstp<=odeint_MAXSTP;nstp++) {
45     (*derivs)(x,y,dydx,p);
46     for (i=1;i<=nvar;i++)
47       yscal[i]=fabs(y[i])+fabs(dydx[i]*h)+TINY;
48     if (ode_fkmax) {
49       if (ode_fkount>=ode_fkmax) nrerror("ode_fkount exceeds ode_fkmax");
50       ode_fxp[++ode_fkount]=x;
51     }
52     if (ode_kmax>0 && ode_kount<ode_kmax-1 && fabs(x-xsav)>ode_dxsav) {
53       ode_xp[++ode_kount]=x;
54       for (i=1;i<=nvar;i++) ode_yp[i][ode_kount]=y[i];
55       xsav=x;
56     }
57     if ((x+h-x2)*(x+h-x1) > 0.0) h=x2-x;
58     rkqs(y,dydx,p,nvar,&x,h,eps,yscal,&hdid,&hnext,globs->rkqs_ign,derivs);
59     if (hdid == h) ++(*nok); 
60     else ++(*nbad);
61     if ((x-x2)*(x2-x1) >= 0.0) {
62       for (i=1;i<=nvar;i++) ystart[i]=y[i];
63       if (ode_kmax>0 && ode_kount<ode_kmax-1) {
64         ode_xp[++ode_kount]=x;
65         for (i=1;i<=nvar;i++) ode_yp[i][ode_kount]=y[i];
66       }
67       free_dvector(dydx,1,nvar);
68       free_dvector(y,1,nvar);
69       free_dvector(yscal,1,nvar);
70       return;
71     }
72     if (fabs(hnext) <= hmin)
73       {
74         cerr << "Step size too small in odeint\n";
75         throw 1;
76       }
77     h=hnext;
78   }
79   cerr << "Too many steps in routine odeint; try -maxstp <n> greater n\n";
80   throw 1;
81 }
\end{verbatim}\normalsize 


