Skip to content
Snippets Groups Projects
Commit 900c980c authored by Van Dung NGUYEN's avatar Van Dung NGUYEN
Browse files

new option

parent ee18f955
No related branches found
No related tags found
1 merge request!310Master - transfer updates into WIP branch
...@@ -2138,7 +2138,7 @@ void Tree::clear() ...@@ -2138,7 +2138,7 @@ void Tree::clear()
_root = NULL; _root = NULL;
}; };
void Tree::initialize(bool rand, bool normalizedWeight) void Tree::initialize(bool rand, bool normalizedWeight, bool type)
{ {
// random weight for leaves // random weight for leaves
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
...@@ -2174,8 +2174,15 @@ void Tree::initialize(bool rand, bool normalizedWeight) ...@@ -2174,8 +2174,15 @@ void Tree::initialize(bool rand, bool normalizedWeight)
if (normalizedWeight) if (normalizedWeight)
{ {
double vv = (n->af->getVal(n->weight))/toltalWeightLeaves; double vv = (n->af->getVal(n->weight))/toltalWeightLeaves;
if (type)
{
n->weight = n->af->getReciprocalVal(vv); n->weight = n->af->getReciprocalVal(vv);
} }
else
{
n->weight = vv;
}
}
// propagate data // propagate data
double w = n->weight; double w = n->weight;
TreeNode* parent = n->parent; TreeNode* parent = n->parent;
......
...@@ -59,7 +59,7 @@ class Tree ...@@ -59,7 +59,7 @@ class Tree
void printTree() const; void printTree() const;
void printTreeInteraction(const std::string fname="treeInteraction.txt", bool colorMat = true, int dir=1) const; void printTreeInteraction(const std::string fname="treeInteraction.txt", bool colorMat = true, int dir=1) const;
void clear(); 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;}; const TreeNode* getRootNode() const {return _root;};
void assignMaterialLaws(int numPhases); void assignMaterialLaws(int numPhases);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment