Struct t8_scheme

Struct Documentation

struct t8_scheme

This class holds one or more element schemes.

It also relays the function calls to the specific schemes.

Public Functions

inline t8_scheme()
inline ~t8_scheme()
inline void ref() const

Increase the reference count of the scheme.

inline int unref() const

Decrease the reference count of the scheme.

If the reference count reaches zero, the scheme is deleted.

Returns:

The remaining reference count. If 0 the scheme was deleted.

inline size_t get_num_eclass_schemes() const

Get the number of eclass schemes inside the scheme.

Returns:

The number of eclass schemes.

template<class TEclassScheme>
inline bool check_eclass_scheme_type(const t8_eclass_t tree_class) const

Check if the scheme is of a specific type.

Template Parameters:

TEclass_Scheme – The type of the scheme to check for.

Parameters:

tree_class[in] The eclass of the current tree.

Returns:

True if the scheme is of type TEclassScheme, false otherwise.

inline t8_eclass_t get_eclass_scheme_eclass(const t8_eclass_t tree_class) const

Get the eclass an eclass scheme is valid for.

Note

This function should return the input value as long as the eclass schemes are sorted correctly. In the future, the trees will access the schemes by a key and then this function will make more sense.

Parameters:

tree_class[in] The eclass of the current tree.

Returns:

The valid tree class for the eclass scheme.

inline size_t get_eclass_scheme_dimension(const t8_eclass_t tree_class) const

Get the dimension of the eclass scheme.

Parameters:

tree_class[in] The eclass of the current tree.

Returns:

The dimension of the eclass scheme.

inline size_t get_element_size(const t8_eclass_t tree_class) const

Return the size of any element of a given class.

Parameters:

tree_class[in] The eclass of the current tree.

Returns:

The size of an element of class tree_class. We provide a default implementation of this routine that should suffice for most use cases.

inline bool refines_irregular(const t8_eclass_t tree_class) const

Returns true, if there is one element in the tree, that does not refine into 2^dim children.

Returns false otherwise.

Parameters:

tree_class[in] The eclass of the current tree.

Returns:

true if there is one element in the tree that does not refine into 2^dim children.

inline int get_maxlevel(const t8_eclass_t tree_class) const

Return the maximum allowed level for any element of a given class.

Parameters:

tree_class[in] The eclass of the current tree.

Returns:

The maximum allowed level for elements of class tree_class.

inline int element_get_level(const t8_eclass_t tree_class, const t8_element_t *element) const

Return the level of a particular element.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element whose level should be returned.

Returns:

The level of element.

inline void element_copy(const t8_eclass_t tree_class, const t8_element_t *source, t8_element_t *dest) const

Copy all entries of source to dest.

dest must be an existing element. No memory is allocated by this function.

Note

source and dest may point to the same element.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • source[in] The element whose entries will be copied to dest.

  • dest[inout] This element’s entries will be overwritten with the entries of source.

inline int element_compare(const t8_eclass_t tree_class, const t8_element_t *elem1, const t8_element_t *elem2) const

Compare two elements.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • elem1[in] The first element.

  • elem2[in] The second element.

Returns:

negative if elem1 < elem2, zero if elem1 equals elem2 and positive if elem1 > elem2. If elem2 is a copy of elem1 then the elements are equal.

inline bool element_is_equal(const t8_eclass_t tree_class, const t8_element_t *elem1, const t8_element_t *elem2) const

Check if two elements are equal.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • elem1[in] The first element.

  • elem2[in] The second element.

Returns:

true if the elements are equal, false if they are not equal

inline bool element_is_refinable(const t8_eclass_t tree_class, const t8_element_t *element) const

Indicates if an element is refinable.

Possible reasons for being not refinable could be that the element has reached its max level.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element to check.

Returns:

True if the element is refinable.

inline void element_get_parent(const t8_eclass_t tree_class, const t8_element_t *element, t8_element_t *parent) const

Compute the parent of a given element element and store it in parent.

parent needs to be an existing element. No memory is allocated by this function. element and parent can point to the same element, then the entries of element are overwritten by the ones of its parent.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element whose parent will be computed.

  • parent[inout] This element’s entries will be overwritten by those of element’s parent. The storage for this element must exist and match the element class of the parent. For a pyramid, for example, it may be either a tetrahedron or a pyramid depending on element’s childid.

inline int element_get_num_siblings(const t8_eclass_t tree_class, const t8_element_t *element) const

