Public Member Functions | Protected Member Functions | Private Attributes
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 TreeNode * first () const
const TreeNode * last () const
bool isLeftChild () const
bool isRightChild () const
const TreeNode * next () const
bool hasChildren () const
int numLeaves () const

Protected Member Functions

TreeNode * left ()
TreeNode * right ()

Private Attributes

TreeNode * parent_
TreeNode * left_
TreeNode * right_

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 63 of file SundanceRivaraTreeNode.hpp.


Constructor & Destructor Documentation

Empty ctor

Definition at line 51 of file SundanceRivaraTreeNode.cpp.

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

Definition at line 69 of file SundanceRivaraTreeNode.hpp.


Member Function Documentation

Delete the node's children

Definition at line 55 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 61 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 82 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 75 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 68 of file SundanceRivaraTreeNode.cpp.

References last(), and right_.

Referenced by last().

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

Definition at line 106 of file SundanceRivaraTreeNode.hpp.

References left_.

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

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 89 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 117 of file SundanceRivaraTreeNode.cpp.

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

Referenced by numLeaves().

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

Definition at line 108 of file SundanceRivaraTreeNode.hpp.

References right_.

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

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

Set the two children of this node

Definition at line 79 of file SundanceRivaraTreeNode.hpp.

References left(), left_, right(), 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 76 of file SundanceRivaraTreeNode.hpp.

References parent_.

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


Member Data Documentation

Definition at line 111 of file SundanceRivaraTreeNode.hpp.

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

Site Contact