Unverified Commit ce5aa33a authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

k-order DLL: no longer write journal file on-disk, unless options_.debug = true

Closes: #1735
parent e3207b1d
/*
* Copyright © 2004 Ondra Kamenik
* Copyright © 2019 Dynare Team
* Copyright © 2019-2020 Dynare Team
*
* This file is part of Dynare.
*
......@@ -57,14 +57,18 @@ struct SystemResources
class Journal : public std::ofstream
{
int ord;
int depth;
int ord{0};
int depth{0};
public:
explicit Journal(const std::string &fname)
: std::ofstream(fname), ord(0), depth(0)
: std::ofstream(fname)
{
printHeader();
}
/* Constructor that does not initialize the std::ofstream. To be used when an
on-disk journal is not wanted. */
Journal() = default;
Journal &operator=(Journal &&) = default;
~Journal() override
{
flush();
......
......@@ -121,6 +121,11 @@ extern "C" {
mexErrMsgTxt("options_.threads.k_order_perturbation be a numeric scalar");
int num_threads = static_cast<int>(mxGetScalar(num_threads_mx));
const mxArray *debug_mx = mxGetField(options_mx, 0, "debug");
if (!(debug_mx && mxIsLogicalScalar(debug_mx)))
mexErrMsgTxt("options_.debug should be a logical scalar");
bool debug = static_cast<bool>(mxGetScalar(debug_mx));
// Extract various fields from M_
const mxArray *fname_mx = mxGetField(M_mx, 0, "fname");
if (!(fname_mx && mxIsChar(fname_mx) && mxGetM(fname_mx) == 1))
......@@ -197,7 +202,10 @@ extern "C" {
try
{
Journal journal(fname + ".jnl");
// Journal is not written on-disk, unless options_.debug = true (see #1735)
Journal journal;
if (debug)
journal = Journal{fname + ".jnl"};
std::unique_ptr<DynamicModelAC> dynamicModelFile;
if (use_dll)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment