Block decomposition: replace expr_t by BinaryOpNode * in a couple of places
parent
c699d57308
commit
928aa977b6
|
@ -242,7 +242,7 @@ DynamicModel::computeTemporaryTermsOrdered()
|
|||
getBlockEquationRenormalizedExpr(block, i)->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
||||
else
|
||||
{
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||
eq_node = getBlockEquationExpr(block, i);
|
||||
eq_node->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
||||
}
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ DynamicModel::computeTemporaryTermsOrdered()
|
|||
getBlockEquationRenormalizedExpr(block, i)->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
||||
else
|
||||
{
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||
eq_node = getBlockEquationExpr(block, i);
|
||||
eq_node->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
||||
}
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ DynamicModel::computeTemporaryTermsOrdered()
|
|||
getBlockEquationRenormalizedExpr(block, i)->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
||||
else
|
||||
{
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||
eq_node = getBlockEquationExpr(block, i);
|
||||
eq_node->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
||||
}
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &basename) const
|
|||
int equation_ID = getBlockEquationID(block, i);
|
||||
EquationType equ_type = getBlockEquationType(block, i);
|
||||
string sModel = symbol_table.getName(symbol_table.getID(SymbolType::endogenous, variable_ID));
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||
eq_node = getBlockEquationExpr(block, i);
|
||||
lhs = eq_node->arg1;
|
||||
rhs = eq_node->arg2;
|
||||
tmp_output.str("");
|
||||
|
@ -528,7 +528,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &basename) const
|
|||
rhs->writeOutput(output, local_output_type, local_temporary_terms, {});
|
||||
output << endl << " ";
|
||||
tmp_output.str("");
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationRenormalizedExpr(block, i));
|
||||
eq_node = getBlockEquationRenormalizedExpr(block, i);
|
||||
lhs = eq_node->arg1;
|
||||
rhs = eq_node->arg2;
|
||||
lhs->writeOutput(output, local_output_type, local_temporary_terms, {});
|
||||
|
@ -1141,7 +1141,7 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
|
|||
}
|
||||
if (equ_type == EquationType::evaluate)
|
||||
{
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||
eq_node = getBlockEquationExpr(block, i);
|
||||
lhs = eq_node->arg1;
|
||||
rhs = eq_node->arg2;
|
||||
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
|
||||
|
@ -1149,7 +1149,7 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
|
|||
}
|
||||
else if (equ_type == EquationType::evaluate_s)
|
||||
{
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationRenormalizedExpr(block, i));
|
||||
eq_node = getBlockEquationRenormalizedExpr(block, i);
|
||||
lhs = eq_node->arg1;
|
||||
rhs = eq_node->arg2;
|
||||
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
|
||||
|
@ -1171,7 +1171,7 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
|
|||
end:
|
||||
FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
|
||||
fnumexpr.write(code_file, instruction_number);
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||
eq_node = getBlockEquationExpr(block, i);
|
||||
lhs = eq_node->arg1;
|
||||
rhs = eq_node->arg2;
|
||||
lhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
|
||||
|
|
|
@ -103,7 +103,7 @@ ModelTree::copyHelper(const ModelTree &m)
|
|||
nonstationary_symbols_map[it.first] = {it.second.first, f(it.second.second)};
|
||||
|
||||
for (const auto &it : m.equation_type_and_normalized_equation)
|
||||
equation_type_and_normalized_equation.emplace_back(it.first, f(it.second));
|
||||
equation_type_and_normalized_equation.emplace_back(it.first, dynamic_cast<BinaryOpNode *>(f(it.second)));
|
||||
|
||||
for (const auto &it : m.blocks_derivatives)
|
||||
{
|
||||
|
|
|
@ -50,7 +50,7 @@ vectorToTuple(const vector<T> &v)
|
|||
}
|
||||
|
||||
//! Vector describing equations: BlockSimulationType, if BlockSimulationType == EVALUATE_s then a expr_t on the new normalized equation
|
||||
using equation_type_and_normalized_equation_t = vector<pair<EquationType, expr_t>>;
|
||||
using equation_type_and_normalized_equation_t = vector<pair<EquationType, BinaryOpNode *>>;
|
||||
|
||||
//! Vector describing variables: max_lag in the block, max_lead in the block
|
||||
using lag_lead_vector_t = vector<pair<int, int>>;
|
||||
|
@ -342,13 +342,13 @@ protected:
|
|||
return equation_type_and_normalized_equation[eq_idx_block2orig[blocks[blk].first_equation + eq]].first == EquationType::evaluate_s;
|
||||
};
|
||||
//! Return the expr_t of equation belonging to the block
|
||||
expr_t
|
||||
BinaryOpNode *
|
||||
getBlockEquationExpr(int blk, int eq) const
|
||||
{
|
||||
return equations[eq_idx_block2orig[blocks[blk].first_equation + eq]];
|
||||
};
|
||||
//! Return the expr_t of renormalized equation belonging to the block
|
||||
expr_t
|
||||
BinaryOpNode *
|
||||
getBlockEquationRenormalizedExpr(int blk, int eq) const
|
||||
{
|
||||
return equation_type_and_normalized_equation[eq_idx_block2orig[blocks[blk].first_equation + eq]].second;
|
||||
|
|
|
@ -210,7 +210,7 @@ StaticModel::computeTemporaryTermsOrdered()
|
|||
getBlockEquationRenormalizedExpr(block, i)->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
||||
else
|
||||
{
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||
eq_node = getBlockEquationExpr(block, i);
|
||||
eq_node->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, block, v_temporary_terms, i);
|
||||
}
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ StaticModel::computeTemporaryTermsOrdered()
|
|||
getBlockEquationRenormalizedExpr(block, i)->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
||||
else
|
||||
{
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||
eq_node = getBlockEquationExpr(block, i);
|
||||
eq_node->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
|
||||
}
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ StaticModel::writeModelEquationsOrdered_M(const string &basename) const
|
|||
int equation_ID = getBlockEquationID(block, i);
|
||||
EquationType equ_type = getBlockEquationType(block, i);
|
||||
string sModel = symbol_table.getName(symbol_table.getID(SymbolType::endogenous, variable_ID));
|
||||
BinaryOpNode *eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||
BinaryOpNode *eq_node = getBlockEquationExpr(block, i);
|
||||
expr_t lhs = eq_node->arg1, rhs = eq_node->arg2;
|
||||
ostringstream tmp_output;
|
||||
lhs->writeOutput(tmp_output, local_output_type, local_temporary_terms, {});
|
||||
|
@ -354,7 +354,7 @@ StaticModel::writeModelEquationsOrdered_M(const string &basename) const
|
|||
}
|
||||
else if (equ_type == EquationType::evaluate_s)
|
||||
{
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationRenormalizedExpr(block, i));
|
||||
eq_node = getBlockEquationRenormalizedExpr(block, i);
|
||||
lhs = eq_node->arg1;
|
||||
rhs = eq_node->arg2;
|
||||
lhs->writeOutput(output, local_output_type, local_temporary_terms, {});
|
||||
|
@ -685,7 +685,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
|||
}
|
||||
if (equ_type == EquationType::evaluate)
|
||||
{
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||
eq_node = getBlockEquationExpr(block, i);
|
||||
lhs = eq_node->arg1;
|
||||
rhs = eq_node->arg2;
|
||||
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
|
||||
|
@ -693,7 +693,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
|||
}
|
||||
else if (equ_type == EquationType::evaluate_s)
|
||||
{
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationRenormalizedExpr(block, i));
|
||||
eq_node = getBlockEquationRenormalizedExpr(block, i);
|
||||
lhs = eq_node->arg1;
|
||||
rhs = eq_node->arg2;
|
||||
rhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
|
||||
|
@ -713,7 +713,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
|||
end:
|
||||
FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
|
||||
fnumexpr.write(code_file, instruction_number);
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||
eq_node = getBlockEquationExpr(block, i);
|
||||
lhs = eq_node->arg1;
|
||||
rhs = eq_node->arg2;
|
||||
lhs->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
|
||||
|
@ -876,7 +876,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
|||
}
|
||||
if (equ_type == EquationType::evaluate)
|
||||
{
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||
eq_node = getBlockEquationExpr(block, i);
|
||||
lhs = eq_node->arg1;
|
||||
rhs = eq_node->arg2;
|
||||
rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
|
||||
|
@ -884,7 +884,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
|||
}
|
||||
else if (equ_type == EquationType::evaluate_s)
|
||||
{
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationRenormalizedExpr(block, i));
|
||||
eq_node = getBlockEquationRenormalizedExpr(block, i);
|
||||
lhs = eq_node->arg1;
|
||||
rhs = eq_node->arg2;
|
||||
rhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
|
||||
|
@ -904,7 +904,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
|||
end_l:
|
||||
FNUMEXPR_ fnumexpr(ModelEquation, getBlockEquationID(block, i));
|
||||
fnumexpr.write(code_file, instruction_number);
|
||||
eq_node = static_cast<BinaryOpNode *>(getBlockEquationExpr(block, i));
|
||||
eq_node = getBlockEquationExpr(block, i);
|
||||
lhs = eq_node->arg1;
|
||||
rhs = eq_node->arg2;
|
||||
lhs->compile(code_file, instruction_number, false, tt2, map_idx2[block], false, false);
|
||||
|
|
Loading…
Reference in New Issue