From 92cdc2e4039aedc577d3c0fe402532d930972666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Mon, 9 Dec 2013 16:23:49 +0100 Subject: [PATCH] Forbid the combination of estimation/mode_file and estimated_params_init/use_calibration Closes #549 (cherry picked from commit 49a51ed80844358d35e099b5eb102baef05b6846) --- preprocessor/ComputingTasks.cc | 14 ++++++++++++++ preprocessor/ComputingTasks.hh | 1 + preprocessor/Statement.cc | 3 ++- preprocessor/Statement.hh | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index 8d213250b1..36b1d456e5 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/ComputingTasks.cc @@ -342,6 +342,13 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli cerr << "ERROR: The estimation statement requires a data file to be supplied via the datafile option." << endl; exit(EXIT_FAILURE); } + + if (options_list.string_options.find("mode_file") != options_list.string_options.end() && + mod_file_struct.estim_params_use_calib) + { + cerr << "ERROR: The mode_file option of the estimation statement is incompatible with the use_calibration option of the estimated_params_init block." << endl; + exit(EXIT_FAILURE); + } } void @@ -593,6 +600,13 @@ EstimatedParamsInitStatement::EstimatedParamsInitStatement(const vector<Estimati { } +void +EstimatedParamsInitStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +{ + if (use_calibration) + mod_file_struct.estim_params_use_calib = true; +} + void EstimatedParamsInitStatement::writeOutput(ostream &output, const string &basename) const { diff --git a/preprocessor/ComputingTasks.hh b/preprocessor/ComputingTasks.hh index 6d67638c42..feddfbbc2e 100644 --- a/preprocessor/ComputingTasks.hh +++ b/preprocessor/ComputingTasks.hh @@ -293,6 +293,7 @@ public: EstimatedParamsInitStatement(const vector<EstimationParams> &estim_params_list_arg, const SymbolTable &symbol_table_arg, const bool use_calibration_arg); + virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings); virtual void writeOutput(ostream &output, const string &basename) const; }; diff --git a/preprocessor/Statement.cc b/preprocessor/Statement.cc index 4dbf8ba52d..f990f6110b 100644 --- a/preprocessor/Statement.cc +++ b/preprocessor/Statement.cc @@ -49,7 +49,8 @@ ModFileStructure::ModFileStructure() : bayesian_irf_present(false), estimation_data_statement_present(false), last_markov_switching_chain(0), - calib_smoother_present(false) + calib_smoother_present(false), + estim_params_use_calib(false) { } diff --git a/preprocessor/Statement.hh b/preprocessor/Statement.hh index d4dad9b877..7cd7b92141 100644 --- a/preprocessor/Statement.hh +++ b/preprocessor/Statement.hh @@ -98,6 +98,8 @@ public: int last_markov_switching_chain; //! Whether a calib_smoother statement is present bool calib_smoother_present; + //! Whether there is an estimated_params_init with use_calibration + bool estim_params_use_calib; //! Set of parameters used within shocks blocks, inside the expressions //! defining the values of covariances (stored as symbol ids) set<int> parameters_within_shocks_values; -- GitLab