diff --git a/NonLinearSolver/modelReduction/Tree.cpp b/NonLinearSolver/modelReduction/Tree.cpp index 953615dbc3aecfd6eff268d0cab2a2688fee5fc2..1c7cf9c7ad1eed50472b27ccd397ffd48537c8d4 100644 --- a/NonLinearSolver/modelReduction/Tree.cpp +++ b/NonLinearSolver/modelReduction/Tree.cpp @@ -1042,6 +1042,18 @@ bool Tree::removeZeroLeaves(double tol, bool iteration) otherChild->parent = parent->parent; otherChild->childOrder = parent->childOrder; grandParent->childs[parent->childOrder] = otherChild; + + // decrease all associated nodes by 1 + std::vector<TreeNode*> allAssociatedNodesToChild; + getRefToAssociatedNodes(otherChild,allAssociatedNodesToChild); + for (int j=0; j< allAssociatedNodesToChild.size(); j++) + { + std::vector<int> loc; + getMaxLocationByDepth(loc); + allAssociatedNodesToChild[j]->depth--; + allAssociatedNodesToChild[j]->location=loc[allAssociatedNodesToChild[j]->depth]+1; + }; + Msg::Info("child weight = %e otherChild weight = %e parent weight = %e",leaf->af->getVal(leaf->weight),otherChild->af->getVal(otherChild->weight),parent->weight); } else if (parent->childs.size() > 2)