Commit 6e1d5bdf authored by Houtan Bastani's avatar Houtan Bastani
Browse files

preprocessor: json: print steady_state_model file

parent d4e3dbe3
...@@ -195,7 +195,8 @@ ExprNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output ...@@ -195,7 +195,8 @@ ExprNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output
void void
ExprNode::writeJsonExternalFunctionOutput(vector<string> &efout, ExprNode::writeJsonExternalFunctionOutput(vector<string> &efout,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
// Nothing to do // Nothing to do
} }
...@@ -340,7 +341,8 @@ NumConstNode::writeOutput(ostream &output, ExprNodeOutputType output_type, ...@@ -340,7 +341,8 @@ NumConstNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
void void
NumConstNode::writeJsonOutput(ostream &output, NumConstNode::writeJsonOutput(ostream &output,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
output << datatree.num_constants.get(id); output << datatree.num_constants.get(id);
} }
...@@ -640,7 +642,8 @@ VariableNode::containsExternalFunction() const ...@@ -640,7 +642,8 @@ VariableNode::containsExternalFunction() const
void void
VariableNode::writeJsonOutput(ostream &output, VariableNode::writeJsonOutput(ostream &output,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<VariableNode *>(this)); temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<VariableNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
...@@ -650,7 +653,7 @@ VariableNode::writeJsonOutput(ostream &output, ...@@ -650,7 +653,7 @@ VariableNode::writeJsonOutput(ostream &output,
} }
output << datatree.symbol_table.getName(symb_id); output << datatree.symbol_table.getName(symb_id);
if (lag != 0) if (isdynamic && lag != 0)
output << "(" << lag << ")"; output << "(" << lag << ")";
} }
...@@ -1892,7 +1895,8 @@ UnaryOpNode::containsExternalFunction() const ...@@ -1892,7 +1895,8 @@ UnaryOpNode::containsExternalFunction() const
void void
UnaryOpNode::writeJsonOutput(ostream &output, UnaryOpNode::writeJsonOutput(ostream &output,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<UnaryOpNode *>(this)); temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
...@@ -1966,7 +1970,7 @@ UnaryOpNode::writeJsonOutput(ostream &output, ...@@ -1966,7 +1970,7 @@ UnaryOpNode::writeJsonOutput(ostream &output,
break; break;
case oSteadyState: case oSteadyState:
output << "("; output << "(";
arg->writeJsonOutput(output, temporary_terms, tef_terms); arg->writeJsonOutput(output, temporary_terms, tef_terms, isdynamic);
output << ")"; output << ")";
return; return;
case oSteadyStateParamDeriv: case oSteadyStateParamDeriv:
...@@ -2017,7 +2021,7 @@ UnaryOpNode::writeJsonOutput(ostream &output, ...@@ -2017,7 +2021,7 @@ UnaryOpNode::writeJsonOutput(ostream &output,
} }
// Write argument // Write argument
arg->writeJsonOutput(output, temporary_terms, tef_terms); arg->writeJsonOutput(output, temporary_terms, tef_terms, isdynamic);
if (close_parenthesis) if (close_parenthesis)
output << ")"; output << ")";
...@@ -2227,9 +2231,10 @@ UnaryOpNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutputType out ...@@ -2227,9 +2231,10 @@ UnaryOpNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutputType out
void void
UnaryOpNode::writeJsonExternalFunctionOutput(vector<string> &efout, UnaryOpNode::writeJsonExternalFunctionOutput(vector<string> &efout,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
arg->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms); arg->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms, isdynamic);
} }
void void
...@@ -3300,7 +3305,8 @@ BinaryOpNode::containsExternalFunction() const ...@@ -3300,7 +3305,8 @@ BinaryOpNode::containsExternalFunction() const
void void
BinaryOpNode::writeJsonOutput(ostream &output, BinaryOpNode::writeJsonOutput(ostream &output,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
// If current node is a temporary term // If current node is a temporary term
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this)); temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
...@@ -3323,9 +3329,9 @@ BinaryOpNode::writeJsonOutput(ostream &output, ...@@ -3323,9 +3329,9 @@ BinaryOpNode::writeJsonOutput(ostream &output,
default: default:
; ;
} }
arg1->writeJsonOutput(output, temporary_terms, tef_terms); arg1->writeJsonOutput(output, temporary_terms, tef_terms, isdynamic);
output << ","; output << ",";
arg2->writeJsonOutput(output, temporary_terms, tef_terms); arg2->writeJsonOutput(output, temporary_terms, tef_terms, isdynamic);
output << ")"; output << ")";
return; return;
} }
...@@ -3333,9 +3339,9 @@ BinaryOpNode::writeJsonOutput(ostream &output, ...@@ -3333,9 +3339,9 @@ BinaryOpNode::writeJsonOutput(ostream &output,
if (op_code == oPowerDeriv) if (op_code == oPowerDeriv)
{ {
output << "get_power_deriv("; output << "get_power_deriv(";
arg1->writeJsonOutput(output, temporary_terms, tef_terms); arg1->writeJsonOutput(output, temporary_terms, tef_terms, isdynamic);
output << ","; output << ",";
arg2->writeJsonOutput(output, temporary_terms, tef_terms); arg2->writeJsonOutput(output, temporary_terms, tef_terms, isdynamic);
output << "," << powerDerivOrder << ")"; output << "," << powerDerivOrder << ")";
return; return;
} }
...@@ -3355,7 +3361,7 @@ BinaryOpNode::writeJsonOutput(ostream &output, ...@@ -3355,7 +3361,7 @@ BinaryOpNode::writeJsonOutput(ostream &output,
} }
// Write left argument // Write left argument
arg1->writeJsonOutput(output, temporary_terms, tef_terms); arg1->writeJsonOutput(output, temporary_terms, tef_terms, isdynamic);
if (close_parenthesis) if (close_parenthesis)
output << ")"; output << ")";
...@@ -3422,7 +3428,7 @@ BinaryOpNode::writeJsonOutput(ostream &output, ...@@ -3422,7 +3428,7 @@ BinaryOpNode::writeJsonOutput(ostream &output,
} }
// Write right argument // Write right argument
arg2->writeJsonOutput(output, temporary_terms, tef_terms); arg2->writeJsonOutput(output, temporary_terms, tef_terms, isdynamic);
if (close_parenthesis) if (close_parenthesis)
output << ")"; output << ")";
...@@ -3620,10 +3626,11 @@ BinaryOpNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutputType ou ...@@ -3620,10 +3626,11 @@ BinaryOpNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutputType ou
void void
BinaryOpNode::writeJsonExternalFunctionOutput(vector<string> &efout, BinaryOpNode::writeJsonExternalFunctionOutput(vector<string> &efout,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
arg1->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms); arg1->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms, isdynamic);
arg2->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms); arg2->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms, isdynamic);
} }
void void
...@@ -4578,7 +4585,8 @@ TrinaryOpNode::containsExternalFunction() const ...@@ -4578,7 +4585,8 @@ TrinaryOpNode::containsExternalFunction() const
void void
TrinaryOpNode::writeJsonOutput(ostream &output, TrinaryOpNode::writeJsonOutput(ostream &output,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
// If current node is a temporary term // If current node is a temporary term
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this)); temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
...@@ -4598,11 +4606,11 @@ TrinaryOpNode::writeJsonOutput(ostream &output, ...@@ -4598,11 +4606,11 @@ TrinaryOpNode::writeJsonOutput(ostream &output,
break; break;
} }
arg1->writeJsonOutput(output, temporary_terms, tef_terms); arg1->writeJsonOutput(output, temporary_terms, tef_terms, isdynamic);
output << ","; output << ",";
arg2->writeJsonOutput(output, temporary_terms, tef_terms); arg2->writeJsonOutput(output, temporary_terms, tef_terms, isdynamic);
output << ","; output << ",";
arg3->writeJsonOutput(output, temporary_terms, tef_terms); arg3->writeJsonOutput(output, temporary_terms, tef_terms, isdynamic);
output << ")"; output << ")";
} }
...@@ -4685,11 +4693,12 @@ TrinaryOpNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutputType o ...@@ -4685,11 +4693,12 @@ TrinaryOpNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutputType o
void void
TrinaryOpNode::writeJsonExternalFunctionOutput(vector<string> &efout, TrinaryOpNode::writeJsonExternalFunctionOutput(vector<string> &efout,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
arg1->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms); arg1->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms, isdynamic);
arg2->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms); arg2->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms, isdynamic);
arg3->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms); arg3->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms, isdynamic);
} }
void void
...@@ -5298,7 +5307,8 @@ AbstractExternalFunctionNode::writeExternalFunctionArguments(ostream &output, Ex ...@@ -5298,7 +5307,8 @@ AbstractExternalFunctionNode::writeExternalFunctionArguments(ostream &output, Ex
void void
AbstractExternalFunctionNode::writeJsonExternalFunctionArguments(ostream &output, AbstractExternalFunctionNode::writeJsonExternalFunctionArguments(ostream &output,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
for (vector<expr_t>::const_iterator it = arguments.begin(); for (vector<expr_t>::const_iterator it = arguments.begin();
it != arguments.end(); it++) it != arguments.end(); it++)
...@@ -5306,7 +5316,7 @@ AbstractExternalFunctionNode::writeJsonExternalFunctionArguments(ostream &output ...@@ -5306,7 +5316,7 @@ AbstractExternalFunctionNode::writeJsonExternalFunctionArguments(ostream &output
if (it != arguments.begin()) if (it != arguments.begin())
output << ","; output << ",";
(*it)->writeJsonOutput(output, temporary_terms, tef_terms); (*it)->writeJsonOutput(output, temporary_terms, tef_terms, isdynamic);
} }
} }
...@@ -5476,7 +5486,8 @@ ExternalFunctionNode::compileExternalFunctionOutput(ostream &CompileCode, unsign ...@@ -5476,7 +5486,8 @@ ExternalFunctionNode::compileExternalFunctionOutput(ostream &CompileCode, unsign
void void
ExternalFunctionNode::writeJsonOutput(ostream &output, ExternalFunctionNode::writeJsonOutput(ostream &output,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this)); temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
...@@ -5486,7 +5497,7 @@ ExternalFunctionNode::writeJsonOutput(ostream &output, ...@@ -5486,7 +5497,7 @@ ExternalFunctionNode::writeJsonOutput(ostream &output,
} }
output << datatree.symbol_table.getName(symb_id) << "("; output << datatree.symbol_table.getName(symb_id) << "(";
writeJsonExternalFunctionArguments(output, temporary_terms, tef_terms); writeJsonExternalFunctionArguments(output, temporary_terms, tef_terms, isdynamic);
output << ")"; output << ")";
} }
...@@ -5602,14 +5613,15 @@ ExternalFunctionNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutpu ...@@ -5602,14 +5613,15 @@ ExternalFunctionNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutpu
void void
ExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &efout, ExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &efout,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
int first_deriv_symb_id = datatree.external_functions_table.getFirstDerivSymbID(symb_id); int first_deriv_symb_id = datatree.external_functions_table.getFirstDerivSymbID(symb_id);
assert(first_deriv_symb_id != eExtFunSetButNoNameProvided); assert(first_deriv_symb_id != eExtFunSetButNoNameProvided);
for (vector<expr_t>::const_iterator it = arguments.begin(); for (vector<expr_t>::const_iterator it = arguments.begin();
it != arguments.end(); it++) it != arguments.end(); it++)
(*it)->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms); (*it)->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms, isdynamic);
if (!alreadyWrittenAsTefTerm(symb_id, tef_terms)) if (!alreadyWrittenAsTefTerm(symb_id, tef_terms))
{ {
...@@ -5629,7 +5641,7 @@ ExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &efout, ...@@ -5629,7 +5641,7 @@ ExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &efout,
ef << ", \"external_function_term_dd\": \"TEFDD_" << indx << "\""; ef << ", \"external_function_term_dd\": \"TEFDD_" << indx << "\"";
ef << ", \"value\": \"" << datatree.symbol_table.getName(symb_id) << "("; ef << ", \"value\": \"" << datatree.symbol_table.getName(symb_id) << "(";
writeJsonExternalFunctionArguments(ef, temporary_terms, tef_terms); writeJsonExternalFunctionArguments(ef, temporary_terms, tef_terms, isdynamic);
ef << ")\"}}"; ef << ")\"}}";
efout.push_back(ef.str()); efout.push_back(ef.str());
} }
...@@ -5719,7 +5731,8 @@ FirstDerivExternalFunctionNode::composeDerivatives(const vector<expr_t> &dargs) ...@@ -5719,7 +5731,8 @@ FirstDerivExternalFunctionNode::composeDerivatives(const vector<expr_t> &dargs)
void void
FirstDerivExternalFunctionNode::writeJsonOutput(ostream &output, FirstDerivExternalFunctionNode::writeJsonOutput(ostream &output,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
// If current node is a temporary term // If current node is a temporary term
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<FirstDerivExternalFunctionNode *>(this)); temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<FirstDerivExternalFunctionNode *>(this));
...@@ -5934,7 +5947,8 @@ FirstDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Exp ...@@ -5934,7 +5947,8 @@ FirstDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Exp
void void
FirstDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &efout, FirstDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &efout,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
int first_deriv_symb_id = datatree.external_functions_table.getFirstDerivSymbID(symb_id); int first_deriv_symb_id = datatree.external_functions_table.getFirstDerivSymbID(symb_id);
assert(first_deriv_symb_id != eExtFunSetButNoNameProvided); assert(first_deriv_symb_id != eExtFunSetButNoNameProvided);
...@@ -5944,7 +5958,7 @@ FirstDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> & ...@@ -5944,7 +5958,7 @@ FirstDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &
if (first_deriv_symb_id == symb_id) if (first_deriv_symb_id == symb_id)
{ {
expr_t parent = datatree.AddExternalFunction(symb_id, arguments); expr_t parent = datatree.AddExternalFunction(symb_id, arguments);
parent->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms); parent->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms, isdynamic);
return; return;
} }
...@@ -5967,7 +5981,7 @@ FirstDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> & ...@@ -5967,7 +5981,7 @@ FirstDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &
<< ", \"value\": \"" << datatree.symbol_table.getName(first_deriv_symb_id) << "("; << ", \"value\": \"" << datatree.symbol_table.getName(first_deriv_symb_id) << "(";
} }
writeJsonExternalFunctionArguments(ef, temporary_terms, tef_terms); writeJsonExternalFunctionArguments(ef, temporary_terms, tef_terms, isdynamic);
ef << ")\"}}"; ef << ")\"}}";
efout.push_back(ef.str()); efout.push_back(ef.str());
} }
...@@ -6100,7 +6114,8 @@ SecondDerivExternalFunctionNode::composeDerivatives(const vector<expr_t> &dargs) ...@@ -6100,7 +6114,8 @@ SecondDerivExternalFunctionNode::composeDerivatives(const vector<expr_t> &dargs)
void void
SecondDerivExternalFunctionNode::writeJsonOutput(ostream &output, SecondDerivExternalFunctionNode::writeJsonOutput(ostream &output,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
// If current node is a temporary term // If current node is a temporary term
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<SecondDerivExternalFunctionNode *>(this)); temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<SecondDerivExternalFunctionNode *>(this));
...@@ -6293,7 +6308,8 @@ SecondDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Ex ...@@ -6293,7 +6308,8 @@ SecondDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Ex
void void
SecondDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &efout, SecondDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &efout,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const
{ {
int second_deriv_symb_id = datatree.external_functions_table.getSecondDerivSymbID(symb_id); int second_deriv_symb_id = datatree.external_functions_table.getSecondDerivSymbID(symb_id);
assert(second_deriv_symb_id != eExtFunSetButNoNameProvided); assert(second_deriv_symb_id != eExtFunSetButNoNameProvided);
...@@ -6303,7 +6319,7 @@ SecondDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> ...@@ -6303,7 +6319,7 @@ SecondDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string>
if (second_deriv_symb_id == symb_id) if (second_deriv_symb_id == symb_id)
{ {
expr_t parent = datatree.AddExternalFunction(symb_id, arguments); expr_t parent = datatree.AddExternalFunction(symb_id, arguments);
parent->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms); parent->writeJsonExternalFunctionOutput(efout, temporary_terms, tef_terms, isdynamic);
return; return;
} }
...@@ -6327,7 +6343,7 @@ SecondDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> ...@@ -6327,7 +6343,7 @@ SecondDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string>
<< ", \"value\": \"" << datatree.symbol_table.getName(second_deriv_symb_id) << "("; << ", \"value\": \"" << datatree.symbol_table.getName(second_deriv_symb_id) << "(";
} }
writeJsonExternalFunctionArguments(ef, temporary_terms, tef_terms); writeJsonExternalFunctionArguments(ef, temporary_terms, tef_terms, isdynamic);
ef << ")\"}}" << endl; ef << ")\"}}" << endl;
efout.push_back(ef.str()); efout.push_back(ef.str());
} }
......
...@@ -223,7 +223,7 @@ enum ExprNodeOutputType ...@@ -223,7 +223,7 @@ enum ExprNodeOutputType
void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms) const; void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms) const;
//! Writes output of node in JSON syntax //! Writes output of node in JSON syntax
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const = 0; virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic = true) const = 0;
virtual int precedenceJson(const temporary_terms_t &temporary_terms) const; virtual int precedenceJson(const temporary_terms_t &temporary_terms) const;
...@@ -236,7 +236,8 @@ enum ExprNodeOutputType ...@@ -236,7 +236,8 @@ enum ExprNodeOutputType
//! Allows the insertion of commas if necessary //! Allows the insertion of commas if necessary
virtual void writeJsonExternalFunctionOutput(vector<string> &efout, virtual void writeJsonExternalFunctionOutput(vector<string> &efout,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const; deriv_node_temp_terms_t &tef_terms,
const bool isdynamic = true) const;
virtual void compileExternalFunctionOutput(ostream &CompileCode, unsigned int &instruction_number, virtual void compileExternalFunctionOutput(ostream &CompileCode, unsigned int &instruction_number,
bool lhs_rhs, const temporary_terms_t &temporary_terms, bool lhs_rhs, const temporary_terms_t &temporary_terms,
...@@ -490,7 +491,7 @@ public: ...@@ -490,7 +491,7 @@ public:
}; };
virtual void prepareForDerivation(); virtual void prepareForDerivation();
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const; virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const;
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const; virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
virtual bool containsExternalFunction() const; virtual bool containsExternalFunction() const;
virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const; virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const; virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
...@@ -540,7 +541,7 @@ public: ...@@ -540,7 +541,7 @@ public:
VariableNode(DataTree &datatree_arg, int symb_id_arg, int lag_arg); VariableNode(DataTree &datatree_arg, int symb_id_arg, int lag_arg);
virtual void prepareForDerivation(); virtual void prepareForDerivation();
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const; virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const;
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const; virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
virtual bool containsExternalFunction() const; virtual bool containsExternalFunction() const;
virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const; virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
virtual void computeTemporaryTerms(map<expr_t, int > &reference_count, virtual void computeTemporaryTerms(map<expr_t, int > &reference_count,
...@@ -620,14 +621,15 @@ public: ...@@ -620,14 +621,15 @@ public:
map<NodeTreeReference, temporary_terms_t> &temp_terms_map, map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
bool is_matlab, NodeTreeReference tr) const; bool is_matlab, NodeTreeReference tr) const;
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const; virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const;
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const; virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
virtual bool containsExternalFunction() const; virtual bool containsExternalFunction() const;
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type, virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const; deriv_node_temp_terms_t &tef_terms) const;
virtual void writeJsonExternalFunctionOutput(vector<string> &efout, virtual void writeJsonExternalFunctionOutput(vector<string> &efout,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const; deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const;
virtual void compileExternalFunctionOutput(ostream &CompileCode, unsigned int &instruction_number, virtual void compileExternalFunctionOutput(ostream &CompileCode, unsigned int &instruction_number,
bool lhs_rhs, const temporary_terms_t &temporary_terms, bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
...@@ -712,14 +714,15 @@ public: ...@@ -712,14 +714,15 @@ public:
map<NodeTreeReference, temporary_terms_t> &temp_terms_map, map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
bool is_matlab, NodeTreeReference tr) const; bool is_matlab, NodeTreeReference tr) const;
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const; virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const;
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const; virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
virtual bool containsExternalFunction() const; virtual bool containsExternalFunction() const;
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type, virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const; deriv_node_temp_terms_t &tef_terms) const;
virtual void writeJsonExternalFunctionOutput(vector<string> &efout, virtual void writeJsonExternalFunctionOutput(vector<string> &efout,
const temporary_terms_t &temporary_terms, const temporary_terms_t &temporary_terms,
deriv_node_temp_terms_t &tef_terms) const; deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const;
virtual void compileExternalFunctionOutput(ostream &CompileCode, unsigned int &instruction_number, virtual void compileExternalFunctionOutput(ostream &CompileCode, unsigned int &instruction_number,
bool lhs_rhs, const temporary_terms_t &temporary_terms, bool lhs_rhs, const temporary_terms_t &temporary_terms,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
...@@ -821,14 +824,15 @@ public: ...@@ -821,14 +824,15 @@ public:
map<NodeTreeReference, temporary_terms_t> &temp_terms_map, map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
bool is_matlab, NodeTreeReference tr) const; bool is_matlab, NodeTreeReference tr) const;
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const; virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const;
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const;