changeset 31416:33d5c1c41bbc

Clean up unused portions of runge_kutta_interpolate (bug #63162) * runge_kutta_interpolate.m: Eliminate unnecessary call to FCN (the stepper function, called prior to runge_kutta_interpolate, has already done that). Eliminate unnecessary DT, FCN, and ARGS arguments. * integrate_adaptive.m: Update calls to runge_kutta_interpolate.
author Ken Marek <marek_ka@mercer.edu>
date Thu, 06 Oct 2022 16:17:50 -0400
parents 00e2eafd1c0f
children 7286327ec4b6
files scripts/ode/private/integrate_adaptive.m scripts/ode/private/runge_kutta_interpolate.m
diffstat 2 files changed, 11 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ode/private/integrate_adaptive.m	Thu Nov 10 18:52:19 2022 +0100
+++ b/scripts/ode/private/integrate_adaptive.m	Thu Oct 06 16:17:50 2022 -0400
@@ -193,8 +193,7 @@
           iout = max (t_caught);
           output_x(:, t_caught) = ...
             runge_kutta_interpolate (order, [t_old t_new], [x_old x_new], ...
-                                     output_t(t_caught), new_k_vals, dt, ...
-                                     fcn, options.funarguments);
+                                     output_t(t_caught), new_k_vals);
         endif
         ## Add a possible additional output value if we found a terminal Event
         if ((terminal_event == true) && ...
@@ -210,8 +209,7 @@
         tadd = tadd(2:end);
         output_x(:, iout + (1:iadd)) = ...
           runge_kutta_interpolate (order, [t_old t_new], [x_old x_new], ...
-                                   tadd, new_k_vals, dt, fcn, ...
-                                   options.funarguments);
+                                   tadd, new_k_vals);
         output_t(iout + (1:iadd)) = tadd;
         iout = length (output_t);
       else                         # refine = 1
--- a/scripts/ode/private/runge_kutta_interpolate.m	Thu Nov 10 18:52:19 2022 +0100
+++ b/scripts/ode/private/runge_kutta_interpolate.m	Thu Oct 06 16:17:50 2022 -0400
@@ -23,22 +23,21 @@
 ##
 ########################################################################
 
-function u_interp = runge_kutta_interpolate (order, z, u, t, k_vals, dt, fcn, args)
+function u_interp = runge_kutta_interpolate (order, z, u, t, k_vals)
 
   switch (order)
 
     case 1
+      ## Unused
       u_interp = interp1 (z, u.', t, "linear");
 
     case 2
-      if (! isempty (k_vals))
-        der = k_vals(:,1);
-      else
-        der = feval (fcn, z(1) , u(:,1), args);
-      endif
+      ## ode23s with Rosenbrock scheme:
+      der = k_vals(:,1);
       u_interp = quadratic_interpolation (z, u, der, t);
 
     case 3
+      ## ode23 with Bogacki-Shampine scheme:
       u_interp = hermite_cubic_interpolation (z, u, k_vals, t);
 
     case 5
@@ -46,11 +45,10 @@
       u_interp = hermite_quartic_interpolation (z, u, k_vals, t);
 
     otherwise
-      warning (["High order interpolation not yet implemented: ", ...
-                "using cubic interpolation instead"]);
-      der(:,1) = feval (fcn, z(1), u(:,1), args);
-      der(:,2) = feval (fcn, z(2), u(:,2), args);
-      u_interp = hermite_cubic_interpolation (z, u, der, t);
+      ## This should never happen
+      warning (["Invalid/unimplemented interpolation order: ", ...
+                "using linear interpolation instead"]);
+      u_interp = interp1 (z, u.', t, "linear");
 
   endswitch