From b403cef87134c240b321667a4c4267b2ddf44cc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 21 Sep 2022 18:47:14 +0200
Subject: [PATCH] Put driver output of static block decomposition in a separate
 function
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

For symmetry with the dynamic case, and for avoiding a call to “return” in the
middle of StaticModel::writeDriverOutput().
---
 src/StaticModel.cc | 8 ++++++--
 src/StaticModel.hh | 3 +++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/StaticModel.cc b/src/StaticModel.cc
index 13a023f5..7f7d3449 100644
--- a/src/StaticModel.cc
+++ b/src/StaticModel.cc
@@ -1146,9 +1146,13 @@ StaticModel::writeDriverOutput(ostream &output, bool block) const
            << temporary_terms_idxs.at(mlv)+1 << ';' << endl;
   output << "};" << endl;
 
-  if (!block)
-    return;
+  if (block)
+    writeBlockDriverOutput(output);
+}
 
+void
+StaticModel::writeBlockDriverOutput(ostream &output) const
+{
   for (int blk = 0; blk < static_cast<int>(blocks.size()); blk++)
     {
       output << "block_structure_stat.block(" << blk+1 << ").Simulation_Type = " << static_cast<int>(blocks[blk].simulation_type) << ";" << endl
diff --git a/src/StaticModel.hh b/src/StaticModel.hh
index 127252b1..7659456d 100644
--- a/src/StaticModel.hh
+++ b/src/StaticModel.hh
@@ -116,6 +116,9 @@ private:
      (failure can happen in normalization). */
   virtual bool computingPassBlock(const eval_context_t &eval_context, bool no_tmp_terms);
 
+  // Write the block structure of the model in the driver file
+  void writeBlockDriverOutput(ostream &output) const;
+
 protected:
   string
   modelClassName() const override
-- 
GitLab