preprocessor: take care of extra exos in dynasave

issue#70
Houtan Bastani 2015-04-03 17:11:28 +02:00
parent de1af95604
commit 0c6f84bdcf
2 changed files with 24 additions and 0 deletions

View File

@ -1424,6 +1424,29 @@ DynaSaveStatement::DynaSaveStatement(const SymbolList &symbol_list_arg,
{
}
Statement *
DynaSaveStatement::cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table)
{
SymbolList new_symbol_list;
try
{
SymbolTable *new_symbol_table = dynamic_datatree.getSymbolTable();
vector<string> symbols = symbol_list.get_symbols();
for (vector<string>::const_iterator it = symbols.begin(); it != symbols.end(); it++)
{
new_symbol_table->getID(*it);
new_symbol_list.addSymbol(*it);
}
}
catch (SymbolTable::UnknownSymbolNameException &e)
{
cerr << "ERROR: A variable in the dynasave statement was not found in the symbol table" << endl
<< " This likely means that you have declared a varexo that is not used in the model" << endl;
exit(EXIT_FAILURE);
}
return new DynaSaveStatement(new_symbol_list, filename);
}
void
DynaSaveStatement::writeOutput(ostream &output, const string &basename) const
{

View File

@ -269,6 +269,7 @@ public:
DynaSaveStatement(const SymbolList &symbol_list_arg,
const string &filename_arg);
virtual void writeOutput(ostream &output, const string &basename) const;
virtual Statement *cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table);
};
class ModelComparisonStatement : public Statement