diff --git a/ComputingTasks.cc b/ComputingTasks.cc index f750b9b6..ae5a6f22 100644 --- a/ComputingTasks.cc +++ b/ComputingTasks.cc @@ -2600,7 +2600,7 @@ SvarIdentificationStatement::writeJsonOutput(ostream &output) const output << "{" << "\"equation_number\": " << it->equation << ", " << "\"restriction_number\": " << it->restriction_nbr << ", " - << "\"variable\": " << symbol_table.getName(it->variable) << ", " + << "\"variable\": \"" << symbol_table.getName(it->variable) << "\", " << "\"expression\": \""; it->value->writeOutput(output); output << "\"}"; diff --git a/ExprNode.cc b/ExprNode.cc index b5b9d4dd..5cc0298b 100644 --- a/ExprNode.cc +++ b/ExprNode.cc @@ -5610,15 +5610,15 @@ ExternalFunctionNode::writeJsonExternalFunctionOutput(vector &efout, stringstream ef; ef << "{\"external_function\": {" - << "\"output\": \"TEF_" << indx << "\""; + << "\"external_function_term\": \"TEF_" << indx << "\""; if (symb_id == first_deriv_symb_id) - ef << ", \"output_d\": \"TEFD_" << indx << "\""; + ef << ", \"external_function_term_d\": \"TEFD_" << indx << "\""; if (symb_id == second_deriv_symb_id) - ef << ", \"output_dd\": \"TEFDD_" << indx << "\""; + ef << ", \"external_function_term_dd\": \"TEFDD_" << indx << "\""; - ef << ", \"function\": \"" << datatree.symbol_table.getName(symb_id) << "("; + ef << ", \"value\": \"" << datatree.symbol_table.getName(symb_id) << "("; writeJsonExternalFunctionArguments(ef, temporary_terms, tef_terms); ef << ")\"}}"; efout.push_back(ef.str()); @@ -5944,17 +5944,17 @@ FirstDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector & stringstream ef; if (first_deriv_symb_id == eExtFunNotSet) ef << "{\"first_deriv_external_function\": {" - << "\"output\": \"TEFD_fdd_" << getIndxInTefTerms(symb_id, tef_terms) << "_" << inputIndex << "\"" + << "\"external_function_term\": \"TEFD_fdd_" << getIndxInTefTerms(symb_id, tef_terms) << "_" << inputIndex << "\"" << ", \"analytic_derivative\": false" << ", \"wrt\": " << inputIndex - << ", \"function\": \"" << datatree.symbol_table.getName(symb_id) << "("; + << ", \"value\": \"" << datatree.symbol_table.getName(symb_id) << "("; else { tef_terms[make_pair(first_deriv_symb_id, arguments)] = (int) tef_terms.size(); ef << "{\"first_deriv_external_function\": {" - << "\"output\": \"TEFD_def_" << getIndxInTefTerms(first_deriv_symb_id, tef_terms) + << "\"external_function_term\": \"TEFD_def_" << getIndxInTefTerms(first_deriv_symb_id, tef_terms) << "\"" << ", \"analytic_derivative\": true" - << ", \"function\": \"" << datatree.symbol_table.getName(first_deriv_symb_id) << "("; + << ", \"value\": \"" << datatree.symbol_table.getName(first_deriv_symb_id) << "("; } writeJsonExternalFunctionArguments(ef, temporary_terms, tef_terms); @@ -6303,18 +6303,18 @@ SecondDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector stringstream ef; if (second_deriv_symb_id == eExtFunNotSet) ef << "{\"second_deriv_external_function\": {" - << "\"output\": \"TEFDD_fdd_" << getIndxInTefTerms(symb_id, tef_terms) << "_" << inputIndex1 << "_" << inputIndex2 << "\"" + << "\"external_function_term\": \"TEFDD_fdd_" << getIndxInTefTerms(symb_id, tef_terms) << "_" << inputIndex1 << "_" << inputIndex2 << "\"" << ", \"analytic_derivative\": false" << ", \"wrt1\": " << inputIndex1 << ", \"wrt2\": " << inputIndex2 - << ", \"function\": \"" << datatree.symbol_table.getName(symb_id) << "("; + << ", \"value\": \"" << datatree.symbol_table.getName(symb_id) << "("; else { tef_terms[make_pair(second_deriv_symb_id, arguments)] = (int) tef_terms.size(); ef << "{\"second_deriv_external_function\": {" - << "\"output\": \"TEFDD_def_" << getIndxInTefTerms(second_deriv_symb_id, tef_terms) + << "\"external_function_term\": \"TEFDD_def_" << getIndxInTefTerms(second_deriv_symb_id, tef_terms) << "\"" << ", \"analytic_derivative\": true" - << ", \"function\": \"" << datatree.symbol_table.getName(second_deriv_symb_id) << "("; + << ", \"value\": \"" << datatree.symbol_table.getName(second_deriv_symb_id) << "("; } writeJsonExternalFunctionArguments(ef, temporary_terms, tef_terms); diff --git a/ModelTree.cc b/ModelTree.cc index 3e2b7395..a2cc7df3 100644 --- a/ModelTree.cc +++ b/ModelTree.cc @@ -1334,7 +1334,8 @@ ModelTree::writeJsonTemporaryTerms(const temporary_terms_t &tt, const temporary_ output << ", "; output << "{\"temporary_term\": \""; (*it)->writeJsonOutput(output, tt, tef_terms); - output << " = "; + output << "\"" + << ", \"value\": \""; (*it)->writeJsonOutput(output, tt2, tef_terms); output << "\"}" << endl; wrote_term = true; @@ -1567,12 +1568,15 @@ ModelTree::writeJsonModelLocalVariables(ostream &output, deriv_node_temp_terms_t for (set::const_iterator it = used_local_vars.begin(); it != used_local_vars.end(); ++it) { + if (it != used_local_vars.begin()) + output << ", "; int id = *it; expr_t value = local_variables_table.find(id)->second; /* We append underscores to avoid name clashes with "g1" or "oo_" (see also VariableNode::writeOutput) */ - output << "{\"" << symbol_table.getName(id) << "__ = "; + output << "{\"variable\": \"" << symbol_table.getName(id) << "__\"" + << ", \"value\": \""; value->writeJsonOutput(output, tt, tef_terms); output << "\"}" << endl; }