Remove unused parameters to various methods

master
Sébastien Villemot 2022-06-24 15:45:35 +02:00
parent e0c9a287c5
commit 3b99ac5df0
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
9 changed files with 29 additions and 32 deletions

View File

@ -2778,7 +2778,7 @@ DynamicModel::writeBlockDriverOutput(ostream &output, const string &basename,
}
void
DynamicModel::writeDriverOutput(ostream &output, const string &basename, bool block_decomposition, bool use_dll, bool occbin, bool estimation_present, bool compute_xrefs) const
DynamicModel::writeDriverOutput(ostream &output, const string &basename, bool block_decomposition, bool estimation_present, bool compute_xrefs) const
{
/* Writing initialisation for M_.lead_lag_incidence matrix
M_.lead_lag_incidence is a matrix with as many columns as there are
@ -3682,7 +3682,7 @@ DynamicModel::analyzePacEquationStructure(const string &name, map<string, string
exit(EXIT_FAILURE);
}
auto [optim_share_index, optim_part, non_optim_part, additive_part]
= arg2->getPacOptimizingShareAndExprNodes(lhs_symb_id, lhs_orig_symb_id);
= arg2->getPacOptimizingShareAndExprNodes(lhs_orig_symb_id);
pair<int, vector<tuple<int, bool, int>>> ec_params_and_vars;
vector<tuple<optional<int>, optional<int>, int>> ar_params_and_vars;
@ -3756,7 +3756,7 @@ DynamicModel::getPacTargetSymbId(const string &pac_model_name) const
if (!barg2)
throw PacTargetNotIdentifiedException{pac_model_name, "RHS must be a binary operator"};
auto [optim_share_index, optim_part, non_optim_part, additive_part]
= barg2->getPacOptimizingShareAndExprNodes(lhs_symb_id, undiff_lhs_symb_id);
= barg2->getPacOptimizingShareAndExprNodes(undiff_lhs_symb_id);
/* If there is an optimization part, restrict the search to that part,
since it contains the MCE . */
expr_t mce = optim_part ? optim_part : equation->arg2;
@ -5874,7 +5874,7 @@ DynamicModel::addOccbinEquation(expr_t eq, optional<int> lineno, const map<strin
}
bool
DynamicModel::isChecksumMatching(const string &basename, bool block) const
DynamicModel::isChecksumMatching(const string &basename) const
{
stringstream buffer;

View File

@ -330,7 +330,7 @@ public:
void computingPass(bool jacobianExo, int derivsOrder, int paramsDerivsOrder,
const eval_context_t &eval_context, bool no_tmp_terms, bool block, bool use_dll);
//! Writes information about the dynamic model to the driver file
void writeDriverOutput(ostream &output, const string &basename, bool block, bool use_dll, bool occbin, bool estimation_present, bool compute_xrefs) const;
void writeDriverOutput(ostream &output, const string &basename, bool block, bool estimation_present, bool compute_xrefs) const;
//! Write JSON AST
void writeJsonAST(ostream &output) const;
@ -638,7 +638,7 @@ public:
//! Returns true if a parameter was used in the model block with a lead or lag
bool ParamUsedWithLeadLag() const;
bool isChecksumMatching(const string &basename, bool block) const;
bool isChecksumMatching(const string &basename) const;
//! Simplify model equations: if a variable is equal to a constant, replace that variable elsewhere in the model
/*! Equations with MCP tags are excluded, see dynare#1697 */

View File

@ -5487,7 +5487,7 @@ BinaryOpNode::getPacNonOptimizingPart(int optim_share_symb_id) const
}
pair<optional<int>, expr_t>
BinaryOpNode::getPacOptimizingShareAndExprNodesHelper(int lhs_symb_id, int lhs_orig_symb_id) const
BinaryOpNode::getPacOptimizingShareAndExprNodesHelper(int lhs_orig_symb_id) const
{
optional<int> optim_param_symb_id;
expr_t optim_part = nullptr;
@ -5514,7 +5514,7 @@ BinaryOpNode::getPacOptimizingShareAndExprNodesHelper(int lhs_symb_id, int lhs_o
}
tuple<optional<int>, expr_t, expr_t, expr_t>
BinaryOpNode::getPacOptimizingShareAndExprNodes(int lhs_symb_id, int lhs_orig_symb_id) const
BinaryOpNode::getPacOptimizingShareAndExprNodes(int lhs_orig_symb_id) const
{
vector<pair<expr_t, int>> terms;
decomposeAdditiveTerms(terms, 1);
@ -5532,7 +5532,7 @@ BinaryOpNode::getPacOptimizingShareAndExprNodes(int lhs_symb_id, int lhs_orig_sy
if (auto bopn = dynamic_cast<BinaryOpNode *>(it->first); bopn)
{
tie(optim_share, optim_part)
= bopn->getPacOptimizingShareAndExprNodesHelper(lhs_symb_id, lhs_orig_symb_id);
= bopn->getPacOptimizingShareAndExprNodesHelper(lhs_orig_symb_id);
if (optim_share && optim_part)
{
terms.erase(it);

View File

@ -1154,8 +1154,8 @@ public:
//! Finds the share of optimizing agents in the PAC equation,
//! the expr node associated with it,
//! and the expr node associated with the non-optimizing part
tuple<optional<int>, expr_t, expr_t, expr_t> getPacOptimizingShareAndExprNodes(int lhs_symb_id, int lhs_orig_symb_id) const;
pair<optional<int>, expr_t> getPacOptimizingShareAndExprNodesHelper(int lhs_symb_id, int lhs_orig_symb_id) const;
tuple<optional<int>, expr_t, expr_t, expr_t> getPacOptimizingShareAndExprNodes(int lhs_orig_symb_id) const;
pair<optional<int>, expr_t> getPacOptimizingShareAndExprNodesHelper(int lhs_orig_symb_id) const;
expr_t getPacNonOptimizingPart(int optim_share_symb_id) const;
bool isParamTimesEndogExpr() const override;
//! Substitute auxiliary variables by their expression in static model

View File

@ -114,9 +114,9 @@ ModFile::checkPass(bool nostrict, bool stochastic)
steady_state_model.checkPass(mod_file_struct, warnings);
// Check epilogue block
epilogue.checkPass(mod_file_struct, warnings);
epilogue.checkPass(mod_file_struct);
pac_model_table.checkPass(mod_file_struct, warnings);
pac_model_table.checkPass(mod_file_struct);
if (mod_file_struct.write_latex_steady_state_model_present
&& !mod_file_struct.steady_state_model_present)
@ -785,7 +785,7 @@ ModFile::writeMOutput(const string &basename, bool clear_all, bool clear_global,
const filesystem::path &matlabroot,
const filesystem::path &dynareroot, bool onlymodel, bool gui, bool notime) const
{
bool hasModelChanged = !dynamic_model.isChecksumMatching(basename, block) || !check_model_changes;
bool hasModelChanged = !dynamic_model.isChecksumMatching(basename) || !check_model_changes;
if (hasModelChanged)
{
// Erase possible remnants of previous runs
@ -893,8 +893,8 @@ ModFile::writeMOutput(const string &basename, bool clear_all, bool clear_global,
var_model_table.writeOutput(basename, mOutputFile);
trend_component_model_table.writeOutput(basename, mOutputFile);
var_expectation_model_table.writeOutput(basename, mOutputFile);
pac_model_table.writeOutput(basename, mOutputFile);
var_expectation_model_table.writeOutput(mOutputFile);
pac_model_table.writeOutput(mOutputFile);
// Initialize M_.Sigma_e, M_.Correlation_matrix, M_.H, and M_.Correlation_matrix_ME
mOutputFile << "M_.Sigma_e = zeros(" << symbol_table.exo_nbr() << ", "
@ -968,7 +968,7 @@ ModFile::writeMOutput(const string &basename, bool clear_all, bool clear_global,
if (dynamic_model.equation_number() > 0)
{
dynamic_model.writeDriverOutput(mOutputFile, basename, block, use_dll, mod_file_struct.occbin_constraints_present, mod_file_struct.estimation_present, compute_xrefs);
dynamic_model.writeDriverOutput(mOutputFile, basename, block, mod_file_struct.estimation_present, compute_xrefs);
if (!no_static)
static_model.writeDriverOutput(mOutputFile, block);
}
@ -1087,7 +1087,7 @@ ModFile::writeMOutput(const string &basename, bool clear_all, bool clear_global,
}
// Create steady state file
steady_state_model.writeSteadyStateFile(basename, mod_file_struct.ramsey_model_present, false);
steady_state_model.writeSteadyStateFile(basename, false);
// Create epilogue file
epilogue.writeEpilogueFile(basename);
@ -1111,7 +1111,7 @@ ModFile::writeJuliaOutput(const string &basename) const
dynamic_model.writeDynamicFile(basename, block, use_dll, "", {}, {}, true);
dynamic_model.writeParamsDerivativesFile(basename, true);
}
steady_state_model.writeSteadyStateFile(basename, mod_file_struct.ramsey_model_present, true);
steady_state_model.writeSteadyStateFile(basename, true);
}
void

View File

@ -177,7 +177,7 @@ SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const
}
void
SteadyStateModel::writeSteadyStateFile(const string &basename, bool ramsey_model, bool julia) const
SteadyStateModel::writeSteadyStateFile(const string &basename, bool julia) const
{
if (def_table.size() == 0)
return;
@ -307,7 +307,7 @@ Epilogue::addDefinition(int symb_id, expr_t expr)
}
void
Epilogue::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) const
Epilogue::checkPass(ModFileStructure &mod_file_struct) const
{
if (dynamic_def_table.size() == 0)
{

View File

@ -54,10 +54,7 @@ public:
*/
void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) const;
//! Write the steady state file
/*!
\param[in] ramsey_model Is there a Ramsey model in the MOD file? If yes, then use the "ys" in argument of the steady state file as initial values
*/
void writeSteadyStateFile(const string &basename, bool ramsey_model, bool julia) const;
void writeSteadyStateFile(const string &basename, bool julia) const;
//! Writes LaTeX file with the equations of the dynamic model (for the steady state model)
void writeLatexSteadyStateFile(const string &basename) const;
//! Writes JSON output
@ -83,7 +80,7 @@ public:
void addDefinition(int symb_id, expr_t expr);
//! Checks that no variable is declared twice, and that “with_epilogue” is not misused
void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) const;
void checkPass(ModFileStructure &mod_file_struct) const;
//! Creates static epilogue equations
void toStatic();

View File

@ -771,7 +771,7 @@ VarExpectationModelTable::empty() const
}
void
VarExpectationModelTable::writeOutput(const string &basename, ostream &output) const
VarExpectationModelTable::writeOutput(ostream &output) const
{
for (const auto &name : names)
{
@ -986,7 +986,7 @@ PacModelTable::empty() const
}
void
PacModelTable::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
PacModelTable::checkPass(ModFileStructure &mod_file_struct)
{
for (auto &[name, gv] : growth)
if (gv)
@ -1364,7 +1364,7 @@ PacModelTable::transformPass(const lag_equivalence_table_t &unary_ops_nodes,
}
void
PacModelTable::writeOutput(const string &basename, ostream &output) const
PacModelTable::writeOutput(ostream &output) const
{
// Helper to print the “growth_info” structure (linear decomposition of growth)
auto growth_info_helper = [&](const string &fieldname, const growth_info_t &gi)

View File

@ -218,7 +218,7 @@ public:
void transformPass(ExprNode::subst_table_t &diff_subst_table,
DynamicModel &dynamic_model, const VarModelTable &var_model_table,
const TrendComponentModelTable &trend_component_model_table);
void writeOutput(const string &basename, ostream &output) const;
void writeOutput(ostream &output) const;
void writeJsonOutput(ostream &output) const;
};
@ -307,7 +307,7 @@ public:
void addPacModel(string name_arg, string aux_model_name_arg, string discount_arg, expr_t growth_arg, string auxname_arg, PacTargetKind kind_arg);
bool isExistingPacModelName(const string &name_arg) const;
bool empty() const;
void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
void checkPass(ModFileStructure &mod_file_struct);
// Called by DynamicModel::substituteUnaryOps()
void substituteUnaryOpsInGrowth(const lag_equivalence_table_t &nodes, ExprNode::subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs);
void findDiffNodesInGrowth(lag_equivalence_table_t &diff_nodes) const;
@ -320,7 +320,7 @@ public:
ExprNode::subst_table_t &diff_subst_table,
DynamicModel &dynamic_model, const VarModelTable &var_model_table,
const TrendComponentModelTable &trend_component_model_table);
void writeOutput(const string &basename, ostream &output) const;
void writeOutput(ostream &output) const;
void writeJsonOutput(ostream &output) const;
void setTargetExpr(const string &name_arg, expr_t target);
void setTargetAuxnameNonstationary(const string &name_arg, string auxname);