30 inline void Foam::binaryTree::insertNode
36 if (phi0 == phi0->node()->leafRight())
38 phi0->node()->leafRight() =
nullptr;
39 phi0->node()->nodeRight() = newNode;
42 else if (phi0 == phi0->node()->leafLeft())
44 phi0->node()->leafLeft() =
nullptr;
45 phi0->node()->nodeLeft() = newNode;
52 <<
"trying to insert a node with a wrong pointer to a chemPoint" 57 inline void Foam::binaryTree::deleteSubTree(binaryNode* subTreeRoot)
59 if (subTreeRoot !=
nullptr)
63 deleteSubTree(subTreeRoot->nodeLeft());
64 deleteSubTree(subTreeRoot->nodeRight());
70 inline void Foam::binaryTree::deleteSubTree()
76 inline void Foam::binaryTree::transplant(binaryNode* u, binaryNode* v)
81 if (u->parent() ==
nullptr)
86 else if (u == u->parent()->nodeLeft())
91 else if (u == u->parent()->nodeRight())
98 <<
"wrong addressing of the initial node" 101 v->parent() = u->parent();
106 <<
"trying to transplant a nullptr node" 114 if (y->parent() !=
nullptr)
116 if (y == y->parent()->nodeLeft())
119 return y->parent()->leafRight();
121 else if (y == y->parent()->nodeRight())
123 return y->parent()->leafLeft();
128 <<
"wrong addressing of the initial node" 143 if (x == x->node()->leafLeft())
149 else if (x == x->node()->leafRight())
157 <<
"wrong addressing of the initial leaf" 170 if (y->parent()!=
nullptr)
172 if (y == y->parent()->nodeLeft())
177 else if (y == y->parent()->nodeRight())
184 <<
"wrong addressing of the initial node" 197 if (x == x->node()->leafLeft())
202 else if (x == x->node()->leafRight())
210 <<
"wrong addressing of the initial leaf" 221 if (subTreeRoot !=
nullptr)
241 if (subTreeRoot ==
nullptr)
287 const scalar& a = node->
a();
289 for (
label i=0; i<phiq.
size(); i++) vPhi += phiq[i]*v[i];
331 if (subTreeRoot!=
nullptr)
333 while(subTreeRoot->
nodeLeft() !=
nullptr)
335 subTreeRoot = subTreeRoot->
nodeLeft();
361 return size_ >= maxNLeafs_;
376 while (nextChP !=
nullptr)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void size(const label)
Override size to be inconsistent with allocated storage.
Leaf of the binary tree. The chemPoint stores the composition 'phi', the mapping of this composition ...
chemPointISAT * treeSuccessor(chemPointISAT *x)
label size() const
Member functions.
void binaryTreeSearch(const scalarField &phiq, binaryNode *node, chemPointISAT *&nearest)
chemPointISAT * treeMin()
void clear()
Removes every entries of the tree and delete the associated objects.
chemPointISAT *& leafRight()
void resetNumRetrieve()
Resets the number of retrieves at each time step.
Template functions to aid in the implementation of demand driven data.
binaryNode *& nodeRight()
const scalarField & v() const
Topology.
void deleteDemandDrivenData(DataPtr &dataPtr)
chemPointISAT *& leafLeft()
Access.