diff --git a/src/DynareMain.cc b/src/DynareMain.cc index 4e9ff55aef86d93e355572b45ade8c5b97025e1e..f28a7a842db30836c6d5002466413ef7c0ca9ca0 100644 --- a/src/DynareMain.cc +++ b/src/DynareMain.cc @@ -56,7 +56,7 @@ usage() "[conffile=path_to_config_file] [parallel_follower_open_mode] " "[parallel_test] [parallel_use_psexec=true|false]" << " [-D<variable>[=<value>]] [-I/path] [nostrict] [stochastic] [fast] [minimal_workspace] " - "[compute_xrefs] [output=second|third] [language=matlab|julia]" + "[compute_xrefs] [output=first|second|third] [language=matlab|julia]" << " [params_derivs_order=0|1|2] [transform_unary_ops] " "[exclude_eqs=<equation_tag_list_or_file>] [include_eqs=<equation_tag_list_or_file>]" << " [json=parse|check|transform|compute] [jsonstdout] [onlyjson] [jsonderivsimple] " @@ -320,7 +320,9 @@ main(int argc, char** argv) s.erase(0, 7); - if (s == "second") + if (s == "first") + output_mode = OutputType::first; + else if (s == "second") output_mode = OutputType::second; else if (s == "third") output_mode = OutputType::third; diff --git a/src/ExtendedPreprocessorTypes.hh b/src/ExtendedPreprocessorTypes.hh index 79f9e9a6581e7fbf9bf532d18bd14d72d1ee099d..dd4d999f548982afafa0d5a0d9c9cf16d506f046 100644 --- a/src/ExtendedPreprocessorTypes.hh +++ b/src/ExtendedPreprocessorTypes.hh @@ -24,6 +24,7 @@ enum class OutputType { standard, // Default value, infer the derivation order from .mod file only + first, // Output only 1st dynamic derivatives with no other computations second, // Output at least 2nd dynamic derivatives third, // Output at least 3rd dynamic derivatives }; diff --git a/src/ModFile.cc b/src/ModFile.cc index 928ec611b51b1c724c52a1c7c22c13fc15d49dc1..eb2de0b81d09a33401de4018e6a361a6dbd508d9 100644 --- a/src/ModFile.cc +++ b/src/ModFile.cc @@ -960,8 +960,22 @@ ModFile::computingPass(bool no_tmp_terms, OutputType output, int params_derivs_o no_tmp_terms, block, use_dll); } } - else // No computing task requested, compute derivatives up to 2nd order by default - dynamic_model.computingPass(2, 0, global_eval_context, no_tmp_terms, block, use_dll); + else // No computing task requested, compute derivatives up to 2nd order by default unless + // output=first (preprocessor#100) or third (preprocessor#121) is requested + { + switch (output) + { + case OutputType::first: + dynamic_model.computingPass(1, 0, global_eval_context, no_tmp_terms, block, use_dll); + break; + case OutputType::third: + dynamic_model.computingPass(3, 0, global_eval_context, no_tmp_terms, block, use_dll); + break; + default: + dynamic_model.computingPass(2, 0, global_eval_context, no_tmp_terms, block, use_dll); + break; + } + } if (linear) {