diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc index 618cbbfd2160668fa0067dfd78a17d244d2aba3f..6f98950228dd7da8baab509b886dcdf1964996f5 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 2afa2ba7a71a73f77afca49dc9d9a616c5c7c5c1..cc3587a29fbaba46bd7aafcb3b982754692b034b 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 8ef6fd4e9cc19412cc2820f420b0d491186679bd..cb52be73656310063e96da7c00d943d7289ec2ef 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<int> 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<int>::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 e2438ed777a0ed37fcbe0d09e44cc267c84a0988..7e914aaac95752b46b74419ae65a33df4e0ed903 100644 --- a/src/ModelTree.hh +++ b/src/ModelTree.hh @@ -197,9 +197,6 @@ protected: void fixNestedParenthesis(ostringstream &output, map<string, string> &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<expr_t, expr_t, ExprNodeLess> &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 f75ee6d01809407e28f3b3e3b90c04b8dde6c451..151f0d8a178582665675fee1b91584b116113362 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);