Compute the number of siblings of an element.

That is the number of Children of its parent.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element.

Returns:

The number of siblings of element. Note that this number is >= 1, since we count the element itself as a sibling.

inline void element_get_sibling(const t8_eclass_t tree_class, const t8_element_t *element, const int sibid, t8_element_t *sibling) const

Compute a specific sibling of a given element element and store it in sibling.

sibling needs to be an existing element. No memory is allocated by this function. element and sibling can point to the same element, then the entries of element are overwritten by the ones of its sibid-th sibling.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element whose sibling will be computed.

  • sibid[in] The id of the sibling computed.

  • sibling[inout] This element’s entries will be overwritten by those of element’s sibid-th sibling. The storage for this element must exist and match the element class of the sibling.

inline int element_get_num_corners(const t8_eclass_t tree_class, const t8_element_t *element) const

Compute the number of corners of a given element.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element.

Returns:

The number of corners of element.

inline int element_get_num_faces(const t8_eclass_t tree_class, const t8_element_t *element) const

Compute the number of faces of a given element.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element.

Returns:

The number of faces of element.

inline int element_get_max_num_faces(const t8_eclass_t tree_class, const t8_element_t *element) const

Compute the maximum number of faces of a given element and all of its descendants.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element.

Returns:

The maximum number of faces of element and its descendants.

inline int element_get_num_children(const t8_eclass_t tree_class, const t8_element_t *element) const

Return the number of children of an element when it is refined.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element whose number of children is returned.

Returns:

The number of children of element if it is to be refined.

inline int get_max_num_children(const t8_eclass_t tree_class) const

Return the max number of children of an eclass.

Parameters:

tree_class[in] The eclass of tree the elements are part of.

Returns:

The max number of children of element.

inline int element_get_num_face_children(const t8_eclass_t tree_class, const t8_element_t *element, const int face) const

Return the number of children of an element’s face when the element is refined.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element whose face is considered.

  • face[in] A face of element.

Returns:

The number of children of face if element is to be refined.

inline int element_get_face_corner(const t8_eclass_t tree_class, const t8_element_t *element, const int face, const int corner) const

Return the corner number of an element’s face corner.

Example quad: 2 x &#8212; x 3 | | | | face 1 0 x &#8212; x 1 Thus for face = 1 the output is: corner=0 : 1, corner=1: 3

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element.

  • face[in] A face index for element.

  • corner[in] A corner index for the face 0 <= corner < num_face_corners.

Returns:

The corner number of the corner-th vertex of face.

inline int element_get_corner_face(const t8_eclass_t tree_class, const t8_element_t *element, const int corner, const int face) const

Return the face numbers of the faces sharing an element’s corner.

Example quad: 2 x &#8212; x 3 | | | | face 1 0 x &#8212; x 1 face 2 Thus for corner = 1 the output is: face=0 : 2, face=1: 1

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element.

  • corner[in] A corner index for the face.

  • face[in] A face index for corner.

Returns:

The face number of the face-th face at corner.

inline void element_get_child(const t8_eclass_t tree_class, const t8_element_t *element, const int childid, t8_element_t *child) const

Construct the child element of a given number.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] This must be a valid element, bigger than maxlevel.

  • childid[in] The number of the child to construct.

  • child[inout] The storage for this element must exist. On output, a valid element. It is valid to call this function with element = child.

inline void element_get_children(const t8_eclass_t tree_class, const t8_element_t *element, const int length, t8_element_t *c[]) const

Construct all children of a given element.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] This must be a valid element, bigger than maxlevel.

  • length[in] The length of the output array c must match the number of children.

  • c[inout] The storage for these length elements must exist. On output, all children are valid. It is valid to call this function with element = c[0].

inline int element_get_child_id(const t8_eclass_t tree_class, const t8_element_t *element) const

Compute the child id of an element.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] This must be a valid element.

Returns:

The child id of element.

inline int element_get_ancestor_id(const t8_eclass_t tree_class, const t8_element_t *element, const int level) const

Compute the ancestor id of an element, that is the child id at a given level.

Note

The ancestor id at element.level is the same as the child id.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] This must be a valid element.

  • level[in] A refinement level. Must satisfy level <= element.level

Returns:

The child_id of element in regard to its level ancestor.

inline bool element_is_ancestor(const t8_eclass_t tree_class, const t8_element_t *element_A, const t8_element_t *element_B) const

