Small simplification
parent
3d21821d0c
commit
93ef4c6feb
|
@ -1331,14 +1331,13 @@ ModelTree::writeModelEquations(ostream &output, ExprNodeOutputType output_type,
|
||||||
for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
|
for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
|
||||||
{
|
{
|
||||||
BinaryOpNode *eq_node = equations[eq];
|
BinaryOpNode *eq_node = equations[eq];
|
||||||
expr_t lhs = eq_node->arg1;
|
expr_t lhs = eq_node->arg1, rhs = eq_node->arg2;
|
||||||
expr_t rhs = eq_node->arg2;
|
|
||||||
|
|
||||||
// Test if the right hand side of the equation is empty.
|
// Test if the right hand side of the equation is empty.
|
||||||
double vrhs = 1.0;
|
double vrhs = 1.0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
vrhs = rhs->eval(eval_context_t());
|
vrhs = rhs->eval({});
|
||||||
}
|
}
|
||||||
catch (ExprNode::EvalException &e)
|
catch (ExprNode::EvalException &e)
|
||||||
{
|
{
|
||||||
|
@ -1389,14 +1388,13 @@ ModelTree::writeBytecodeModelEquations(BytecodeWriter &code_file, bool dynamic,
|
||||||
for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
|
for (int eq = 0; eq < static_cast<int>(equations.size()); eq++)
|
||||||
{
|
{
|
||||||
BinaryOpNode *eq_node = equations[eq];
|
BinaryOpNode *eq_node = equations[eq];
|
||||||
expr_t lhs = eq_node->arg1;
|
expr_t lhs = eq_node->arg1, rhs = eq_node->arg2;
|
||||||
expr_t rhs = eq_node->arg2;
|
|
||||||
code_file << FNUMEXPR_{ExpressionType::ModelEquation, eq};
|
code_file << FNUMEXPR_{ExpressionType::ModelEquation, eq};
|
||||||
// Test if the right hand side of the equation is empty.
|
// Test if the right hand side of the equation is empty.
|
||||||
double vrhs = 1.0;
|
double vrhs = 1.0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
vrhs = rhs->eval(eval_context_t());
|
vrhs = rhs->eval({});
|
||||||
}
|
}
|
||||||
catch (ExprNode::EvalException &e)
|
catch (ExprNode::EvalException &e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue