From f0c7a8d407df3690a1ed39b85e1f95b8a6a204c3 Mon Sep 17 00:00:00 2001
From: Van Dung Nguyen <vdg.nguyen@gmail.com>
Date: Wed, 28 Oct 2020 15:30:04 +0100
Subject: [PATCH] ok

---
 NonLinearSolver/modelReduction/DeepMaterialNetworks.cpp | 2 +-
 NonLinearSolver/modelReduction/Tree.cpp                 | 7 ++++++-
 NonLinearSolver/modelReduction/Tree.h                   | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/NonLinearSolver/modelReduction/DeepMaterialNetworks.cpp b/NonLinearSolver/modelReduction/DeepMaterialNetworks.cpp
index f990a778e..07fbc4265 100644
--- a/NonLinearSolver/modelReduction/DeepMaterialNetworks.cpp
+++ b/NonLinearSolver/modelReduction/DeepMaterialNetworks.cpp
@@ -3204,7 +3204,7 @@ void DeepMaterialNetwork::downscale(const STensor3& Fcur, STensor3& F,  const Tr
     double wChild = getWeight(node);
     int childOrder = node->childOrder;
     //
-    double f = wChild/wParent;
+   //double f = wChild/wParent;
     double fact = 1./wChild;
     
     /*
diff --git a/NonLinearSolver/modelReduction/Tree.cpp b/NonLinearSolver/modelReduction/Tree.cpp
index c41223e04..ed8d0a0e8 100644
--- a/NonLinearSolver/modelReduction/Tree.cpp
+++ b/NonLinearSolver/modelReduction/Tree.cpp
@@ -971,7 +971,7 @@ int Tree::getNumberOfNodes() const
   return allNodes.size();
 };
 
-bool Tree::removeZeroLeaves(double tol)
+bool Tree::removeZeroLeaves(double tol, bool iteration)
 {
   bool ok = false;
   int maxInter = 100;
@@ -1122,6 +1122,11 @@ bool Tree::removeZeroLeaves(double tol)
         Msg::Exit(0);
       }
     };
+    
+    if (!iteration)
+    {
+      break;
+    }
   };
   return false;
 };
diff --git a/NonLinearSolver/modelReduction/Tree.h b/NonLinearSolver/modelReduction/Tree.h
index 5c280beb8..e5d7abd66 100644
--- a/NonLinearSolver/modelReduction/Tree.h
+++ b/NonLinearSolver/modelReduction/Tree.h
@@ -78,7 +78,7 @@ class Tree
     void printNodeFraction() const;
     
     bool removeLeavesWithZeroContribution(double tol=1e-6);
-    bool removeZeroLeaves(double tol);
+    bool removeZeroLeaves(double tol, bool iteration=true);
     bool treeMerging();
     
     #ifndef SWIG
-- 
GitLab