From 94f454cd2451adfdbd6aa99961771f73876bde0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Guts=29?= Date: Fri, 22 Dec 2023 11:49:48 +0100 Subject: [PATCH] Add option to not write the dynamic model routines (m|mex). --- src/DynareMain.cc | 7 +++++-- src/ModFile.cc | 5 +++-- src/ModFile.hh | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/DynareMain.cc b/src/DynareMain.cc index 4e9ff55a..8d022485 100644 --- a/src/DynareMain.cc +++ b/src/DynareMain.cc @@ -62,7 +62,7 @@ usage() << " [json=parse|check|transform|compute] [jsonstdout] [onlyjson] [jsonderivsimple] " "[nopathchange] [nopreprocessoroutput]" << " [mexext=] [matlabroot=] [onlymodel] [notime] [use_dll] " - "[nocommutativity]" + "[nocommutativity] [nodynamic]" << endl; exit(EXIT_FAILURE); } @@ -169,6 +169,7 @@ main(int argc, char** argv) filesystem::path matlabroot; bool onlymodel = false; bool use_dll = false; + bool nodynamic = false; for (auto s : options) { @@ -426,6 +427,8 @@ main(int argc, char** argv) use_dll = true; else if (s == "nocommutativity") DataTree::setNoCommutativity(); + else if (s == "nodynamic") + nodynamic = true; else { cerr << "Unknown option: " << s << endl; @@ -541,7 +544,7 @@ main(int argc, char** argv) else mod_file->writeMOutput(basename, clear_all, clear_global, no_warn, console, nograph, nointeractive, config, check_model_changes, minimal_workspace, - compute_xrefs, mexext, matlabroot, onlymodel, gui, notime); + compute_xrefs, mexext, matlabroot, onlymodel, gui, notime, nodynamic); /* Ensures that workers are not destroyed before they finish compiling. Also ensures that the preprocessor final message is printed after the end of diff --git a/src/ModFile.cc b/src/ModFile.cc index 3201be71..bef4cc99 100644 --- a/src/ModFile.cc +++ b/src/ModFile.cc @@ -845,7 +845,7 @@ ModFile::writeMOutput(const string& basename, bool clear_all, bool clear_global, bool console, bool nograph, bool nointeractive, const Configuration& config, bool check_model_changes, bool minimal_workspace, bool compute_xrefs, const string& mexext, const filesystem::path& matlabroot, bool onlymodel, - bool gui, bool notime) const + bool gui, bool notime, bool nodynamic) const { if (basename.empty()) { @@ -1165,7 +1165,8 @@ ModFile::writeMOutput(const string& basename, bool clear_all, bool clear_global, } } - dynamic_model.writeDynamicFile(basename, use_dll, mexext, matlabroot, false); + if (!nodynamic) + dynamic_model.writeDynamicFile(basename, use_dll, mexext, matlabroot, false); dynamic_model.writeParamsDerivativesFile(basename); } diff --git a/src/ModFile.hh b/src/ModFile.hh index 440fc01f..37421d6f 100644 --- a/src/ModFile.hh +++ b/src/ModFile.hh @@ -179,7 +179,7 @@ public: bool console, bool nograph, bool nointeractive, const Configuration& config, bool check_model_changes, bool minimal_workspace, bool compute_xrefs, const string& mexext, const filesystem::path& matlabroot, bool onlymodel, - bool gui, bool notime) const; + bool gui, bool notime, bool nodynamic) const; void writeJuliaOutput(const string& basename) const;