From 3f874cfcedfb22b72ac63aca5cdd28c2d7349c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Mon, 28 May 2018 16:39:28 +0200 Subject: [PATCH] Remove obsolete function --- src/DynamicModel.cc | 1 - src/ExprNode.cc | 4 ++-- src/ModelTree.cc | 34 ---------------------------------- src/ModelTree.hh | 3 --- src/StaticModel.cc | 1 - 5 files changed, 2 insertions(+), 41 deletions(-) diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc index 618cbbfd..6f989502 100644 --- a/src/DynamicModel.cc +++ b/src/DynamicModel.cc @@ -4981,7 +4981,6 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con ostringstream third_derivs1_output; // Used for storing third order derivatives equations deriv_node_temp_terms_t tef_terms; - writeModelLocalVariables(model_local_vars_output, output_type, tef_terms); writeTemporaryTerms(params_derivs_temporary_terms, {}, params_derivs_temporary_terms_idxs, model_output, output_type, tef_terms); diff --git a/src/ExprNode.cc b/src/ExprNode.cc index 2afa2ba7..cc3587a2 100644 --- a/src/ExprNode.cc +++ b/src/ExprNode.cc @@ -853,8 +853,8 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type, output << ")"; } else - /* We append underscores to avoid name clashes with "g1" or "oo_" (see - also ModelTree::writeModelLocalVariables) */ + /* We append underscores to avoid name clashes with "g1" or "oo_". + But we probably never arrive here because MLV are temporary terms… */ output << datatree.symbol_table.getName(symb_id) << "__"; break; diff --git a/src/ModelTree.cc b/src/ModelTree.cc index 8ef6fd4e..cb52be73 100644 --- a/src/ModelTree.cc +++ b/src/ModelTree.cc @@ -1469,40 +1469,6 @@ ModelTree::compileTemporaryTerms(ostream &code_file, unsigned int &instruction_n } } -void -ModelTree::writeModelLocalVariables(ostream &output, ExprNodeOutputType output_type, deriv_node_temp_terms_t &tef_terms) const -{ - return; - /* Collect all model local variables appearing in equations, and print only - them. Printing unused model local variables can lead to a crash (see - ticket #101). */ - set used_local_vars; - const temporary_terms_t tt; - const temporary_terms_idxs_t tti; - for (size_t i = 0; i < equations.size(); i++) - equations[i]->collectVariables(eModelLocalVariable, used_local_vars); - - for (vector::const_iterator it = local_variables_vector.begin(); - it != local_variables_vector.end(); it++) - if (used_local_vars.find(*it) != used_local_vars.end()) - { - int id = *it; - expr_t value = local_variables_table.find(id)->second; - value->writeExternalFunctionOutput(output, output_type, tt, tti, tef_terms); - - if (IS_C(output_type)) - output << "double "; - else if (IS_JULIA(output_type)) - output << " @inbounds "; - - /* We append underscores to avoid name clashes with "g1" or "oo_" (see - also VariableNode::writeOutput) */ - output << symbol_table.getName(id) << "__ = "; - value->writeOutput(output, output_type, tt, tti, tef_terms); - output << ";" << endl; - } -} - void ModelTree::writeJsonModelLocalVariables(ostream &output, deriv_node_temp_terms_t &tef_terms) const { diff --git a/src/ModelTree.hh b/src/ModelTree.hh index e2438ed7..7e914aaa 100644 --- a/src/ModelTree.hh +++ b/src/ModelTree.hh @@ -197,9 +197,6 @@ protected: void fixNestedParenthesis(ostringstream &output, map &tmp_paren_vars, bool &message_printed) const; //! Tests if string contains more than 32 nested parens, Issue #1201 bool testNestedParenthesis(const string &str) const; - //! Writes model local variables - /*! No temporary term is used in the output, so that local parameters declarations can be safely put before temporary terms declaration in the output files */ - void writeModelLocalVariables(ostream &output, ExprNodeOutputType output_type, deriv_node_temp_terms_t &tef_terms) const; void writeModelLocalVariableTemporaryTerms(const temporary_terms_t &tto, const map &tt, ostream &output, ExprNodeOutputType output_type, deriv_node_temp_terms_t &tef_terms) const; diff --git a/src/StaticModel.cc b/src/StaticModel.cc index f75ee6d0..151f0d8a 100644 --- a/src/StaticModel.cc +++ b/src/StaticModel.cc @@ -2519,7 +2519,6 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons ostringstream third_derivs1_output; // Used for storing third order derivatives equations deriv_node_temp_terms_t tef_terms; - writeModelLocalVariables(model_local_vars_output, output_type, tef_terms); writeTemporaryTerms(params_derivs_temporary_terms, {}, params_derivs_temporary_terms_idxs, model_output, output_type, tef_terms);