diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc index d32eda89685f1f1338689600b2694a5425ff34da..bac07b44c0ab9a59bdd5a8b5e181701499b7c9c7 100644 --- a/src/ComputingTasks.cc +++ b/src/ComputingTasks.cc @@ -2438,7 +2438,7 @@ PlannerObjectiveStatement::writeOutput(ostream &output, const string &basename, for (const auto &temporary_terms_derivative : model_tree.getTemporaryTermsDerivatives()) output << temporary_terms_derivative.size() << "; "; output << "];" << endl; - model_tree.writeStaticFile(basename + ".objective", false, false, false, "", {}, {}, false); + model_tree.writeStaticFile(basename + ".objective", false, false, "", {}, {}, false); } void diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc index 0591d2c20b6b951ca1c05bf5b871c3645e2bd3e7..84244248158fe160c9f42a907d2fe389df0b5789 100644 --- a/src/DynamicModel.cc +++ b/src/DynamicModel.cc @@ -4536,20 +4536,19 @@ DynamicModel::computeBlockDynJacobianCols() } void -DynamicModel::writeDynamicFile(const string &basename, bool block, bool bytecode, bool use_dll, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot, bool julia) const +DynamicModel::writeDynamicFile(const string &basename, bool block, bool use_dll, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot, bool julia) const { filesystem::path model_dir{basename}; model_dir /= "model"; if (use_dll) filesystem::create_directories(model_dir / "src"); - if (bytecode) - filesystem::create_directories(model_dir / "bytecode"); + filesystem::create_directories(model_dir / "bytecode"); if (block) { - if (bytecode) - writeDynamicBlockBytecode(basename); - else if (use_dll) + writeDynamicBlockBytecode(basename); + + if (use_dll) { writeDynamicPerBlockCFiles(basename); writeDynamicBlockCFile(basename); @@ -4572,9 +4571,9 @@ DynamicModel::writeDynamicFile(const string &basename, bool block, bool bytecode } else { - if (bytecode) - writeDynamicBytecode(basename); - else if (use_dll) + writeDynamicBytecode(basename); + + if (use_dll) { writeDynamicCFile(basename); compileMEX(basename, "dynamic", mexext, { model_dir / "src" / "dynamic.c" }, diff --git a/src/DynamicModel.hh b/src/DynamicModel.hh index 3092d796f9ceba53a626777f10fce8ae50d0d75a..d808a4109f43bd3e089a1dd9255063c45bc4d64d 100644 --- a/src/DynamicModel.hh +++ b/src/DynamicModel.hh @@ -400,8 +400,8 @@ public: //! in the trend_component model void updateVarAndTrendModel() const; - //! Writes dynamic model file - void writeDynamicFile(const string &basename, bool block, bool bytecode, bool use_dll, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot, bool julia) const; + //! Writes dynamic model file (+ bytecode) + void writeDynamicFile(const string &basename, bool block, bool use_dll, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot, bool julia) const; //! Writes file containing parameters derivatives void writeParamsDerivativesFile(const string &basename, bool julia) const; diff --git a/src/ModFile.cc b/src/ModFile.cc index a54a726b19949971204641e5747b4ea272c5d403..96f7e53b710e582936bda8aff59a0fdaef42748f 100644 --- a/src/ModFile.cc +++ b/src/ModFile.cc @@ -1077,11 +1077,11 @@ ModFile::writeMOutput(const string &basename, bool clear_all, bool clear_global, { if (!no_static) { - static_model.writeStaticFile(basename, block, bytecode, use_dll, mexext, matlabroot, dynareroot, false); + static_model.writeStaticFile(basename, block, use_dll, mexext, matlabroot, dynareroot, false); static_model.writeParamsDerivativesFile(basename, false); } - dynamic_model.writeDynamicFile(basename, block, bytecode, use_dll, mexext, matlabroot, dynareroot, false); + dynamic_model.writeDynamicFile(basename, block, use_dll, mexext, matlabroot, dynareroot, false); dynamic_model.writeParamsDerivativesFile(basename, false); @@ -1107,10 +1107,10 @@ ModFile::writeJuliaOutput(const string &basename) const { if (!no_static) { - static_model.writeStaticFile(basename, false, false, false, "", {}, {}, true); + static_model.writeStaticFile(basename, false, false, "", {}, {}, true); static_model.writeParamsDerivativesFile(basename, true); } - dynamic_model.writeDynamicFile(basename, block, bytecode, use_dll, "", {}, {}, true); + dynamic_model.writeDynamicFile(basename, block, use_dll, "", {}, {}, true); dynamic_model.writeParamsDerivativesFile(basename, true); } steady_state_model.writeSteadyStateFile(basename, mod_file_struct.ramsey_model_present, true); diff --git a/src/StaticModel.cc b/src/StaticModel.cc index a26bb32c8fffa0861d09b3b6859ecb228ceb39be..3b6320defe5da4cd108c88670ce201b7ed35b5e6 100644 --- a/src/StaticModel.cc +++ b/src/StaticModel.cc @@ -1785,20 +1785,19 @@ StaticModel::writeStaticJuliaFile(const string &basename) const } void -StaticModel::writeStaticFile(const string &basename, bool block, bool bytecode, bool use_dll, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot, bool julia) const +StaticModel::writeStaticFile(const string &basename, bool block, bool use_dll, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot, bool julia) const { filesystem::path model_dir{basename}; model_dir /= "model"; if (use_dll) filesystem::create_directories(model_dir / "src"); - if (bytecode) - filesystem::create_directories(model_dir / "bytecode"); + filesystem::create_directories(model_dir / "bytecode"); if (block) { - if (bytecode) - writeStaticBlockBytecode(basename); - else if (use_dll) + writeStaticBlockBytecode(basename); + + if (use_dll) { writeStaticPerBlockCFiles(basename); writeStaticBlockCFile(basename); @@ -1821,9 +1820,9 @@ StaticModel::writeStaticFile(const string &basename, bool block, bool bytecode, } else { - if (bytecode) - writeStaticBytecode(basename); - else if (use_dll) + writeStaticBytecode(basename); + + if (use_dll) { writeStaticCFile(basename); compileMEX(basename, "static", mexext, { model_dir / "src" / "static.c" }, diff --git a/src/StaticModel.hh b/src/StaticModel.hh index ec1b2ff9c42fc671b96691c0bf0d3ccca0149b72..c105cec4ff0ce858c20e0f55d9e41a2fe46da2f9 100644 --- a/src/StaticModel.hh +++ b/src/StaticModel.hh @@ -136,8 +136,8 @@ public: */ void computingPass(int derivsOrder, int paramsDerivsOrder, const eval_context_t &eval_context, bool no_tmp_terms, bool block); - //! Writes static model file - void writeStaticFile(const string &basename, bool block, bool bytecode, bool use_dll, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot, bool julia) const; + //! Writes static model file (+ bytecode) + void writeStaticFile(const string &basename, bool block, bool use_dll, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot, bool julia) const; //! Write JSON Output (used by PlannerObjectiveStatement) void writeJsonOutput(ostream &output) const;