ms-dsge: add param initialization to C output
parent
b426f7236c
commit
0c5966d487
|
@ -852,6 +852,15 @@ ModFile::writeCOutputFiles(const string &basename) const
|
||||||
|
|
||||||
dynamic_model.writeCOutput(mDriverCFile, basename, false, false, true, mod_file_struct.order_option, mod_file_struct.estimation_present);
|
dynamic_model.writeCOutput(mDriverCFile, basename, false, false, true, mod_file_struct.order_option, mod_file_struct.estimation_present);
|
||||||
|
|
||||||
|
mDriverCFile << "/*" << endl
|
||||||
|
<< " * Writing statements" << endl
|
||||||
|
<< " */" << endl;
|
||||||
|
|
||||||
|
// Print statements
|
||||||
|
for (vector<Statement *>::const_iterator it = statements.begin();
|
||||||
|
it != statements.end(); it++)
|
||||||
|
(*it)->writeCOutput(mDriverCFile, basename);
|
||||||
|
|
||||||
mDriverCFile << "}" << endl;
|
mDriverCFile << "}" << endl;
|
||||||
mDriverCFile.close();
|
mDriverCFile.close();
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,16 @@ InitParamStatement::writeOutput(ostream &output, const string &basename) const
|
||||||
output << symbol_table.getName(symb_id) << " = M_.params( " << id << " );\n";
|
output << symbol_table.getName(symb_id) << " = M_.params( " << id << " );\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InitParamStatement::writeCOutput(ostream &output, const string &basename)
|
||||||
|
{
|
||||||
|
int id = symbol_table.getTypeSpecificID(symb_id);
|
||||||
|
output << "params[ " << id << " ] = ";
|
||||||
|
param_value->writeOutput(output);
|
||||||
|
output << ";" << endl;
|
||||||
|
output << "double " << symbol_table.getName(symb_id) << " = params[ " << id << " ];" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InitParamStatement::fillEvalContext(eval_context_t &eval_context) const
|
InitParamStatement::fillEvalContext(eval_context_t &eval_context) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
const SymbolTable &symbol_table_arg);
|
const SymbolTable &symbol_table_arg);
|
||||||
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
|
virtual void writeCOutput(ostream &output, const string &basename);
|
||||||
//! Fill eval context with parameter value
|
//! Fill eval context with parameter value
|
||||||
void fillEvalContext(eval_context_t &eval_context) const;
|
void fillEvalContext(eval_context_t &eval_context) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -63,6 +63,11 @@ Statement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &wa
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Statement::writeCOutput(ostream &output, const string &basename)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Statement::computingPass()
|
Statement::computingPass()
|
||||||
{
|
{
|
||||||
|
|
|
@ -138,6 +138,7 @@ public:
|
||||||
\param basename is the name of the modfile (without extension) which can be used to build auxiliary files
|
\param basename is the name of the modfile (without extension) which can be used to build auxiliary files
|
||||||
*/
|
*/
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const = 0;
|
virtual void writeOutput(ostream &output, const string &basename) const = 0;
|
||||||
|
virtual void writeCOutput(ostream &output, const string &basename);
|
||||||
};
|
};
|
||||||
|
|
||||||
class NativeStatement : public Statement
|
class NativeStatement : public Statement
|
||||||
|
|
Loading…
Reference in New Issue