26 #if defined (HAVE_CONFIG_H)
42 double*,
const double&,
double*,
F77_INT*);
75 tmp_state(i) =
state[i];
76 tmp_deriv(i) = deriv[i];
81 ColumnVector tmp_fval = (*user_fsub) (tmp_state, tmp_deriv, t, tmp_ires);
83 ires = octave::to_f77_int (tmp_ires);
90 delta[i] = tmp_fval(i);
98 double *pd,
const double& cj,
double *,
F77_INT *)
107 tmp_deriv.
elem (i) = deriv[i];
111 Matrix tmp_pd = (*user_jsub) (tmp_state, tmp_deriv, time, cj);
115 pd[
nn * j + i] = tmp_pd.
elem (i, j);
128 tmp_state(i) =
state[i];
132 for (
F77_INT i = 0; i < ng; i++)
133 gout[i] = tmp_fval(i);
154 for (
F77_INT i = 0; i < 15; i++)
168 ng = octave::to_f77_int (tmp.
numel ());
173 F77_INT maxord = octave::to_f77_int (maximum_order ());
176 if (maxord > 0 && maxord < 6)
183 (*current_liboctave_error_handler)
184 (
"dassl: invalid value for maximum order");
221 (*current_liboctave_error_handler)
222 (
"dasrt: inconsistent sizes for state and residual vectors");
230 (*current_liboctave_error_handler)
231 (
"dasrt: no user supplied RHS subroutine!");
247 double mss = maximum_step_size ();
256 double iss = initial_step_size ();
265 F77_INT sl = octave::to_f77_int (step_limit ());
274 abs_tol = absolute_tolerance ();
275 rel_tol = relative_tolerance ();
280 if (abs_tol_len == 1 && rel_tol_len == 1)
284 else if (abs_tol_len ==
n && rel_tol_len ==
n)
290 (*current_liboctave_error_handler)
291 (
"dasrt: inconsistent sizes for tolerance arrays");
297 DASRT_options::reset =
false;
313 double *dummy =
nullptr;
319 prel_tol, pabs_tol, tmp_istate, prwork,
lrw,
368 (*current_liboctave_error_handler)
369 (
"unrecognized value of istate (= %" OCTAVE_IDX_TYPE_FORMAT
") "
370 "returned from ddasrt",
istate);
387 if (n_out > 0 &&
n > 0)
395 xdot_out(0,i) =
xdot(i);
416 xdot_out(j,i) =
xdot(i);
446 if (n_out > 0 &&
n > 0)
457 double next_crit = tcrit(0);
459 while (i_out < n_out)
461 bool do_restart =
false;
463 next_out = tout(i_out);
465 next_crit = tcrit(i_crit);
467 bool save_output =
false;
470 if (next_crit == next_out)
479 else if (next_crit < next_out)
520 x_out(i_out-1,i) =
x(i);
521 xdot_out(i_out-1,i) =
xdot(i);
524 t_outs(i_out-1) = t_out;
558 std::ostringstream buf;
560 std::string t_curr = buf.str ();
565 retval =
"a step was successfully taken in intermediate-output mode.";
569 retval =
"integration completed by stepping exactly to TOUT";
573 retval =
"integration to tout completed by stepping past TOUT";
577 retval =
"integration completed by finding one or more roots of G at T";
581 retval =
"a large amount of work has been expended (t =" + t_curr +
')';
585 retval =
"the error tolerances are too stringent";
589 retval =
"error weight became zero during problem. (t = " + t_curr +
590 "; solution component i vanished, and atol or atol(i) == 0)";
594 retval =
"repeated error test failures on the last attempted step (t = "
599 retval =
"the corrector could not converge (t = " + t_curr +
')';
603 retval =
"the matrix of partial derivatives is singular (t = " + t_curr +
608 retval =
"the corrector could not converge (t = " + t_curr +
609 "; repeated test failures)";
613 retval =
"corrector could not converge because IRES was -1 (t = "
618 retval =
"return requested in user-supplied function (t = " + t_curr +
623 retval =
"failed to compute consistent initial conditions";
627 retval =
"unrecoverable error (see printed message)";
631 retval =
"unknown error state";
F77_INT(* dasrt_jac_ptr)(const double &, const double *, const double *, double *, const double &, double *, F77_INT *)
F77_RET_T F77_FUNC(ddasrt, DDASRT)(dasrt_fcn_ptr
F77_INT(* dasrt_fcn_ptr)(const double &, const double *, const double *, double *, F77_INT &, double *, F77_INT *)
F77_INT(* dasrt_constr_ptr)(const F77_INT &, const double &, const double *, const F77_INT &, double *, double *, F77_INT *)
F77_RET_T const F77_INT F77_DBLE F77_DBLE F77_DBLE const F77_DBLE F77_INT const F77_DBLE const F77_DBLE F77_INT F77_DBLE const F77_INT F77_INT const F77_INT F77_DBLE F77_INT const F77_INT F77_INT *static DAEFunc::DAERHSFunc user_fsub
F77_INT ddasrt_j(const double &time, const double *state, const double *deriv, double *pd, const double &cj, double *, F77_INT *)
static DAERTFunc::DAERTConstrFunc user_csub
static F77_INT ddasrt_f(const double &t, const double *state, const double *deriv, double *delta, F77_INT &ires, double *, F77_INT *)
static F77_INT ddasrt_g(const F77_INT &neq, const double &t, const double *state, const F77_INT &ng, double *gout, double *, F77_INT *)
static DAEFunc::DAEJacFunc user_jsub
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
octave_idx_type numel(void) const
Number of elements in the array.
T & elem(octave_idx_type n)
Size of the specified dimension.
const T * fortran_vec(void) const
Size of the specified dimension.
bool isempty(void) const
Size of the specified dimension.
void resize(octave_idx_type n, const double &rfv=0)
DAEJacFunc jacobian_function(void) const
Matrix(* DAEJacFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, double cj)
ColumnVector(* DAERHSFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &ires)
DAERHSFunc function(void) const
ColumnVector(* DAERTConstrFunc)(const ColumnVector &x, double t)
DAERTConstrFunc constraint_function(void) const
Array< octave_f77_int_type > iwork
DASRT_result integrate(const ColumnVector &tout)
Array< octave_f77_int_type > jroot
Array< octave_f77_int_type > info
std::string error_message(void) const
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
virtual void force_restart(void)
octave_idx_type size(void) const
void set_stop_time(double tt)
void clear_stop_time(void)
Vector representing the dimensions (size) of an Array.
subroutine ddasrt(RES, NEQ, T, Y, YPRIME, TOUT, INFO, RTOL, ATOL, IDID, RWORK, LRW, IWORK, LIW, RPAR, IPAR, JAC, G, NG, JROOT)
#define F77_XFCN(f, F, args)
octave_f77_int_type F77_INT
F77_RET_T(F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const F77_INT &, const F77_INT &, const F77_INT &, F77_INT &, F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, F77_DBLE *, F77_DBLE *, const F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, F77_INT *, F77_INT &F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL)
static uint32_t state[624]
octave_value::octave_value(const Array< char > &chm, char type) return retval