Sundance::Rivara::TreeNode Class Reference

Inheritance diagram for Sundance::Rivara::TreeNode:

Sundance::Rivara::Edge Sundance::Rivara::Element

List of all members.

Public Member Functions

 TreeNode ()
virtual ~TreeNode ()
void deleteChildren ()
void setParent (TreeNode *parent)
void setChildren (TreeNode *left, TreeNode *right)
const TreeNodefirst () const
const TreeNodelast () const
bool isLeftChild () const
bool isRightChild () const
const TreeNodenext () const
bool hasChildren () const
int numLeaves () const

Protected Member Functions

TreeNodeleft ()
TreeNoderight ()

Private Attributes

TreeNodeparent_
TreeNodeleft_
TreeNoderight_


Detailed Description

Class TreeNode represents a node in a Rivara mesh refinement tree. Each node has either zero or two children depending on whether it has been refined. All non-root nodes have a pointer back to their parent.

Only maximal elements will be responsible for deleting their children. Therefore, the TreeNode dtor does not delete children; subtypes that need to delete children should call the deleteChildren() method.

Definition at line 21 of file SundanceRivaraTreeNode.hpp.


Constructor & Destructor Documentation

TreeNode::TreeNode (  ) 

Empty ctor

Definition at line 9 of file SundanceRivaraTreeNode.cpp.

virtual Sundance::Rivara::TreeNode::~TreeNode (  )  [inline, virtual]

Definition at line 27 of file SundanceRivaraTreeNode.hpp.


Member Function Documentation

void TreeNode::deleteChildren (  ) 

Delete the node's children

Definition at line 13 of file SundanceRivaraTreeNode.cpp.

References left_, and right_.

Referenced by Sundance::Rivara::Element::~Element().

const TreeNode * TreeNode::first (  )  const

return the leftmost leaf beneath this node

Definition at line 19 of file SundanceRivaraTreeNode.cpp.

References first(), and left_.

Referenced by first(), and next().

bool Sundance::Rivara::TreeNode::hasChildren (  )  const [inline]

bool TreeNode::isLeftChild (  )  const

Indicate whether this is the leftward child of another node

Definition at line 40 of file SundanceRivaraTreeNode.cpp.

References left_, and parent_.

Referenced by next().

bool TreeNode::isRightChild (  )  const

Indicate whether this is the rightward child of another node

Definition at line 33 of file SundanceRivaraTreeNode.cpp.

References parent_, and right_.

Referenced by next().

const TreeNode * TreeNode::last (  )  const

return the rightmost leaf beneath this node

Definition at line 26 of file SundanceRivaraTreeNode.cpp.

References last(), and right_.

Referenced by last().

TreeNode* Sundance::Rivara::TreeNode::left (  )  [inline, protected]

Definition at line 64 of file SundanceRivaraTreeNode.hpp.

References left_.

Referenced by Sundance::Rivara::Element::refine().

const TreeNode * TreeNode::next (  )  const

Return the next leaf in a left-to-right walk of the tree. If this is the last leaf, return 0.

Definition at line 47 of file SundanceRivaraTreeNode.cpp.

References first(), isLeftChild(), isRightChild(), parent_, and right_.

Referenced by Sundance::Rivara::ElementIterator::getNextElement(), and Sundance::Rivara::ElementIterator::hasMoreElements().

int TreeNode::numLeaves (  )  const

Return a count of the number of leaves

Definition at line 75 of file SundanceRivaraTreeNode.cpp.

References hasChildren(), left_, numLeaves(), and right_.

Referenced by numLeaves().

TreeNode* Sundance::Rivara::TreeNode::right (  )  [inline, protected]

Definition at line 66 of file SundanceRivaraTreeNode.hpp.

References right_.

Referenced by Sundance::Rivara::Element::refine().

void Sundance::Rivara::TreeNode::setChildren ( TreeNode left,
TreeNode right 
) [inline]

Set the two children of this node

Definition at line 37 of file SundanceRivaraTreeNode.hpp.

References left_, and right_.

Referenced by Sundance::Rivara::Edge::bisect(), and Sundance::Rivara::Element::refine().

void Sundance::Rivara::TreeNode::setParent ( TreeNode parent  )  [inline]

set the parent of this node

Definition at line 34 of file SundanceRivaraTreeNode.hpp.

References parent_.

Referenced by Sundance::Rivara::Element::refine().


Member Data Documentation

Definition at line 69 of file SundanceRivaraTreeNode.hpp.

Referenced by isLeftChild(), isRightChild(), next(), and setParent().

Site Contact