Hierarchical.h

Note

The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.

class Hierarchical

This class provides storage and data access for hierarchical classes; that is, classes where an object may have a child and a parent.

Note to developers: each subclass of Hierarchical that implements an assignment operator must call the base class assignment operator at the end of the subclass assignment operator. See the Mesh class for an example.

Hierarchical(T &self)

Constructor

std::size_t depth() const

Return depth of the hierarchy; that is, the total number of objects in the hierarchy linked to the current object via child-parent relationships, including the object itself.

Returns
std::size_t
The depth of the hierarchy.
bool has_parent() const

Check if the object has a parent.

Returns
bool
The return value is true iff the object has a parent.
bool has_child() const

Check if the object has a child.

Returns
bool
The return value is true iff the object has a child.
T &parent()

Return parent in hierarchy. An error is thrown if the object has no parent.

Returns
_Object_
The parent object.
const T &parent() const

Return parent in hierarchy (const version).

std::shared_ptr<T> parent_shared_ptr()

Return shared pointer to parent. A zero pointer is returned if the object has no parent.

Returns
shared_ptr<T>
The parent object.
std::shared_ptr<const T> parent_shared_ptr() const

Return shared pointer to parent (const version).

T &child()

Return child in hierarchy. An error is thrown if the object has no child.

Returns
_T_
The child object.
const T &child() const

Return child in hierarchy (const version).

std::shared_ptr<T> child_shared_ptr()

Return shared pointer to child. A zero pointer is returned if the object has no child.

Returns
shared_ptr<T>
The child object.
std::shared_ptr<const T> child_shared_ptr() const

Return shared pointer to child (const version).

T &root_node()

Return root node object in hierarchy.

Returns
_T_
The root node object.
const T &root_node() const

Return root node object in hierarchy (const version).

std::shared_ptr<T> root_node_shared_ptr()

Return shared pointer to root node object in hierarchy.

Returns
_T_
The root node object.
std::shared_ptr<const T> root_node_shared_ptr() const

Return shared pointer to root node object in hierarchy (const version).

T &leaf_node()

Return leaf node object in hierarchy.

Returns
_T_
The leaf node object.
const T &leaf_node() const

Return leaf node object in hierarchy (const version).

std::shared_ptr<T> leaf_node_shared_ptr()

Return shared pointer to leaf node object in hierarchy.

Returns
_T_
The leaf node object.
std::shared_ptr<const T> leaf_node_shared_ptr() const

Return shared pointer to leaf node object in hierarchy (const version).

void set_parent(std::shared_ptr<T> parent)

Set parent

void clear_child()

Clear child

void set_child(std::shared_ptr<T> child)

Set child

const Hierarchical &operator=(const Hierarchical &hierarchical)

Assignment operator

void _debug() const

Function useful for debugging the hierarchy