Fix logic of include_eqs in the presence of [static]/[dynamic] equations

In a model with [static]/[dynamic] equations, if the user was using include_eqs
with a list of equations that does *not* contain equations marked
[static]/[dynamic], then the call to ModelTree::includeExcludeEquations(…,
static_equations=true) would have an empty list of equation tags (as stored
in tag_eqns).

The right behaviour in this case is to exclude all static equations. However,
the code would exclude none, and this would disrupt the equilibrium between
[static] and [dynamic] equations (since all [dynamic] equations were excluded
by the other call to the same method).

The fix consists in removing the shortcut that returns from the method if
tag_eqns is empty.

(cherry picked from commit a73b0d911a)
5.x
Sébastien Villemot 2021-12-10 12:46:11 +01:00
parent 4deb397d18
commit f44155d43a
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 0 additions and 3 deletions

View File

@ -1566,9 +1566,6 @@ ModelTree::includeExcludeEquations(set<pair<string, string>> &eqs, bool exclude_
else
++it;
if (tag_eqns.empty())
return excluded_vars;
set<int> eqns;
if (exclude_eqs)
eqns = tag_eqns;