Query whether element A is an ancestor of the element B.

An element A is ancestor of an element B if A == B or if B can be obtained from A via successive refinement.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element_A[in] An element of class eclass in scheme scheme.

  • element_B[in] An element of class eclass in scheme scheme.

Returns:

True if and only if element_A is an ancestor of element_B.

inline bool elements_are_family(const t8_eclass_t tree_class, t8_element_t *const *fam) const

Query whether a given set of elements is a family or not.

Note

level 0 elements do not form a family.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • fam[in] An array of as many elements as an element of class tree_class has siblings.

Returns:

Zero if fam is not a family, nonzero if it is.

inline void element_get_nca(const t8_eclass_t tree_class, const t8_element_t *elem1, const t8_element_t *elem2, t8_element_t *const nca) const

Compute the nearest common ancestor of two elements.

That is, the element with highest level that still has both given elements as descendants.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • elem1[in] The first of the two input elements.

  • elem2[in] The second of the two input elements.

  • nca[inout] The storage for this element must exist and match the element class of the child. On output the unique nearest common ancestor of elem1 and elem2.

inline t8_element_shape_t element_get_face_shape(const t8_eclass_t tree_class, const t8_element_t *element, const int face) const

Compute the shape of the face of an element.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element.

  • face[in] A face of element.

Returns:

The element shape of the face. I.e. T8_ECLASS_LINE for quads, T8_ECLASS_TRIANGLE for tets and depending on the face number either T8_ECLASS_QUAD or T8_ECLASS_TRIANGLE for prisms.

inline void element_get_children_at_face(const t8_eclass_t tree_class, const t8_element_t *element, const int face, t8_element_t *children[], int num_children, int *child_indices) const

Given an element and a face of the element, compute all children of the element that touch the face.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element.

  • face[in] A face of element.

  • children[inout] Allocated elements, in which the children of element that share a face with face are stored. They will be stored in order of their linear id.

  • num_children[in] The number of elements in children. Must match the number of children that touch face. element_get_num_face_children

  • child_indices[inout] If not NULL, an array of num_children integers must be given, on output its i-th entry is the child_id of the i-th face_child. It is valid to call this function with element = children[0].

inline int element_face_get_child_face(const t8_eclass_t tree_class, const t8_element_t *element, const int face, const int face_child) const

Given a face of an element and a child number of a child of that face, return the face number of the child of the element that matches the child face.

 x ---- x   x      x           x ---- x
 |      |   |      |           |   |  | <-- f
 |      |   |      x           |   x--x
 |      |   |                  |      |
 x ---- x   x                  x ---- x
  element    face  face_child    Returns the face number f
Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element.

  • face[in] Then number of the face.

  • face_child[in] A number 0 <= face_child < num_face_children, specifying a child of element that shares a face with face. These children are counted in linear order. This coincides with the order of children from a call to element_get_children_at_face.

Returns:

The face number of the face of a child of element that coincides with face_child.

inline int element_face_get_parent_face(const t8_eclass_t tree_class, const t8_element_t *element, const int face) const

Given a face of an element return the face number of the parent of the element that matches the element’s face.

Or return -1 if no face of the parent matches the face.

Note

For the root element this function always returns face.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element.

  • face[in] Then number of the face.

Returns:

If face of element is also a face of element’s parent, the face number of this face. Otherwise -1.

inline int element_face_get_ancestor_face(const t8_eclass_t tree_class, const t8_element_t *element, const int ancestor_level, const int face) const

Given a face of an element and a level coarser than (or equal to) the element’s level, return the face number of the ancestor of the element that matches the element’s face.

Or return -1 if no face of the ancestor matches the face.

Note

For the root element this function always returns face.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element.

  • ancestor_level[in] A refinement level smaller than (or equal to) element’s level.

  • face[in] Then number of a face of element.

Returns:

If face of element is a subface of a face of element’s ancestor at level ancestor_level, the face number of this face. Otherwise -1.

inline int element_get_tree_face(const t8_eclass_t tree_class, const t8_element_t *element, const int face) const

Given an element and a face of this element.

If the face lies on the tree boundary, return the face number of the tree face. If not the return value is arbitrary. You can call element_is_root_boundary to query whether the face is at the tree boundary.

Warning

The return value may look like a valid face of the tree even if the element does not lie on the root boundary.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element.

  • face[in] The index of a face of element.

Returns:

