preprocessor: replace extra exos in steady state model
(commit lost in merge) (cherry picked from commit d7db5070e7cf8d1b043062b04d3bd3c4e18ce6c1)time-shift
parent
1c6b394c77
commit
8bc946c148
|
@ -315,6 +315,7 @@ ModFile::transformPass(bool nostrict)
|
||||||
symbol_table.rmExo(unusedExo);
|
symbol_table.rmExo(unusedExo);
|
||||||
dynamic_model.reindex(orig_symbol_table);
|
dynamic_model.reindex(orig_symbol_table);
|
||||||
external_functions_table.reindex(symbol_table, orig_symbol_table);
|
external_functions_table.reindex(symbol_table, orig_symbol_table);
|
||||||
|
steady_state_model.reindex(orig_symbol_table);
|
||||||
|
|
||||||
vector<Statement *> orig_statements = statements;
|
vector<Statement *> orig_statements = statements;
|
||||||
statements.clear();
|
statements.clear();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2010-2014 Dynare Team
|
* Copyright (C) 2010-2015 Dynare Team
|
||||||
*
|
*
|
||||||
* This file is part of Dynare.
|
* This file is part of Dynare.
|
||||||
*
|
*
|
||||||
|
@ -104,6 +104,37 @@ SteadyStateModel::checkPass(bool ramsey_model, WarningConsolidation &warnings) c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SteadyStateModel::reindex(SymbolTable orig_symbol_table)
|
||||||
|
{
|
||||||
|
if (def_table.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
DataTree *dt = dynamic_cast<DataTree *> (this);
|
||||||
|
vector<int> new_symb_ids;
|
||||||
|
vector<pair<vector<int>, expr_t> > orig_def_table = def_table;
|
||||||
|
def_table.clear();
|
||||||
|
for (vector<pair<vector<int>, expr_t> >::const_iterator it = orig_def_table.begin();
|
||||||
|
it != orig_def_table.end(); it++)
|
||||||
|
try
|
||||||
|
{
|
||||||
|
new_symb_ids.clear();
|
||||||
|
for (vector<int>::const_iterator it1 = it->first.begin();
|
||||||
|
it1 != it->first.end(); it1++)
|
||||||
|
if (symbol_table.getName(*it1) == orig_symbol_table.getName(*it1))
|
||||||
|
new_symb_ids.push_back(*it1);
|
||||||
|
else
|
||||||
|
new_symb_ids.push_back(symbol_table.getID(orig_symbol_table.getName(*it1)));
|
||||||
|
addMultipleDefinitions(new_symb_ids,
|
||||||
|
it->second->cloneDynamicReindex(*dt, orig_symbol_table));
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
cerr << "ERROR: an unused exogenous variable was found in the steady_state_model block" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SteadyStateModel::writeSteadyStateFile(const string &basename, bool ramsey_model) const
|
SteadyStateModel::writeSteadyStateFile(const string &basename, bool ramsey_model) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2010-2014 Dynare Team
|
* Copyright (C) 2010-2015 Dynare Team
|
||||||
*
|
*
|
||||||
* This file is part of Dynare.
|
* This file is part of Dynare.
|
||||||
*
|
*
|
||||||
|
@ -51,6 +51,8 @@ public:
|
||||||
void writeSteadyStateFile(const string &basename, bool ramsey_model) const;
|
void writeSteadyStateFile(const string &basename, bool ramsey_model) const;
|
||||||
// in ExternalFiles.cc
|
// in ExternalFiles.cc
|
||||||
void writeSteadyStateFileC(const string &basename, bool ramsey_model) const;
|
void writeSteadyStateFileC(const string &basename, bool ramsey_model) const;
|
||||||
|
//! Used to reindex def_table after removal of extra exogenous
|
||||||
|
void reindex(SymbolTable orig_symbol_table);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue