code simplifications

parent 148aa9d9
Pipeline #3032 passed with stages
in 12 minutes and 3 seconds
...@@ -6720,8 +6720,7 @@ DynamicModel::fillEvalContext(eval_context_t &eval_context) const ...@@ -6720,8 +6720,7 @@ DynamicModel::fillEvalContext(eval_context_t &eval_context) const
} }
//Third, trend variables //Third, trend variables
vector <int> trendVars = symbol_table.getTrendVarIds(); for (int trendVar : symbol_table.getTrendVarIds())
for (int &trendVar : trendVars)
eval_context[trendVar] = 2; //not <= 0 bc of log, not 1 bc of powers eval_context[trendVar] = 2; //not <= 0 bc of log, not 1 bc of powers
} }
...@@ -6729,13 +6728,9 @@ bool ...@@ -6729,13 +6728,9 @@ bool
DynamicModel::isModelLocalVariableUsed() const DynamicModel::isModelLocalVariableUsed() const
{ {
set<int> used_local_vars; set<int> used_local_vars;
size_t i = 0; for (size_t i = 0; i < equations.size() && used_local_vars.empty(); i++)
while (i < equations.size() && used_local_vars.size() == 0) equations[i]->collectVariables(SymbolType::modelLocalVariable, used_local_vars);
{ return !used_local_vars.empty();
equations[i]->collectVariables(SymbolType::modelLocalVariable, used_local_vars);
i++;
}
return used_local_vars.size() > 0;
} }
void void
......
Markdown is supported
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