Verified Commit 0988a1f7 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Generated LaTeX files are now under <basename>/latex/

parent ac9d352a
Pipeline #1517 passed with stage
in 1 minute and 25 seconds
...@@ -6062,13 +6062,13 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con ...@@ -6062,13 +6062,13 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
void void
DynamicModel::writeLatexFile(const string &basename, const bool write_equation_tags) const DynamicModel::writeLatexFile(const string &basename, const bool write_equation_tags) const
{ {
writeLatexModelFile(basename + "_dynamic", ExprNodeOutputType::latexDynamicModel, write_equation_tags); writeLatexModelFile(basename, "dynamic", ExprNodeOutputType::latexDynamicModel, write_equation_tags);
} }
void void
DynamicModel::writeLatexOriginalFile(const string &basename, const bool write_equation_tags) const DynamicModel::writeLatexOriginalFile(const string &basename, const bool write_equation_tags) const
{ {
writeLatexModelFile(basename + "_original", ExprNodeOutputType::latexDynamicModel, write_equation_tags); writeLatexModelFile(basename, "original", ExprNodeOutputType::latexDynamicModel, write_equation_tags);
} }
void void
......
...@@ -132,10 +132,11 @@ SteadyStateModel::checkPass(ModFileStructure &mod_file_struct, WarningConsolidat ...@@ -132,10 +132,11 @@ SteadyStateModel::checkPass(ModFileStructure &mod_file_struct, WarningConsolidat
void void
SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const
{ {
boost::filesystem::create_directories(basename + "/latex");
ofstream output, content_output; ofstream output, content_output;
string filename = basename + "_steady_state.tex"; string filename = basename + "/latex/steady_state.tex";
string content_basename = basename + "_steady_state_content"; string content_filename = basename + "/latex/steady_state_content.tex";
string content_filename = content_basename + ".tex";
output.open(filename, ios::out | ios::binary); output.open(filename, ios::out | ios::binary);
if (!output.is_open()) if (!output.is_open())
...@@ -172,7 +173,7 @@ SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const ...@@ -172,7 +173,7 @@ SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const
static_model.writeLatexAuxVarRecursiveDefinitions(content_output); static_model.writeLatexAuxVarRecursiveDefinitions(content_output);
output << "\\include{" << content_basename << "}" << endl output << "\\include{steady_state_content.tex}" << endl
<< "\\end{document}" << endl; << "\\end{document}" << endl;
output.close(); output.close();
......
...@@ -1834,12 +1834,13 @@ ModelTree::Write_Inf_To_Bin_File(const string &filename, ...@@ -1834,12 +1834,13 @@ ModelTree::Write_Inf_To_Bin_File(const string &filename,
} }
void void
ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output_type, const bool write_equation_tags) const ModelTree::writeLatexModelFile(const string &mod_basename, const string &latex_basename, ExprNodeOutputType output_type, const bool write_equation_tags) const
{ {
boost::filesystem::create_directories(mod_basename + "/latex");
ofstream output, content_output; ofstream output, content_output;
string filename = basename + ".tex"; string filename = mod_basename + "/latex/" + latex_basename + ".tex";
string content_basename = basename + "_content"; string content_filename = mod_basename + "/latex/" + latex_basename + "_content" + ".tex";
string content_filename = content_basename + ".tex";
output.open(filename, ios::out | ios::binary); output.open(filename, ios::out | ios::binary);
if (!output.is_open()) if (!output.is_open())
{ {
...@@ -1906,7 +1907,7 @@ ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output ...@@ -1906,7 +1907,7 @@ ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output
content_output << endl << R"(\end{dmath})" << endl; content_output << endl << R"(\end{dmath})" << endl;
} }
output << R"(\include{)" << content_basename << "}" << endl output << R"(\include{)" << latex_basename + "_content" << "}" << endl
<< R"(\end{document})" << endl; << R"(\end{document})" << endl;
output.close(); output.close();
......
...@@ -191,7 +191,7 @@ protected: ...@@ -191,7 +191,7 @@ protected:
void compileModelEquations(ostream &code_file, unsigned int &instruction_number, const temporary_terms_t &tt, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const; void compileModelEquations(ostream &code_file, unsigned int &instruction_number, const temporary_terms_t &tt, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const;
//! Writes LaTeX model file //! Writes LaTeX model file
void writeLatexModelFile(const string &basename, ExprNodeOutputType output_type, const bool write_equation_tags) const; void writeLatexModelFile(const string &mod_basename, const string &latex_basename, ExprNodeOutputType output_type, const bool write_equation_tags) const;
//! Sparse matrix of double to store the values of the Jacobian //! Sparse matrix of double to store the values of the Jacobian
/*! First index is equation number, second index is endogenous type specific ID */ /*! First index is equation number, second index is endogenous type specific ID */
......
...@@ -2380,7 +2380,7 @@ StaticModel::collect_block_first_order_derivatives() ...@@ -2380,7 +2380,7 @@ StaticModel::collect_block_first_order_derivatives()
void void
StaticModel::writeLatexFile(const string &basename, bool write_equation_tags) const StaticModel::writeLatexFile(const string &basename, bool write_equation_tags) const
{ {
writeLatexModelFile(basename + "_static", ExprNodeOutputType::latexStaticModel, write_equation_tags); writeLatexModelFile(basename, "static", ExprNodeOutputType::latexStaticModel, write_equation_tags);
} }
void void
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment