Commit c47b6e6e authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Fix bug with notmpterms option

Commit c6cb9aa1 was not the right fix.
parent 9043efab
Pipeline #198 passed with stage
in 1 minute and 35 seconds
......@@ -1256,17 +1256,14 @@ ModelTree::computeTemporaryTerms(bool is_matlab, bool no_tmp_terms)
reference_count[v] = { ExprNode::min_cost(is_matlab)+1, NodeTreeReference::residuals };
}
/* When option notmpterms is set, we only need to process model local
variables (and turn them into temporary terms); no need to go further */
if (no_tmp_terms)
return;
map<NodeTreeReference, temporary_terms_t> temp_terms_map;
temp_terms_map[NodeTreeReference::residuals] = temporary_terms_res;
temp_terms_map[NodeTreeReference::firstDeriv] = temporary_terms_g1;
temp_terms_map[NodeTreeReference::secondDeriv] = temporary_terms_g2;
temp_terms_map[NodeTreeReference::thirdDeriv] = temporary_terms_g3;
if (!no_tmp_terms)
{
for (auto & equation : equations)
equation->computeTemporaryTerms(reference_count,
temp_terms_map,
......@@ -1286,6 +1283,7 @@ ModelTree::computeTemporaryTerms(bool is_matlab, bool no_tmp_terms)
third_derivative.second->computeTemporaryTerms(reference_count,
temp_terms_map,
is_matlab, NodeTreeReference::thirdDeriv);
}
for (map<NodeTreeReference, temporary_terms_t>::const_iterator it = temp_terms_map.begin();
it != temp_terms_map.end(); it++)
......@@ -1301,8 +1299,8 @@ ModelTree::computeTemporaryTerms(bool is_matlab, bool no_tmp_terms)
it != temporary_terms_mlv.end(); it++)
temporary_terms_idxs[it->first] = idx++;
for (auto temporary_terms_re : temporary_terms_res)
temporary_terms_idxs[temporary_terms_re] = idx++;
for (auto it : temporary_terms_res)
temporary_terms_idxs[it] = idx++;
for (auto it : temporary_terms_g1)
temporary_terms_idxs[it] = idx++;
......
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