Template Struct t8_standalone_scheme
Defined in File t8_standalone_implementation.hxx
Inheritance Relationships
Base Type
public t8_scheme_helpers< TEclass, t8_standalone_scheme< TEclass > >(Template Class t8_scheme_helpers)
Struct Documentation
-
template<t8_eclass TEclass>
struct t8_standalone_scheme : public t8_scheme_helpers<TEclass, t8_standalone_scheme<TEclass>> A templated implementation of the scheme interface based on cutting planes.
Public Functions
-
inline t8_standalone_scheme() noexcept
Constructor.
-
inline ~t8_standalone_scheme()
Destructor for all default schemes.
-
inline t8_standalone_scheme(t8_standalone_scheme &&other) noexcept
Move constructor.
-
inline t8_standalone_scheme &operator=(t8_standalone_scheme &&other) noexcept
Move assignment operator.
-
inline t8_standalone_scheme(const t8_standalone_scheme &other)
Copy constructor.
-
inline t8_standalone_scheme &operator=(const t8_standalone_scheme &other)
Copy assignment operator.
-
inline void element_new(const int length, t8_element_t **elems) const noexcept
Allocate memory for an array of elements of a given class and initialize them.
See also
See also
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 element_new, then it is guaranteed that element_init is called on it.
Note
In debugging mode, an element that was created with element_new 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_new should initialize an element in the same way as a call to element_init would.
- Parameters:
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.
-
inline void element_destroy(const int length, t8_element_t **elems) const noexcept
Deallocate an array of elements.
- Parameters:
length – [in] The number of elements in the array.
elems – [inout] On input an array of length many allocated element pointers. On output all these pointers will be freed. elems itself will not be freed by this function.
-
inline constexpr void element_MPI_Pack(t8_element_t **const elements, const unsigned int count, void *send_buffer, const int buffer_size, int *position, sc_MPI_Comm comm) const noexcept
Pack multiple elements into contiguous memory, so they can be sent via MPI.
- Parameters:
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 constexpr void element_MPI_Pack_size(const unsigned int count, sc_MPI_Comm comm, int *pack_size) const noexcept
Determine an upper bound for the size of the packed message of count elements.
- Parameters:
count – [in] Number of elements to pack
comm – [in] MPI Communicator
pack_size – [out] upper bound on the message size
-
inline constexpr void element_MPI_Unpack(void *recvbuf, const int buffer_size, int *position, t8_element_t **elements, const unsigned int count, sc_MPI_Comm comm) const noexcept
Unpack multiple elements from contiguous memory that was received via MPI.
- Parameters:
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
-
inline void element_transform_face([[maybe_unused]] const t8_element_t *elem1, [[maybe_unused]] t8_element_t *elem2, [[maybe_unused]] const int orientation, [[maybe_unused]] const int sign, [[maybe_unused]] const int is_smaller_face) noexcept
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.
See also
Note
elem1 and elem2 may point to the same element.
- Parameters:
elem1 – [in] The face element.
elem2 – [inout] On return the face element elem1 with respective 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 void element_transform_face(const t8_element_t *elem1, [[maybe_unused]] t8_element_t *elem2, [[maybe_unused]] const int orientation, [[maybe_unused]] const int sign, [[maybe_unused]] const int is_smaller_face) noexcept
Implementation of element_transform_face for lines.
See also
Note
elem1 and elem2 may point to the same element.
- Parameters:
elem1 – [in] The face element.
elem2 – [inout] On return the face element elem1 with respective 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 void element_transform_face(const t8_element_t *elem1, t8_element_t *elem2, [[maybe_unused]] int orientation, const int sign, [[maybe_unused]] const int is_smaller_face) noexcept
Implementation of element_transform_face for quads.
See also
Note
elem1 and elem2 may point to the same element.
- Parameters:
elem1 – [in] The face element.
elem2 – [inout] On return the face element elem1 with respective 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 void element_transform_face([[maybe_unused]] const t8_element_t *elem1, [[maybe_unused]] t8_element_t *elem2, [[maybe_unused]] int orientation, [[maybe_unused]] const int sign, [[maybe_unused]] const int is_smaller_face) noexcept
Implementation of element_transform_face for triangles.
See also
Note
elem1 and elem2 may point to the same element.
- Parameters:
elem1 – [in] The face element.
elem2 – [inout] On return the face element elem1 with respective 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.
Public Static Functions
-
static inline constexpr size_t get_element_size(void) noexcept
Return the size of any element of a given class.
- Returns:
The size of an element.
-
static inline constexpr int refines_irregular(void) noexcept
Returns true, if there is one element in the tree, that does not refine into 2^dim children.
Returns false otherwise.
- Returns:
non-zero if there is one element in the tree that does not refine into 2^dim children.
-
static inline constexpr int get_maxlevel(void) noexcept
Return the maximum allowed level for any element of a given class.
- Returns:
The maximum allowed level for elements of class ts.
-
static inline constexpr int element_get_num_corners([[maybe_unused]] const t8_element_t *elem) noexcept
Compute the number of corners of a given element.
- Parameters:
elem – [in] The element.
- Returns:
The number of corners of elem.
-
static inline constexpr int element_get_num_faces([[maybe_unused]] const t8_element_t *elem) noexcept
Compute the number of faces of a given element.
- Parameters:
elem – [in] The element.
- Returns:
The number of faces of elem.
-
static inline constexpr int element_get_max_num_faces([[maybe_unused]] const t8_element_t *elem) noexcept
Compute the maximum number of faces of a given element and all of its descendants.
- Parameters:
elem – [in] The element.
- Returns:
The maximum number of faces of elem and its descendants.
-
static inline constexpr t8_element_shape_t element_get_shape([[maybe_unused]] const t8_element_t *elem) noexcept
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:
elem – [in] The element to be considered
- Returns:
The shape of the element as an eclass
-
static inline constexpr int element_get_face_corner([[maybe_unused]] const t8_element_t *element, const int face, const int corner) noexcept
Return the corner number of an element’s face corner.
Example quad: 2 x — x 3 | | | | face 1 0 x — x 1 Thus for face = 1 the output is: corner=0 : 1, corner=1: 3
The order in which the corners must be given is determined by the eclass of element: LINE/QUAD/TRIANGLE: No specific order. HEX : In Z-order of the face starting with the lowest corner number. TET : Starting with the lowest corner number counterclockwise as seen from ‘outside’ of the element.
- Parameters:
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.
-
static inline constexpr int element_get_corner_face([[maybe_unused]] const t8_element_t *element, const int corner, const int face) noexcept
Return the face numbers of the faces sharing an element’s corner.
Example quad: 2 x — x 3 | | | | face 1 0 x — x 1 face 2 Thus for corner = 1 the output is: face=0 : 2, face=1: 1
- Parameters:
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.
-
static inline constexpr t8_element_shape_t element_get_face_shape([[maybe_unused]] const t8_element_t *elem, [[maybe_unused]] const int face) noexcept
Compute the shape of the face of an element.
- Parameters:
elem – [in] The element.
face – [in] A face of elem.
- 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.
-
static inline constexpr void element_copy(const t8_element_t *source, t8_element_t *dest) noexcept
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:
source – [in] The element whose entries will be copied to dest.
dest – [inout] This element’s entries will be overwrite with the entries of source.
-
static inline constexpr int element_is_equal(const t8_element_t *elem1, const t8_element_t *elem2) noexcept
Check if two elements are equal.
- Parameters:
elem1 – [in] The first element.
elem2 – [in] The second element.
- Returns:
true if the elements are equal, false if they are not equal
-
static inline constexpr int element_get_level(const t8_element_t *elem) noexcept
Return the level of a particular element.
- Parameters:
elem – [in] The element whose level should be returned.
- Returns:
The level of elem.
-
static inline constexpr void set_to_root(t8_element_t *elem) noexcept
create the root element
- Parameters:
elem – [inout] The element that is filled with the root
-
static inline constexpr void element_get_parent(const t8_element_t *elem, t8_element_t *parent) noexcept
Compute the parent of a given element elem and store it in parent.
parent needs to be an existing element. No memory is allocated by this function. elem and parent can point to the same element, then the entries of elem are overwritten by the ones of its parent.
- Parameters:
elem – [in] The element whose parent will be computed.
parent – [inout] This element’s entries will be overwritten by those of elem’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 elem’s childid.
-
static inline constexpr int element_get_num_siblings(const t8_element_t *elem) noexcept
Compute the number of siblings of an element.
That is the number of elements with the same parent (if available).
- Parameters:
elem – [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. Note that the number of siblings is 1 for the root element.
-
static inline constexpr void element_get_sibling([[maybe_unused]] const t8_element_t *elem, [[maybe_unused]] const int sibid, [[maybe_unused]] t8_element_t *sibling) noexcept
Compute a specific sibling of a given element elem and store it in sibling.
sibling needs to be an existing element. No memory is allocated by this function. elem and sibling can point to the same element, then the entries of elem are overwritten by the ones of its sibid-th sibling.
- Parameters:
elem – [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 elem’s sibid-th sibling. The storage for this element must exist and match the element class of the sibling.
-
static inline constexpr void element_get_child(const t8_element_t *elem, const int childid, t8_element_t *child) noexcept
Construct the child element of a given number.
See also
t8_element_child_eclass
- Parameters:
elem – [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 and match the element class of the child. For a pyramid, for example, it may be either a tetrahedron or a pyramid depending on childid. This can be checked by t8_element_child_eclass. On output, a valid element. It is valid to call this function with elem = child.
-
static inline constexpr int element_get_num_children([[maybe_unused]] const t8_element_t *elem) noexcept
Return the number of children of an element when it is refined.
- Parameters:
elem – [in] The element whose number of children is returned.
- Returns:
The number of children of elem if it is to be refined.
-
static inline constexpr int get_max_num_children() noexcept
Return the max number of children of an eclass.
- Returns:
The max number of children of element.
-
static inline constexpr bool element_is_refinable(const t8_element_t *elem) noexcept
Indicates if an element is refinable.
Possible reasons for being not refinable could be that the element has reached its max level.
- Parameters:
elem – [in] The element to check.
- Returns:
True if the element is refinable.
-
static inline constexpr void element_get_children(const t8_element_t *elem, const int length, t8_element_t *c[]) noexcept
Construct all children of a given element.
See also
t8_element_num_children
See also
t8_element_child_eclass
- Parameters:
elem – [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 and match the element class in the children’s ordering. On output, all children are valid. It is valid to call this function with elem = c[0].
-
static inline constexpr int element_get_child_id(const t8_element_t *elem) noexcept
Compute the child id of an element.
- Parameters:
elem – [in] This must be a valid element.
- Returns:
The child id of elem.
-
static inline constexpr int element_get_ancestor_id(const t8_element_t *elem, const t8_element_level level) noexcept
Compute the ancestor id of an element, that is the child id at a given level.
- Parameters:
elem – [in] This must be a valid element.
level – [in] A refinement level. Must satisfy level < elem.level
- Returns:
The child_id of elem in regard to its level ancestor.
-
static inline constexpr int elements_are_family(t8_element_t *const *fam) noexcept
Query whether a given set of elements is a family or not.
Note
level 0 elements do not form a family.
- Parameters:
fam – [in] An array of as many elements as an element of class ts has siblings.
- Returns:
Zero if fam is not a family, nonzero if it is.
-
static inline constexpr void element_get_nca(const t8_element_t *elem1, const t8_element_t *elem2, t8_element_t *nca) noexcept
Compute the nearest common ancestor of two elements.
That is, the element with highest level that still has both given elements as descendants.
- Parameters:
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.
-
static inline constexpr void element_get_first_descendant(const t8_element_t *elem, t8_element_t *desc, const t8_element_level level) noexcept
Compute the first descendant of a given element.
- Parameters:
elem – [in] The element whose descendant is computed.
desc – [out] The first element in a uniform refinement of elem of the given level.
level – [in] The level, at which the descendant is computed.
-
static inline constexpr void element_get_last_descendant(const t8_element_t *elem, t8_element_t *desc, const t8_element_level level) noexcept
Compute the last descendant of a given element.
- Parameters:
elem – [in] The element whose descendant is computed.
desc – [out] The last element in a uniform refinement of elem of the given level.
level – [in] The level, at which the descendant is computed.
-
static inline constexpr int element_get_num_face_children([[maybe_unused]] const t8_element_t *elem, [[maybe_unused]] const int face) noexcept
Return the number of children of an element’s face when the element is refined.
- Parameters:
elem – [in] The element whose face is considered.
face – [in] A face of elem.
- Returns:
The number of children of face if elem is to be refined.
-
static inline constexpr void element_get_children_at_face([[maybe_unused]] const t8_element_t *elem, const int face, t8_element_t *children[], const int num_children, [[maybe_unused]] int *child_indices) noexcept
Given an element and a face of the element, compute all children of the element that touch the face.
- Parameters:
elem – [in] The element.
face – [in] A face of elem.
children – [inout] Allocated elements, in which the children of elem 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 elem = children[0].
-
static inline constexpr int element_face_get_child_face([[maybe_unused]] const t8_element_t *elem, const int face, [[maybe_unused]] const int face_child) noexcept
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 elem face face_child Returns the face number f
- Parameters:
elem – [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 elem 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 elem that coincides with face_child.
-
static inline constexpr int element_face_get_parent_face([[maybe_unused]] const t8_element_t *elem, const int face) noexcept
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:
elem – [in] The element.
face – [in] Then number of the face.
- Returns:
If face of elem is also a face of elem’s parent, the face number of this face. Otherwise -1.
-
static inline constexpr void element_get_first_descendant_face(const t8_element_t *elem, const int face, t8_element_t *first_desc, const t8_element_level level) noexcept
Construct the first descendant of an element at a given level that touches a given face.
- Parameters:
elem – [in] The input element.
face – [in] A face of elem.
first_desc – [inout] An allocated element. This element’s data will be filled with the data of the first descendant of elem that shares a face with face.
level – [in] The level, at which the first descendant is constructed
-
static inline constexpr void element_get_last_descendant_face([[maybe_unused]] const t8_element_t *elem, const int face, t8_element_t *last_desc, const t8_element_level level) noexcept
Construct the last descendant of an element at a given level that touches a given face.
- Parameters:
elem – [in] The input element.
face – [in] A face of elem.
last_desc – [inout] An allocated element. This element’s data will be filled with the data of the last descendant of elem that shares a face with face.
level – [in] The level, at which the last descendant is constructed
-
static inline constexpr int element_is_root_boundary(const t8_element_t *elem, const int face) noexcept
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:
elem – [in] The input element.
face – [in] A face of elem.
- Returns:
True if face is a subface of the element’s root element.
-
static inline constexpr int element_get_tree_face([[maybe_unused]] const t8_element_t *elem, const int face) noexcept
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 t8_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:
elem – [in] The element.
face – [in] The index of a face of elem.
- 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.
-
static inline constexpr int element_get_face_neighbor_inside([[maybe_unused]] const t8_element_t *elem, t8_element_t *neigh, const int face, int *neigh_face) noexcept
Construct the face neighbor of a given element if this face neighbor is inside the root tree.
Return 0 otherwise.
- Parameters:
elem – [in] The element to be considered.
neigh – [inout] If the face neighbor of elem 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.
-
static inline void element_transform_face([[maybe_unused]] const t8_element_t *elem1, [[maybe_unused]] t8_element_t *elem2, [[maybe_unused]] const int orientation, [[maybe_unused]] const int sign, [[maybe_unused]] const int is_smaller_face) noexcept
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.
See also
Note
elem1 and elem2 may point to the same element.
- Parameters:
elem1 – [in] The face element.
elem2 – [inout] On return the face element elem1 with respective 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.
-
static inline constexpr int element_extrude_face([[maybe_unused]] const t8_element_t *face, [[maybe_unused]] t8_element_t *elem, [[maybe_unused]] const int root_face, [[maybe_unused]] const t8_scheme *scheme) noexcept
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:
face – [in] A face element.
elem – [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.
scheme – [in] The scheme collection with a scheme for the eclass of the face.
- Returns:
The face number of the face of elem that coincides with face.
-
static inline constexpr void element_get_boundary_face(const t8_element_t *elem, const int face, [[maybe_unused]] t8_element_t *boundary, [[maybe_unused]] const t8_scheme *scheme) noexcept
Construct the boundary element at a specific face.
- Parameters:
elem – [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.
scheme – [in] The scheme containing an eclass scheme for the boundary face. If elem is of class T8_ECLASS_VERTEX, then boundary must be NULL and will not be modified.
-
static inline constexpr void element_set_linear_id(t8_element_t *elem, const t8_element_level level, t8_linearidx_t id) noexcept
Initialize the entries of an allocated element according to a given linear id in a uniform refinement.
- Parameters:
elem – [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’
-
static inline constexpr t8_linearidx_t element_get_linear_id(const t8_element_t *elem, const t8_element_level level) noexcept
Compute the linear id of a given element in a hypothetical uniform refinement of a given level.
- Parameters:
elem – [in] The element whose id we compute.
level – [in] The level of the uniform refinement to consider.
- Returns:
The linear id of the element.
-
static inline constexpr void element_construct_successor(const t8_element_t *elem1, t8_element_t *elem2) noexcept
Construct the successor in a uniform refinement of a given element.
- Parameters:
elem1 – [in] The element whose successor should be constructed.
elem2 – [inout] The element whose entries will be set.
-
static inline constexpr t8_gloidx_t element_count_leaves(const t8_element_t *elem, const t8_element_level level) noexcept
Count how many leaf descendants of a given uniform level an element would produce.
Example: If elem 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 elem’s level is 0, and level = 3, the return value is 2^3 = 8.
- Parameters:
elem – [in] The element to be checked.
level – [in] A refinement level.
- Returns:
Suppose elem is uniformly refined up to level level. The return value is the resulting number of elements (of the given level). If level < t8_element_level(t), the return value should be 0.
-
static inline constexpr t8_gloidx_t count_leaves_from_root(const t8_element_level level) noexcept
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:
level – [in] A refinement level.
- Returns:
The value of t8_element_count_leaves if the input element is the root (level 0) element.
-
static inline constexpr int element_compare(const t8_element_t *elem1, const t8_element_t *elem2) noexcept
Compare two elements.
- Parameters:
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.
-
static inline constexpr void element_get_vertex_reference_coords(const t8_element_t *elem, const int vertex, double coords[]) noexcept
Compute the coordinates of a given element vertex inside a reference tree that is embedded into [0,1]^d (d = dimension).
- Parameters:
elem – [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.
-
static inline constexpr void element_get_reference_coords(const t8_element_t *elem, const double *ref_coords, const size_t num_coords, double *out_coords) noexcept
Convert a point in the reference space of an element to a point in the reference space of the tree.
- Parameters:
elem – [in] The element.
ref_coords – [in] The coordinates of the point in the reference space of the element.
num_coords – [in] The number of coordinates to evaluate.
out_coords – [out] The coordinates of the point in the reference space of the tree.
-
static inline void element_init([[maybe_unused]] const int length, [[maybe_unused]] t8_element_t *elems) noexcept
Initialize an array of allocated elements.
See also
See also
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_new should initialize an element in the same way as a call to element_init would.
- Parameters:
length – [in] The number of elements to be initialized.
elems – [inout] On input an array of length many allocated elements.
-
static inline constexpr void element_deinit([[maybe_unused]] const int length, [[maybe_unused]] t8_element_t *elems) noexcept
Deinitialize an array of allocated elements.
See also
Note
Call this function if you called element_init on the element pointers.
- Parameters:
length – [in] The number of elements to be deinitialized.
elems – [inout] On input an array of length many allocated and initialized elements, on output an array of length many allocated, but not initialized elements.
-
static inline constexpr int element_is_valid(const t8_element_t *elem) noexcept
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 (elem)) in the implementation of each of the functions in this file.
- Parameters:
elem – [in] The element to be checked.
- Returns:
True if elem is safe to use. False otherwise.
-
static inline constexpr void element_debug_print(const t8_element_t *elem) noexcept
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:
elem – [in] The element to print
-
static inline constexpr void element_to_string(const t8_element_t *elem, char *debug_string, const int string_size) noexcept
Fill a string with readable information about the element.
- Parameters:
elem – [in] The element to translate into human-readable information
debug_string – [inout] The string to fill.
string_size – [in] Buffer size of c-string
-
inline t8_standalone_scheme() noexcept