Simplification using non-default std::ofstream constructor
parent
92047f547e
commit
c8b046ec86
|
@ -5389,8 +5389,7 @@ OccbinConstraintsStatement::writeOutput(ostream &output, const string &basename,
|
||||||
<< "oo_.dr=set_state_space(oo_.dr,M_,options_);" << endl;
|
<< "oo_.dr=set_state_space(oo_.dr,M_,options_);" << endl;
|
||||||
|
|
||||||
string filename = "+" + basename + "/occbin_difference.m";
|
string filename = "+" + basename + "/occbin_difference.m";
|
||||||
ofstream diff_output;
|
ofstream diff_output{filename, ios::out | ios::binary};
|
||||||
diff_output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!diff_output.is_open())
|
if (!diff_output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
|
|
@ -477,8 +477,7 @@ DynamicModel::writeDynamicPerBlockMFiles(const string &basename) const
|
||||||
int nze_exo_det = blocks_derivatives_exo_det[blk].size();
|
int nze_exo_det = blocks_derivatives_exo_det[blk].size();
|
||||||
|
|
||||||
string filename = packageDir(basename + ".block") + "/dynamic_" + to_string(blk+1) + ".m";
|
string filename = packageDir(basename + ".block") + "/dynamic_" + to_string(blk+1) + ".m";
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -586,8 +585,7 @@ DynamicModel::writeDynamicPerBlockCFiles(const string &basename) const
|
||||||
int nze_exo_det = blocks_derivatives_exo_det[blk].size();
|
int nze_exo_det = blocks_derivatives_exo_det[blk].size();
|
||||||
|
|
||||||
string filename = basename + "/model/src/dynamic_" + to_string(blk+1) + ".c";
|
string filename = basename + "/model/src/dynamic_" + to_string(blk+1) + ".c";
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -753,8 +751,7 @@ DynamicModel::writeDynamicPerBlockCFiles(const string &basename) const
|
||||||
output.close();
|
output.close();
|
||||||
|
|
||||||
filename = basename + "/model/src/dynamic_" + to_string(blk+1) + ".h";
|
filename = basename + "/model/src/dynamic_" + to_string(blk+1) + ".h";
|
||||||
ofstream header_output;
|
ofstream header_output{filename, ios::out | ios::binary};
|
||||||
header_output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!header_output.is_open())
|
if (!header_output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1287,8 +1284,7 @@ DynamicModel::writeDynamicCFile(const string &basename) const
|
||||||
|
|
||||||
int ntt = temporary_terms_mlv.size() + temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size() + temporary_terms_derivatives[2].size() + temporary_terms_derivatives[3].size();
|
int ntt = temporary_terms_mlv.size() + temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size() + temporary_terms_derivatives[2].size() + temporary_terms_derivatives[3].size();
|
||||||
|
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1480,9 +1476,8 @@ DynamicModel::writeBlockBytecodeBinFile(const string &basename, int num, int &u_
|
||||||
void
|
void
|
||||||
DynamicModel::writeDynamicBlockMFile(const string &basename) const
|
DynamicModel::writeDynamicBlockMFile(const string &basename) const
|
||||||
{
|
{
|
||||||
ofstream output;
|
|
||||||
string filename = packageDir(basename) + "/dynamic.m";
|
string filename = packageDir(basename) + "/dynamic.m";
|
||||||
output.open(filename, ios::out | ios::binary);
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1516,8 +1511,7 @@ DynamicModel::writeDynamicBlockCFile(const string &basename) const
|
||||||
{
|
{
|
||||||
string filename = basename + "/model/src/dynamic.c";
|
string filename = basename + "/model/src/dynamic.c";
|
||||||
|
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1609,8 +1603,7 @@ DynamicModel::writeWrapperFunctions(const string &basename, const string &ending
|
||||||
name = "dynamic_resid_g1_g2_g3";
|
name = "dynamic_resid_g1_g2_g3";
|
||||||
|
|
||||||
string filename = packageDir(basename) + "/" + name + ".m";
|
string filename = packageDir(basename) + "/" + name + ".m";
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1659,8 +1652,7 @@ DynamicModel::writeDynamicModelHelper(const string &basename,
|
||||||
const ostringstream &s, const ostringstream &s_tt) const
|
const ostringstream &s, const ostringstream &s_tt) const
|
||||||
{
|
{
|
||||||
string filename = packageDir(basename) + "/" + name_tt + ".m";
|
string filename = packageDir(basename) + "/" + name_tt + ".m";
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1741,8 +1733,7 @@ void
|
||||||
DynamicModel::writeDynamicMatlabCompatLayer(const string &basename) const
|
DynamicModel::writeDynamicMatlabCompatLayer(const string &basename) const
|
||||||
{
|
{
|
||||||
string filename = packageDir(basename) + "/dynamic.m";
|
string filename = packageDir(basename) + "/dynamic.m";
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -2656,8 +2647,7 @@ DynamicModel::writeBlockDriverOutput(ostream &output, const string &basename,
|
||||||
{
|
{
|
||||||
filesystem::create_directories(basename + "/model/bytecode");
|
filesystem::create_directories(basename + "/model/bytecode");
|
||||||
string main_name = basename + "/model/bytecode/kfi";
|
string main_name = basename + "/model/bytecode/kfi";
|
||||||
ofstream KF_index_file;
|
ofstream KF_index_file{main_name, ios::out | ios::binary | ios::ate};
|
||||||
KF_index_file.open(main_name, ios::out | ios::binary | ios::ate);
|
|
||||||
int n_obs = symbol_table.observedVariablesNbr();
|
int n_obs = symbol_table.observedVariablesNbr();
|
||||||
int n_state = state_var.size();
|
int n_state = state_var.size();
|
||||||
for (int it : state_var)
|
for (int it : state_var)
|
||||||
|
@ -5143,8 +5133,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
|
||||||
}
|
}
|
||||||
|
|
||||||
string filename = julia ? basename + "DynamicParamsDerivs.jl" : packageDir(basename) + "/dynamic_params_derivs.m";
|
string filename = julia ? basename + "DynamicParamsDerivs.jl" : packageDir(basename) + "/dynamic_params_derivs.m";
|
||||||
ofstream paramsDerivsFile;
|
ofstream paramsDerivsFile{filename, ios::out | ios::binary};
|
||||||
paramsDerivsFile.open(filename, ios::out | ios::binary);
|
|
||||||
if (!paramsDerivsFile.is_open())
|
if (!paramsDerivsFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
|
|
@ -40,7 +40,7 @@ macroExpandModFile(const string &filename, const string &basename, const istream
|
||||||
{
|
{
|
||||||
if (save_macro_file.empty())
|
if (save_macro_file.empty())
|
||||||
save_macro_file = basename + "-macroexp.mod";
|
save_macro_file = basename + "-macroexp.mod";
|
||||||
ofstream macro_output_file(save_macro_file);
|
ofstream macro_output_file{save_macro_file};
|
||||||
if (macro_output_file.fail())
|
if (macro_output_file.fail())
|
||||||
{
|
{
|
||||||
cerr << "Cannot open " << save_macro_file << " for macro output" << endl;
|
cerr << "Cannot open " << save_macro_file << " for macro output" << endl;
|
||||||
|
|
|
@ -814,25 +814,21 @@ ModFile::writeMOutput(const string &basename, bool clear_all, bool clear_global,
|
||||||
filesystem::remove_all(basename + "/model/bytecode");
|
filesystem::remove_all(basename + "/model/bytecode");
|
||||||
}
|
}
|
||||||
|
|
||||||
ofstream mOutputFile;
|
if (!basename.size())
|
||||||
|
|
||||||
if (basename.size())
|
|
||||||
{
|
|
||||||
filesystem::create_directory("+" + basename);
|
|
||||||
string fname = "+" + basename + "/driver.m";
|
|
||||||
mOutputFile.open(fname, ios::out | ios::binary);
|
|
||||||
if (!mOutputFile.is_open())
|
|
||||||
{
|
|
||||||
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Missing file name" << endl;
|
cerr << "ERROR: Missing file name" << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filesystem::create_directory("+" + basename);
|
||||||
|
string fname = "+" + basename + "/driver.m";
|
||||||
|
ofstream mOutputFile{fname, ios::out | ios::binary};
|
||||||
|
if (!mOutputFile.is_open())
|
||||||
|
{
|
||||||
|
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
mOutputFile << "%" << endl
|
mOutputFile << "%" << endl
|
||||||
<< "% Status : main Dynare file" << endl
|
<< "% Status : main Dynare file" << endl
|
||||||
<< "%" << endl
|
<< "%" << endl
|
||||||
|
@ -1273,25 +1269,21 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ofstream jsonOutputFile;
|
if (!basename.size())
|
||||||
|
|
||||||
if (basename.size())
|
|
||||||
{
|
|
||||||
filesystem::create_directories(basename + "/model/json");
|
|
||||||
string fname{basename + "/model/json/modfile.json"};
|
|
||||||
jsonOutputFile.open(fname, ios::out | ios::binary);
|
|
||||||
if (!jsonOutputFile.is_open())
|
|
||||||
{
|
|
||||||
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Missing file name" << endl;
|
cerr << "ERROR: Missing file name" << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filesystem::create_directories(basename + "/model/json");
|
||||||
|
string fname{basename + "/model/json/modfile.json"};
|
||||||
|
ofstream jsonOutputFile{fname, ios::out | ios::binary};
|
||||||
|
if (!jsonOutputFile.is_open())
|
||||||
|
{
|
||||||
|
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
jsonOutputFile << output.str();
|
jsonOutputFile << output.str();
|
||||||
jsonOutputFile.close();
|
jsonOutputFile.close();
|
||||||
|
|
||||||
|
@ -1397,8 +1389,7 @@ ModFile::writeJsonComputingPassOutput(const string &basename, JsonFileOutputType
|
||||||
void
|
void
|
||||||
ModFile::writeJsonFileHelper(const string &fname, ostringstream &output) const
|
ModFile::writeJsonFileHelper(const string &fname, ostringstream &output) const
|
||||||
{
|
{
|
||||||
ofstream jsonOutput;
|
ofstream jsonOutput{fname, ios::out | ios::binary};
|
||||||
jsonOutput.open(fname, ios::out | ios::binary);
|
|
||||||
if (!jsonOutput.is_open())
|
if (!jsonOutput.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
||||||
|
|
|
@ -132,18 +132,17 @@ SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const
|
||||||
{
|
{
|
||||||
filesystem::create_directories(basename + "/latex");
|
filesystem::create_directories(basename + "/latex");
|
||||||
|
|
||||||
ofstream output, content_output;
|
|
||||||
string filename = basename + "/latex/steady_state.tex";
|
string filename = basename + "/latex/steady_state.tex";
|
||||||
string content_filename = basename + "/latex/steady_state_content.tex";
|
string content_filename = basename + "/latex/steady_state_content.tex";
|
||||||
|
|
||||||
output.open(filename, ios::out | ios::binary);
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
content_output.open(content_filename, ios::out | ios::binary);
|
ofstream content_output{content_filename, ios::out | ios::binary};
|
||||||
if (!content_output.is_open())
|
if (!content_output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << content_filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << content_filename << " for writing" << endl;
|
||||||
|
@ -377,8 +376,7 @@ void
|
||||||
Epilogue::writeStaticEpilogueFile(const string &basename) const
|
Epilogue::writeStaticEpilogueFile(const string &basename) const
|
||||||
{
|
{
|
||||||
string filename = packageDir(basename) + "/epilogue_static.m";
|
string filename = packageDir(basename) + "/epilogue_static.m";
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -416,8 +414,7 @@ void
|
||||||
Epilogue::writeDynamicEpilogueFile(const string &basename) const
|
Epilogue::writeDynamicEpilogueFile(const string &basename) const
|
||||||
{
|
{
|
||||||
string filename = packageDir(basename) + "/epilogue_dynamic.m";
|
string filename = packageDir(basename) + "/epilogue_dynamic.m";
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
|
|
@ -1473,17 +1473,16 @@ ModelTree::writeLatexModelFile(const string &mod_basename, const string &latex_b
|
||||||
{
|
{
|
||||||
filesystem::create_directories(mod_basename + "/latex");
|
filesystem::create_directories(mod_basename + "/latex");
|
||||||
|
|
||||||
ofstream output, content_output;
|
|
||||||
string filename = mod_basename + "/latex/" + latex_basename + ".tex";
|
string filename = mod_basename + "/latex/" + latex_basename + ".tex";
|
||||||
string content_filename = mod_basename + "/latex/" + latex_basename + "_content" + ".tex";
|
string content_filename = mod_basename + "/latex/" + latex_basename + "_content" + ".tex";
|
||||||
output.open(filename, ios::out | ios::binary);
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
content_output.open(content_filename, ios::out | ios::binary);
|
ofstream content_output{content_filename, ios::out | ios::binary};
|
||||||
if (!content_output.is_open())
|
if (!content_output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << content_filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << content_filename << " for writing" << endl;
|
||||||
|
|
|
@ -225,8 +225,7 @@ StaticModel::writeStaticPerBlockMFiles(const string &basename) const
|
||||||
BlockSimulationType simulation_type = blocks[blk].simulation_type;
|
BlockSimulationType simulation_type = blocks[blk].simulation_type;
|
||||||
|
|
||||||
string filename = packageDir(basename + ".block") + "/static_" + to_string(blk+1) + ".m";
|
string filename = packageDir(basename + ".block") + "/static_" + to_string(blk+1) + ".m";
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -281,8 +280,7 @@ StaticModel::writeStaticPerBlockCFiles(const string &basename) const
|
||||||
BlockSimulationType simulation_type = blocks[blk].simulation_type;
|
BlockSimulationType simulation_type = blocks[blk].simulation_type;
|
||||||
|
|
||||||
string filename = basename + "/model/src/static_" + to_string(blk+1) + ".c";
|
string filename = basename + "/model/src/static_" + to_string(blk+1) + ".c";
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -350,8 +348,7 @@ StaticModel::writeStaticPerBlockCFiles(const string &basename) const
|
||||||
output.close();
|
output.close();
|
||||||
|
|
||||||
filename = basename + "/model/src/static_" + to_string(blk+1) + ".h";
|
filename = basename + "/model/src/static_" + to_string(blk+1) + ".h";
|
||||||
ofstream header_output;
|
ofstream header_output{filename, ios::out | ios::binary};
|
||||||
header_output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!header_output.is_open())
|
if (!header_output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -957,8 +954,7 @@ StaticModel::writeWrapperFunctions(const string &basename, const string &ending)
|
||||||
name = "static_resid_g1_g2_g3";
|
name = "static_resid_g1_g2_g3";
|
||||||
|
|
||||||
string filename = packageDir(basename) + "/" + name + ".m";
|
string filename = packageDir(basename) + "/" + name + ".m";
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1006,8 +1002,7 @@ StaticModel::writeStaticModelHelper(const string &basename,
|
||||||
const ostringstream &s, const ostringstream &s_tt) const
|
const ostringstream &s, const ostringstream &s_tt) const
|
||||||
{
|
{
|
||||||
string filename = packageDir(basename) + "/" + name_tt + ".m";
|
string filename = packageDir(basename) + "/" + name_tt + ".m";
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1079,8 +1074,7 @@ void
|
||||||
StaticModel::writeStaticMatlabCompatLayer(const string &basename) const
|
StaticModel::writeStaticMatlabCompatLayer(const string &basename) const
|
||||||
{
|
{
|
||||||
string filename = packageDir(basename) + "/static.m";
|
string filename = packageDir(basename) + "/static.m";
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1563,8 +1557,7 @@ StaticModel::writeStaticCFile(const string &basename) const
|
||||||
|
|
||||||
int ntt = temporary_terms_mlv.size() + temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size() + temporary_terms_derivatives[2].size() + temporary_terms_derivatives[3].size();
|
int ntt = temporary_terms_mlv.size() + temporary_terms_derivatives[0].size() + temporary_terms_derivatives[1].size() + temporary_terms_derivatives[2].size() + temporary_terms_derivatives[3].size();
|
||||||
|
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1716,8 +1709,7 @@ StaticModel::writeStaticBlockMFile(const string &basename) const
|
||||||
{
|
{
|
||||||
string filename = packageDir(basename) + "/static.m";
|
string filename = packageDir(basename) + "/static.m";
|
||||||
|
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1752,8 +1744,7 @@ StaticModel::writeStaticBlockCFile(const string &basename) const
|
||||||
{
|
{
|
||||||
string filename = basename + "/model/src/static.c";
|
string filename = basename + "/model/src/static.c";
|
||||||
|
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -2255,9 +2246,8 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ofstream paramsDerivsFile;
|
|
||||||
string filename = julia ? basename + "StaticParamsDerivs.jl" : packageDir(basename) + "/static_params_derivs.m";
|
string filename = julia ? basename + "StaticParamsDerivs.jl" : packageDir(basename) + "/static_params_derivs.m";
|
||||||
paramsDerivsFile.open(filename, ios::out | ios::binary);
|
ofstream paramsDerivsFile{filename, ios::out | ios::binary};
|
||||||
if (!paramsDerivsFile.is_open())
|
if (!paramsDerivsFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
|
|
@ -247,8 +247,7 @@ TrendComponentModelTable::writeOutput(const string &basename, ostream &output) c
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string filename = "+" + basename + "/trend_component_ar_a0.m";
|
string filename = "+" + basename + "/trend_component_ar_a0.m";
|
||||||
ofstream ar_ec_output;
|
ofstream ar_ec_output{filename, ios::out | ios::binary};
|
||||||
ar_ec_output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!ar_ec_output.is_open())
|
if (!ar_ec_output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -429,8 +428,7 @@ VarModelTable::writeOutput(const string &basename, ostream &output) const
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string filename = "+" + basename + "/varmatrices.m";
|
string filename = "+" + basename + "/varmatrices.m";
|
||||||
ofstream ar_output;
|
ofstream ar_output{filename, ios::out | ios::binary};
|
||||||
ar_output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!ar_output.is_open())
|
if (!ar_output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1754,8 +1752,7 @@ PacModelTable::writeTargetCoefficientsFile(const string &basename) const
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string filename = DataTree::packageDir(basename) + "/pac_target_coefficients.m";
|
string filename = DataTree::packageDir(basename) + "/pac_target_coefficients.m";
|
||||||
ofstream output;
|
ofstream output{filename, ios::out | ios::binary};
|
||||||
output.open(filename, ios::out | ios::binary);
|
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
|
Loading…
Reference in New Issue