The index of the tree face that face is a subface of, if face is on a tree boundary. Any arbitrary integer if is not at a tree boundary.

inline void element_transform_face(const t8_eclass_t tree_class, const t8_element_t *elem1, t8_element_t *elem2, const int orientation, const int sign, const int is_smaller_face) const

Suppose we have two trees that share a common face f.

Given an element e that is a subface of f in one of the trees and given the orientation of the tree connection, construct the face element of the respective tree neighbor that logically coincides with e but lies in the coordinate system of the neighbor tree.

Note

elem1 and elem2 may point to the same element.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • elem1[in] The face element.

  • elem2[inout] On return the face element elem1 with respect to the coordinate system of the other tree.

  • orientation[in] The orientation of the tree-tree connection.

  • sign[in] Depending on the topological orientation of the two tree faces, either 0 (both faces have opposite orientation) or 1 (both faces have the same top. orientation). t8_eclass_face_orientation

  • is_smaller_face[in] Flag to declare whether elem1 belongs to the smaller face. A face f of tree T is smaller than f’ of T’ if either the eclass of T is smaller or if the classes are equal and f<f’. The orientation is defined in relation to the smaller face.

inline int element_extrude_face(const t8_eclass_t tree_class, const t8_element_t *face, t8_element_t *element, const int root_face) const

Given a boundary face inside a root tree’s face construct the element inside the root tree that has the given face as a face.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • face[in] A face element.

  • element[inout] An allocated element. The entries will be filled with the data of the element that has face as a face and lies within the root tree.

  • root_face[in] The index of the face of the root tree in which face lies.

Returns:

The face number of the face of element that coincides with face.

inline void element_get_boundary_face(const t8_eclass_t tree_class, const t8_element_t *element, const int face, t8_element_t *boundary) const

Construct the boundary element at a specific face.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The input element.

  • face[in] The index of the face of which to construct the boundary element.

  • boundary[inout] An allocated element of dimension of element minus 1. The entries will be filled with the entries of the face of element. If element is of class T8_ECLASS_VERTEX, then boundary must be NULL and will not be modified.

inline void element_get_first_descendant_face(const t8_eclass_t tree_class, const t8_element_t *element, const int face, t8_element_t *first_desc, const int level) const

Construct the first descendant of an element at a given level that touches a given face.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The input element.

  • face[in] A face of element.

  • first_desc[inout] An allocated element. This element’s data will be filled with the data of the first descendant of element that shares a face with face.

  • level[in] The level, at which the first descendant is constructed

inline void element_get_last_descendant_face(const t8_eclass_t tree_class, const t8_element_t *element, const int face, t8_element_t *last_desc, const int level) const

Construct the last descendant of an element at a given level that touches a given face.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The input element.

  • face[in] A face of element.

  • last_desc[inout] An allocated element. This element’s data will be filled with the data of the last descendant of element that shares a face with face.

  • level[in] The level, at which the last descendant is constructed

inline bool element_is_root_boundary(const t8_eclass_t tree_class, const t8_element_t *element, const int face) const

Compute whether a given element shares a given face with its root tree.

Note

You can compute the corresponding face number of the tree via element_get_tree_face.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The input element.

  • face[in] A face of element.

Returns:

True if face is a subface of the element’s root element.

inline int element_get_face_neighbor_inside(const t8_eclass_t tree_class, const t8_element_t *element, t8_element_t *neigh, const int face, int *neigh_face) const

Construct the face neighbor of a given element if this face neighbor is inside the root tree.

Return 0 otherwise.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element to be considered.

  • neigh[inout] If the face neighbor of element along face is inside the root tree, this element’s data is filled with the data of the face neighbor. Otherwise the data can be modified arbitrarily.

  • face[in] The number of the face along which the neighbor should be constructed.

  • neigh_face[out] The number of face as viewed from neigh. An arbitrary value, if the neighbor is not inside the root tree.

Returns:

True if neigh is inside the root tree. False if not. In this case neigh’s data can be arbitrary on output.

inline t8_element_shape_t element_get_shape(const t8_eclass_t tree_class, const t8_element_t *element) const

Return the shape of an allocated element according its type.

For example, a child of an element can be an element of a different shape and has to be handled differently - according to its shape.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element to be considered

Returns:

The shape of the element as an eclass

inline void element_set_linear_id(const t8_eclass_t tree_class, t8_element_t *element, const int level, const t8_linearidx_t id) const

