From 41d38551e5de69d4400d6503f041ce0e6a83503c Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Wed, 11 Dec 2019 12:20:13 +0100 Subject: [PATCH] write names of epilogue variables --- src/ModFile.cc | 2 ++ src/ModelEquationBlock.cc | 13 +++++++++++++ src/ModelEquationBlock.hh | 3 +++ 3 files changed, 18 insertions(+) diff --git a/src/ModFile.cc b/src/ModFile.cc index 50a560a3..d2195270 100644 --- a/src/ModFile.cc +++ b/src/ModFile.cc @@ -1011,6 +1011,8 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo << "M_.ramsey_eq_nbr = " << mod_file_struct.ramsey_eq_nbr << ";" << endl << "M_.set_auxiliary_variables = exist(['./+' M_.fname '/set_auxiliary_variables.m'], 'file') == 2;" << endl; + epilogue.writeOutput(mOutputFile); + if (dynamic_model.equation_number() > 0) { if (linear_decomposition) diff --git a/src/ModelEquationBlock.cc b/src/ModelEquationBlock.cc index a4eaf92b..66a87387 100644 --- a/src/ModelEquationBlock.cc +++ b/src/ModelEquationBlock.cc @@ -415,3 +415,16 @@ Epilogue::writeEpilogueFile(const string &basename) const output << "end" << endl; output.close(); } + +void +Epilogue::writeOutput(ostream &output) const +{ + if (def_table.empty()) + return; + + int idx = 1; + output << "M_.epilogue_names = cell(" << def_table.size() << ",1);" << endl; + for (const auto & [symb_id, expr] : def_table) + output << "M_.epilogue_names{" << idx++ << "} = '" + << symbol_table.getName(symb_id) << "';" << endl; +} diff --git a/src/ModelEquationBlock.hh b/src/ModelEquationBlock.hh index 9feb71af..434ecbf9 100644 --- a/src/ModelEquationBlock.hh +++ b/src/ModelEquationBlock.hh @@ -95,6 +95,9 @@ public: //! Write the steady state file void writeEpilogueFile(const string &basename) const; + + //! Write Output + void writeOutput(ostream &output) const; }; -- GitLab