From 1ed72f6da257c6c587782a98385962f12fa0a1a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 28 Sep 2022 16:54:03 +0200
Subject: [PATCH] =?UTF-8?q?Write=20block=20decomposition=20information=20i?=
 =?UTF-8?q?n=20M=5F=20independently=20of=20=E2=80=9Cblock=E2=80=9D=20optio?=
 =?UTF-8?q?n?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is now possible since the block decomposition is always computed. Of
course, the information is not printed if the decomposition failed.
---
 src/DynamicModel.cc | 4 ++--
 src/DynamicModel.hh | 2 +-
 src/ModFile.cc      | 4 ++--
 src/StaticModel.cc  | 4 ++--
 src/StaticModel.hh  | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 7a48b406..45a406f1 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -1615,7 +1615,7 @@ DynamicModel::writeBlockDriverOutput(ostream &output, const string &basename,
 }
 
 void
-DynamicModel::writeDriverOutput(ostream &output, const string &basename, bool block_decomposition, bool estimation_present, bool compute_xrefs) const
+DynamicModel::writeDriverOutput(ostream &output, const string &basename, bool estimation_present, bool compute_xrefs) const
 {
   /* Writing initialisation for M_.lead_lag_incidence matrix
      M_.lead_lag_incidence is a matrix with as many columns as there are
@@ -1744,7 +1744,7 @@ DynamicModel::writeDriverOutput(ostream &output, const string &basename, bool bl
         }
 
   // Write the block structure of the model
-  if (block_decomposition)
+  if (block_decomposed)
     writeBlockDriverOutput(output, basename, state_var, estimation_present);
 
   output << "M_.state_var = [";
diff --git a/src/DynamicModel.hh b/src/DynamicModel.hh
index 588684ab..8bdca374 100644
--- a/src/DynamicModel.hh
+++ b/src/DynamicModel.hh
@@ -327,7 +327,7 @@ public:
   void computingPass(int derivsOrder, int paramsDerivsOrder, const eval_context_t &eval_context,
                      bool no_tmp_terms, bool block, bool use_dll);
   //! Writes information about the dynamic model to the driver file
-  void writeDriverOutput(ostream &output, const string &basename, bool block, bool estimation_present, bool compute_xrefs) const;
+  void writeDriverOutput(ostream &output, const string &basename, bool estimation_present, bool compute_xrefs) const;
 
   //! Write JSON AST
   void writeJsonAST(ostream &output) const;
diff --git a/src/ModFile.cc b/src/ModFile.cc
index 66f84197..84c3f7bf 100644
--- a/src/ModFile.cc
+++ b/src/ModFile.cc
@@ -967,9 +967,9 @@ ModFile::writeMOutput(const string &basename, bool clear_all, bool clear_global,
 
   if (dynamic_model.equation_number() > 0)
     {
-      dynamic_model.writeDriverOutput(mOutputFile, basename, block, mod_file_struct.estimation_present, compute_xrefs);
+      dynamic_model.writeDriverOutput(mOutputFile, basename, mod_file_struct.estimation_present, compute_xrefs);
       if (!no_static)
-        static_model.writeDriverOutput(mOutputFile, block);
+        static_model.writeDriverOutput(mOutputFile);
     }
 
   if (onlymodel || gui)
diff --git a/src/StaticModel.cc b/src/StaticModel.cc
index d9ed5c3d..c005f124 100644
--- a/src/StaticModel.cc
+++ b/src/StaticModel.cc
@@ -791,14 +791,14 @@ StaticModel::writeStaticBlockCFile(const string &basename, vector<filesystem::pa
 }
 
 void
-StaticModel::writeDriverOutput(ostream &output, bool block) const
+StaticModel::writeDriverOutput(ostream &output) const
 {
   output << "M_.static_tmp_nbr = [";
   for (const auto &temporary_terms_derivative : temporary_terms_derivatives)
     output << temporary_terms_derivative.size() << "; ";
   output << "];" << endl;
 
-  if (block)
+  if (block_decomposed)
     writeBlockDriverOutput(output);
 
   writeDriverSparseIndicesHelper<false>(output);
diff --git a/src/StaticModel.hh b/src/StaticModel.hh
index f973af3e..e50dc696 100644
--- a/src/StaticModel.hh
+++ b/src/StaticModel.hh
@@ -127,7 +127,7 @@ public:
   explicit StaticModel(const DynamicModel &m);
 
   //! Writes information about the static model to the driver file
-  void writeDriverOutput(ostream &output, bool block) const;
+  void writeDriverOutput(ostream &output) const;
 
   //! Execute computations (variable sorting + derivation + block decomposition)
   /*!
-- 
GitLab