Initialize the entries of an allocated element according to a given linear id in a uniform refinement.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[inout] The element whose entries will be set.

  • level[in] The level of the uniform refinement to consider.

  • id[in] The linear id. id must fulfil 0 <= id < ‘number of leaves in the uniform refinement’

inline t8_linearidx_t element_get_linear_id(const t8_eclass_t tree_class, const t8_element_t *element, const int level) const

Compute the linear id of a given element in a hypothetical uniform refinement of a given level.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element whose id we compute.

  • level[in] The level of the uniform refinement to consider.

Returns:

The linear id of the element.

inline void element_get_first_descendant(const t8_eclass_t tree_class, const t8_element_t *element, t8_element_t *desc, const int level) const

Compute the first descendant of a given element.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element whose descendant is computed.

  • desc[out] The first element in a uniform refinement of element of the given level.

  • level[in] The level, at which the descendant is computed.

inline void element_get_last_descendant(const t8_eclass_t tree_class, const t8_element_t *element, t8_element_t *desc, const int level) const

Compute the last descendant of a given element.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element whose descendant is computed.

  • desc[out] The last element in a uniform refinement of element of the given level.

  • level[in] The level, at which the descendant is computed.

inline void element_construct_successor(const t8_eclass_t tree_class, const t8_element_t *element, t8_element_t *successor) const

Construct the successor in a uniform refinement of a given element.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element whose successor should be constructed.

  • successor[inout] The element whose entries will be set to the successor of element.

inline void element_get_vertex_reference_coords(const t8_eclass_t tree_class, const t8_element_t *element, const int vertex, double coords[]) const

Compute the coordinates of a given element vertex inside a reference tree that is embedded into [0,1]^d (d = dimension).

Warning

coords should be zero-initialized, as only the first d coords will be set, but when used elsewhere all coords might be used.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element to be considered.

  • vertex[in] The id of the vertex whose coordinates shall be computed.

  • coords[out] An array of at least as many doubles as the element’s dimension whose entries will be filled with the coordinates of vertex.

inline void element_get_reference_coords(const t8_eclass_t tree_class, const t8_element_t *element, const double *ref_coords, const size_t num_coords, double *out_coords) const

Convert points in the reference space of an element to points in the reference space of the tree.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element.

  • ref_coords[in] The coordinates \( [0,1]^\mathrm{dim} \) of the point in the reference space of the element.

  • num_coords[in] Number of \( dim\)-sized coordinates to evaluate.

  • out_coords[out] The coordinates of the points in the reference space of the tree.

inline t8_gloidx_t element_count_leaves(const t8_eclass_t tree_class, const t8_element_t *t, const int level) const

Count how many leaf descendants of a given uniform level an element would produce.

Example: If t is a line element that refines into 2 line elements on each level, then the return value is max(0, 2^{level - level(t)}). Thus, if t’s level is 0, and level = 3, the return value is 2^3 = 8.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • t[in] The element to be checked.

  • level[in] A refinement level.

Returns:

Suppose t is uniformly refined up to level level. The return value is the resulting number of elements (of the given level). If level < element_get_level(t), the return value should be 0.

inline t8_gloidx_t count_leaves_from_root(const t8_eclass_t tree_class, const int level) const

Count how many leaf descendants of a given uniform level the root element will produce.

This is a convenience function, and can be implemented via t8_element_count_leaves.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • level[in] A refinement level.

Returns:

The value of t8_element_count_leaves if the input element is the root (level 0) element.

inline int element_is_valid(const t8_eclass_t tree_class, const t8_element_t *element) const

Query whether a given element can be considered as ‘valid’ and it is safe to perform any of the above algorithms on it.

For example this could mean that all coordinates are in valid ranges and other membervariables do have meaningful values.

Note

An element that is constructed with element_new must pass this test.

Note

An element for which element_init was called must pass this test.

Note

This function is used for debugging to catch certain errors. These can for example occur when an element points to a region of memory which should not be interpreted as an element.

Note

We recommend to use the assertion T8_ASSERT (element_is_valid (element)) in the implementation of each of the functions in this file.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element to be checked.

Returns:

True if element is safe to use. False otherwise.

inline void element_debug_print(const t8_eclass_t tree_class, const t8_element_t *element) const

Print a given element.

For a example for a triangle print the coordinates and the level of the triangle. This function is only available in the debugging configuration.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element to print

