From 5ddc0a595b9b6ca9f9901e31a3e998d8d4938e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien.villemot@ens.fr> Date: Fri, 4 Feb 2011 12:38:12 +0100 Subject: [PATCH] Workaround for ticket #157 --- ComputingTasks.cc | 9 +++++++++ NumericalInitialization.cc | 6 ++++++ NumericalInitialization.hh | 4 +++- Statement.cc | 3 ++- Statement.hh | 5 ++++- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ComputingTasks.cc b/ComputingTasks.cc index 2c2b5668..241062d7 100644 --- a/ComputingTasks.cc +++ b/ComputingTasks.cc @@ -135,6 +135,15 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct) cerr << "ERROR: in 'stoch_simul', you cannot use option 'pruning' with 'k_order_solver' option or with 3rd order approximation" << endl; exit(EXIT_FAILURE); } + + // Workaround for ticket #157 + it = options_list.num_options.find("periods"); + if (it != options_list.num_options.end() && atoi(it->second.c_str()) > 0 + && mod_file_struct.histval_present) + { + cerr << "ERROR: the 'periods' option of 'stoch_simul' is not compatible with a 'histval' block" << endl; + exit(EXIT_FAILURE); + } } void diff --git a/NumericalInitialization.cc b/NumericalInitialization.cc index 9a67b05f..6b08a74e 100644 --- a/NumericalInitialization.cc +++ b/NumericalInitialization.cc @@ -177,6 +177,12 @@ HistValStatement::HistValStatement(const hist_values_t &hist_values_arg, { } +void +HistValStatement::checkPass(ModFileStructure &mod_file_struct) +{ + mod_file_struct.histval_present = true; +} + void HistValStatement::writeOutput(ostream &output, const string &basename) const { diff --git a/NumericalInitialization.hh b/NumericalInitialization.hh index bde6a7ec..b9639af9 100644 --- a/NumericalInitialization.hh +++ b/NumericalInitialization.hh @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2010 Dynare Team + * Copyright (C) 2003-2011 Dynare Team * * This file is part of Dynare. * @@ -100,6 +100,8 @@ private: public: HistValStatement(const hist_values_t &hist_values_arg, const SymbolTable &symbol_table_arg); + //! Workaround for trac ticket #157 + virtual void checkPass(ModFileStructure &mod_file_struct); virtual void writeOutput(ostream &output, const string &basename) const; }; diff --git a/Statement.cc b/Statement.cc index 0c070c10..8cff67d9 100644 --- a/Statement.cc +++ b/Statement.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2010 Dynare Team + * Copyright (C) 2006-2011 Dynare Team * * This file is part of Dynare. * @@ -33,6 +33,7 @@ ModFileStructure::ModFileStructure() : identification_present(false), partial_information(false), shocks_present(false), + histval_present(false), k_order_solver(false), calibrated_measurement_errors(false), dsge_prior_weight_in_estimated_params(false), diff --git a/Statement.hh b/Statement.hh index 5f98d9af..27a8b3d2 100644 --- a/Statement.hh +++ b/Statement.hh @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2010 Dynare Team + * Copyright (C) 2006-2011 Dynare Team * * This file is part of Dynare. * @@ -61,6 +61,9 @@ public: //! Whether a shocks or mshocks block is present /*! Used for the workaround for trac ticket #35 */ bool shocks_present; + //! Whether a histval bloc is present + /*! Used for the workaround for trac ticket #157 */ + bool histval_present; //! Whether the "k_order_solver" option is used (explictly, or implicitly if order >= 3) bool k_order_solver; //! Whether there is a calibrated measurement error -- GitLab