Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
preprocessor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pablo Winant
preprocessor
Commits
cf493ef6
Verified
Commit
cf493ef6
authored
2 years ago
by
Sébastien Villemot
Browse files
Options
Downloads
Patches
Plain Diff
Add two missing checks for file opening failures
parent
253fbbe7
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/DynamicModel.cc
+10
-0
10 additions, 0 deletions
src/DynamicModel.cc
with
10 additions
and
0 deletions
src/DynamicModel.cc
+
10
−
0
View file @
cf493ef6
...
@@ -1065,6 +1065,11 @@ DynamicModel::writeDynamicJacobianNonZeroEltsFile(const string &basename) const
...
@@ -1065,6 +1065,11 @@ DynamicModel::writeDynamicJacobianNonZeroEltsFile(const string &basename) const
const filesystem::path filename {packageDir(basename) / "
dynamic_g1_nz
.
m
"};
const filesystem::path filename {packageDir(basename) / "
dynamic_g1_nz
.
m
"};
ofstream output{filename, ios::out | ios::binary};
ofstream output{filename, ios::out | ios::binary};
if (!output.is_open())
{
cerr << "
ERROR
:
Can
'
t
open
file
" << filename.string() << "
for
writing
" << endl;
exit(EXIT_FAILURE);
}
output << "
function
[
nzij_pred
,
nzij_current
,
nzij_fwrd
]
=
dynamic_g1_nz
()
" << endl
output << "
function
[
nzij_pred
,
nzij_current
,
nzij_fwrd
]
=
dynamic_g1_nz
()
" << endl
<< "
%
Returns
the
coordinates
of
non
-
zero
elements
in
the
Jacobian
,
in
column
-
major
order
,
for
each
lead
/
lag
(
only
for
endogenous
)
" << endl;
<< "
%
Returns
the
coordinates
of
non
-
zero
elements
in
the
Jacobian
,
in
column
-
major
order
,
for
each
lead
/
lag
(
only
for
endogenous
)
" << endl;
auto print_nzij = [&output](const vector<pair<int, int>> &nzij, const string &name) {
auto print_nzij = [&output](const vector<pair<int, int>> &nzij, const string &name) {
...
@@ -1500,6 +1505,11 @@ DynamicModel::writeBlockDriverOutput(ostream &output, const string &basename,
...
@@ -1500,6 +1505,11 @@ DynamicModel::writeBlockDriverOutput(ostream &output, const string &basename,
filesystem::create_directories(basename + "
/
model
/
bytecode
");
filesystem::create_directories(basename + "
/
model
/
bytecode
");
const filesystem::path main_name {basename + "
/
model
/
bytecode
/
kfi
"};
const filesystem::path main_name {basename + "
/
model
/
bytecode
/
kfi
"};
ofstream KF_index_file{main_name, ios::out | ios::binary | ios::ate};
ofstream KF_index_file{main_name, ios::out | ios::binary | ios::ate};
if (!KF_index_file.is_open())
{
cerr << "
ERROR
:
Can
'
t
open
file
" << main_name.string() << "
for
writing
" << endl;
exit(EXIT_FAILURE);
}
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)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment