Skip to content
Snippets Groups Projects
Verified Commit 627dd92c authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Block decomposition: bugfix with temporary terms when mfs=3

In an “evaluate” block, the LHS of a renormalized equation (such as “log(x)=…”)
could be associated to a temporary term that would then be incorrectly
computed: that temporary term would be evaluated *before* (and not after) the
evaluation of the associated variable (“x” in the example).
parent e1533533
No related branches found
No related tags found
No related merge requests found
...@@ -988,7 +988,16 @@ ModelTree::computeBlockTemporaryTerms() ...@@ -988,7 +988,16 @@ ModelTree::computeBlockTemporaryTerms()
blocks_temporary_terms[blk].resize(blocks[blk].size + 1); blocks_temporary_terms[blk].resize(blocks[blk].size + 1);
for (int eq = 0; eq < blocks[blk].size; eq++) for (int eq = 0; eq < blocks[blk].size; eq++)
{ {
if (eq < blocks[blk].getRecursiveSize() && isBlockEquationRenormalized(blk, eq)) /* It is important to compute temporary terms of the renormalized
equation if the latter is going to be used in the output files.
Otherwise, for an equation of the form log(x) = RHS, a temporary
term could be associated to log(x), and since it would be
associated to this equation, it would be printed and thus computed
*before* x is actually evaluated, and thus would be incorrect. */
if ((blocks[blk].simulation_type == BlockSimulationType::evaluateBackward
|| blocks[blk].simulation_type == BlockSimulationType::evaluateForward
|| eq < blocks[blk].getRecursiveSize())
&& isBlockEquationRenormalized(blk, eq))
getBlockEquationRenormalizedExpr(blk, eq)->computeBlockTemporaryTerms(blk, eq, blocks_temporary_terms, reference_count); getBlockEquationRenormalizedExpr(blk, eq)->computeBlockTemporaryTerms(blk, eq, blocks_temporary_terms, reference_count);
else else
getBlockEquationExpr(blk, eq)->computeBlockTemporaryTerms(blk, eq, blocks_temporary_terms, reference_count); getBlockEquationExpr(blk, eq)->computeBlockTemporaryTerms(blk, eq, blocks_temporary_terms, reference_count);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment