diff liboctave/ODESSA.cc @ 4231:1032fb9ec0d1

[project @ 2002-12-19 19:58:29 by jwe]
author jwe
date Thu, 19 Dec 2002 19:59:13 +0000
parents 1feaee8df4ff
children 5ab4ac522fec
line wrap: on
line diff
--- a/liboctave/ODESSA.cc
+++ b/liboctave/ODESSA.cc
@@ -278,20 +278,24 @@
 	idf = 0;
       
       iopt(2) = idf;
-      
-      
+
       if (restart)
 	{
 	  restart = false;
 	  istate = 1;
 	}
-      
+
+      int max_maxord = 0;
+
       if (integration_method () == "stiff")
 	{
 	  if (user_jsub)
 	    method_flag = 21;
 	  else
 	    method_flag = 22;
+
+	  max_maxord = 5;
+
 	  if (isopt)
 	    {
 	      liw = 21 + n + npar;
@@ -305,6 +309,8 @@
 	}
       else
 	{
+	  max_maxord = 12;
+
 	  if (isopt)
 	    {
 	      if (user_jsub)
@@ -338,8 +344,27 @@
 	    rwork.elem (i) = 0.0;
 	}
       
+      maxord = maximum_order ();
+
+      if (maxord >= 0)
+	{
+	  if (maxord > 0 && maxord <= max_maxord)
+	    {
+	      iwork(4) = maxord;
+	      iopt(0) = 1;
+	    }
+	  else
+	    {
+	      (*current_liboctave_error_handler)
+		("odessa: invalid value for maximum order");
+	      integration_error = true;
+	      return;
+	    }
+	}
+
       initialized = true;
     }
+
   integration_error = false;
 
   // NOTE: this won't work if LSODE passes copies of the state vector.