From 9f45200924b7458f53921b9fea8652a6554a03f9 Mon Sep 17 00:00:00 2001
From: ferhat <ferhat@ac1d8469-bf42-47a9-8791-bf33cf982152>
Date: Wed, 2 Sep 2009 14:40:54 +0000
Subject: [PATCH] simulate.dll has been replaced by bytecode.dll

git-svn-id: https://www.dynare.org/svn/dynare/trunk@2881 ac1d8469-bf42-47a9-8791-bf33cf982152
---
 matlab/dynare_config.m                        |  6 ++---
 matlab/global_initialization.m                |  2 +-
 matlab/simul.m                                | 26 ++++++++++++++-----
 matlab/steady_.m                              |  2 +-
 mex/sources/build_matlab.m                    |  4 +--
 mex/sources/build_matlab_multithread.m        |  6 ++---
 .../{simulate => bytecode}/Interpreter.cc     |  0
 .../{simulate => bytecode}/Interpreter.hh     |  0
 .../{simulate => bytecode}/Mem_Mngr.cc        |  0
 .../{simulate => bytecode}/Mem_Mngr.hh        |  0
 .../{simulate => bytecode}/SparseMatrix.cc    |  0
 .../{simulate => bytecode}/SparseMatrix.hh    |  4 +--
 .../simulate.cc => bytecode/bytecode.cc}      |  2 +-
 .../simulate.hh => bytecode/bytecode.hh}      |  0
 .../testing/mex_interface.cc                  |  0
 .../testing/mex_interface.hh                  |  0
 .../testing/simulate_debug.m                  |  0
 preprocessor/ComputingTasks.cc                | 19 +-------------
 preprocessor/DynamicModel.hh                  |  2 +-
 19 files changed, 34 insertions(+), 39 deletions(-)
 rename mex/sources/{simulate => bytecode}/Interpreter.cc (100%)
 rename mex/sources/{simulate => bytecode}/Interpreter.hh (100%)
 rename mex/sources/{simulate => bytecode}/Mem_Mngr.cc (100%)
 rename mex/sources/{simulate => bytecode}/Mem_Mngr.hh (100%)
 rename mex/sources/{simulate => bytecode}/SparseMatrix.cc (100%)
 rename mex/sources/{simulate => bytecode}/SparseMatrix.hh (98%)
 rename mex/sources/{simulate/simulate.cc => bytecode/bytecode.cc} (99%)
 rename mex/sources/{simulate/simulate.hh => bytecode/bytecode.hh} (100%)
 rename mex/sources/{simulate => bytecode}/testing/mex_interface.cc (100%)
 rename mex/sources/{simulate => bytecode}/testing/mex_interface.hh (100%)
 rename mex/sources/{simulate => bytecode}/testing/simulate_debug.m (100%)

diff --git a/matlab/dynare_config.m b/matlab/dynare_config.m
index 07c4465d88..f5a01d4189 100644
--- a/matlab/dynare_config.m
+++ b/matlab/dynare_config.m
@@ -152,8 +152,8 @@ for i=1:number_of_mex_files
     disp([ message mex_status{i,3} '.' ])
 end
 
-% Test if simulate DLL is present
-if exist('simulate') == 3
+% Test if bytecode DLL is present
+if exist('bytecode') == 3
   remove_path_to_mex = 0;
   if ~multithread_flag
       message = '[mex] ';
@@ -163,7 +163,7 @@ if exist('simulate') == 3
 else
   message = '[no]  ';
 end
-disp([ message 'Fast model evaluation.' ])
+disp([ message 'Bytecode evaluation.' ])
 
 if remove_path_to_mex
   rmpath(path_to_mex_files);
diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m
index 85521e2047..07ae890cef 100644
--- a/matlab/global_initialization.m
+++ b/matlab/global_initialization.m
@@ -224,7 +224,7 @@ function global_initialization()
   % did model undergo block decomposition + minimum feedback set computation ?
   options_.block = 0;
 
-  % model evaluated using simulate.dll
+  % model evaluated using bytecode.dll
   options_.bytecode = 0;
   
   % SWZ SBVAR
diff --git a/matlab/simul.m b/matlab/simul.m
index e280383940..2c08d9ff7a 100644
--- a/matlab/simul.m
+++ b/matlab/simul.m
@@ -57,21 +57,33 @@ ct_=0;
 
 if options_.simul_algo == 0
   if ~ options_.initval_file
-      make_ex_;
-      make_y_;
+      if ~isfield(options_,'datafile')
+        make_ex_;
+        make_y_;
+      else
+          read_data_;
+      end
   end
-
+  
   if isempty(options_.scalv) | options_.scalv == 0
     options_.scalv = oo_.steady_state ;
   end
 
   options_.scalv= 1 ;
 
