From 399b6d261526db94f16101ebba25236d4a834c9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Wed, 9 Oct 2013 16:55:46 +0200
Subject: [PATCH] Specialized maxit in bytecode mex (dynamic simulation vs
 steady state).

---
 mex/sources/bytecode/bytecode.cc | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/mex/sources/bytecode/bytecode.cc b/mex/sources/bytecode/bytecode.cc
index fada2bf13e..5a08c6754a 100644
--- a/mex/sources/bytecode/bytecode.cc
+++ b/mex/sources/bytecode/bytecode.cc
@@ -707,16 +707,25 @@ main(int nrhs, const char *prhs[])
     DYN_MEX_FUNC_ERR_MSG_TXT("verbosity is not a field of options_");
   if (verbose)
     print_it = true;
-  field = mxGetFieldNumber(options_, "simul");
-  mxArray *simul;
+  if (!steady_state)
+    field = mxGetFieldNumber(options_, "simul");
+  else
+    field = mxGetFieldNumber(options_, "steady");
+  mxArray *temporaryfield;
   if (field >= 0)
-    simul = mxGetFieldByNumber(options_, 0, field);
+    temporaryfield = mxGetFieldByNumber(options_, 0, field);
   else
-    DYN_MEX_FUNC_ERR_MSG_TXT("simul is not a field of options_");
-  field = mxGetFieldNumber(simul, "maxit");
+    if (!steady_state)
+      DYN_MEX_FUNC_ERR_MSG_TXT("simul is not a field of options_");
+    else
+      DYN_MEX_FUNC_ERR_MSG_TXT("steady is not a field of options_");
+  field = mxGetFieldNumber(temporaryfield, "maxit");
   if (field<0)
-    DYN_MEX_FUNC_ERR_MSG_TXT("maxit is not a field of options_.simul");
-  int maxit_ = int (floor(*(mxGetPr(mxGetFieldByNumber(simul, 0, field)))));
+    if (!steady_state)
+      DYN_MEX_FUNC_ERR_MSG_TXT("maxit is not a field of options_.simul");
+    else
+      DYN_MEX_FUNC_ERR_MSG_TXT("maxit is not a field of options_.steady");
+  int maxit_ = int (floor(*(mxGetPr(mxGetFieldByNumber(temporaryfield, 0, field)))));
   field = mxGetFieldNumber(options_, "slowc");
   if (field < 0)
     DYN_MEX_FUNC_ERR_MSG_TXT("slows is not a field of options_");
-- 
GitLab