Fix bug in JSON output for derivatives w.r.t. parameters

Confusion between a symbol ID and a derivation ID, which could lead to invalid
output or crash.
master
Sébastien Villemot 2022-07-12 15:24:20 +02:00
parent 440173f2bc
commit 2013056a2c
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
2 changed files with 2 additions and 2 deletions

View File

@ -5616,7 +5616,7 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
<< R"(, "param2_col": )" << param2_col + 1;
if (writeDetails)
gpp_output << R"(, "var": ")" << symbol_table.getName(var) << R"(")"
gpp_output << R"(, "var": ")" << symbol_table.getName(getSymbIDByDerivID(var)) << R"(")"
<< R"(, "lag": )" << getLagByDerivID(var)
<< R"(, "param1": ")" << symbol_table.getName(getSymbIDByDerivID(param1)) << R"(")"
<< R"(, "param2": ")" << symbol_table.getName(getSymbIDByDerivID(param2)) << R"(")";

View File

@ -2061,7 +2061,7 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
<< R"(, "param2_col": )" << param2_col;
if (writeDetails)
third_derivs_output << R"(, "var": ")" << symbol_table.getName(var) << R"(")"
third_derivs_output << R"(, "var": ")" << symbol_table.getName(getSymbIDByDerivID(var)) << R"(")"
<< R"(, "param1": ")" << symbol_table.getName(getSymbIDByDerivID(param1)) << R"(")"
<< R"(, "param2": ")" << symbol_table.getName(getSymbIDByDerivID(param2)) << R"(")";