-  if M_.maximum_endo_lag ==1 & M_.maximum_endo_lead <= 1
-    sim1 ;
+  if(options_.block)
+      if(options_.bytecode)
+          oo_.endo_simul=bytecode('dynamic');
+      else
+          eval([M_.fname '_dynamic']);
+      end;
   else
-    simk ;
-  end
+      if M_.maximum_endo_lag ==1 & M_.maximum_endo_lead <= 1
+         sim1 ;
+      else
+         simk ;
+      end
+  end;
 else
   set_default_option('replic',1);
   set_default_option('simul_seed',1);
diff --git a/matlab/steady_.m b/matlab/steady_.m
index f884ad6f1d..450d7ced14 100644
--- a/matlab/steady_.m
+++ b/matlab/steady_.m
@@ -80,7 +80,7 @@ function steady_()
                           oo_.exo_det_steady_state], M_.params);
     end
   elseif options_.block && options_.bytecode
-      [oo_.steady_state,check] = simulate('steady_state');
+      [oo_.steady_state,check] = bytecode('steady_state');
   else
     [oo_.steady_state,check] = dynare_solve([M_.fname '_static'],...
 				     oo_.steady_state,...
diff --git a/mex/sources/build_matlab.m b/mex/sources/build_matlab.m
index a6fd7176c9..e15d544460 100644
--- a/mex/sources/build_matlab.m
+++ b/mex/sources/build_matlab.m
@@ -135,5 +135,5 @@ eval([ COMPILE_COMMAND ' -DMATLAB -Igensylv/cc ' ...
        'gensylv/cc/Vector.cpp ' ...
        BLAS_PATH ' ' LAPACK_PATH ]);
 
-disp('Compiling simulate...')
-eval([ COMPILE_COMMAND ' -Isimulate -I../../preprocessor simulate/simulate.cc simulate/Interpreter.cc simulate/Mem_Mngr.cc simulate/SparseMatrix.cc']);
\ No newline at end of file
+disp('Compiling bytecode...')
+eval([ COMPILE_COMMAND ' -Ibytecode -I../../preprocessor bytecode/bytecode.cc bytecode/Interpreter.cc bytecode/Mem_Mngr.cc bytecode/SparseMatrix.cc']);
\ No newline at end of file
diff --git a/mex/sources/build_matlab_multithread.m b/mex/sources/build_matlab_multithread.m
index b0a6e8468c..bcfa94c016 100644
--- a/mex/sources/build_matlab_multithread.m
+++ b/mex/sources/build_matlab_multithread.m
@@ -114,7 +114,7 @@ try
     disp('|  OpenMp is used (multithreaded mex files) for: |')
     disp('|   * sparse_hessian_times_B_kronecker_C.cc      |')
     disp('|   * A_times_B_kronecker_C.cc                   |')
-    disp('|   * simulate (SparseMatrix.cc)                 |')
+    disp('|   * bytecode (SparseMatrix.cc)                 |')
     disp('|------------------------------------------------|')
     disp(' ')
     COMPILE_OPTIONS_OMP = [ COMPILE_OPTIONS  CFLAGS CXXFLAGS LDFLAGS ];
@@ -161,5 +161,5 @@ eval([ COMPILE_COMMAND ' -DMATLAB -Igensylv/cc ' ...
        'gensylv/cc/Vector.cpp ' ...
        BLAS_PATH ' ' LAPACK_PATH ]);
 
-disp('Compiling simulate...')
-eval([ COMPILE_COMMAND_OMP ' -Isimulate -I../../preprocessor simulate/simulate.cc simulate/Interpreter.cc simulate/Mem_Mngr.cc simulate/SparseMatrix.cc']);
\ No newline at end of file
+disp('Compiling bytecode...')
+eval([ COMPILE_COMMAND_OMP ' -Ibytecode -I../../preprocessor bytecode/bytecode.cc bytecode/Interpreter.cc bytecode/Mem_Mngr.cc bytecode/SparseMatrix.cc']);
\ No newline at end of file
diff --git a/mex/sources/simulate/Interpreter.cc b/mex/sources/bytecode/Interpreter.cc
similarity index 100%
rename from mex/sources/simulate/Interpreter.cc
rename to mex/sources/bytecode/Interpreter.cc
diff --git a/mex/sources/simulate/Interpreter.hh b/mex/sources/bytecode/Interpreter.hh
similarity index 100%
rename from mex/sources/simulate/Interpreter.hh
rename to mex/sources/bytecode/Interpreter.hh
diff --git a/mex/sources/simulate/Mem_Mngr.cc b/mex/sources/bytecode/Mem_Mngr.cc
similarity index 100%
rename from mex/sources/simulate/Mem_Mngr.cc
rename to mex/sources/bytecode/Mem_Mngr.cc
diff --git a/mex/sources/simulate/Mem_Mngr.hh b/mex/sources/bytecode/Mem_Mngr.hh
similarity index 100%
rename from mex/sources/simulate/Mem_Mngr.hh
rename to mex/sources/bytecode/Mem_Mngr.hh
diff --git a/mex/sources/simulate/SparseMatrix.cc b/mex/sources/bytecode/SparseMatrix.cc
similarity index 100%
rename from mex/sources/simulate/SparseMatrix.cc
rename to mex/sources/bytecode/SparseMatrix.cc
diff --git a/mex/sources/simulate/SparseMatrix.hh b/mex/sources/bytecode/SparseMatrix.hh
similarity index 98%
rename from mex/sources/simulate/SparseMatrix.hh
rename to mex/sources/bytecode/SparseMatrix.hh
index 28eb9da078..066f4ad18f 100644
--- a/mex/sources/simulate/SparseMatrix.hh
+++ b/mex/sources/bytecode/SparseMatrix.hh
@@ -26,11 +26,11 @@
 #include <map>
 #include <ctime>
 #include "Mem_Mngr.hh"
-#ifdef NO_OPENMP
+/*#ifdef NO_OPENMP
 // Nothing to single thread version.
 #else
   #include <omp.h>
-#endif
+#endif*/
 #ifdef _MSC_VER
   #include <limits>
 #endif
diff --git a/mex/sources/simulate/simulate.cc b/mex/sources/bytecode/bytecode.cc
similarity index 99%
rename from mex/sources/simulate/simulate.cc
rename to mex/sources/bytecode/bytecode.cc
index e40a49c8de..84e211e371 100644
--- a/mex/sources/simulate/simulate.cc
+++ b/mex/sources/bytecode/bytecode.cc
@@ -24,7 +24,7 @@
 ////////////////////////////////////////////////////////////////////////
 
 #include <cstring>
-#include "simulate.hh"
+#include "bytecode.hh"
 #include "Interpreter.hh"
 #include "Mem_Mngr.hh"
 
diff --git a/mex/sources/simulate/simulate.hh b/mex/sources/bytecode/bytecode.hh
similarity index 100%
rename from mex/sources/simulate/simulate.hh
rename to mex/sources/bytecode/bytecode.hh
diff --git a/mex/sources/simulate/testing/mex_interface.cc b/mex/sources/bytecode/testing/mex_interface.cc
similarity index 100%
rename from mex/sources/simulate/testing/mex_interface.cc
rename to mex/sources/bytecode/testing/mex_interface.cc
diff --git a/mex/sources/simulate/testing/mex_interface.hh b/mex/sources/bytecode/testing/mex_interface.hh
similarity index 100%
rename from mex/sources/simulate/testing/mex_interface.hh
rename to mex/sources/bytecode/testing/mex_interface.hh
diff --git a/mex/sources/simulate/testing/simulate_debug.m b/mex/sources/bytecode/testing/simulate_debug.m
similarity index 100%
rename from mex/sources/simulate/testing/simulate_debug.m
rename to mex/sources/bytecode/testing/simulate_debug.m
diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc
index b5c841e61b..75fc41bb26 100644
--- a/preprocessor/ComputingTasks.cc
+++ b/preprocessor/ComputingTasks.cc
@@ -94,24 +94,7 @@ void
 SimulStatement::writeOutput(ostream &output, const string &basename) const
 {
   options_list.writeOutput(output);
-  if (!block)
-    output << "simul(oo_.dr);\n";
-  else
-    {
-      output << "if (~ options_.initval_file) & (size(oo_.endo_simul,2)<options_.periods)" << endl
-             << "  if ~isfield(options_,'datafile')" << endl
-             << "    make_y_;" << endl
-             << "    make_ex_;" << endl
-             << "  else" << endl
-             << "    read_data_;" << endl
-             << "  end" << endl
-             << "end" << endl;
-      if (byte_code)
-          output << "oo_.endo_simul=simulate;" << endl;
-        else
-          output << basename << "_dynamic;" << endl;
-      output << "dyn2vec;" << endl;
-    }
+  output << "simul(oo_.dr);\n";
 }
 
 StochSimulStatement::StochSimulStatement(const SymbolList &symbol_list_arg,
diff --git a/preprocessor/DynamicModel.hh b/preprocessor/DynamicModel.hh
index 92bd817126..9ddbada8ce 100644
--- a/preprocessor/DynamicModel.hh
+++ b/preprocessor/DynamicModel.hh
@@ -143,7 +143,7 @@ public:
   virtual NodeID AddVariable(const string &name, int lag = 0);
   //! Absolute value under which a number is considered to be zero
   double cutoff;
-  //! The weight of the Markowitz criteria to determine the pivot in the linear solver (simul_NG1 and simul_NG from simulate.cc)
+  //! The weight of the Markowitz criteria to determine the pivot in the linear solver (simul_NG1 and simul_NG from bytecode.cc)
   double markowitz;
   //! Compute the minimum feedback set in the dynamic model:
   /*!   0 : all endogenous variables are considered as feedback variables
-- 
GitLab