diff scripts/ode/private/integrate_const.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_const.m	Sun Oct 04 16:24:32 2015 +0100
+++ b/scripts/ode/private/integrate_const.m	Sun Oct 04 22:18:54 2015 -0700
@@ -63,7 +63,7 @@
 
 function solution = integrate_const (stepper, func, tspan, x0, dt, options)
 
-  solution = struct;
+  solution = struct ();
 
   ## first values for time and solution
   t = tspan(1);
@@ -72,7 +72,7 @@
   vdirection = odeget (options, "vdirection", [], "fast");
   if (sign (dt) != vdirection)
     error ("OdePkg:InvalidArgument",
-           "option ''InitialStep'' has a wrong sign");
+           "option 'InitialStep' has a wrong sign");
   endif
 
   ## setting parameters
@@ -189,11 +189,11 @@
     vcntiter = 0;
       
     ## Call plot only if a valid result has been found, therefore this
-    ## code fragment has moved here. Stop integration if plot function
+    ## code 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
+      for vcnt = 0:options.Refine  # Approximation between told and t
+        if (options.vhaverefine)  # Do interpolation
           vapproxtime = (vcnt + 1) / (options.Refine + 2);
           vapproxvals = (1 - vapproxtime) * vSaveVUForRefine ...
                         + (vapproxtime) * y(:,end);
@@ -207,18 +207,18 @@
         endif
         vpltret = feval (options.OutputFcn, vapproxtime, vapproxvals, [],
                          options.vfunarguments{:});
-        if (vpltret) # Leave refinement loop
-          break
+        if (vpltret)  # Leave refinement loop
+          break;
         endif
       endfor
-      if (vpltret) # Leave main loop
+      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 true
+    ## 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),
                                              [], options.vfunarguments{:});
@@ -227,7 +227,7 @@
         t(solution.vcntloop-1,:) = solution.vevent{3}(end,:);
         x(:,solution.vcntloop-1) = solution.vevent{4}(end,:)';
         solution.vunhandledtermination = false; 
-        break
+        break;
       endif
     endif
     
@@ -238,12 +238,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
 
@@ -257,19 +257,18 @@
   if (vdirection * z(end) < vdirection * tspan(end))
     if (solution.vunhandledtermination == true)
       error ("OdePkg:InvalidArgument",
-             ["Solving has not been successful. The iterative integration loop",
-              " exited at time t = %f 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"], z(end), tspan(end));
+             ["Solving has not been successful.  The iterative integration"
+              " loop exited at time t = %f 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"],
+             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
@@ -284,6 +283,3 @@
   
 endfunction
 
-## Local Variables: ***
-## mode: octave ***
-## End: ***