From a21e48740b108744c78cf9712c3a9d60aae95d7d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien.villemot@ens.fr>
Date: Fri, 15 Jun 2012 11:06:07 +0200
Subject: [PATCH] Fix nograph, nodisplay and graph_format for identification
 and dynare_sensitivity

---
 preprocessor/ComputingTasks.cc | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc
index 671431933..3ec386ae6 100644
--- a/preprocessor/ComputingTasks.cc
+++ b/preprocessor/ComputingTasks.cc
@@ -379,6 +379,21 @@ void
 DynareSensitivityStatement::writeOutput(ostream &output, const string &basename) const
 {
   options_list.writeOutput(output, "options_gsa");
+
+  /* Ensure that nograph, nodisplay and graph_format are also set in top-level
+     options_.
+     \todo factorize this code between identification and dynare_sensitivity,
+     and provide a generic mechanism for this situation (maybe using regexps) */
+  OptionsList::num_options_t::const_iterator it = options_list.num_options.find("nodisplay");
+  if (it != options_list.num_options.end())
+    output << "options_.nodisplay = " << it->second << endl;
+  it = options_list.num_options.find("nograph");
+  if (it != options_list.num_options.end())
+    output << "options_.nograph = " << it->second << endl;
+  OptionsList::string_options_t::const_iterator it2 = options_list.string_options.find("graph_format");
+  if (it2 != options_list.string_options.end())
+    output << "options_.graph_format = " << it2->second << endl;
+  
   output << "dynare_sensitivity(options_gsa);" << endl;
 }
 
@@ -1185,6 +1200,21 @@ void
 IdentificationStatement::writeOutput(ostream &output, const string &basename) const
 {
   options_list.writeOutput(output, "options_ident");
+
+  /* Ensure that nograph, nodisplay and graph_format are also set in top-level
+     options_.
+     \todo factorize this code between identification and dynare_sensitivity,
+     and provide a generic mechanism for this situation (maybe using regexps) */
+  OptionsList::num_options_t::const_iterator it = options_list.num_options.find("nodisplay");
+  if (it != options_list.num_options.end())
+    output << "options_.nodisplay = " << it->second << endl;
+  it = options_list.num_options.find("nograph");
+  if (it != options_list.num_options.end())
+    output << "options_.nograph = " << it->second << endl;
+  OptionsList::string_options_t::const_iterator it2 = options_list.string_options.find("graph_format");
+  if (it2 != options_list.string_options.end())
+    output << "options_.graph_format = " << it2->second << endl;
+
   output << "dynare_identification(options_ident);" << endl;
 }
 
-- 
GitLab