From f45a99fc68dc2b5ceade836715666cb7a00599f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 17 Jan 2023 16:38:03 +0100
Subject: [PATCH] =?UTF-8?q?Correctly=20propagate=20=E2=80=9Cmfs=E2=80=9D?=
 =?UTF-8?q?=20and=20=E2=80=9Ccutoff=E2=80=9D=20to=20the=20static=20model?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Those two settings were previously always at their default value for the static
model, independently of what the user would set in the .mod file.
---
 src/ParsingDriver.cc | 2 --
 src/StaticModel.cc   | 3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc
index 320de782..0ca6faff 100644
--- a/src/ParsingDriver.cc
+++ b/src/ParsingDriver.cc
@@ -686,7 +686,6 @@ ParsingDriver::cutoff(const string &value)
 {
   double val = stod(value);
   mod_file->dynamic_model.cutoff = val;
-  mod_file->static_model.cutoff = val;
 }
 
 void
@@ -694,7 +693,6 @@ ParsingDriver::mfs(const string &value)
 {
   int val = stoi(value);
   mod_file->dynamic_model.mfs = val;
-  mod_file->static_model.mfs = val;
 }
 
 void
diff --git a/src/StaticModel.cc b/src/StaticModel.cc
index 4ddb82a0..244a48f5 100644
--- a/src/StaticModel.cc
+++ b/src/StaticModel.cc
@@ -88,6 +88,9 @@ StaticModel::StaticModel(const DynamicModel &m) :
   for (auto aux_eq : m.aux_equations)
     addAuxEquation(aux_eq->toStatic(*this));
 
+  cutoff = m.cutoff;
+  mfs = m.mfs;
+
   user_set_add_flags = m.user_set_add_flags;
   user_set_subst_flags = m.user_set_subst_flags;
   user_set_add_libs = m.user_set_add_libs;
-- 
GitLab