Commit 85dbb649 authored by Houtan Bastani's avatar Houtan Bastani

move trend_component_table and var_model_table to DynamicModel as they are only used there

parent eb74d483
Pipeline #23 passed with stage
in 1 minute and 17 seconds
...@@ -2061,11 +2061,8 @@ ModelComparisonStatement::writeJsonOutput(ostream &output) const ...@@ -2061,11 +2061,8 @@ ModelComparisonStatement::writeJsonOutput(ostream &output) const
PlannerObjectiveStatement::PlannerObjectiveStatement(SymbolTable &symbol_table, PlannerObjectiveStatement::PlannerObjectiveStatement(SymbolTable &symbol_table,
NumericalConstants &num_constants, NumericalConstants &num_constants,
ExternalFunctionsTable &external_functions_table, ExternalFunctionsTable &external_functions_table) :
TrendComponentModelTable &trend_component_model_table_arg, model_tree{symbol_table, num_constants, external_functions_table}
VarModelTable &var_model_table_arg) :
model_tree{symbol_table, num_constants, external_functions_table,
trend_component_model_table_arg, var_model_table_arg}
{ {
} }
......
...@@ -510,9 +510,7 @@ private: ...@@ -510,9 +510,7 @@ private:
public: public:
PlannerObjectiveStatement(SymbolTable &symbol_table, PlannerObjectiveStatement(SymbolTable &symbol_table,
NumericalConstants &num_constants, NumericalConstants &num_constants,
ExternalFunctionsTable &external_functions_table, ExternalFunctionsTable &external_functions_table);
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg);
/*! \todo check there are only endogenous variables at the current period in the objective /*! \todo check there are only endogenous variables at the current period in the objective
(no exogenous, no lead/lag) */ (no exogenous, no lead/lag) */
void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) override; void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) override;
......
...@@ -28,14 +28,10 @@ ...@@ -28,14 +28,10 @@
DataTree::DataTree(SymbolTable &symbol_table_arg, DataTree::DataTree(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg, NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg, ExternalFunctionsTable &external_functions_table_arg) :
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg) :
symbol_table(symbol_table_arg), symbol_table(symbol_table_arg),
num_constants(num_constants_arg), num_constants(num_constants_arg),
external_functions_table(external_functions_table_arg), external_functions_table(external_functions_table_arg)
trend_component_model_table(trend_component_model_table_arg),
var_model_table(var_model_table_arg)
{ {
Zero = AddNonNegativeConstant("0"); Zero = AddNonNegativeConstant("0");
One = AddNonNegativeConstant("1"); One = AddNonNegativeConstant("1");
......
...@@ -45,10 +45,6 @@ public: ...@@ -45,10 +45,6 @@ public:
NumericalConstants &num_constants; NumericalConstants &num_constants;
//! A reference to the external functions table //! A reference to the external functions table
ExternalFunctionsTable &external_functions_table; ExternalFunctionsTable &external_functions_table;
//! A reference to the trend component model table
TrendComponentModelTable &trend_component_model_table;
//! A reference to the VAR model table
VarModelTable &var_model_table;
protected: protected:
//! num_constant_id -> NumConstNode //! num_constant_id -> NumConstNode
...@@ -122,9 +118,8 @@ private: ...@@ -122,9 +118,8 @@ private:
public: public:
DataTree(SymbolTable &symbol_table_arg, DataTree(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg, NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg, ExternalFunctionsTable &external_functions_table_arg);
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg);
virtual virtual
~DataTree(); ~DataTree();
......
...@@ -36,8 +36,9 @@ DynamicModel::DynamicModel(SymbolTable &symbol_table_arg, ...@@ -36,8 +36,9 @@ DynamicModel::DynamicModel(SymbolTable &symbol_table_arg,
ExternalFunctionsTable &external_functions_table_arg, ExternalFunctionsTable &external_functions_table_arg,
TrendComponentModelTable &trend_component_model_table_arg, TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg) : VarModelTable &var_model_table_arg) :
ModelTree(symbol_table_arg, num_constants_arg, external_functions_table_arg, ModelTree(symbol_table_arg, num_constants_arg, external_functions_table_arg),
trend_component_model_table_arg, var_model_table_arg), trend_component_model_table(trend_component_model_table_arg),
var_model_table(var_model_table_arg),
max_lag(0), max_lead(0), max_lag(0), max_lead(0),
max_endo_lag(0), max_endo_lead(0), max_endo_lag(0), max_endo_lead(0),
max_exo_lag(0), max_exo_lead(0), max_exo_lag(0), max_exo_lead(0),
......
...@@ -30,6 +30,11 @@ using namespace std; ...@@ -30,6 +30,11 @@ using namespace std;
//! Stores a dynamic model //! Stores a dynamic model
class DynamicModel : public ModelTree class DynamicModel : public ModelTree
{ {
public:
//! A reference to the trend component model table
TrendComponentModelTable &trend_component_model_table;
//! A reference to the VAR model table
VarModelTable &var_model_table;
private: private:
constexpr static double zero_band{1e-8}; constexpr static double zero_band{1e-8};
......
...@@ -32,8 +32,7 @@ ...@@ -32,8 +32,7 @@
ModFile::ModFile(WarningConsolidation &warnings_arg) ModFile::ModFile(WarningConsolidation &warnings_arg)
: var_model_table(symbol_table), : var_model_table(symbol_table),
trend_component_model_table(symbol_table), trend_component_model_table(symbol_table),
expressions_tree(symbol_table, num_constants, external_functions_table, expressions_tree(symbol_table, num_constants, external_functions_table),
trend_component_model_table, var_model_table),
original_model(symbol_table, num_constants, external_functions_table, original_model(symbol_table, num_constants, external_functions_table,
trend_component_model_table, var_model_table), trend_component_model_table, var_model_table),
dynamic_model(symbol_table, num_constants, external_functions_table, dynamic_model(symbol_table, num_constants, external_functions_table,
...@@ -46,12 +45,9 @@ ModFile::ModFile(WarningConsolidation &warnings_arg) ...@@ -46,12 +45,9 @@ ModFile::ModFile(WarningConsolidation &warnings_arg)
trend_component_model_table, var_model_table), trend_component_model_table, var_model_table),
epilogue(symbol_table, num_constants, external_functions_table, epilogue(symbol_table, num_constants, external_functions_table,
trend_component_model_table, var_model_table), trend_component_model_table, var_model_table),
static_model(symbol_table, num_constants, external_functions_table, static_model(symbol_table, num_constants, external_functions_table),
trend_component_model_table, var_model_table), steady_state_model(symbol_table, num_constants, external_functions_table, static_model),
steady_state_model(symbol_table, num_constants, external_functions_table, diff_static_model(symbol_table, num_constants, external_functions_table),
trend_component_model_table, var_model_table, static_model),
diff_static_model(symbol_table, num_constants, external_functions_table,
trend_component_model_table, var_model_table),
linear(false), block(false), byte_code(false), use_dll(false), no_static(false), linear(false), block(false), byte_code(false), use_dll(false), no_static(false),
differentiate_forward_vars(false), nonstationary_variables(false), differentiate_forward_vars(false), nonstationary_variables(false),
param_used_with_lead_lag(false), warnings(warnings_arg) param_used_with_lead_lag(false), warnings(warnings_arg)
......
...@@ -25,11 +25,8 @@ ...@@ -25,11 +25,8 @@
SteadyStateModel::SteadyStateModel(SymbolTable &symbol_table_arg, SteadyStateModel::SteadyStateModel(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg, NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg, ExternalFunctionsTable &external_functions_table_arg,
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg,
const StaticModel &static_model_arg) : const StaticModel &static_model_arg) :
DataTree(symbol_table_arg, num_constants_arg, external_functions_table_arg, DataTree(symbol_table_arg, num_constants_arg, external_functions_table_arg),
trend_component_model_table_arg, var_model_table_arg),
static_model(static_model_arg) static_model(static_model_arg)
{ {
} }
......
...@@ -39,8 +39,6 @@ public: ...@@ -39,8 +39,6 @@ public:
SteadyStateModel(SymbolTable &symbol_table_arg, SteadyStateModel(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg, NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg, ExternalFunctionsTable &external_functions_table_arg,
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg,
const StaticModel &static_model_arg); const StaticModel &static_model_arg);
//! Add an expression of the form "var = expr;" //! Add an expression of the form "var = expr;"
void addDefinition(int symb_id, expr_t expr); void addDefinition(int symb_id, expr_t expr);
......
...@@ -1003,11 +1003,8 @@ ModelTree::BlockLinear(const blocks_derivatives_t &blocks_derivatives, const vec ...@@ -1003,11 +1003,8 @@ ModelTree::BlockLinear(const blocks_derivatives_t &blocks_derivatives, const vec
ModelTree::ModelTree(SymbolTable &symbol_table_arg, ModelTree::ModelTree(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg, NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg, ExternalFunctionsTable &external_functions_table_arg) :
TrendComponentModelTable &trend_component_model_table_arg, DataTree(symbol_table_arg, num_constants_arg, external_functions_table_arg),
VarModelTable &var_model_table_arg) :
DataTree(symbol_table_arg, num_constants_arg, external_functions_table_arg,
trend_component_model_table_arg, var_model_table_arg),
cutoff(1e-15), cutoff(1e-15),
mfs(0) mfs(0)
......
...@@ -323,9 +323,7 @@ protected: ...@@ -323,9 +323,7 @@ protected:
public: public:
ModelTree(SymbolTable &symbol_table_arg, ModelTree(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg, NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg, ExternalFunctionsTable &external_functions_table_arg);
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg);
//! Absolute value under which a number is considered to be zero //! Absolute value under which a number is considered to be zero
double cutoff; double cutoff;
//! Compute the minimum feedback set //! Compute the minimum feedback set
......
...@@ -2136,9 +2136,7 @@ ParsingDriver::begin_planner_objective() ...@@ -2136,9 +2136,7 @@ ParsingDriver::begin_planner_objective()
{ {
planner_objective_statement = make_unique<PlannerObjectiveStatement>(mod_file->symbol_table, planner_objective_statement = make_unique<PlannerObjectiveStatement>(mod_file->symbol_table,
mod_file->num_constants, mod_file->num_constants,
mod_file->external_functions_table, mod_file->external_functions_table);
mod_file->trend_component_model_table,
mod_file->var_model_table);
set_current_data_tree(&planner_objective_statement->getPlannerObjective()); set_current_data_tree(&planner_objective_statement->getPlannerObjective());
} }
......
...@@ -31,11 +31,8 @@ ...@@ -31,11 +31,8 @@
StaticModel::StaticModel(SymbolTable &symbol_table_arg, StaticModel::StaticModel(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg, NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg, ExternalFunctionsTable &external_functions_table_arg) :
TrendComponentModelTable &trend_component_model_table_arg, ModelTree(symbol_table_arg, num_constants_arg, external_functions_table_arg),
VarModelTable &var_model_table_arg) :
ModelTree(symbol_table_arg, num_constants_arg, external_functions_table_arg,
trend_component_model_table_arg, var_model_table_arg),
global_temporary_terms(true) global_temporary_terms(true)
{ {
} }
......
...@@ -162,9 +162,7 @@ protected: ...@@ -162,9 +162,7 @@ protected:
public: public:
StaticModel(SymbolTable &symbol_table_arg, StaticModel(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants, NumericalConstants &num_constants,
ExternalFunctionsTable &external_functions_table_arg, ExternalFunctionsTable &external_functions_table_arg);
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg);
//! Writes information on block decomposition when relevant //! Writes information on block decomposition when relevant
void writeOutput(ostream &output, bool block) const; void writeOutput(ostream &output, bool block) const;
......
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