inline void element_to_string(const t8_eclass_t tree_class, const t8_element_t *element, char *debug_string, const int string_size) const

Fill a string with readable information about the element.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[in] The element to translate into human-readable information.

  • debug_string[inout] The string to fill.

  • string_size[in] The length of debug_string.

inline void element_new(const t8_eclass_t tree_class, const int length, t8_element_t **elements) const

Allocate memory for length many elements of a given class and initialize them, and put pointers to the elements in the provided array.

See also

element_destroy

See also

element_init

See also

element_is_valid

Note

There are two ways to create multiple elements of the same type. Create an array of element pointers and fill it with element_new, or allocate memory for length times element_size many bytes, and fill them with element_init. To access a specific element, offset calculation needs to be done manually, as t8_element_t is incomplete.

Note

In debugging mode, an element that was created with element_new must pass element_is_valid (for example the root element).

Note

If an element was created by element_new then element_init may not be called for it. Thus, element_new should initialize an element in the same way as a call to element_init would.

Note

Every call to element_new must be matched by a call to element_destroy

Parameters:
  • tree_class[in] The eclass of the current tree.

  • length[in] The number of elements to be allocated.

  • elements[inout] On input an array of length many element pointers. On output all these pointers will point to an allocated and initialized element.

inline void element_init(const t8_eclass_t tree_class, const int length, t8_element_t *elements) const

Initialize an array of allocated elements.

See also

element_deinit

See also

element_new

See also

element_is_valid

Note

In debugging mode, an element that was passed to element_init must pass element_is_valid.

Note

If an element was created by element_new then element_init may not be called for it. Thus, element_init should initialize an element in the same way as a call to element_new would.

Note

Every call to element_init must be matched by a call to element_deinit

Parameters:
  • tree_class[in] The eclass of the current tree.

  • length[in] The number of elements to be initialized.

  • elements[inout] On input an array of length many allocated elements.

inline void element_deinit(const t8_eclass_t tree_class, const int length, t8_element_t *elements) const

Deinitialize an array of allocated elements.

See also

element_init

Note

Call this function if you called element_init on the element pointers.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • length[in] The number of elements to be deinitialized.

  • elements[inout] On input an array of length many allocated and initialized elements, on output an array of length many allocated, but not initialized elements.

inline void element_destroy(const t8_eclass_t tree_class, const int length, t8_element_t **elements) const

Deallocate an array of elements.

See also

element_new

Parameters:
  • tree_class[in] The eclass of the current tree.

  • length[in] The number of elements in the array.

  • elements[inout] On input an array of length many allocated element pointers. On output all these pointers will be freed. element itself will not be freed by this function.

inline void set_to_root(const t8_eclass_t tree_class, t8_element_t *element) const

create the root element

Parameters:
  • tree_class[in] The eclass of the current tree.

  • element[inout] The element that is filled with the root

inline void element_MPI_Pack(const t8_eclass_t tree_class, t8_element_t **const elements, const unsigned int count, void *send_buffer, int buffer_size, int *position, sc_MPI_Comm comm) const

Pack multiple elements into contiguous memory, so they can be sent via MPI.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • elements[in] Array of elements that are to be packed

  • count[in] Number of elements to pack

  • send_buffer[inout] Buffer in which to pack the elements

  • buffer_size[in] size of the buffer (in order to check that we don’t access out of range)

  • position[inout] the position of the first byte that is not already packed

  • comm[in] MPI Communicator

inline void element_MPI_Pack_size(const t8_eclass_t tree_class, const unsigned int count, sc_MPI_Comm comm, int *pack_size) const

Determine an upper bound for the size of the packed message of count elements.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • count[in] Number of elements to pack

  • comm[in] MPI Communicator

  • pack_size[out] upper bound on the message size

inline void element_MPI_Unpack(t8_eclass_t tree_class, void *recvbuf, const int buffer_size, int *position, t8_element_t **elements, const unsigned int count, sc_MPI_Comm comm) const

Unpack multiple elements from contiguous memory that was received via MPI.

Parameters:
  • tree_class[in] The eclass of the current tree.

  • recvbuf[in] Buffer from which to unpack the elements

  • buffer_size[in] size of the buffer (in order to check that we don’t access out of range)

  • position[inout] the position of the first byte that is not already packed

  • elements[in] Array of initialised elements that is to be filled from the message

  • count[in] Number of elements to unpack

  • comm[in] MPI Communicator

Friends

friend struct t8_scheme_builder