comparison liboctave/DASPK.cc @ 11502:4638800cd660

delete data pointer members from liboctave ODE/DAE classes; make destuctors virtual in ODE/DAE base classes
author John W. Eaton <jwe@octave.org>
date Thu, 13 Jan 2011 03:16:40 -0500
parents 8a5e980da6aa
children fd0a3ac60b0e
comparison
equal deleted inserted replaced
11501:331fcc41ca23 11502:4638800cd660
71 static DAEFunc::DAEJacFunc user_jac; 71 static DAEFunc::DAEJacFunc user_jac;
72 static octave_idx_type nn; 72 static octave_idx_type nn;
73 73
74 static octave_idx_type 74 static octave_idx_type
75 ddaspk_f (const double& time, const double *state, const double *deriv, 75 ddaspk_f (const double& time, const double *state, const double *deriv,
76 const double&, double *delta, octave_idx_type& ires, double *, octave_idx_type *) 76 const double&, double *delta, octave_idx_type& ires, double *,
77 octave_idx_type *)
77 { 78 {
78 BEGIN_INTERRUPT_WITH_EXCEPTIONS; 79 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
79 80
80 ColumnVector tmp_deriv (nn); 81 ColumnVector tmp_deriv (nn);
81 ColumnVector tmp_state (nn); 82 ColumnVector tmp_state (nn);
169 info.resize (20, 1); 170 info.resize (20, 1);
170 171
171 for (octave_idx_type i = 0; i < 20; i++) 172 for (octave_idx_type i = 0; i < 20; i++)
172 info(i) = 0; 173 info(i) = 0;
173 174
174 pinfo = info.fortran_vec ();
175
176 octave_idx_type n = size (); 175 octave_idx_type n = size ();
177 176
178 nn = n; 177 nn = n;
179 178
180 info(0) = 0; 179 info(0) = 0;
184 rwork(0) = stop_time; 183 rwork(0) = stop_time;
185 info(3) = 1; 184 info(3) = 1;
186 } 185 }
187 else 186 else
188 info(3) = 0; 187 info(3) = 0;
189
190 px = x.fortran_vec ();
191 pxdot = xdot.fortran_vec ();
192 188
193 // DAEFunc 189 // DAEFunc
194 190
195 user_fun = DAEFunc::function (); 191 user_fun = DAEFunc::function ();
196 user_jac = DAEFunc::jacobian_function (); 192 user_jac = DAEFunc::jacobian_function ();
238 lrw += n; 234 lrw += n;
239 235
240 iwork.resize (liw, 1); 236 iwork.resize (liw, 1);
241 rwork.resize (lrw, 1); 237 rwork.resize (lrw, 1);
242 238
243 piwork = iwork.fortran_vec ();
244 prwork = rwork.fortran_vec ();
245
246 // DASPK_options 239 // DASPK_options
247 240
248 abs_tol = absolute_tolerance (); 241 abs_tol = absolute_tolerance ();
249 rel_tol = relative_tolerance (); 242 rel_tol = relative_tolerance ();
250 243
265 ("daspk: inconsistent sizes for tolerance arrays"); 258 ("daspk: inconsistent sizes for tolerance arrays");
266 259
267 integration_error = true; 260 integration_error = true;
268 return retval; 261 return retval;
269 } 262 }
270
271 pabs_tol = abs_tol.fortran_vec ();
272 prel_tol = rel_tol.fortran_vec ();
273 263
274 double hmax = maximum_step_size (); 264 double hmax = maximum_step_size ();
275 if (hmax >= 0.0) 265 if (hmax >= 0.0)
276 { 266 {
277 rwork(1) = hmax; 267 rwork(1) = hmax;
458 DASPK_options::reset = false; 448 DASPK_options::reset = false;
459 449
460 restart = false; 450 restart = false;
461 } 451 }
462 452
463 static double *dummy = 0; 453 double *px = x.fortran_vec ();
464 static octave_idx_type *idummy = 0; 454 double *pxdot = xdot.fortran_vec ();
455
456 octave_idx_type *pinfo = info.fortran_vec ();
457
458 double *prel_tol = rel_tol.fortran_vec ();
459 double *pabs_tol = abs_tol.fortran_vec ();
460
461 double *prwork = rwork.fortran_vec ();
462 octave_idx_type *piwork = iwork.fortran_vec ();
463
464 double *dummy = 0;
465 octave_idx_type *idummy = 0;
465 466
466 F77_XFCN (ddaspk, DDASPK, (ddaspk_f, nn, t, px, pxdot, tout, pinfo, 467 F77_XFCN (ddaspk, DDASPK, (ddaspk_f, nn, t, px, pxdot, tout, pinfo,
467 prel_tol, pabs_tol, istate, prwork, lrw, 468 prel_tol, pabs_tol, istate, prwork, lrw,
468 piwork, liw, dummy, idummy, ddaspk_j, 469 piwork, liw, dummy, idummy, ddaspk_j,
469 ddaspk_psol)); 470 ddaspk_psol));