NumConstNode::write{Bytecode,Json}Output(): check for temporary terms, as is done for MATLAB output

master
Sébastien Villemot 2022-06-24 16:43:16 +02:00
parent 17f72d6162
commit 297f86a90e
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 6 additions and 2 deletions

View File

@ -461,7 +461,10 @@ NumConstNode::writeJsonOutput(ostream &output,
const deriv_node_temp_terms_t &tef_terms,
bool isdynamic) const
{
output << datatree.num_constants.get(id);
if (temporary_terms.contains(const_cast<NumConstNode *>(this)))
output << "T" << idx;
else
output << datatree.num_constants.get(id);
}
bool
@ -482,7 +485,8 @@ NumConstNode::writeBytecodeOutput(BytecodeWriter &code_file, bool lhs_rhs,
const temporary_terms_idxs_t &temporary_terms_idxs, bool dynamic, bool steady_dynamic,
const deriv_node_temp_terms_t &tef_terms) const
{
code_file << FLDC_{datatree.num_constants.getDouble(id)};
if (!checkIfTemporaryTermThenWriteBytecode(code_file, temporary_terms, temporary_terms_idxs, dynamic))
code_file << FLDC_{datatree.num_constants.getDouble(id)};
}
void