#ifndef RUNGE6_H
# define RUNGE6_H

# ifndef GPK_STD_H
/* Miscellaneous definitions. Things like C and BOOL. */
#  include <gpk_std.h>
# endif

/* Enum Runge_e tells you what kind of error the differential equation solver
	encountered. */
enum runge_e	{R_NOERR=0, /* It worked ! */
				R_MANYSTEPS, /* Too many steps between output points. */
				R_SMALLSTEP, /* Step is too small for CPU accuracy. */
				R_OUTFAIL, /* Output routine returns FALSE. */
				R_NOSTEP, /* Can't find a step small enough to make
											(*xdot)() return TRUE. */
				R_NOMEM, /* Can't allocate memory. */
				R_BADSTART /* xdot cannot be evaluated at initial value*/
				};

/*
struct runge_s is the result of the equation solver.  It tells you
whether things completed successfully or not, and contains a pointer to
all the values from the ODE at all timesteps (unless a output function
is specified, in which case it returns whatever the output function
produced for all time steps).

	isgood -- integration completed as requested.
	stepcount -- number of output points which have been reached.
				stepcount is less than the requested number if there was
				an error.
	errtype -- see above (enum runge_e).
	xx -- pointer to an array of output data (or x, if nout == 0).
		xx is a long array which contains, sequentially, each component
		of the ODE (or whatever the output function produced) for each
		requested time step.  For example a two component ODE evaluated
		at 3 time steps would be stored as:
		x[0](t=t0) x[1](t=t0) x[0](t=t1) x[1](t=t1) x[0](t=t2) x[1](t=t2)
	t -- time of last good integration step.
*/
struct runge_s {BOOL isgood; int stepcount; int errtype;
				double *xx, t;};
#endif
