38 const double*,
double*,
43 const double*,
double*,
44 const double&,
double*,
48 const double&,
const double*,
57 double&,
double*,
double*,
const double&,
58 octave_idx_type*,
const double*,
59 const double*, octave_idx_type&,
double*,
60 const octave_idx_type&, octave_idx_type*,
61 const octave_idx_type&,
double*,
77 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
84 tmp_state(i) = state[i];
85 tmp_deriv(i) = deriv[i];
88 ColumnVector tmp_fval = (*user_fsub) (tmp_state, tmp_deriv, t, ires);
90 if (tmp_fval.
length () == 0)
95 delta[i] = tmp_fval(i);
98 END_INTERRUPT_WITH_EXCEPTIONS;
107 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
116 tmp_deriv.
elem (i) = deriv[i];
117 tmp_state.
elem (i) = state[i];
120 Matrix tmp_pd = (*user_jsub) (tmp_state, tmp_deriv, time, cj);
124 pd[nn * j + i] = tmp_pd.
elem (i, j);
126 END_INTERRUPT_WITH_EXCEPTIONS;
135 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
141 tmp_state(i) = state[i];
146 gout[i] = tmp_fval(i);
148 END_INTERRUPT_WITH_EXCEPTIONS;
193 if (maxord > 0 && maxord < 6)
200 (*current_liboctave_error_handler)
201 (
"dassl: invalid value for maximum order");
208 lrw = 50 + 9*n + n*n + 3*
ng;
236 if (fval.
length () != x.length ())
238 (*current_liboctave_error_handler)
239 (
"dasrt: inconsistent sizes for state and residual vectors");
247 (*current_liboctave_error_handler)
248 (
"dasrt: no user supplied RHS subroutine!");
296 if (abs_tol_len == 1 && rel_tol_len == 1)
300 else if (abs_tol_len == n && rel_tol_len == n)
306 (*current_liboctave_error_handler)
307 (
"dasrt: inconsistent sizes for tolerance arrays");
380 (*current_liboctave_error_handler)
381 (
"unrecognized value of istate (= %d) returned from ddasrt",
399 if (n_out > 0 && n > 0)
402 xdot_out.
resize (n_out, n);
407 xdot_out(0,i) =
xdot(i);
428 xdot_out(j,i) =
xdot(i);
458 if (n_out > 0 && n > 0)
461 xdot_out.
resize (n_out, n);
469 double next_crit = tcrit(0);
471 while (i_out < n_out)
473 bool do_restart =
false;
475 next_out = tout(i_out);
477 next_crit = tcrit(i_crit);
482 if (next_crit == next_out)
491 else if (next_crit < next_out)
532 x_out(i_out-1,i) =
x(i);
533 xdot_out(i_out-1,i) =
xdot(i);
536 t_outs(i_out-1) = t_out;
541 xdot_out.
resize (i_out, n);
570 std::ostringstream buf;
572 std::string t_curr = buf.str ();
577 retval =
"a step was successfully taken in intermediate-output mode.";
581 retval =
"integration completed by stepping exactly to TOUT";
585 retval =
"integration to tout completed by stepping past TOUT";
589 retval =
"integration completed by finding one or more roots of G at T";
593 retval = std::string (
"a large amount of work has been expended (t =")
598 retval =
"the error tolerances are too stringent";
602 retval = std::string (
"error weight became zero during problem. (t = ")
604 +
"; solution component i vanished, and atol or atol(i) == 0)";
608 retval = std::string (
"repeated error test failures on the last attempted step (t = ")
613 retval = std::string (
"the corrector could not converge (t = ")
618 retval = std::string (
"the matrix of partial derivatives is singular (t = ")
623 retval = std::string (
"the corrector could not converge (t = ")
624 + t_curr +
"; repeated test failures)";
628 retval = std::string (
"corrector could not converge because IRES was -1 (t = ")
633 retval = std::string (
"return requested in user-supplied function (t = ")
638 retval =
"failed to compute consistent initial conditions";
642 retval =
"unrecoverable error (see printed message)";
646 retval =
"unknown error state";
Array< octave_idx_type > iwork
double maximum_step_size(void) const
subroutine ddasrt(RES, NEQ, T, Y, YPRIME, TOUT, INFO, RTOL, ATOL, IDID, RWORK, LRW, IWORK, LIW, RPAR, IPAR, JAC, G, NG, JROOT)
octave_idx_type size(void) const
F77_RET_T F77_FUNC(ddasrt, DDASRT)(dasrt_fcn_ptr
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
static uint32_t state[624]
DAERTConstrFunc constraint_function(void) const
F77_RET_T const octave_idx_type double double double const double octave_idx_type const double const double octave_idx_type double const octave_idx_type octave_idx_type const octave_idx_type double octave_idx_type const octave_idx_type octave_idx_type *static DAEFunc::DAERHSFunc user_fsub
static DAERTFunc::DAERTConstrFunc user_csub
static octave_idx_type nn
DAERHSFunc function(void) const
Matrix(* DAEJacFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, double cj)
T & elem(octave_idx_type n)
std::string error_message(void) const
#define F77_XFCN(f, F, args)
octave_idx_type(* dasrt_constr_ptr)(const octave_idx_type &, const double &, const double *, const octave_idx_type &, double *, double *, octave_idx_type *)
DAEJacFunc jacobian_function(void) const
octave_idx_type ddasrt_j(const double &time, const double *state, const double *deriv, double *pd, const double &cj, double *, octave_idx_type *)
static octave_idx_type ddasrt_f(const double &t, const double *state, const double *deriv, double *delta, octave_idx_type &ires, double *, octave_idx_type *)
virtual void force_restart(void)
void set_stop_time(double tt)
void resize(const dim_vector &dv, const T &rfv)
octave_idx_type capacity(void) const
Number of elements in the array.
ColumnVector(* DAERTConstrFunc)(const ColumnVector &x, double t)
DASRT_result integrate(const ColumnVector &tout)
void clear_stop_time(void)
octave_idx_type step_limit(void) const
Array< double > relative_tolerance(void) const
octave_idx_type length(void) const
Number of elements in the array.
octave_idx_type(* dasrt_fcn_ptr)(const double &, const double *, const double *, double *, octave_idx_type &, double *, octave_idx_type *)
Array< double > absolute_tolerance(void) const
Array< octave_idx_type > info
Array< octave_idx_type > jroot
octave_idx_type maximum_order(void) const
static octave_idx_type ddasrt_g(const octave_idx_type &neq, const double &t, const double *state, const octave_idx_type &ng, double *gout, double *, octave_idx_type *)
double initial_step_size(void) const
ColumnVector(* DAERHSFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &ires)
const T * fortran_vec(void) const
static DAEFunc::DAEJacFunc user_jsub
octave_idx_type(* dasrt_jac_ptr)(const double &, const double *, const double *, double *, const double &, double *, octave_idx_type *)
void resize(octave_idx_type n, const double &rfv=0)