mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 04:50:34 +05:00
template functions to header
This commit is contained in:
parent
d995976621
commit
0c4b90c4c4
@ -1988,7 +1988,8 @@ namespace netgen
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
template <int dim, typename T>
|
||||
void T_ADTree<dim,T> :: PrintRec (ostream & ost, const T_ADTreeNode<dim,T> * node) const
|
||||
{
|
||||
@ -2030,8 +2031,7 @@ namespace netgen
|
||||
els += ElementsRec(node->right);
|
||||
return els;
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@ -609,9 +609,45 @@ public:
|
||||
int Elements () const
|
||||
{ return ElementsRec (root); }
|
||||
|
||||
void PrintRec (ostream & ost, const T_ADTreeNode<dim,T> * node) const;
|
||||
int DepthRec (const T_ADTreeNode<dim,T> * node) const;
|
||||
int ElementsRec (const T_ADTreeNode<dim,T> * node) const;
|
||||
void PrintRec (ostream & ost, const T_ADTreeNode<dim,T> * node) const
|
||||
{
|
||||
|
||||
// if (node->data) // true anyway
|
||||
{
|
||||
ost << node->pi << ": ";
|
||||
ost << node->nchilds << " childs, ";
|
||||
for (int i = 0; i < dim; i++)
|
||||
ost << node->data[i] << " ";
|
||||
ost << endl;
|
||||
}
|
||||
if (node->left)
|
||||
PrintRec (ost, node->left);
|
||||
if (node->right)
|
||||
PrintRec (ost, node->right);
|
||||
}
|
||||
|
||||
int DepthRec (const T_ADTreeNode<dim,T> * node) const
|
||||
{
|
||||
int ldepth = 0;
|
||||
int rdepth = 0;
|
||||
|
||||
if (node->left)
|
||||
ldepth = DepthRec(node->left);
|
||||
if (node->right)
|
||||
rdepth = DepthRec(node->right);
|
||||
return 1 + max2 (ldepth, rdepth);
|
||||
}
|
||||
|
||||
int ElementsRec (const T_ADTreeNode<dim,T> * node) const
|
||||
{
|
||||
int els = 1;
|
||||
if (node->left)
|
||||
els += ElementsRec(node->left);
|
||||
if (node->right)
|
||||
els += ElementsRec(node->right);
|
||||
return els;
|
||||
}
|
||||
|
||||
|
||||
void PrintMemInfo (ostream & ost) const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user