diff --git a/preprocessor/SteadyStateModel.cc b/preprocessor/SteadyStateModel.cc index fa39c8e5096b56800bcb7e3233b27ed0f4f8e60b..9f16652754d5a0bbf6f301d427e2bf064a58c54d 100644 --- a/preprocessor/SteadyStateModel.cc +++ b/preprocessor/SteadyStateModel.cc @@ -93,6 +93,15 @@ SteadyStateModel::checkPass(bool ramsey_policy, WarningConsolidation &warnings) copy(symb_ids.begin(), symb_ids.end(), back_inserter(so_far_defined)); } + + set<int> orig_endogs = symbol_table.getOrigEndogenous(); + for (set<int>::const_iterator it = orig_endogs.begin(); + it != orig_endogs.end(); ++it) + { + if (find(so_far_defined.begin(), so_far_defined.end(), *it) + == so_far_defined.end()) + warnings << "WARNING: in the 'steady_state_model' block, variable '" << symbol_table.getName(*it) << "' is not assigned a value" << endl; + } } void diff --git a/preprocessor/SymbolTable.cc b/preprocessor/SymbolTable.cc index 21b406b80f39199e6877e4f4a0eaee84a13a6031..97b98430499cfc189341457fd3d41b69b5689000 100644 --- a/preprocessor/SymbolTable.cc +++ b/preprocessor/SymbolTable.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 Dynare Team + * Copyright (C) 2003-2014 Dynare Team * * This file is part of Dynare. * @@ -591,3 +591,23 @@ SymbolTable::getEndogenous() const endogs.insert(it->second); return endogs; } + +bool +SymbolTable::isAuxiliaryVariable(int symb_id) const +{ + for (int i = 0; i < aux_vars.size(); i++) + if (aux_vars[i].get_symb_id() == symb_id) + return true; + return false; +} + +set<int> +SymbolTable::getOrigEndogenous() const +{ + set <int> origendogs; + for (symbol_table_type::const_iterator it = symbol_table.begin(); + it != symbol_table.end(); it++) + if (getType(it->second) == eEndogenous && !isAuxiliaryVariable(it->second)) + origendogs.insert(it->second); + return origendogs; +} diff --git a/preprocessor/SymbolTable.hh b/preprocessor/SymbolTable.hh index c87160145ac0e4efd3b2640afdcf7e4129987c86..8e0903e5cab36e0cc06f0938a3f4255841efb2d9 100644 --- a/preprocessor/SymbolTable.hh +++ b/preprocessor/SymbolTable.hh @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 Dynare Team + * Copyright (C) 2003-2014 Dynare Team * * This file is part of Dynare. * @@ -297,6 +297,10 @@ public: set <int> getExogenous() const; //! Get list of endogenous variables set <int> getEndogenous() const; + //! Is a given symbol an auxiliary variable + bool isAuxiliaryVariable(int symb_id) const; + //! Get list of endogenous variables without aux vars + set <int> getOrigEndogenous() const; }; inline bool