From 551db4a446e9007c78305745b776f6ac20c0301c 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 --- preprocessor/ComputingTasks.cc | 9 +++++++++ preprocessor/NumericalInitialization.cc | 6 ++++++ preprocessor/NumericalInitialization.hh | 4 +++- preprocessor/Statement.cc | 3 ++- preprocessor/Statement.hh | 5 ++++- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index 2c2b5668b0..241062d746 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/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/preprocessor/NumericalInitialization.cc b/preprocessor/NumericalInitialization.cc index 9a67b05fa2..6b08a74eb4 100644 --- a/preprocessor/NumericalInitialization.cc +++ b/preprocessor/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/preprocessor/NumericalInitialization.hh b/preprocessor/NumericalInitialization.hh index bde6a7eceb..b9639af910 100644 --- a/preprocessor/NumericalInitialization.hh +++ b/preprocessor/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/preprocessor/Statement.cc b/preprocessor/Statement.cc index 0c070c1081..8cff67d989 100644 --- a/preprocessor/Statement.cc +++ b/preprocessor/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/preprocessor/Statement.hh b/preprocessor/Statement.hh index 5f98d9af9d..27a8b3d2a7 100644 --- a/preprocessor/Statement.hh +++ b/preprocessor/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