Bytecode: rename output methods for better consistency
parent
1d838e96ff
commit
2944484442
|
@ -562,9 +562,8 @@ DynamicModel::writeDynamicPerBlockMFiles(const string &basename) const
|
|||
}
|
||||
|
||||
void
|
||||
DynamicModel::writeModelEquationsCode(const string &basename) const
|
||||
DynamicModel::writeDynamicBytecode(const string &basename) const
|
||||
{
|
||||
|
||||
ostringstream tmp_output;
|
||||
ofstream code_file;
|
||||
unsigned int instruction_number = 0;
|
||||
|
@ -590,7 +589,7 @@ DynamicModel::writeModelEquationsCode(const string &basename) const
|
|||
else
|
||||
simulation_type = BlockSimulationType::solveBackwardComplete;
|
||||
|
||||
Write_Inf_To_Bin_File(basename + "/model/bytecode/dynamic.bin", u_count_int, file_open, simulation_type == BlockSimulationType::solveTwoBoundariesComplete, symbol_table.endo_nbr());
|
||||
writeBytecodeBinFile(basename + "/model/bytecode/dynamic.bin", u_count_int, file_open, simulation_type == BlockSimulationType::solveTwoBoundariesComplete);
|
||||
file_open = true;
|
||||
|
||||
//Temporary variables declaration
|
||||
|
@ -808,7 +807,7 @@ DynamicModel::writeModelEquationsCode(const string &basename) const
|
|||
}
|
||||
|
||||
void
|
||||
DynamicModel::writeModelEquationsCode_Block(const string &basename, bool linear_decomposition) const
|
||||
DynamicModel::writeDynamicBlockBytecode(const string &basename, bool linear_decomposition) const
|
||||
{
|
||||
struct Uff_l
|
||||
{
|
||||
|
@ -871,7 +870,7 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, bool linear_
|
|||
|| simulation_type == BlockSimulationType::solveBackwardComplete
|
||||
|| simulation_type == BlockSimulationType::solveForwardComplete)
|
||||
{
|
||||
Write_Inf_To_Bin_File_Block(basename, block, u_count_int, file_open,
|
||||
writeBlockBytecodeBinFile(basename, block, u_count_int, file_open,
|
||||
simulation_type == BlockSimulationType::solveTwoBoundariesComplete || simulation_type == BlockSimulationType::solveTwoBoundariesSimple, linear_decomposition);
|
||||
file_open = true;
|
||||
}
|
||||
|
@ -1377,8 +1376,8 @@ DynamicModel::printNonZeroHessianEquations(ostream &output) const
|
|||
}
|
||||
|
||||
void
|
||||
DynamicModel::Write_Inf_To_Bin_File_Block(const string &basename, int num,
|
||||
int &u_count_int, bool &file_open, bool is_two_boundaries, bool linear_decomposition) const
|
||||
DynamicModel::writeBlockBytecodeBinFile(const string &basename, int num, int &u_count_int,
|
||||
bool &file_open, bool is_two_boundaries, bool linear_decomposition) const
|
||||
{
|
||||
int j;
|
||||
std::ofstream SaveCode;
|
||||
|
@ -4636,14 +4635,10 @@ DynamicModel::computeBlockDynJacobianCols()
|
|||
void
|
||||
DynamicModel::writeDynamicFile(const string &basename, bool block, bool linear_decomposition, bool bytecode, bool use_dll, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot, bool julia) const
|
||||
{
|
||||
if (block && bytecode)
|
||||
writeModelEquationsCode_Block(basename, linear_decomposition);
|
||||
if ((block && bytecode) || linear_decomposition)
|
||||
writeDynamicBlockBytecode(basename, linear_decomposition);
|
||||
else if (!block && bytecode)
|
||||
{
|
||||
if (linear_decomposition)
|
||||
writeModelEquationsCode_Block(basename, linear_decomposition);
|
||||
writeModelEquationsCode(basename);
|
||||
}
|
||||
writeDynamicBytecode(basename);
|
||||
else if (block && !bytecode)
|
||||
{
|
||||
writeDynamicPerBlockMFiles(basename);
|
||||
|
|
|
@ -135,10 +135,13 @@ private:
|
|||
void writeDynamicBlockMFile(const string &basename) const;
|
||||
//! Writes the per-block dynamic files of block decomposed model (MATLAB version)
|
||||
void writeDynamicPerBlockMFiles(const string &basename) const;
|
||||
//! Writes the code of the Block reordred structure of the model in virtual machine bytecode
|
||||
void writeModelEquationsCode_Block(const string &basename, bool linear_decomposition) const;
|
||||
//! Writes the code of the block-decomposed model in virtual machine bytecode
|
||||
void writeDynamicBlockBytecode(const string &basename, bool linear_decomposition) const;
|
||||
//! Writes the code of the model in virtual machine bytecode
|
||||
void writeModelEquationsCode(const string &basename) const;
|
||||
void writeDynamicBytecode(const string &basename) const;
|
||||
//! Adds per-block information for bytecode simulation in a separate .bin file
|
||||
void writeBlockBytecodeBinFile(const string &basename, int num, int &u_count_int, bool &file_open,
|
||||
bool is_two_boundaries, bool linear_decomposition) const;
|
||||
|
||||
void writeSetAuxiliaryVariables(const string &basename, bool julia) const;
|
||||
void writeAuxVarRecursiveDefinitions(ostream &output, ExprNodeOutputType output_type) const;
|
||||
|
@ -368,9 +371,6 @@ public:
|
|||
//! Substitutes pac_expectation operator with expectation based on auxiliary model
|
||||
void substitutePacExpectation(const string &pac_model_name);
|
||||
|
||||
//! Adds informations for simulation in a binary file
|
||||
void Write_Inf_To_Bin_File_Block(const string &basename,
|
||||
int num, int &u_count_int, bool &file_open, bool is_two_boundaries, bool linear_decomposition) const;
|
||||
//! Writes dynamic model file
|
||||
void writeDynamicFile(const string &basename, bool block, bool linear_decomposition, bool bytecode, bool use_dll, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot, bool julia) const;
|
||||
//! Writes file containing parameters derivatives
|
||||
|
|
|
@ -1509,8 +1509,8 @@ ModelTree::compileModelEquations(ostream &code_file, unsigned int &instruction_n
|
|||
}
|
||||
|
||||
void
|
||||
ModelTree::Write_Inf_To_Bin_File(const string &filename,
|
||||
int &u_count_int, bool &file_open, bool is_two_boundaries, int block_mfs) const
|
||||
ModelTree::writeBytecodeBinFile(const string &filename, int &u_count_int, bool &file_open,
|
||||
bool is_two_boundaries) const
|
||||
{
|
||||
int j;
|
||||
std::ofstream SaveCode;
|
||||
|
@ -1534,10 +1534,10 @@ ModelTree::Write_Inf_To_Bin_File(const string &filename,
|
|||
int var = symbol_table.getTypeSpecificID(symb);
|
||||
int lag = getLagByDerivID(deriv_id);
|
||||
SaveCode.write(reinterpret_cast<char *>(&eq), sizeof(eq));
|
||||
int varr = var + lag * block_mfs;
|
||||
int varr = var + lag * symbol_table.endo_nbr();
|
||||
SaveCode.write(reinterpret_cast<char *>(&varr), sizeof(varr));
|
||||
SaveCode.write(reinterpret_cast<char *>(&lag), sizeof(lag));
|
||||
int u = u_count_int + block_mfs;
|
||||
int u = u_count_int + symbol_table.endo_nbr();
|
||||
SaveCode.write(reinterpret_cast<char *>(&u), sizeof(u));
|
||||
u_count_int++;
|
||||
}
|
||||
|
|
|
@ -242,8 +242,8 @@ protected:
|
|||
void writeJsonTemporaryTerms(const temporary_terms_t &tt, temporary_terms_t &temp_term_union, ostream &output, deriv_node_temp_terms_t &tef_terms, const string &concat) const;
|
||||
//! Compiles temporary terms
|
||||
void compileTemporaryTerms(ostream &code_file, unsigned int &instruction_number, bool dynamic, bool steady_dynamic, temporary_terms_t &temporary_terms_union, const temporary_terms_idxs_t &temporary_terms_idxs) const;
|
||||
//! Adds informations for simulation in a binary file
|
||||
void Write_Inf_To_Bin_File(const string &filename, int &u_count_int, bool &file_open, bool is_two_boundaries, int block_mfs) const;
|
||||
//! Adds information for (non-block) bytecode simulation in a separate .bin file
|
||||
void writeBytecodeBinFile(const string &filename, int &u_count_int, bool &file_open, bool is_two_boundaries) const;
|
||||
//! Fixes output when there are more than 32 nested parens, Issue #1201
|
||||
void fixNestedParenthesis(ostringstream &output, map<string, string> &tmp_paren_vars, bool &message_printed) const;
|
||||
//! Tests if string contains more than 32 nested parens, Issue #1201
|
||||
|
|
|
@ -279,7 +279,7 @@ StaticModel::writeStaticPerBlockMFiles(const string &basename) const
|
|||
}
|
||||
|
||||
void
|
||||
StaticModel::writeModelEquationsCode(const string &basename) const
|
||||
StaticModel::writeStaticBytecode(const string &basename) const
|
||||
{
|
||||
ostringstream tmp_output;
|
||||
ofstream code_file;
|
||||
|
@ -298,7 +298,7 @@ StaticModel::writeModelEquationsCode(const string &basename) const
|
|||
int count_u;
|
||||
int u_count_int = 0;
|
||||
|
||||
Write_Inf_To_Bin_File(basename + "/model/bytecode/static.bin", u_count_int, file_open, false, symbol_table.endo_nbr());
|
||||
writeBytecodeBinFile(basename + "/model/bytecode/static.bin", u_count_int, file_open, false);
|
||||
file_open = true;
|
||||
|
||||
// Compute the union of temporary terms from residuals and 1st derivatives
|
||||
|
@ -436,7 +436,7 @@ StaticModel::writeModelEquationsCode(const string &basename) const
|
|||
}
|
||||
|
||||
void
|
||||
StaticModel::writeModelEquationsCode_Block(const string &basename) const
|
||||
StaticModel::writeStaticBlockBytecode(const string &basename) const
|
||||
{
|
||||
struct Uff_l
|
||||
{
|
||||
|
@ -497,7 +497,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename) const
|
|||
|| simulation_type == BlockSimulationType::solveBackwardComplete
|
||||
|| simulation_type == BlockSimulationType::solveForwardComplete)
|
||||
{
|
||||
Write_Inf_To_Bin_File_Block(basename, block, u_count_int, file_open);
|
||||
writeBlockBytecodeBinFile(basename, block, u_count_int, file_open);
|
||||
file_open = true;
|
||||
}
|
||||
|
||||
|
@ -839,7 +839,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename) const
|
|||
}
|
||||
|
||||
void
|
||||
StaticModel::Write_Inf_To_Bin_File_Block(const string &basename, int num,
|
||||
StaticModel::writeBlockBytecodeBinFile(const string &basename, int num,
|
||||
int &u_count_int, bool &file_open) const
|
||||
{
|
||||
int j;
|
||||
|
@ -1718,9 +1718,9 @@ void
|
|||
StaticModel::writeStaticFile(const string &basename, bool block, bool bytecode, bool use_dll, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot, bool julia) const
|
||||
{
|
||||
if (block && bytecode)
|
||||
writeModelEquationsCode_Block(basename);
|
||||
writeStaticBlockBytecode(basename);
|
||||
else if (!block && bytecode)
|
||||
writeModelEquationsCode(basename);
|
||||
writeStaticBytecode(basename);
|
||||
else if (block && !bytecode)
|
||||
{
|
||||
writeStaticPerBlockMFiles(basename);
|
||||
|
|
|
@ -51,11 +51,15 @@ private:
|
|||
//! Writes the per-block static files of block decomposed model (MATLAB version)
|
||||
void writeStaticPerBlockMFiles(const string &basename) const;
|
||||
|
||||
//! Writes the code of the Block reordred structure of the model in virtual machine bytecode
|
||||
void writeModelEquationsCode_Block(const string &basename) const;
|
||||
//! Writes the code of the block-decomposed model in virtual machine bytecode
|
||||
void writeStaticBlockBytecode(const string &basename) const;
|
||||
|
||||
//! Writes the code of the model in virtual machine bytecode
|
||||
void writeModelEquationsCode(const string &basename) const;
|
||||
void writeStaticBytecode(const string &basename) const;
|
||||
|
||||
//! Adds per-block information for bytecode simulation in a separate .bin file
|
||||
void writeBlockBytecodeBinFile(const string &basename, int num,
|
||||
int &u_count_int, bool &file_open) const;
|
||||
|
||||
//! Computes jacobian and prepares for equation normalization
|
||||
/*! Using values from initval/endval blocks and parameter initializations:
|
||||
|
@ -130,10 +134,6 @@ public:
|
|||
*/
|
||||
void computingPass(int derivsOrder, int paramsDerivsOrder, const eval_context_t &eval_context, bool no_tmp_terms, bool block, bool bytecode);
|
||||
|
||||
//! Adds informations for simulation in a binary file for a block decomposed model
|
||||
void Write_Inf_To_Bin_File_Block(const string &basename, int num,
|
||||
int &u_count_int, bool &file_open) const;
|
||||
|
||||
//! Writes static model file
|
||||
void writeStaticFile(const string &basename, bool block, bool bytecode, bool use_dll, const string &mexext, const filesystem::path &matlabroot, const filesystem::path &dynareroot, bool julia) const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue