diff --git a/ComputingTasks.cc b/ComputingTasks.cc index ac377eca612e19776a544ee4f2053c1fd464708b..20118f1ebbf140f1669924c2d11a548ef11ae921 100644 --- a/ComputingTasks.cc +++ b/ComputingTasks.cc @@ -35,6 +35,7 @@ SteadyStatement::SteadyStatement(const OptionsList &options_list_arg) : void SteadyStatement::checkPass(ModFileStructure &mod_file_struct) { + mod_file_struct.steady_present = true; } void diff --git a/DynareBison.yy b/DynareBison.yy index 48076c9483ce0460bd2b6a103ec590c189ed157b..e5254ae902e1a972eeb7dff07f932be670577880 100644 --- a/DynareBison.yy +++ b/DynareBison.yy @@ -111,7 +111,7 @@ class ParsingDriver; %token MODE_CHECK MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS %token MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER %token <string_val> NAME -%token NAN_CONSTANT NOBS NOCONSTANT NOCORR NODIAGNOSTIC NOFUNCTIONS +%token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NOCORR NODIAGNOSTIC NOFUNCTIONS %token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF %token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS %token PARAMETERS PARAMETER_SET PARTIAL_INFORMATION PERIODS PLANNER_OBJECTIVE PLOT_CONDITIONAL_FORECAST PLOT_PRIORS PREFILTER PRESAMPLE @@ -463,6 +463,7 @@ model_options : BLOCK { driver.block(); } | o_mfs | BYTECODE { driver.byte_code(); } | USE_DLL { driver.use_dll(); } + | NO_STATIC { driver.no_static();} | o_linear ; diff --git a/DynareFlex.ll b/DynareFlex.ll index ea329b9f5a8ca1d99ce56feaa14bd9cd5d397836..113a73e7fe98307de28785a11e6d977383ed2cc0 100644 --- a/DynareFlex.ll +++ b/DynareFlex.ll @@ -416,6 +416,7 @@ int sigma_e = 0; <DYNARE_BLOCK>use_dll {return token::USE_DLL;} <DYNARE_BLOCK>block {return token::BLOCK;} <DYNARE_BLOCK>bytecode {return token::BYTECODE;} +<DYNARE_BLOCK>no_static {return token::NO_STATIC;} <DYNARE_STATEMENT,DYNARE_BLOCK>linear {return token::LINEAR;} diff --git a/ModFile.cc b/ModFile.cc index 0ee3b6ff19f94257accd57cf9350ba6e2a318972..048365a2e753e42869fcc15527a01a490ef28602 100644 --- a/ModFile.cc +++ b/ModFile.cc @@ -27,7 +27,7 @@ ModFile::ModFile() : expressions_tree(symbol_table, num_constants), static_model(symbol_table, num_constants), dynamic_model(symbol_table, num_constants), linear(false), block(false), byte_code(false), - use_dll(false) + use_dll(false), no_static(false) { } @@ -134,6 +134,12 @@ ModFile::checkPass() cerr << "ERROR: In 'model' block, can't use option 'bytecode' without option 'block'" << endl; exit(EXIT_FAILURE); } + if (stochastic_statement_present || mod_file_struct.check_present || mod_file_struct.steady_present && no_static) + { + cerr << "no_static option is incompatible with stochastic simulation, estimation, optimal policy, steady or check command" << endl; + exit(EXIT_FAILURE); + } + } void @@ -187,7 +193,8 @@ ModFile::computingPass(bool no_tmp_terms) { // Compute static model and its derivatives dynamic_model.toStatic(static_model); - static_model.computingPass(global_eval_context, no_tmp_terms, false, block); + if(!no_static) + static_model.computingPass(global_eval_context, no_tmp_terms, false, block); // Set things to compute for dynamic model if (dynamic_model_needed) { @@ -336,7 +343,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all dynamic_model.writeOutput(mOutputFile, basename, block, byte_code, use_dll); else dynamic_model.writeOutput(mOutputFile, basename, false, false, false); - if (!byte_code) + if (!byte_code && !no_static) static_model.writeOutput(mOutputFile, block); } @@ -356,7 +363,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all // Special treatment for load params and steady state statement: insert initial values for the auxiliary variables LoadParamsAndSteadyStateStatement *lpass = dynamic_cast<LoadParamsAndSteadyStateStatement *>(*it); - if (lpass) + if (lpass && !no_static) static_model.writeAuxVarInitval(mOutputFile); } @@ -373,7 +380,8 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all // Create static and dynamic files if (dynamic_model.equation_number() > 0) { - static_model.writeStaticFile(basename, block, byte_code); + if (!no_static) + static_model.writeStaticFile(basename, block, byte_code); if (dynamic_model_needed) { diff --git a/ModFile.hh b/ModFile.hh index def8595ddc8d7a7b3ec87dbdd339f0935480aa5a..5af71538e7e897c296530b679c56add043deb7fa 100644 --- a/ModFile.hh +++ b/ModFile.hh @@ -60,6 +60,9 @@ public: //! Is the model stored in a MEX file ? (option "use_dll" of "model") bool use_dll; + //! Is the static model have to computed (no_static=false) or not (no_static=true). Option of 'model' + bool no_static; + //! Global evaluation context /*! Filled using initval blocks and parameters initializations */ eval_context_type global_eval_context; diff --git a/ParsingDriver.cc b/ParsingDriver.cc index 3c6bba6c1dcc7e5471cfc02289c35ea29b326bdb..dfdd62f26bd44cc6138339c88705df0d4097c538 100644 --- a/ParsingDriver.cc +++ b/ParsingDriver.cc @@ -365,6 +365,13 @@ ParsingDriver::block() mod_file->block = true; } + +void +ParsingDriver::no_static() +{ + mod_file->no_static = true; +} + void ParsingDriver::byte_code() { diff --git a/ParsingDriver.hh b/ParsingDriver.hh index f4ed5fb807ff702dfcea38e884bc1b95b3d9edc1..5921022030fc5abd9c4e2f07d255a79f6dde6912 100644 --- a/ParsingDriver.hh +++ b/ParsingDriver.hh @@ -188,6 +188,8 @@ public: void block(); //! the model is stored in a binary file void byte_code(); + //! the static model is not computed + void no_static(); //! cutoff option of model block void cutoff(string *value); //! mfs option of model block diff --git a/Statement.cc b/Statement.cc index 08295127f5409c18ad63bc2a728e682edda3a8ac..db9cd915a5bb7918a800226460650d19bc13de91 100644 --- a/Statement.cc +++ b/Statement.cc @@ -21,6 +21,7 @@ ModFileStructure::ModFileStructure() : check_present(false), + steady_present(false), simul_present(false), stoch_simul_present(false), estimation_present(false), diff --git a/Statement.hh b/Statement.hh index b745a16d5f63b0405631ab66b6e85fad3be4ce87..170322ae854447303099c789e6098037271a4bc5 100644 --- a/Statement.hh +++ b/Statement.hh @@ -34,6 +34,8 @@ public: ModFileStructure(); //! Wheter check is present bool check_present; + //! Wheter steady is present + bool steady_present; //! Whether a simul statement is present bool simul_present; //! Whether a stoch_simul statement is present