29 #ifndef _SMESH_Tree_HXX_
30 #define _SMESH_Tree_HXX_
57 template<
class BND_BOX,
140 template<
class BND_BOX,
int NB_CHILDREN>
158 template<
class BND_BOX,
int NB_CHILDREN>
164 myBox = buildRootBox();
166 if ( myLimit->myMinBoxSize > 0. && maxSize() <= myLimit->myMinBoxSize )
179 template<
class BND_BOX,
int NB_CHILDREN>
186 for(
int i = 0; i<NB_CHILDREN; i++)
187 delete myChildren[i];
206 template<
class BND_BOX,
int NB_CHILDREN>
209 if ( isLeaf() )
return;
221 for (
int i = 0; i < NB_CHILDREN; i++)
225 myChildren[i] = newChild();
227 myChildren[i]->myFather =
this;
228 if (myChildren[i]->myLimit)
229 delete myChildren[i]->myLimit;
230 myChildren[i]->myLimit = myLimit;
231 myChildren[i]->myLevel = myLevel + 1;
232 myChildren[i]->myBox = newChildBox( i );
234 if ( myLimit->myMinBoxSize > 0. && myChildren[i]->maxSize() <= myLimit->myMinBoxSize )
235 myChildren[i]->myIsLeaf =
true;
242 for (
int i = 0; i<NB_CHILDREN; i++)
243 myChildren[i]->buildChildren();
253 template<
class BND_BOX,
int NB_CHILDREN>
256 return myIsLeaf || ((myLimit->myMaxLevel > 0) ? (level() >= myLimit->myMaxLevel) :
false );
265 template<
class BND_BOX,
int NB_CHILDREN>
268 if ( full && myFather )
269 return myFather->getHeight(
true );
275 for (
int i = 0; i<NB_CHILDREN; i++)
277 int h = myChildren[i]->getHeight(
false );
const double theEnlargeFactor
Definition: SMESH_Tree.hxx:34
Base class for 2D and 3D trees.
Definition: SMESH_Tree.hxx:60
virtual SMESH_Tree * newChild() const =0
static int nbChildren()
Definition: SMESH_Tree.hxx:88
virtual ~SMESH_Tree()
SMESH_Tree Destructor.
Definition: SMESH_Tree.hxx:180
SMESH_Tree * myFather
Definition: SMESH_Tree.hxx:115
SMESH_Tree ** myChildren
Definition: SMESH_Tree.hxx:112
virtual box_type * buildRootBox()=0
virtual void buildChildrenData()=0
const box_type * getBox() const
Definition: SMESH_Tree.hxx:83
void compute()
Compute the Tree.
Definition: SMESH_Tree.hxx:159
SMESH_Tree(SMESH_TreeLimit *limit=0)
Constructor.
Definition: SMESH_Tree.hxx:141
BND_BOX box_type
Definition: SMESH_Tree.hxx:63
const SMESH_TreeLimit * myLimit
Definition: SMESH_Tree.hxx:121
virtual double maxSize() const =0
int level() const
Definition: SMESH_Tree.hxx:80
bool isLeaf() const
Tell if Tree is a leaf or not An inheriting class can influence it via myIsLeaf protected field.
Definition: SMESH_Tree.hxx:254
bool myIsLeaf
Definition: SMESH_Tree.hxx:118
virtual void enlargeByFactor(box_type *box, double factor) const =0
void buildChildren()
Build the children boxes and call buildChildrenData()
Definition: SMESH_Tree.hxx:207
int myLevel
Definition: SMESH_Tree.hxx:127
virtual box_type * newChildBox(int childIndex) const =0
box_type * myBox
Definition: SMESH_Tree.hxx:124
int getHeight(const bool full=true) const
Return height of the tree, full or from this level to topest leaf.
Definition: SMESH_Tree.hxx:266
Definition: SMESH_Tree.hxx:38
SMESH_TreeLimit(int maxLevel=8, double minSize=0.)
Definition: SMESH_Tree.hxx:47
double myMinBoxSize
Definition: SMESH_Tree.hxx:42
int myMaxLevel
Definition: SMESH_Tree.hxx:40
virtual ~SMESH_TreeLimit()
Definition: SMESH_Tree.hxx:48