Function t8_element_new

Function Documentation

void t8_element_new(const t8_scheme_c *scheme, const t8_eclass_t tree_class, const int length, t8_element_t **elems)

Allocate memory for an array of elements of a given class and initialize them.

See also

t8_element_init

See also

element_is_valid

Note

Not every element that is created in t8code will be created by a call to this function. However, if an element is not created using t8_element_new, then it is guaranteed that t8_scheme::element_init is called on it.

Note

In debugging mode, an element that was created with t8_element_new must pass t8_element_is_valid.

Note

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

Parameters:
  • scheme[in] The scheme of the forest.

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

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

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