diff --git a/ComputingTasks.cc b/ComputingTasks.cc index 8e1945d6bafbd1cd23c5bc22df61305a7a7b9b65..db29b6d9c26486b1da3830fac8cd647f8aae2329 100644 --- a/ComputingTasks.cc +++ b/ComputingTasks.cc @@ -1790,7 +1790,7 @@ PlannerObjectiveStatement::getPlannerObjective() const void PlannerObjectiveStatement::computingPass() { - model_tree->computingPass(eval_context_t(), false, true, true, none, false, false); + model_tree->computingPass(eval_context_t(), false, true, true, none, false, false, false); computing_pass_called = true; } diff --git a/DynamicModel.cc b/DynamicModel.cc index a7aa4dd02c2df63ea904333c4cb72ae1bb3536b9..b2b5c8f67ac20f804d71961d519f2c0d7716e426 100644 --- a/DynamicModel.cc +++ b/DynamicModel.cc @@ -3180,7 +3180,7 @@ DynamicModel::runTrendTest(const eval_context_t &eval_context) void DynamicModel::computingPass(bool jacobianExo, bool hessian, bool thirdDerivatives, int paramsDerivsOrder, const eval_context_t &eval_context, bool no_tmp_terms, bool block, bool use_dll, - bool bytecode) + bool bytecode, const bool nopreprocessoroutput) { assert(jacobianExo || !(hessian || thirdDerivatives || paramsDerivsOrder)); @@ -3203,19 +3203,22 @@ DynamicModel::computingPass(bool jacobianExo, bool hessian, bool thirdDerivative } // Launch computations - cout << "Computing dynamic model derivatives:" << endl - << " - order 1" << endl; + if (!nopreprocessoroutput) + cout << "Computing dynamic model derivatives:" << endl + << " - order 1" << endl; computeJacobian(vars); if (hessian) { - cout << " - order 2" << endl; + if (!nopreprocessoroutput) + cout << " - order 2" << endl; computeHessian(vars); } if (paramsDerivsOrder > 0) { - cout << " - derivatives of Jacobian/Hessian w.r. to parameters" << endl; + if (!nopreprocessoroutput) + cout << " - derivatives of Jacobian/Hessian w.r. to parameters" << endl; computeParamsDerivatives(paramsDerivsOrder); if (!no_tmp_terms) @@ -3224,7 +3227,8 @@ DynamicModel::computingPass(bool jacobianExo, bool hessian, bool thirdDerivative if (thirdDerivatives) { - cout << " - order 3" << endl; + if (!nopreprocessoroutput) + cout << " - order 3" << endl; computeThirdDerivatives(vars); } @@ -3246,7 +3250,8 @@ DynamicModel::computingPass(bool jacobianExo, bool hessian, bool thirdDerivative equation_type_and_normalized_equation = equationTypeDetermination(first_order_endo_derivatives, variable_reordered, equation_reordered, mfs); - cout << "Finding the optimal block decomposition of the model ...\n"; + if (!nopreprocessoroutput) + cout << "Finding the optimal block decomposition of the model ...\n"; lag_lead_vector_t equation_lag_lead, variable_lag_lead; @@ -3768,7 +3773,7 @@ DynamicModel::replaceMyEquations(DynamicModel &dynamic_model) const } void -DynamicModel::computeRamseyPolicyFOCs(const StaticModel &static_model) +DynamicModel::computeRamseyPolicyFOCs(const StaticModel &static_model, const bool nopreprocessoroutput) { // Add aux LM to constraints in equations // equation[i]->lhs = rhs becomes equation[i]->MULT_(i+1)*(lhs-rhs) = 0 @@ -3779,8 +3784,8 @@ DynamicModel::computeRamseyPolicyFOCs(const StaticModel &static_model) assert(substeq != NULL); equations[i] = substeq; } - - cout << "Ramsey Problem: added " << i << " Multipliers." << endl; + if (!nopreprocessoroutput) + cout << "Ramsey Problem: added " << i << " Multipliers." << endl; // Add Planner Objective to equations to include in computeDerivIDs assert(static_model.equations.size() == 1); diff --git a/DynamicModel.hh b/DynamicModel.hh index ada85d140d1f19ac671ad381f609bc3ca2df81d8..3692661199716237a35515472c533afdb271f96e 100644 --- a/DynamicModel.hh +++ b/DynamicModel.hh @@ -243,7 +243,7 @@ public: \param no_tmp_terms if true, no temporary terms will be computed in the dynamic files */ void computingPass(bool jacobianExo, bool hessian, bool thirdDerivatives, int paramsDerivsOrder, - const eval_context_t &eval_context, bool no_tmp_terms, bool block, bool use_dll, bool bytecode); + const eval_context_t &eval_context, bool no_tmp_terms, bool block, bool use_dll, bool bytecode, const bool nopreprocessoroutput); //! Writes model initialization and lead/lag incidence matrix to output void writeOutput(ostream &output, const string &basename, bool block, bool byte_code, bool use_dll, int order, bool estimation_present, bool compute_xrefs, bool julia) const; @@ -296,7 +296,7 @@ public: void cloneDynamic(DynamicModel &dynamic_model) const; //! Replaces model equations with derivatives of Lagrangian w.r.t. endogenous - void computeRamseyPolicyFOCs(const StaticModel &static_model); + void computeRamseyPolicyFOCs(const StaticModel &static_model, const bool nopreprocessoroutput); //! Replaces the model equations in dynamic_model with those in this model void replaceMyEquations(DynamicModel &dynamic_model) const; diff --git a/DynareMain.cc b/DynareMain.cc index d37b2314d061060b27ab4601d5b5d6dc7aa6edb7..eb2891a6e30235df2d17a4e08e2714511a84033c 100644 --- a/DynareMain.cc +++ b/DynareMain.cc @@ -46,6 +46,7 @@ void main2(stringstream &in, string &basename, bool debug, bool clear_all, bool , bool cygwin, bool msvc, bool mingw #endif , JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, bool jsonderivsimple + , bool nopreprocessoroutput ); void main1(string &modfile, string &basename, string &modfiletxt, bool debug, bool save_macro, string &save_macro_file, @@ -120,6 +121,7 @@ main(int argc, char **argv) bool onlyjson = false; bool jsonderivsimple = false; LanguageOutputType language = matlab; + bool nopreprocessoroutput = false; // Parse options for (int arg = 2; arg < argc; arg++) @@ -303,6 +305,8 @@ main(int argc, char **argv) json_output_mode = standardout; else if (!strcmp(argv[arg], "onlyjson")) onlyjson = true; + else if (!strcmp(argv[arg], "nopreprocessoroutput")) + nopreprocessoroutput = true; else if (!strcmp(argv[arg], "jsonderivsimple")) jsonderivsimple = true; else if (strlen(argv[arg]) >= 4 && !strncmp(argv[arg], "json", 4)) @@ -333,8 +337,9 @@ main(int argc, char **argv) } } - cout << "Starting Dynare (version " << PACKAGE_VERSION << ")." << endl - << "Starting preprocessing of the model file ..." << endl; + if (!nopreprocessoroutput) + cout << "Starting Dynare (version " << PACKAGE_VERSION << ")." << endl + << "Starting preprocessing of the model file ..." << endl; // Construct basename (i.e. remove file extension if there is one) string basename = argv[1]; @@ -397,7 +402,7 @@ main(int argc, char **argv) #if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) , cygwin, msvc, mingw #endif - , json, json_output_mode, onlyjson, jsonderivsimple + , json, json_output_mode, onlyjson, jsonderivsimple, nopreprocessoroutput ); return EXIT_SUCCESS; diff --git a/DynareMain2.cc b/DynareMain2.cc index 6f0e113917835db3c9d1263904e38398ae7db017..d61df45b5039433290c4a67cc0e50dffd0c42276 100644 --- a/DynareMain2.cc +++ b/DynareMain2.cc @@ -35,6 +35,7 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear , bool cygwin, bool msvc, bool mingw #endif , JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, bool jsonderivsimple + , bool nopreprocessoroutput ) { ParsingDriver p(warnings, nostrict); @@ -42,38 +43,40 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear // Do parsing and construct internal representation of mod file ModFile *mod_file = p.parse(in, debug); if (json == parsing) - mod_file->writeJsonOutput(basename, json, json_output_mode, onlyjson); + mod_file->writeJsonOutput(basename, json, json_output_mode, onlyjson, nopreprocessoroutput); // Run checking pass mod_file->checkPass(nostrict, stochastic); if (json == checkpass) - mod_file->writeJsonOutput(basename, json, json_output_mode, onlyjson); + mod_file->writeJsonOutput(basename, json, json_output_mode, onlyjson, nopreprocessoroutput); // Perform transformations on the model (creation of auxiliary vars and equations) - mod_file->transformPass(nostrict, stochastic, compute_xrefs || json == transformpass); + mod_file->transformPass(nostrict, stochastic, compute_xrefs || json == transformpass, nopreprocessoroutput); if (json == transformpass) - mod_file->writeJsonOutput(basename, json, json_output_mode, onlyjson); + mod_file->writeJsonOutput(basename, json, json_output_mode, onlyjson, nopreprocessoroutput); // Evaluate parameters initialization, initval, endval and pounds - mod_file->evalAllExpressions(warn_uninit); + mod_file->evalAllExpressions(warn_uninit, nopreprocessoroutput); // Do computations - mod_file->computingPass(no_tmp_terms, output_mode, params_derivs_order); + mod_file->computingPass(no_tmp_terms, output_mode, params_derivs_order, nopreprocessoroutput); if (json == computingpass) - mod_file->writeJsonOutput(basename, json, json_output_mode, onlyjson, jsonderivsimple); + mod_file->writeJsonOutput(basename, json, json_output_mode, onlyjson, nopreprocessoroutput, jsonderivsimple); // Write outputs if (output_mode != none) - mod_file->writeExternalFiles(basename, output_mode, language); + mod_file->writeExternalFiles(basename, output_mode, language, nopreprocessoroutput); else mod_file->writeOutputFiles(basename, clear_all, clear_global, no_log, no_warn, console, nograph, nointeractive, config_file, check_model_changes, minimal_workspace, compute_xrefs #if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) , cygwin, msvc, mingw #endif + , nopreprocessoroutput ); delete mod_file; - cout << "Preprocessing completed." << endl; + if (!nopreprocessoroutput) + cout << "Preprocessing completed." << endl; } diff --git a/ModFile.cc b/ModFile.cc index 42fa7f64ef65f055147f67fa475e70412b591c4e..06c9bf82cfa1c4e88cebd5919f7c74ba6531bc13 100644 --- a/ModFile.cc +++ b/ModFile.cc @@ -53,9 +53,10 @@ ModFile::~ModFile() } void -ModFile::evalAllExpressions(bool warn_uninit) +ModFile::evalAllExpressions(bool warn_uninit, const bool nopreprocessoroutput) { - cout << "Evaluating expressions..."; + if (!nopreprocessoroutput) + cout << "Evaluating expressions..."; // Loop over all statements, and fill global eval context if relevant for (vector<Statement *>::const_iterator it = statements.begin(); it != statements.end(); it++) @@ -76,7 +77,8 @@ ModFile::evalAllExpressions(bool warn_uninit) // Evaluate model local variables dynamic_model.fillEvalContext(global_eval_context); - cout << "done" << endl; + if (!nopreprocessoroutput) + cout << "done" << endl; // Check if some symbols are not initialized, and give them a zero value then for (int id = 0; id <= symbol_table.maxID(); id++) @@ -340,7 +342,7 @@ ModFile::checkPass(bool nostrict, bool stochastic) } void -ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs) +ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const bool nopreprocessoroutput) { // Save the original model (must be done before any model transformations by preprocessor) dynamic_model.setLeadsLagsOrig(); @@ -389,7 +391,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs) if (linear) dynamic_model.cloneDynamic(orig_ramsey_dynamic_model); dynamic_model.cloneDynamic(ramsey_FOC_equations_dynamic_model); - ramsey_FOC_equations_dynamic_model.computeRamseyPolicyFOCs(*planner_objective); + ramsey_FOC_equations_dynamic_model.computeRamseyPolicyFOCs(*planner_objective, nopreprocessoroutput); ramsey_FOC_equations_dynamic_model.replaceMyEquations(dynamic_model); mod_file_struct.ramsey_eq_nbr = dynamic_model.equation_number() - mod_file_struct.orig_eq_nbr; } @@ -498,13 +500,14 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs) exit(EXIT_FAILURE); } - if (!mod_file_struct.ramsey_model_present) - cout << "Found " << dynamic_model.equation_number() << " equation(s)." << endl; - else - { - cout << "Found " << mod_file_struct.orig_eq_nbr << " equation(s)." << endl; - cout << "Found " << dynamic_model.equation_number() << " FOC equation(s) for Ramsey Problem." << endl; - } + if (!nopreprocessoroutput) + if (!mod_file_struct.ramsey_model_present) + cout << "Found " << dynamic_model.equation_number() << " equation(s)." << endl; + else + { + cout << "Found " << mod_file_struct.orig_eq_nbr << " equation(s)." << endl; + cout << "Found " << dynamic_model.equation_number() << " FOC equation(s) for Ramsey Problem." << endl; + } if (symbol_table.exists("dsge_prior_weight")) if (mod_file_struct.bayesian_irf_present) @@ -526,7 +529,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs) } void -ModFile::computingPass(bool no_tmp_terms, FileOutputType output, int params_derivs_order) +ModFile::computingPass(bool no_tmp_terms, FileOutputType output, int params_derivs_order, const bool nopreprocessoroutput) { // Mod file may have no equation (for example in a standalone BVAR estimation) if (dynamic_model.equation_number() > 0) @@ -550,7 +553,7 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, int params_deri if (mod_file_struct.identification_present || mod_file_struct.estimation_analytic_derivation) paramsDerivsOrder = params_derivs_order; static_model.computingPass(global_eval_context, no_tmp_terms, static_hessian, - false, paramsDerivsOrder, block, byte_code); + false, paramsDerivsOrder, block, byte_code, nopreprocessoroutput); } // Set things to compute for dynamic model if (mod_file_struct.perfect_foresight_solver_present || mod_file_struct.check_present @@ -560,7 +563,7 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, int params_deri || mod_file_struct.calib_smoother_present) { if (mod_file_struct.perfect_foresight_solver_present) - dynamic_model.computingPass(true, false, false, none, global_eval_context, no_tmp_terms, block, use_dll, byte_code); + dynamic_model.computingPass(true, false, false, none, global_eval_context, no_tmp_terms, block, use_dll, byte_code, nopreprocessoroutput); else { if (mod_file_struct.stoch_simul_present @@ -585,13 +588,13 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, int params_deri int paramsDerivsOrder = 0; if (mod_file_struct.identification_present || mod_file_struct.estimation_analytic_derivation) paramsDerivsOrder = params_derivs_order; - dynamic_model.computingPass(true, hessian, thirdDerivatives, paramsDerivsOrder, global_eval_context, no_tmp_terms, block, use_dll, byte_code); + dynamic_model.computingPass(true, hessian, thirdDerivatives, paramsDerivsOrder, global_eval_context, no_tmp_terms, block, use_dll, byte_code, nopreprocessoroutput); if (linear && mod_file_struct.ramsey_model_present) - orig_ramsey_dynamic_model.computingPass(true, true, false, paramsDerivsOrder, global_eval_context, no_tmp_terms, block, use_dll, byte_code); + orig_ramsey_dynamic_model.computingPass(true, true, false, paramsDerivsOrder, global_eval_context, no_tmp_terms, block, use_dll, byte_code, nopreprocessoroutput); } } else // No computing task requested, compute derivatives up to 2nd order by default - dynamic_model.computingPass(true, true, false, none, global_eval_context, no_tmp_terms, block, use_dll, byte_code); + dynamic_model.computingPass(true, true, false, none, global_eval_context, no_tmp_terms, block, use_dll, byte_code, nopreprocessoroutput); if ((linear && !mod_file_struct.ramsey_model_present && !dynamic_model.checkHessianZero()) || (linear && mod_file_struct.ramsey_model_present && !orig_ramsey_dynamic_model.checkHessianZero())) @@ -627,6 +630,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo #if defined(_WIN32) || defined(__CYGWIN32__) , bool cygwin, bool msvc, bool mingw #endif + , const bool nopreprocessoroutput ) const { ofstream mOutputFile; @@ -702,7 +706,8 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo if (param_used_with_lead_lag) mOutputFile << "M_.parameter_used_with_lead_lag = true;" << endl; - cout << "Processing outputs ..." << endl; + if (!nopreprocessoroutput) + cout << "Processing outputs ..." << endl; symbol_table.writeOutput(mOutputFile); @@ -932,11 +937,12 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo steady_state_model.writeSteadyStateFile(basename, mod_file_struct.ramsey_model_present, false); } - cout << "done" << endl; + if (!nopreprocessoroutput) + cout << "done" << endl; } void -ModFile::writeExternalFiles(const string &basename, FileOutputType output, LanguageOutputType language) const +ModFile::writeExternalFiles(const string &basename, FileOutputType output, LanguageOutputType language, const bool nopreprocessoroutput) const { switch (language) { @@ -947,7 +953,7 @@ ModFile::writeExternalFiles(const string &basename, FileOutputType output, Langu writeExternalFilesCC(basename, output); break; case julia: - writeExternalFilesJulia(basename, output); + writeExternalFilesJulia(basename, output, nopreprocessoroutput); break; default: cerr << "This case shouldn't happen. Contact the authors of Dynare" << endl; @@ -1165,7 +1171,7 @@ ModFile::writeModelCC(const string &basename) const } void -ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output) const +ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output, const bool nopreprocessoroutput) const { ofstream jlOutputFile; if (basename.size()) @@ -1242,7 +1248,8 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output) jlOutputFile << "model_.h = zeros(Float64, 1, 1)" << endl << "model_.correlation_matrix_me = ones(Float64, 1, 1)" << endl; - cout << "Processing outputs ..." << endl; + if (!nopreprocessoroutput) + cout << "Processing outputs ..." << endl; symbol_table.writeJuliaOutput(jlOutputFile); if (dynamic_model.equation_number() > 0) @@ -1286,11 +1293,12 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output) << "end" << endl << "end" << endl; jlOutputFile.close(); - cout << "done" << endl; + if (!nopreprocessoroutput) + cout << "done" << endl; } void -ModFile::writeJsonOutput(const string &basename, JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, bool jsonderivsimple) +ModFile::writeJsonOutput(const string &basename, JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, const bool nopreprocessoroutput, bool jsonderivsimple) { if (json == nojson) return; @@ -1314,24 +1322,25 @@ ModFile::writeJsonOutput(const string &basename, JsonOutputPointType json, JsonF cout << "}" << endl << "//-- END JSON --// " << endl; - switch (json) - { - case parsing: - cout << "JSON written after Parsing step." << endl; - break; - case checkpass: - cout << "JSON written after Check step." << endl; - break; - case transformpass: - cout << "JSON written after Transform step." << endl; - break; - case computingpass: - cout << "JSON written after Computing step." << endl; - break; - case nojson: - cerr << "ModFile::writeJsonOutput: should not arrive here." << endl; - exit(EXIT_FAILURE); - } + if (!nopreprocessoroutput) + switch (json) + { + case parsing: + cout << "JSON written after Parsing step." << endl; + break; + case checkpass: + cout << "JSON written after Check step." << endl; + break; + case transformpass: + cout << "JSON written after Transform step." << endl; + break; + case computingpass: + cout << "JSON written after Computing step." << endl; + break; + case nojson: + cerr << "ModFile::writeJsonOutput: should not arrive here." << endl; + exit(EXIT_FAILURE); + } if (onlyjson) exit(EXIT_SUCCESS); diff --git a/ModFile.hh b/ModFile.hh index 216542cbfa14c212734e94a2dc37fbf20438c945..ac678b5b52ba79970f086d25b72a0c50878e3410 100644 --- a/ModFile.hh +++ b/ModFile.hh @@ -128,17 +128,17 @@ public: void addStatementAtFront(Statement *st); //! Evaluate all the statements /*! \param warn_uninit Should a warning be displayed for uninitialized endogenous/exogenous/parameters ? */ - void evalAllExpressions(bool warn_uninit); + void evalAllExpressions(bool warn_uninit, const bool nopreprocessoroutput); //! Do some checking and fills mod_file_struct /*! \todo add check for number of equations and endogenous if ramsey_policy is present */ void checkPass(bool nostrict, bool stochastic); //! Perform some transformations on the model (creation of auxiliary vars and equations) /*! \param compute_xrefs if true, equation cross references will be computed */ - void transformPass(bool nostrict, bool stochastic, bool compute_xrefs); + void transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const bool nopreprocessoroutput); //! Execute computations /*! \param no_tmp_terms if true, no temporary terms will be computed in the static and dynamic files */ /*! \param params_derivs_order compute this order of derivs wrt parameters */ - void computingPass(bool no_tmp_terms, FileOutputType output, int params_derivs_order); + void computingPass(bool no_tmp_terms, FileOutputType output, int params_derivs_order, const bool nopreprocessoroutput); //! Writes Matlab/Octave output files /*! \param basename The base name used for writing output files. Should be the name of the mod file without its extension @@ -157,11 +157,12 @@ public: #if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) , bool cygwin, bool msvc, bool mingw #endif + , const bool nopreprocessoroutput ) const; - void writeExternalFiles(const string &basename, FileOutputType output, LanguageOutputType language) const; + void writeExternalFiles(const string &basename, FileOutputType output, LanguageOutputType language, const bool nopreprocessoroutput) const; void writeExternalFilesC(const string &basename, FileOutputType output) const; void writeExternalFilesCC(const string &basename, FileOutputType output) const; - void writeExternalFilesJulia(const string &basename, FileOutputType output) const; + void writeExternalFilesJulia(const string &basename, FileOutputType output, const bool nopreprocessoroutput) const; //! Writes C output files only => No further Matlab processing void writeCOutputFiles(const string &basename) const; void writeModelC(const string &basename) const; @@ -174,7 +175,7 @@ public: //! Initially created to enable Julia to work with .mod files //! Potentially outputs ModFile after the various parts of processing (parsing, checkPass, transformPass, computingPass) //! Allows user of other host language platforms (python, fortran, etc) to provide support for dynare .mod files - void writeJsonOutput(const string &basename, JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, bool jsonderivsimple = false); + void writeJsonOutput(const string &basename, JsonOutputPointType json, JsonFileOutputType json_output_mode, bool onlyjson, const bool nopreprocessoroutput, bool jsonderivsimple = false); }; #endif // ! MOD_FILE_HH diff --git a/StaticModel.cc b/StaticModel.cc index 37133f8a3de9d08e996181593c6b69867ce89f66..8d6ba2449ad82a12c4355cceefba8cdb4d0e7ce5 100644 --- a/StaticModel.cc +++ b/StaticModel.cc @@ -1047,7 +1047,7 @@ StaticModel::collect_first_order_derivatives_endogenous() } void -StaticModel::computingPass(const eval_context_t &eval_context, bool no_tmp_terms, bool hessian, bool thirdDerivatives, int paramsDerivsOrder, bool block, bool bytecode) +StaticModel::computingPass(const eval_context_t &eval_context, bool no_tmp_terms, bool hessian, bool thirdDerivatives, int paramsDerivsOrder, bool block, bool bytecode, const bool nopreprocessoroutput) { initializeVariablesAndEquations(); @@ -1077,27 +1077,31 @@ StaticModel::computingPass(const eval_context_t &eval_context, bool no_tmp_terms } // Launch computations - cout << "Computing static model derivatives:" << endl - << " - order 1" << endl; + if (!nopreprocessoroutput) + cout << "Computing static model derivatives:" << endl + << " - order 1" << endl; first_derivatives.clear(); computeJacobian(vars); if (hessian) { - cout << " - order 2" << endl; + if (!nopreprocessoroutput) + cout << " - order 2" << endl; computeHessian(vars); } if (thirdDerivatives) { - cout << " - order 3" << endl; + if (!nopreprocessoroutput) + cout << " - order 3" << endl; computeThirdDerivatives(vars); } if (paramsDerivsOrder > 0) { - cout << " - derivatives of Jacobian/Hessian w.r. to parameters" << endl; + if (!nopreprocessoroutput) + cout << " - derivatives of Jacobian/Hessian w.r. to parameters" << endl; computeParamsDerivatives(paramsDerivsOrder); if (!no_tmp_terms) @@ -1122,7 +1126,8 @@ StaticModel::computingPass(const eval_context_t &eval_context, bool no_tmp_terms equation_type_and_normalized_equation = equationTypeDetermination(first_order_endo_derivatives, variable_reordered, equation_reordered, mfs); - cout << "Finding the optimal block decomposition of the model ...\n"; + if (!nopreprocessoroutput) + cout << "Finding the optimal block decomposition of the model ...\n"; lag_lead_vector_t equation_lag_lead, variable_lag_lead; diff --git a/StaticModel.hh b/StaticModel.hh index 09abf2067c52f27166df8ed6e389117e429d9c0c..68b6db3d87843fa4c834677e97380529f3a47af4 100644 --- a/StaticModel.hh +++ b/StaticModel.hh @@ -161,7 +161,7 @@ public: \param hessian whether 2nd derivatives w.r. to exo, exo_det and endo should be computed \param paramsDerivsOrder order of derivatives w.r. to a pair (endo/exo/exo_det, parameter) to be computed */ - void computingPass(const eval_context_t &eval_context, bool no_tmp_terms, bool hessian, bool thirdDerivatices, int paramsDerivsOrder, bool block, bool bytecode); + void computingPass(const eval_context_t &eval_context, bool no_tmp_terms, bool hessian, bool thirdDerivatices, int paramsDerivsOrder, bool block, bool bytecode, const bool nopreprocessoroutput); //! Adds informations for simulation in a binary file for a block decomposed model void Write_Inf_To_Bin_File_Block(const string &static_basename, const string &bin_basename, const int &num,