void vdterm_() { vflush(); ct_(); }
//-------------------------------------------------------------------------- void Omu_IntRKsuite::ode_solve(double tstart, VECP y, const VECP u, double tend) { if (_sa) _neq = y->dim; else _neq = _n; _npar = u->dim; v_resize(_work, 32 * _neq); v_resize(_thres, _neq); v_resize(_u, _npar); v_resize(_yp, _neq); _y_head.dim = _neq; _yp_head.dim = _neq; v_set(_thres, _atol); // exclude sensitivities from error test if (!_serr) { for (int i = _n; i < (int)_thres->dim; i++) _thres[i] = 1e128; } v_zero(_yp); v_copy(u, _u); integer NEQ = _neq; // a hack to reinitialize _hnext in each simulation if (tstart < _tlast) _hnext = 0.0; _tlast = tstart; dreal TNOW = tstart; integer CFLAG; //integer METHOD = (_rtol > 5e-4)? 1: (_rtol > 5e-6)? 2: 3; integer METHOD = _method; char TASK = 'c'; logical ERRASS = 0; dreal HSTART = _hnext; integer LENWRK = _work->dim; logical MESAGE = 0; setup_(&NEQ, &tstart, y->ve, &tend, &_rtol, _thres->ve, &METHOD, &TASK, &ERRASS, &HSTART, _work->ve, &LENWRK, &MESAGE); while (TNOW < tend) { ct_(&::F, &TNOW, y->ve, _yp->ve, _work->ve, &CFLAG); if (CFLAG > 1) fprintf(stderr, "RKsuite message %d at time %g\n", CFLAG, TNOW); if (CFLAG > 4) m_error(E_CONV, "Omu_IntRKsuite::step"); } integer TOTF, STPCST, STPSOK; dreal WASTE; stat_(&TOTF, &STPCST, &WASTE, &STPSOK, &HSTART); _hnext = HSTART; }