Remove useless accessor methods for data members that are const in ExprNode classes

Those const data members are simply made public.
parent cac65b07
Pipeline #397 passed with stage
in 1 minute and 21 seconds
......@@ -4936,7 +4936,7 @@ VarExpectationModelStatement::writeOutput(ostream &output, const string &basenam
<< mstruct << ".variable_id = " << symbol_table.getTypeSpecificID(variable)+1 << ";" << endl;
auto disc_var = dynamic_cast<const VariableNode *>(discount);
if (disc_var)
output << mstruct << ".discount_index = " << symbol_table.getTypeSpecificID(disc_var->get_symb_id()) + 1 << ';' << endl;
output << mstruct << ".discount_index = " << symbol_table.getTypeSpecificID(disc_var->symb_id) + 1 << ';' << endl;
else
{
output << mstruct << ".discount_value = ";
......
......@@ -174,13 +174,13 @@ DataTree::AddPlus(expr_t iArg1, expr_t iArg2)
{
// Simplify x+(-y) in x-y
auto uarg2 = dynamic_cast<UnaryOpNode *>(iArg2);
if (uarg2 != nullptr && uarg2->get_op_code() == UnaryOpcode::uminus)
return AddMinus(iArg1, uarg2->get_arg());
if (uarg2 != nullptr && uarg2->op_code == UnaryOpcode::uminus)
return AddMinus(iArg1, uarg2->arg);
// Simplify (-x)+y in y-x
auto uarg1 = dynamic_cast<UnaryOpNode *>(iArg1);
if (uarg1 != nullptr && uarg1->get_op_code() == UnaryOpcode::uminus)
return AddMinus(iArg2, uarg1->get_arg());
if (uarg1 != nullptr && uarg1->op_code == UnaryOpcode::uminus)
return AddMinus(iArg2, uarg1->arg);
// To treat commutativity of "+"
// Nodes iArg1 and iArg2 are sorted by index
......@@ -219,8 +219,8 @@ DataTree::AddUMinus(expr_t iArg1)
{
// Simplify -(-x) in x
auto *uarg = dynamic_cast<UnaryOpNode *>(iArg1);
if (uarg != nullptr && uarg->get_op_code() == UnaryOpcode::uminus)
return uarg->get_arg();
if (uarg != nullptr && uarg->op_code == UnaryOpcode::uminus)
return uarg->arg;
return AddUnaryOp(UnaryOpcode::uminus, iArg1);
}
......
This diff is collapsed.
......@@ -1863,22 +1863,22 @@ VariableNode::replaceTrendVar() const
expr_t
VariableNode::detrend(int symb_id, bool log_trend, expr_t trend) const
{
if (get_symb_id() != symb_id)
if (this->symb_id != symb_id)
return const_cast<VariableNode *>(this);
if (log_trend)
{
if (get_lag() == 0)
if (lag == 0)
return datatree.AddPlus(const_cast<VariableNode *>(this), trend);
else
return datatree.AddPlus(const_cast<VariableNode *>(this), trend->decreaseLeadsLags(-1*get_lag()));
return datatree.AddPlus(const_cast<VariableNode *>(this), trend->decreaseLeadsLags(-lag));
}
else
{
if (get_lag() == 0)
if (lag == 0)
return datatree.AddTimes(const_cast<VariableNode *>(this), trend);
else
return datatree.AddTimes(const_cast<VariableNode *>(this), trend->decreaseLeadsLags(-1*get_lag()));
return datatree.AddTimes(const_cast<VariableNode *>(this), trend->decreaseLeadsLags(-lag));
}
}
......@@ -1891,7 +1891,7 @@ VariableNode::countDiffs() const
expr_t
VariableNode::removeTrendLeadLag(map<int, expr_t> trend_symbols_map) const
{
if ((get_type() != SymbolType::trend && get_type() != SymbolType::logTrend) || get_lag() == 0)
if ((get_type() != SymbolType::trend && get_type() != SymbolType::logTrend) || lag == 0)
return const_cast<VariableNode *>(this);
map<int, expr_t>::const_iterator it = trend_symbols_map.find(symb_id);
......@@ -1899,18 +1899,18 @@ VariableNode::removeTrendLeadLag(map<int, expr_t> trend_symbols_map) const
bool log_trend = get_type() == SymbolType::logTrend;
expr_t trend = it->second;
if (get_lag() > 0)
if (lag > 0)
{
expr_t growthFactorSequence = trend->decreaseLeadsLags(-1);
if (log_trend)
{
for (int i = 1; i < get_lag(); i++)
for (int i = 1; i < lag; i++)
growthFactorSequence = datatree.AddPlus(growthFactorSequence, trend->decreaseLeadsLags(-1*(i+1)));
return datatree.AddPlus(noTrendLeadLagNode, growthFactorSequence);
}
else
{
for (int i = 1; i < get_lag(); i++)
for (int i = 1; i < lag; i++)
growthFactorSequence = datatree.AddTimes(growthFactorSequence, trend->decreaseLeadsLags(-1*(i+1)));
return datatree.AddTimes(noTrendLeadLagNode, growthFactorSequence);
}
......@@ -1920,13 +1920,13 @@ VariableNode::removeTrendLeadLag(map<int, expr_t> trend_symbols_map) const
expr_t growthFactorSequence = trend;
if (log_trend)
{
for (int i = 1; i < abs(get_lag()); i++)
for (int i = 1; i < abs(lag); i++)
growthFactorSequence = datatree.AddPlus(growthFactorSequence, trend->decreaseLeadsLags(i));
return datatree.AddMinus(noTrendLeadLagNode, growthFactorSequence);
}
else
{
for (int i = 1; i < abs(get_lag()); i++)
for (int i = 1; i < abs(lag); i++)
growthFactorSequence = datatree.AddTimes(growthFactorSequence, trend->decreaseLeadsLags(i));
return datatree.AddDivide(noTrendLeadLagNode, growthFactorSequence);
}
......@@ -3411,12 +3411,12 @@ UnaryOpNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_table,
rit != it->second.rend(); rit++)
{
expr_t argsubst = dynamic_cast<UnaryOpNode *>(rit->second)->
get_arg()->substituteDiff(static_datatree, diff_table, subst_table, neweqs);
arg->substituteDiff(static_datatree, diff_table, subst_table, neweqs);
auto *vn = dynamic_cast<VariableNode *>(argsubst);
if (rit == it->second.rbegin())
{
if (vn != nullptr)
symb_id = datatree.symbol_table.addDiffAuxiliaryVar(argsubst->idx, argsubst, vn->get_symb_id(), vn->get_lag());
symb_id = datatree.symbol_table.addDiffAuxiliaryVar(argsubst->idx, argsubst, vn->symb_id, vn->lag);
else
symb_id = datatree.symbol_table.addDiffAuxiliaryVar(argsubst->idx, argsubst);
......@@ -3437,10 +3437,10 @@ UnaryOpNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_table,
{
if (i == last_arg_max_lag)
symb_id = datatree.symbol_table.addDiffLagAuxiliaryVar(argsubst->idx, argsubst,
last_aux_var->get_symb_id(), last_aux_var->get_lag());
last_aux_var->symb_id, last_aux_var->lag);
else
symb_id = datatree.symbol_table.addDiffLagAuxiliaryVar(new_aux_var->idx, new_aux_var,
last_aux_var->get_symb_id(), last_aux_var->get_lag());
last_aux_var->symb_id, last_aux_var->lag);
new_aux_var = datatree.AddVariable(symb_id, 0);
neweqs.push_back(dynamic_cast<BinaryOpNode *>(datatree.AddEqual(new_aux_var,
......@@ -3545,7 +3545,7 @@ UnaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, diff_table_t &nod
symb_id = datatree.symbol_table.addUnaryOpAuxiliaryVar(this->idx, dynamic_cast<UnaryOpNode *>(rit->second), unary_op);
else
symb_id = datatree.symbol_table.addUnaryOpAuxiliaryVar(this->idx, dynamic_cast<UnaryOpNode *>(rit->second), unary_op,
vn->get_symb_id(), vn->get_lag());
vn->symb_id, vn->lag);
aux_var = datatree.AddVariable(symb_id, 0);
neweqs.push_back(dynamic_cast<BinaryOpNode *>(datatree.AddEqual(aux_var,
dynamic_cast<UnaryOpNode *>(rit->second))));
......@@ -5450,10 +5450,10 @@ BinaryOpNode::findTargetVariableHelper(const expr_t arg1, const expr_t arg2,
if (endogs.size() == 2)
{
auto *testarg2 = dynamic_cast<BinaryOpNode *>(arg2);
if (testarg2 != nullptr && testarg2->get_op_code() == BinaryOpcode::minus)
if (testarg2 != nullptr && testarg2->op_code == BinaryOpcode::minus)
{
auto *test_arg1 = dynamic_cast<VariableNode *>(testarg2->get_arg1());
auto *test_arg2 = dynamic_cast<VariableNode *>(testarg2->get_arg2());
auto *test_arg1 = dynamic_cast<VariableNode *>(testarg2->arg1);
auto *test_arg2 = dynamic_cast<VariableNode *>(testarg2->arg2);
if (test_arg1 != nullptr && test_arg2 != nullptr )
if (findTargetVariableHelper1(lhs_symb_id, endogs.begin()->first))
return endogs.rbegin()->first;
......@@ -5495,10 +5495,10 @@ BinaryOpNode::getPacOptimizingPartHelper(const expr_t arg1, const expr_t arg2,
else if (endogs.size() >= 2)
{
auto *testarg2 = dynamic_cast<BinaryOpNode *>(arg2);
if (testarg2 != nullptr && testarg2->get_op_code() == BinaryOpcode::minus)
if (testarg2 != nullptr && testarg2->op_code == BinaryOpcode::minus)
{
auto *test_arg1 = dynamic_cast<VariableNode *>(testarg2->get_arg1());
auto *test_arg2 = dynamic_cast<VariableNode *>(testarg2->get_arg2());
auto *test_arg1 = dynamic_cast<VariableNode *>(testarg2->arg1);
auto *test_arg2 = dynamic_cast<VariableNode *>(testarg2->arg2);
if (test_arg1 != nullptr && test_arg2 != nullptr)
{
vector<int> endog_ids;
......@@ -5712,7 +5712,7 @@ BinaryOpNode::fillErrorCorrectionRowHelper(expr_t arg1, expr_t arg2,
BinaryOpNode *multiplicandr = dynamic_cast<BinaryOpNode *>(arg2);
if (multiplicandr == nullptr
|| multiplicandr->get_op_code() != BinaryOpcode::minus)
|| multiplicandr->op_code != BinaryOpcode::minus)
return;
arg2->collectDynamicVariables(SymbolType::endogenous, endogs);
......
......@@ -638,19 +638,15 @@ struct ExprNodeLess
/*! The constant is necessarily non-negative (this is enforced at the NumericalConstants class level) */
class NumConstNode : public ExprNode
{
private:
public:
//! Id from numerical constants table
const int id;
private:
expr_t computeDerivative(int deriv_id) override;
protected:
void matchVTCTPHelper(int &var_id, int &lag, int &param_id, double &constant, bool at_denominator) const override;
public:
NumConstNode(DataTree &datatree_arg, int idx_arg, int id_arg);
int
get_id() const
{
return id;
};
void prepareForDerivation() override;
void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const override;
void writeJsonAST(ostream &output) const override;
......@@ -721,11 +717,12 @@ public:
class VariableNode : public ExprNode
{
friend class UnaryOpNode;
private:
public:
//! Id from the symbol table
const int symb_id;
//! A positive value is a lead, a negative is a lag
const int lag;
private:
expr_t computeDerivative(int deriv_id) override;
protected:
void matchVTCTPHelper(int &var_id, int &lag, int &param_id, double &constant, bool at_denominator) const override;
......@@ -750,16 +747,6 @@ public:
expr_t toStatic(DataTree &static_datatree) const override;
void computeXrefs(EquationInfo &ei) const override;
SymbolType get_type() const;
int
get_symb_id() const
{
return symb_id;
};
int
get_lag() const
{
return lag;
};
pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t>>> &List_of_Op_RHS) const override;
expr_t getChainRuleDerivative(int deriv_id, const map<int, expr_t> &recursive_variables) override;
int maxEndoLead() const override;
......@@ -820,7 +807,7 @@ class UnaryOpNode : public ExprNode
{
protected:
void matchVTCTPHelper(int &var_id, int &lag, int &param_id, double &constant, bool at_denominator) const override;
private:
public:
const expr_t arg;
//! Stores the information set. Only used for expectation operator
const int expectation_information_set;
......@@ -829,6 +816,7 @@ private:
const UnaryOpcode op_code;
const string adl_param_name;
const vector<int> adl_lags;
private:
expr_t computeDerivative(int deriv_id) override;
int cost(int cost, bool is_matlab) const override;
int cost(const temporary_terms_t &temporary_terms, bool is_matlab) const override;
......@@ -869,18 +857,6 @@ public:
static double eval_opcode(UnaryOpcode op_code, double v) noexcept(false);
double eval(const eval_context_t &eval_context) const noexcept(false) override;
void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const override;
//! Returns operand
expr_t
get_arg() const
{
return (arg);
};
//! Returns op code
UnaryOpcode
get_op_code() const
{
return (op_code);
};
expr_t toStatic(DataTree &static_datatree) const override;
void computeXrefs(EquationInfo &ei) const override;
pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t>>> &List_of_Op_RHS) const override;
......@@ -947,17 +923,18 @@ class BinaryOpNode : public ExprNode
{
protected:
void matchVTCTPHelper(int &var_id, int &lag, int &param_id, double &constant, bool at_denominator) const override;
private:
public:
const expr_t arg1, arg2;
const BinaryOpcode op_code;
const int powerDerivOrder;
const string adlparam;
private:
expr_t computeDerivative(int deriv_id) override;
int cost(int cost, bool is_matlab) const override;
int cost(const temporary_terms_t &temporary_terms, bool is_matlab) const override;
int cost(const map<NodeTreeReference, temporary_terms_t> &temp_terms_map, bool is_matlab) const override;
//! Returns the derivative of this node if darg1 and darg2 are the derivatives of the arguments
expr_t composeDerivatives(expr_t darg1, expr_t darg2);
const int powerDerivOrder;
const string adlparam;
public:
BinaryOpNode(DataTree &datatree_arg, int idx_arg, const expr_t arg1_arg,
BinaryOpcode op_code_arg, const expr_t arg2_arg, int powerDerivOrder);
......@@ -996,29 +973,6 @@ public:
double eval(const eval_context_t &eval_context) const noexcept(false) override;
void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const override;
expr_t Compute_RHS(expr_t arg1, expr_t arg2, int op, int op_type) const;
//! Returns first operand
expr_t
get_arg1() const
{
return (arg1);
};
//! Returns second operand
expr_t
get_arg2() const
{
return (arg2);
};
//! Returns op code
BinaryOpcode
get_op_code() const
{
return (op_code);
};
int
get_power_deriv_order() const
{
return powerDerivOrder;
}
void getPacOptimizingPartHelper(const expr_t arg1, const expr_t arg2,
int lhs_orig_symb_id,
pair<int, pair<vector<int>, vector<bool>>> &ec_params_and_vars,
......@@ -1103,9 +1057,10 @@ public:
class TrinaryOpNode : public ExprNode
{
friend class ModelTree;
private:
public:
const expr_t arg1, arg2, arg3;
const TrinaryOpcode op_code;
private:
expr_t computeDerivative(int deriv_id) override;
int cost(int cost, bool is_matlab) const override;
int cost(const temporary_terms_t &temporary_terms, bool is_matlab) const override;
......@@ -1210,6 +1165,9 @@ public:
//! External function node
class AbstractExternalFunctionNode : public ExprNode
{
public:
const int symb_id;
const vector<expr_t> arguments;
private:
expr_t computeDerivative(int deriv_id) override;
virtual expr_t composeDerivatives(const vector<expr_t> &dargs) = 0;
......@@ -1218,8 +1176,6 @@ protected:
class UnknownFunctionNameAndArgs
{
};
const int symb_id;
const vector<expr_t> arguments;
//! Returns true if the given external function has been written as a temporary term
bool alreadyWrittenAsTefTerm(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const;
//! Returns the index in the tef_terms map of this external function
......@@ -1371,8 +1327,9 @@ public:
class FirstDerivExternalFunctionNode : public AbstractExternalFunctionNode
{
private:
public:
const int inputIndex;
private:
expr_t composeDerivatives(const vector<expr_t> &dargs) override;
protected:
function<bool (expr_t)> sameTefTermPredicate() const override;
......@@ -1414,9 +1371,10 @@ public:
class SecondDerivExternalFunctionNode : public AbstractExternalFunctionNode
{
private:
public:
const int inputIndex1;
const int inputIndex2;
private:
expr_t composeDerivatives(const vector<expr_t> &dargs) override;
protected:
function<bool (expr_t)> sameTefTermPredicate() const override;
......@@ -1459,9 +1417,8 @@ public:
class VarExpectationNode : public ExprNode
{
private:
const string model_name;
public:
const string model_name;
VarExpectationNode(DataTree &datatree_arg, int idx_arg, string model_name_arg);
void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference>> &reference_count,
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
......@@ -1544,8 +1501,9 @@ public:
class PacExpectationNode : public ExprNode
{
private:
public:
const string model_name;
private:
string var_model_name;
int growth_symb_id;
bool stationary_vars_present, nonstationary_vars_present;
......
......@@ -358,16 +358,16 @@ ModelTree::computeNormalizedEquations(multimap<int, int> &endo2eqs) const
{
for (size_t i = 0; i < equations.size(); i++)
{
auto *lhs = dynamic_cast<VariableNode *>(equations[i]->get_arg1());
auto *lhs = dynamic_cast<VariableNode *>(equations[i]->arg1);
if (lhs == nullptr)
continue;
int symb_id = lhs->get_symb_id();
int symb_id = lhs->symb_id;
if (symbol_table.getType(symb_id) != SymbolType::endogenous)
continue;
set<pair<int, int>> endo;
equations[i]->get_arg2()->collectEndogenous(endo);
equations[i]->arg2->collectEndogenous(endo);
if (endo.find({ symbol_table.getTypeSpecificID(symb_id), 0 }) != endo.end())
continue;
......@@ -521,7 +521,7 @@ ModelTree::computeNaturalNormalization()
if (!is_equation_linear[eq])
{
BinaryOpNode *eq_node = equations[eq];
expr_t lhs = eq_node->get_arg1();
expr_t lhs = eq_node->arg1;
result.clear();
lhs->collectDynamicVariables(SymbolType::endogenous, result);
if (result.size() == 1 && result.begin()->second == 0)
......@@ -670,7 +670,7 @@ ModelTree::equationTypeDetermination(const map<tuple<int, int, int>, expr_t> &fi
int eq = Index_Equ_IM[i];
int var = Index_Var_IM[i];
eq_node = equations[eq];
lhs = eq_node->get_arg1();
lhs = eq_node->arg1;
Equation_Simulation_Type = E_SOLVE;
auto derivative = first_order_endo_derivatives.find({ eq, var, 0 });
pair<bool, expr_t> res;
......@@ -1716,8 +1716,8 @@ ModelTree::writeModelEquations(ostream &output, ExprNodeOutputType output_type,
for (int eq = 0; eq < (int) equations.size(); eq++)
{
BinaryOpNode *eq_node = equations[eq];
expr_t lhs = eq_node->get_arg1();
expr_t rhs = eq_node->get_arg2();
expr_t lhs = eq_node->arg1;
expr_t rhs = eq_node->arg2;
// Test if the right hand side of the equation is empty.
double vrhs = 1.0;
......@@ -1774,8 +1774,8 @@ ModelTree::compileModelEquations(ostream &code_file, unsigned int &instruction_n
for (int eq = 0; eq < (int) equations.size(); eq++)
{
BinaryOpNode *eq_node = equations[eq];
expr_t lhs = eq_node->get_arg1();
expr_t rhs = eq_node->get_arg2();
expr_t lhs = eq_node->arg1;
expr_t rhs = eq_node->arg2;
FNUMEXPR_ fnumexpr(ModelEquation, eq);
fnumexpr.write(code_file, instruction_number);
// Test if the right hand side of the equation is empty.
......@@ -1935,7 +1935,7 @@ void
ModelTree::addEquation(expr_t eq, int lineno)
{
auto *beq = dynamic_cast<BinaryOpNode *>(eq);
assert(beq != nullptr && beq->get_op_code() == BinaryOpcode::equal);
assert(beq != nullptr && beq->op_code == BinaryOpcode::equal);
equations.push_back(beq);
equations_lineno.push_back(lineno);
......@@ -1954,7 +1954,7 @@ void
ModelTree::addAuxEquation(expr_t eq)
{
auto *beq = dynamic_cast<BinaryOpNode *>(eq);
assert(beq != nullptr && beq->get_op_code() == BinaryOpcode::equal);
assert(beq != nullptr && beq->op_code == BinaryOpcode::equal);
aux_equations.push_back(beq);
}
......@@ -2162,8 +2162,8 @@ ModelTree::writeJsonModelEquations(ostream &output, bool residuals) const
output << ", ";
BinaryOpNode *eq_node = equations[eq];
expr_t lhs = eq_node->get_arg1();
expr_t rhs = eq_node->get_arg2();
expr_t lhs = eq_node->arg1;
expr_t rhs = eq_node->arg2;
if (residuals)
{
......
......@@ -2944,7 +2944,7 @@ ParsingDriver::is_there_one_integer_argument() const
}
}
else
if (unaryNode->get_op_code() != UnaryOpcode::uminus)
if (unaryNode->op_code != UnaryOpcode::uminus)
return { false, 0 };
else
{
......
......@@ -455,8 +455,8 @@ StaticModel::writeModelEquationsOrdered_M(const string &basename) const
EquationType equ_type = getBlockEquationType(block, i);
string sModel = symbol_table.getName(symbol_table.getID(SymbolType::endogenous, variable_ID));
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
lhs = eq_node->get_arg1();
rhs = eq_node->get_arg2();
lhs = eq_node->arg1;
rhs = eq_node->arg2;
tmp_output.str("");
lhs->writeOutput(tmp_output, local_output_type, local_temporary_terms, {});
switch (simulation_type)
......@@ -483,8 +483,8 @@ StaticModel::writeModelEquationsOrdered_M(const string &basename) const
output << endl << " ";
tmp_output.str("");
eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
lhs = eq_node->get_arg1();
rhs = eq_node->get_arg2();
lhs = eq_node->arg1;
rhs = eq_node->arg2;
lhs->writeOutput(output, local_output_type, local_temporary_terms, {});
output << " = ";
rhs->writeOutput(output, local_output_type, local_temporary_terms, {});
......@@ -830,16 +830,16 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
if (equ_type == E_EVALUATE)
{
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
lhs = eq_node->get_arg1();
rhs = eq_node->get_arg2();
lhs = eq_node->arg1;
rhs = eq_node->arg2;
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
lhs->compile(code_file, instruction_number, true, temporary_terms, map_idx, false, false);
}
else if (equ_type == E_EVALUATE_S)
{
eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
lhs = eq_node->get_arg1();
rhs = eq_node->get_arg2();
lhs = eq_node->arg1;
rhs = eq_node->arg2;
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
lhs->compile(code_file, instruction_number, true, temporary_terms, map_idx, false, false);
}
......@@ -858,8 +858,8 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
fnumexpr.write(code_file, instruction_number);
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
lhs = eq_node->get_arg1();
rhs = eq_node->get_arg2();
lhs = eq_node->arg1;
rhs = eq_node->arg2;
lhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
......@@ -1022,16 +1022,16 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
if (equ_type == E_EVALUATE)
{
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
lhs = eq_node->get_arg1();
rhs = eq_node->get_arg2();
lhs = eq_node->arg1;
rhs = eq_node->arg2;
rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
lhs->compile(code_file, instruction_number, true, tt2, map_idx2[block], false, false);
}
else if (equ_type == E_EVALUATE_S)
{
eq_node = (BinaryOpNode *) getBlockEquationRenormalizedExpr(block, i);
lhs = eq_node->get_arg1();
rhs = eq_node->get_arg2();
lhs = eq_node->arg1;
rhs = eq_node->arg2;
rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
lhs->compile(code_file, instruction_number, true, tt2, map_idx2[block], false, false);
}
......@@ -1050,8 +1050,8 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
fnumexpr.write(code_file, instruction_number);
eq_node = (BinaryOpNode *) getBlockEquationExpr(block, i);
lhs = eq_node->get_arg1();
rhs = eq_node->get_arg2();
lhs = eq_node->arg1;
rhs = eq_node->arg2;
lhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
......@@ -2589,9 +2589,9 @@ StaticModel::writeJsonAuxVarRecursiveDefinitions(ostream &output) const
for (auto aux_equation : aux_equations)
{
output << ", {\"lhs\": \"";
aux_equation->get_arg1()->writeJsonOutput(output, temporary_terms, tef_terms, false);
aux_equation->arg1->writeJsonOutput(output, temporary_terms, tef_terms, false);
output << "\", \"rhs\": \"";
dynamic_cast<BinaryOpNode *>(aux_equation->substituteStaticAuxiliaryDefinition())->get_arg2()->writeJsonOutput(output, temporary_terms, tef_terms, false);
dynamic_cast<BinaryOpNode *>(aux_equation->substituteStaticAuxiliaryDefinition())->arg2->writeJsonOutput(output, temporary_terms, tef_terms, false);
output << "\"}";
}
}
......
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