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

issue#70
Houtan Bastani 2018-09-14 17:04:06 +02:00
parent eb74d48393
commit 85dbb649b7
14 changed files with 27 additions and 56 deletions

View File

@ -2061,11 +2061,8 @@ ModelComparisonStatement::writeJsonOutput(ostream &output) const
PlannerObjectiveStatement::PlannerObjectiveStatement(SymbolTable &symbol_table,
NumericalConstants &num_constants,
ExternalFunctionsTable &external_functions_table,
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg) :
model_tree{symbol_table, num_constants, external_functions_table,
trend_component_model_table_arg, var_model_table_arg}
ExternalFunctionsTable &external_functions_table) :
model_tree{symbol_table, num_constants, external_functions_table}
{
}

View File

@ -510,9 +510,7 @@ private:
public:
PlannerObjectiveStatement(SymbolTable &symbol_table,
NumericalConstants &num_constants,
ExternalFunctionsTable &external_functions_table,
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg);
ExternalFunctionsTable &external_functions_table);
/*! \todo check there are only endogenous variables at the current period in the objective
(no exogenous, no lead/lag) */
void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) override;

View File

@ -28,14 +28,10 @@
DataTree::DataTree(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg,
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg) :
ExternalFunctionsTable &external_functions_table_arg) :
symbol_table(symbol_table_arg),
num_constants(num_constants_arg),
external_functions_table(external_functions_table_arg),
trend_component_model_table(trend_component_model_table_arg),
var_model_table(var_model_table_arg)
external_functions_table(external_functions_table_arg)
{
Zero = AddNonNegativeConstant("0");
One = AddNonNegativeConstant("1");

View File

@ -45,10 +45,6 @@ public:
NumericalConstants &num_constants;
//! A reference to the 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:
//! num_constant_id -> NumConstNode
@ -122,9 +118,8 @@ private:
public:
DataTree(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg,
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg);
ExternalFunctionsTable &external_functions_table_arg);
virtual
~DataTree();

View File

@ -36,8 +36,9 @@ DynamicModel::DynamicModel(SymbolTable &symbol_table_arg,
ExternalFunctionsTable &external_functions_table_arg,
TrendComponentModelTable &trend_component_model_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),
ModelTree(symbol_table_arg, num_constants_arg, external_functions_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_endo_lag(0), max_endo_lead(0),
max_exo_lag(0), max_exo_lead(0),

View File

@ -30,6 +30,11 @@ using namespace std;
//! Stores a dynamic model
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:
constexpr static double zero_band{1e-8};

View File

@ -32,8 +32,7 @@
ModFile::ModFile(WarningConsolidation &warnings_arg)
: var_model_table(symbol_table),
trend_component_model_table(symbol_table),
expressions_tree(symbol_table, num_constants, external_functions_table,
trend_component_model_table, var_model_table),
expressions_tree(symbol_table, num_constants, external_functions_table),
original_model(symbol_table, num_constants, external_functions_table,
trend_component_model_table, var_model_table),
dynamic_model(symbol_table, num_constants, external_functions_table,
@ -46,12 +45,9 @@ ModFile::ModFile(WarningConsolidation &warnings_arg)
trend_component_model_table, var_model_table),
epilogue(symbol_table, num_constants, external_functions_table,
trend_component_model_table, var_model_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,
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),
static_model(symbol_table, num_constants, external_functions_table),
steady_state_model(symbol_table, num_constants, external_functions_table, static_model),
diff_static_model(symbol_table, num_constants, external_functions_table),
linear(false), block(false), byte_code(false), use_dll(false), no_static(false),
differentiate_forward_vars(false), nonstationary_variables(false),
param_used_with_lead_lag(false), warnings(warnings_arg)

View File

@ -25,11 +25,8 @@
SteadyStateModel::SteadyStateModel(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg,
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg,
const StaticModel &static_model_arg) :
DataTree(symbol_table_arg, num_constants_arg, external_functions_table_arg,
trend_component_model_table_arg, var_model_table_arg),
DataTree(symbol_table_arg, num_constants_arg, external_functions_table_arg),
static_model(static_model_arg)
{
}

View File

@ -39,8 +39,6 @@ public:
SteadyStateModel(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg,
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg,
const StaticModel &static_model_arg);
//! Add an expression of the form "var = expr;"
void addDefinition(int symb_id, expr_t expr);

View File

@ -1003,11 +1003,8 @@ ModelTree::BlockLinear(const blocks_derivatives_t &blocks_derivatives, const vec
ModelTree::ModelTree(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg,
TrendComponentModelTable &trend_component_model_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),
ExternalFunctionsTable &external_functions_table_arg) :
DataTree(symbol_table_arg, num_constants_arg, external_functions_table_arg),
cutoff(1e-15),
mfs(0)

View File

@ -323,9 +323,7 @@ protected:
public:
ModelTree(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg,
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg);
ExternalFunctionsTable &external_functions_table_arg);
//! Absolute value under which a number is considered to be zero
double cutoff;
//! Compute the minimum feedback set

View File

@ -2136,9 +2136,7 @@ ParsingDriver::begin_planner_objective()
{
planner_objective_statement = make_unique<PlannerObjectiveStatement>(mod_file->symbol_table,
mod_file->num_constants,
mod_file->external_functions_table,
mod_file->trend_component_model_table,
mod_file->var_model_table);
mod_file->external_functions_table);
set_current_data_tree(&planner_objective_statement->getPlannerObjective());
}

View File

@ -31,11 +31,8 @@
StaticModel::StaticModel(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants_arg,
ExternalFunctionsTable &external_functions_table_arg,
TrendComponentModelTable &trend_component_model_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),
ExternalFunctionsTable &external_functions_table_arg) :
ModelTree(symbol_table_arg, num_constants_arg, external_functions_table_arg),
global_temporary_terms(true)
{
}

View File

@ -162,9 +162,7 @@ protected:
public:
StaticModel(SymbolTable &symbol_table_arg,
NumericalConstants &num_constants,
ExternalFunctionsTable &external_functions_table_arg,
TrendComponentModelTable &trend_component_model_table_arg,
VarModelTable &var_model_table_arg);
ExternalFunctionsTable &external_functions_table_arg);
//! Writes information on block decomposition when relevant
void writeOutput(ostream &output, bool block) const;