code simplifications

issue#70
Houtan Bastani 2020-01-30 12:47:59 +01:00
parent 148aa9d924
commit 3fec11b183
No known key found for this signature in database
GPG Key ID: 000094FB955BE169
1 changed files with 4 additions and 9 deletions

View File

@ -6720,8 +6720,7 @@ DynamicModel::fillEvalContext(eval_context_t &eval_context) const
}
//Third, trend variables
vector <int> trendVars = symbol_table.getTrendVarIds();
for (int &trendVar : trendVars)
for (int trendVar : symbol_table.getTrendVarIds())
eval_context[trendVar] = 2; //not <= 0 bc of log, not 1 bc of powers
}
@ -6729,13 +6728,9 @@ bool
DynamicModel::isModelLocalVariableUsed() const
{
set<int> used_local_vars;
size_t i = 0;
while (i < equations.size() && used_local_vars.size() == 0)
{
equations[i]->collectVariables(SymbolType::modelLocalVariable, used_local_vars);
i++;
}
return used_local_vars.size() > 0;
for (size_t i = 0; i < equations.size() && used_local_vars.empty(); i++)
equations[i]->collectVariables(SymbolType::modelLocalVariable, used_local_vars);
return !used_local_vars.empty();
}
void