diff scripts/ode/private/integrate_n_steps.m @ 20584:eb9e2d187ed2

maint: Use Octave coding conventions in scripts/ode/private dir. * AbsRel_Norm.m, fuzzy_compare.m, hermite_quartic_interpolation.m, integrate_adaptive.m, integrate_const.m, integrate_n_steps.m, kahan.m, ode_struct_value_check.m, odepkg_event_handle.m, odepkg_structure_check.m, runge_kutta_45_dorpri.m, starting_stepsize.m: Wrap long lines to < 80 chars. Use double quotes rather than single quotes where possible. Use ';' at end of keywords "return;" and "break;" Use '##" for stand-alone comments and '#' for end-of-line comments. Use two spaces after period before starting new sentence. Use '!' instead of '~' for logical negation. Use specific form of end (endif, endfor, etc.). Don't use line continuation marker '...' unless necessary.
author Rik <rik@octave.org>
date Sun, 04 Oct 2015 22:18:54 -0700
parents 25623ef2ff4f
children b7ac1e94266e
line wrap: on
line diff
--- a/scripts/ode/private/integrate_n_steps.m	Sun Oct 04 16:24:32 2015 +0100
+++ b/scripts/ode/private/integrate_n_steps.m	Sun Oct 04 22:18:54 2015 -0700
@@ -64,7 +64,7 @@
 
 function solution = integrate_n_steps (stepper, func, t0, x0, dt, n, options)
 
-  solution = struct;
+  solution = struct ();
 
   ## first values for time and solution
   x = x0(:); 
@@ -72,8 +72,7 @@
 
   vdirection = odeget (options, "vdirection", [], "fast");
   if (sign (dt) != vdirection)
-    error("OdePkg:InvalidArgument",
-          "option ''InitialStep'' has a wrong sign");
+    error ("OdePkg:InvalidArgument", "option 'InitialStep' has a wrong sign");
   endif
 
   comp = 0.0;
@@ -139,7 +138,7 @@
     vcntiter = 0;
       
     ## Call plot only if a valid result has been found, therefore this code
-    ## fragment has moved here. Stop integration if plot function returns false
+    ## fragment has moved here.  Stop integration if plot function returns false
     if (options.vhaveoutputfunction)
       for vcnt = 0:options.Refine # Approximation between told and t
         if (options.vhaverefine) # Do interpolation
@@ -157,17 +156,17 @@
         vpltret = feval (options.OutputFcn, vapproxtime, vapproxvals, [],
                          options.vfunarguments{:});
         if (vpltret) # Leave refinement loop
-          break
+          break;
         endif
       endfor
       if (vpltret) # Leave main loop
         solution.vunhandledtermination = false;
-        break
+        break;
       endif
     endif
       
     ## Call event only if a valid result has been found, therefore this
-    ## code fragment has moved here. Stop integration if veventbreak is
+    ## code fragment has moved here.  Stop integration if veventbreak is
     ## true
     if (options.vhaveeventfunction)
       solution.vevent = odepkg_event_handle (options.Events, t(end), x(:,end),
@@ -177,7 +176,7 @@
         t(solution.vcntloop-1,:) = solution.vevent{3}(end,:);
         x(:,solution.vcntloop-1) = solution.vevent{4}(end,:)';
         solution.vunhandledtermination = false; 
-        break
+        break;
       endif
     endif
     
@@ -188,12 +187,12 @@
     ## Stop solving because the last 1000 steps no successful valid
     ## value has been found
     if (vcntiter >= 5000)
-      error (["Solving has not been successful. The iterative",
+      error (["Solving has not been successful.  The iterative",
               " integration loop exited at time t = %f before endpoint at",
-              " tend = %f was reached. This happened because the iterative",
+              " tend = %f was reached.  This happened because the iterative",
               " integration loop does not find a valid solution at this time",
-              " stamp. Try to reduce the value of ''InitialStep'' and/or",
-              " ''MaxStep'' with the command ''odeset''.\n"],
+              " stamp.  Try to reduce the value of 'InitialStep' and/or",
+              " 'MaxStep' with the command 'odeset'.\n"],
              s(end), tspan(end));
     endif
   endfor
@@ -202,20 +201,20 @@
   #if (vdirection * z(end) < vdirection * tspan(end))
   #  if (solution.vunhandledtermination == true)
   #    error ("OdePkg:InvalidArgument",
-  #           ["Solving has not been successful. The iterative",
+  #           ["Solving has not been successful.  The iterative",
   #            " integration loop exited at time t = %f",
-  #            " before endpoint at tend = %f was reached. This may",
+  #            " before endpoint at tend = %f was reached.  This may",
   #            " happen if the stepsize grows smaller than defined in",
-  #            " vminstepsize. Try to reduce the value of ''InitialStep''",
-  #            " and/or ''MaxStep'' with the command ''odeset''.\n"],
+  #            " vminstepsize.  Try to reduce the value of 'InitialStep'",
+  #            " and/or 'MaxStep' with the command 'odeset'.\n"],
   #           z(end), tspan(end));
   #  else
   #    warning ("OdePkg:InvalidArgument",
-  #             ["Solver has been stopped by a call of ''break'' in the main",
+  #             ["Solver has been stopped by a call of 'break' in the main",
   #              " iteration loop at time t = %f before endpoint at tend = %f",
-  #              " was reached. This may happen because the @odeplot function",
-  #              " returned ''true'' or the @event function returned",
-  #              " ''true''.\n"],
+  #              " was reached.  This may happen because the @odeplot function",
+  #              " returned 'true' or the @event function returned",
+  #              " 'true'.\n"],
   #             z(end), tspan(end));
   #  endif
   #endif
@@ -225,6 +224,3 @@
   
 endfunction
 
-## Local Variables: ***
-## mode: octave ***
-## End: ***