From 900c980c645e1f229a4effe2f7aad1fc0a3d22cc Mon Sep 17 00:00:00 2001
From: Van Dung Nguyen <vdg.nguyen@gmail.com>
Date: Wed, 4 Nov 2020 21:00:10 +0100
Subject: [PATCH] new option

---
 NonLinearSolver/modelReduction/Tree.cpp | 11 +++++++++--
 NonLinearSolver/modelReduction/Tree.h   |  2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/NonLinearSolver/modelReduction/Tree.cpp b/NonLinearSolver/modelReduction/Tree.cpp
index 185581bb4..5eb583083 100644
--- a/NonLinearSolver/modelReduction/Tree.cpp
+++ b/NonLinearSolver/modelReduction/Tree.cpp
@@ -2138,7 +2138,7 @@ void Tree::clear()
   _root = NULL;
 };
 
-void Tree::initialize(bool rand, bool normalizedWeight)
+void Tree::initialize(bool rand, bool normalizedWeight, bool type)
 {
   // random weight for leaves
   unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
@@ -2174,7 +2174,14 @@ void Tree::initialize(bool rand, bool normalizedWeight)
     if (normalizedWeight)
     {
       double vv = (n->af->getVal(n->weight))/toltalWeightLeaves;
-      n->weight = n->af->getReciprocalVal(vv);      
+      if (type)
+      {
+        n->weight = n->af->getReciprocalVal(vv);      
+      }
+      else
+      {
+        n->weight = vv;
+      }
     }
     // propagate data
     double w = n->weight;
diff --git a/NonLinearSolver/modelReduction/Tree.h b/NonLinearSolver/modelReduction/Tree.h
index 2f775afd5..afa913b7f 100644
--- a/NonLinearSolver/modelReduction/Tree.h
+++ b/NonLinearSolver/modelReduction/Tree.h
@@ -59,7 +59,7 @@ class Tree
     void printTree() const;
     void printTreeInteraction(const std::string fname="treeInteraction.txt", bool colorMat = true, int dir=1) const;
     void clear();
-    void initialize(bool rand=true, bool normalizedWeight=true);
+    void initialize(bool rand=true, bool normalizedWeight=true, bool type = true);
     const TreeNode* getRootNode() const {return _root;};
     
     void assignMaterialLaws(int numPhases);
-- 
GitLab