preprocessor: always output the original number of equations

issue#70
Houtan Bastani 2014-10-13 17:16:41 +02:00
parent 4ecbb919d8
commit 5146a43084
2 changed files with 5 additions and 6 deletions

View File

@ -39,7 +39,7 @@ ModFile::ModFile(WarningConsolidation &warnings_arg)
steady_state_model(symbol_table, num_constants, external_functions_table, static_model), steady_state_model(symbol_table, num_constants, external_functions_table, static_model),
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), differentiate_forward_vars(false),
nonstationary_variables(false), ramsey_model_orig_eqn_nbr(0), nonstationary_variables(false), orig_eqn_nbr(0),
warnings(warnings_arg) warnings(warnings_arg)
{ {
} }
@ -330,6 +330,7 @@ ModFile::transformPass(bool nostrict)
dynamic_model.removeTrendVariableFromEquations(); dynamic_model.removeTrendVariableFromEquations();
} }
orig_eqn_nbr = dynamic_model.equation_number();
if (mod_file_struct.ramsey_model_present) if (mod_file_struct.ramsey_model_present)
{ {
StaticModel *planner_objective = NULL; StaticModel *planner_objective = NULL;
@ -340,7 +341,6 @@ ModFile::transformPass(bool nostrict)
planner_objective = pos->getPlannerObjective(); planner_objective = pos->getPlannerObjective();
} }
assert(planner_objective != NULL); assert(planner_objective != NULL);
ramsey_model_orig_eqn_nbr = dynamic_model.equation_number();
/* /*
clone the model then clone the new equations back to the original because clone the model then clone the new equations back to the original because
@ -429,7 +429,7 @@ ModFile::transformPass(bool nostrict)
cout << "Found " << dynamic_model.equation_number() << " equation(s)." << endl; cout << "Found " << dynamic_model.equation_number() << " equation(s)." << endl;
else else
{ {
cout << "Found " << ramsey_model_orig_eqn_nbr << " equation(s)." << endl; cout << "Found " << orig_eqn_nbr << " equation(s)." << endl;
cout << "Found " << dynamic_model.equation_number() << " FOC equation(s) for Ramsey Problem." << endl; cout << "Found " << dynamic_model.equation_number() << " FOC equation(s) for Ramsey Problem." << endl;
} }
@ -740,8 +740,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
if (block && !byte_code) if (block && !byte_code)
mOutputFile << "addpath " << basename << ";" << endl; mOutputFile << "addpath " << basename << ";" << endl;
if (mod_file_struct.ramsey_model_present) mOutputFile << "M_.orig_eq_nbr = " << orig_eqn_nbr << ";" << endl;
mOutputFile << "M_.orig_eq_nbr = " << ramsey_model_orig_eqn_nbr << ";" << endl;
if (dynamic_model.equation_number() > 0) if (dynamic_model.equation_number() > 0)
{ {

View File

@ -93,7 +93,7 @@ public:
eval_context_t global_eval_context; eval_context_t global_eval_context;
//! Stores the original number of equations in the model_block //! Stores the original number of equations in the model_block
int ramsey_model_orig_eqn_nbr; int orig_eqn_nbr;
//! Stores the list of extra files to be transefered during a parallel run //! Stores the list of extra files to be transefered during a parallel run
/*! (i.e. option parallel_local_files of model block) */ /*! (i.e. option parallel_local_files of model block) */