t8
UNKNOWN
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
|
This file defines the c interface to (some of) the member functions of the t8_eclass_scheme_c class. More...
#include <t8_element.h>
Go to the source code of this file.
Functions | |
size_t | t8_element_size (const t8_eclass_scheme_c *ts) |
Return the size of any element of a given class. More... | |
int | t8_element_refines_irregular (const t8_eclass_scheme_c *ts) |
Returns true, if there is one element in the tree, that does not refine into 2^dim children. More... | |
int | t8_element_maxlevel (const t8_eclass_scheme_c *ts) |
Return the maximum allowed level for any element of a given class. More... | |
int | t8_element_level (const t8_eclass_scheme_c *ts, const t8_element_t *elem) |
void | t8_element_copy (const t8_eclass_scheme_c *ts, const t8_element_t *source, t8_element_t *dest) |
Copy all entries of source to dest. More... | |
int | t8_element_compare (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2) |
Compare two elements with respect to the scheme. More... | |
int | t8_element_equal (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2) |
Check if two elements are equal. More... | |
void | t8_element_parent (const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *parent) |
Compute the parent of a given element elem and store it in parent. More... | |
int | t8_element_num_siblings (const t8_eclass_scheme_c *ts, const t8_element_t *elem) |
Compute the number of siblings of an element. More... | |
void | t8_element_sibling (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int sibid, t8_element_t *sibling) |
Compute a specific sibling of a given element elem and store it in sibling. More... | |
int | t8_element_num_corners (const t8_eclass_scheme_c *ts, const t8_element_t *elem) |
Compute the number of corners of an element. More... | |
int | t8_element_num_faces (const t8_eclass_scheme_c *ts, const t8_element_t *elem) |
Compute the number of faces of an element. More... | |
int | t8_element_max_num_faces (const t8_eclass_scheme_c *ts, const t8_element_t *elem) |
Compute the maximum number of faces of a given element and all of its descendants. More... | |
int | t8_element_num_children (const t8_eclass_scheme_c *ts, const t8_element_t *elem) |
Compute the number of children of an element when it is refined. More... | |
int | t8_element_num_face_children (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face) |
Compute the number of children of an element's face when the element is refined. More... | |
int | t8_element_get_face_corner (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, int corner) |
Return the corner number of an element's face corner. More... | |
int | t8_element_get_corner_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int corner, int face) |
Compute the face numbers of the faces sharing an element's corner. More... | |
void | t8_element_child (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int childid, t8_element_t *child) |
Construct the child element of a given number. More... | |
void | t8_element_children (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int length, t8_element_t *c[]) |
Construct all children of a given element. More... | |
int | t8_element_child_id (const t8_eclass_scheme_c *ts, const t8_element_t *elem) |
Compute the child id of an element. More... | |
int | t8_element_ancestor_id (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int level) |
Compute the ancestor id of an element, that is the child id at a given level. More... | |
int | t8_element_is_family (const t8_eclass_scheme_c *ts, t8_element_t *const *fam) |
Query whether a given set of elements is a family or not. More... | |
void | t8_element_nca (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2, t8_element_t *nca) |
Compute the nearest common ancestor of two elements. More... | |
t8_element_shape_t | t8_element_face_shape (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face) |
Compute the shape of the face of an element. More... | |
void | t8_element_children_at_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, t8_element_t *children[], int num_children, int *child_indices) |
Given an element and a face of the element, compute all children of the element that touch the face. More... | |
int | t8_element_face_child_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, int face_child) |
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. More... | |
int | t8_element_face_parent_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face) |
Given a face of an element return the face number of the parent of the element that matches the element's face. More... | |
int | t8_element_tree_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face) |
Given an element and a face of this element. More... | |
void | t8_element_transform_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, t8_element_t *elem2, int orientation, int sign, int is_smaller_face) |
Suppose we have two trees that share a common face f. More... | |
int | t8_element_extrude_face (const t8_eclass_scheme_c *ts, const t8_element_t *face, const t8_eclass_scheme_c *face_scheme, t8_element_t *elem, int root_face) |
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. More... | |
void | t8_element_boundary_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, t8_element_t *boundary, const t8_eclass_scheme_c *boundary_scheme) |
Construct the boundary element at a specific face. More... | |
void | t8_element_first_descendant_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, t8_element_t *first_desc, int level) |
Construct the first descendant of an element at a given level that touches a given face. More... | |
void | t8_element_last_descendant_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, t8_element_t *last_desc, int level) |
Construct the last descendant of an element at a given level that touches a given face. More... | |
int | t8_element_is_root_boundary (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face) |
Compute whether a given element shares a given face with its root tree. More... | |
int | t8_element_face_neighbor_inside (const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *neigh, int face, int *neigh_face) |
Construct the face neighbor of a given element if this face neighbor is inside the root tree. More... | |
t8_element_shape_t | t8_element_shape (const t8_eclass_scheme_c *ts, const t8_element_t *elem) |
Return the shape of an allocated element according its type. More... | |
void | t8_element_set_linear_id (const t8_eclass_scheme_c *ts, t8_element_t *elem, int level, t8_linearidx_t id) |
Initialize the entries of an allocated element according to a given linear id in a uniform refinement. More... | |
t8_linearidx_t | t8_element_get_linear_id (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int level) |
Compute the linear id of a given element in a hypothetical uniform refinement of a given level. More... | |
void | t8_element_first_descendant (const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *desc, int level) |
Compute the first descendant of a given element. More... | |
void | t8_element_last_descendant (const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *desc, int level) |
Compute the last descendant of a given element. More... | |
void | t8_element_successor (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, t8_element_t *elem2) |
Construct the successor in a uniform refinement of a given element. More... | |
void | t8_element_vertex_reference_coords (const t8_eclass_scheme_c *ts, const t8_element_t *t, const int vertex, double coords[]) |
Compute the coordinates of a given element vertex inside a reference tree that is embedded into [0,1]^d (d = dimension). More... | |
t8_gloidx_t | t8_element_count_leaves (const t8_eclass_scheme_c *ts, const t8_element_t *t, int level) |
Count how many leaf descendants of a given uniform level an element would produce. More... | |
t8_gloidx_t | t8_element_count_leaves_from_root (const t8_eclass_scheme_c *ts, int level) |
Count how many leaf descendants of a given uniform level the root element will produce. More... | |
int | t8_element_is_valid (const t8_eclass_scheme_c *ts, const t8_element_t *elem) |
Query whether a given element can be considered as 'valid' and it is safe to perform any of the above algorithms on it. More... | |
void | t8_element_debug_print (const t8_eclass_scheme_c *ts, const t8_element_t *elem) |
Print a given element. More... | |
void | t8_element_to_string (const t8_eclass_scheme_c *ts, const t8_element_t *elem, char *debug_string, const int string_size) |
Fill a string with readable information about the element. More... | |
void | t8_element_new (const t8_eclass_scheme_c *ts, int length, t8_element_t **elems) |
Allocate memory for an array of elements of a given class and initialize them. More... | |
void | t8_element_destroy (const t8_eclass_scheme_c *ts, int length, t8_element_t **elems) |
Deallocate an array of elements. More... | |
void | t8_element_root (const t8_eclass_scheme_c *ts, t8_element_t *elem) |
Fills an element with the root element. More... | |
void | t8_element_MPI_Pack (const t8_eclass_scheme_c *ts, t8_element_t **const elements, const unsigned int count, void *send_buffer, const int buffer_size, int *position, sc_MPI_Comm comm) |
Pack multiple elements into contiguous memory, so they can be sent via MPI. More... | |
void | t8_element_MPI_Pack_size (const t8_eclass_scheme_c *ts, const unsigned int count, sc_MPI_Comm comm, int *pack_size) |
Determine an upper bound for the size of the packed message of count elements. More... | |
void | t8_element_MPI_Unpack (const t8_eclass_scheme_c *ts, void *recvbuf, const int buffer_size, int *position, t8_element_t **elements, const unsigned int count, sc_MPI_Comm comm) |
Unpack multiple elements from contiguous memory that was received via MPI. More... | |
This file defines the c interface to (some of) the member functions of the t8_eclass_scheme_c class.
We recommend to use the C++ functions directly and only use this interface when you really need to use C.
int t8_element_ancestor_id | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | level | ||
) |
Compute the ancestor id of an element, that is the child id at a given level.
[in] | ts | Implementation of a class scheme. |
[in] | elem | This must be a valid element. |
[in] | level | A refinement level. Must satisfy level < elem.level |
void t8_element_boundary_face | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | face, | ||
t8_element_t * | boundary, | ||
const t8_eclass_scheme_c * | boundary_scheme | ||
) |
Construct the boundary element at a specific face.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The input element. |
[in] | face | The index of the face of which to construct the boundary element. |
[in,out] | boundary | An allocated element of dimension of element minus 1. The entries will be filled with the entries of the face of element. |
[in] | boundary_scheme | The scheme for the eclass of the boundary face. If elem is of class T8_ECLASS_VERTEX, then boundary must be NULL and will not be modified. |
void t8_element_child | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | childid, | ||
t8_element_t * | child | ||
) |
Construct the child element of a given number.
[in] | ts | Implementation of a class scheme. |
[in] | elem | This must be a valid element, bigger than maxlevel. |
[in] | childid | The number of the child to construct. |
[in,out] | child | The storage for this element must exist. On output, a valid element. It is valid to call this function with elem = child. |
int t8_element_child_id | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem | ||
) |
Compute the child id of an element.
[in] | ts | Implementation of a class scheme. |
[in] | elem | This must be a valid element. |
void t8_element_children | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | length, | ||
t8_element_t * | c[] | ||
) |
Construct all children of a given element.
[in] | ts | Implementation of a class scheme. |
[in] | elem | This must be a valid element, bigger than maxlevel. |
[in] | length | The length of the output array c must match the number of children. |
[in,out] | c | 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]. |
void t8_element_children_at_face | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | face, | ||
t8_element_t * | children[], | ||
int | num_children, | ||
int * | child_indices | ||
) |
Given an element and a face of the element, compute all children of the element that touch the face.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element. |
[in] | face | A face of elem. |
[in,out] | children | 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. |
[in] | num_children | The number of elements in children. Must match the number of children that touch face. t8_element_num_face_children |
[in,out] | child_indices | 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]. |
int t8_element_compare | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem1, | ||
const t8_element_t * | elem2 | ||
) |
Compare two elements with respect to the scheme.
[in] | ts | Implementation of a class scheme. |
[in] | elem1 | The first element. |
[in] | elem2 | The second element. |
void t8_element_copy | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | source, | ||
t8_element_t * | dest | ||
) |
Copy all entries of source to dest.
dest must be an existing element. No memory is allocated by this function.
[in] | ts | Implementation of a class scheme. |
[in] | source | The element whose entries will be copied to dest. |
[in,out] | dest | This element's entries will be overwritten with the entries of source. |
t8_gloidx_t t8_element_count_leaves | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | t, | ||
int | level | ||
) |
Count how many leaf descendants of a given uniform level an element would produce.
[in] | ts | Implementation of a class scheme. |
[in] | t | The element to be checked. |
[in] | level | A refinement level. |
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.
t8_gloidx_t t8_element_count_leaves_from_root | ( | const t8_eclass_scheme_c * | ts, |
int | level | ||
) |
Count how many leaf descendants of a given uniform level the root element will produce.
[in] | ts | Implementation of a class scheme. |
[in] | level | A refinement level. |
This is a convenience function, and can be implemented via t8_element_count_leaves.
void t8_element_debug_print | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem | ||
) |
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.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element to print |
void t8_element_destroy | ( | const t8_eclass_scheme_c * | ts, |
int | length, | ||
t8_element_t ** | elems | ||
) |
Deallocate an array of elements.
[in] | ts | Implementation of a class scheme. |
[in] | length | The number of elements in the array. |
[in,out] | elems | On input an array of length many allocated element pointers. On output all these pointers will be freed. elem itself will not be freed by this function. |
int t8_element_equal | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem1, | ||
const t8_element_t * | elem2 | ||
) |
Check if two elements are equal.
[in] | ts | Implementation of a class scheme. |
[in] | elem1 | The first element. |
[in] | elem2 | The second element. |
int t8_element_extrude_face | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | face, | ||
const t8_eclass_scheme_c * | face_scheme, | ||
t8_element_t * | elem, | ||
int | root_face | ||
) |
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.
[in] | ts | Implementation of a class scheme. |
[in] | face | A face element. |
[in] | face_scheme | The scheme for the face element. |
[in,out] | elem | 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. |
[in] | root_face | The index of the face of the root tree in which face lies. |
int t8_element_face_child_face | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | face, | ||
int | face_child | ||
) |
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 *
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element. |
[in] | face | Then number of the face. |
[in] | face_child | 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 t8_element_children_at_face. |
int t8_element_face_neighbor_inside | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
t8_element_t * | neigh, | ||
int | face, | ||
int * | neigh_face | ||
) |
Construct the face neighbor of a given element if this face neighbor is inside the root tree.
Return 0 otherwise.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element to be considered. |
[in,out] | neigh | 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. |
[in] | face | The number of the face along which the neighbor should be constructed. |
[out] | neigh_face | The number of face as viewed from neigh. An arbitrary value, if the neighbor is not inside the root tree. |
int t8_element_face_parent_face | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | face | ||
) |
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.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element. |
[in] | face | Then number of the face. |
t8_element_shape_t t8_element_face_shape | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | face | ||
) |
Compute the shape of the face of an element.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element. |
[in] | face | A face of elem. |
void t8_element_first_descendant | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
t8_element_t * | desc, | ||
int | level | ||
) |
Compute the first descendant of a given element.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element whose descendant is computed. |
[out] | desc | The first element in a uniform refinement of elem of the maximum possible level. |
void t8_element_first_descendant_face | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | face, | ||
t8_element_t * | first_desc, | ||
int | level | ||
) |
Construct the first descendant of an element at a given level that touches a given face.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The input element. |
[in] | face | A face of elem. |
[in,out] | first_desc | 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. |
[in] | level | The level, at which the first descendant is constructed |
int t8_element_get_corner_face | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | corner, | ||
int | face | ||
) |
Compute 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
[in] | ts | Implementation of a class scheme. |
[in] | element | The element. |
[in] | corner | A corner index for the face. |
[in] | face | A face index for corner. |
int t8_element_get_face_corner | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | face, | ||
int | corner | ||
) |
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
[in] | ts | Implementation of a class scheme. |
[in] | element | The element. |
[in] | face | A face index for element. |
[in] | corner | A corner index for the face 0 <= corner < num_face_corners. |
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.
t8_linearidx_t t8_element_get_linear_id | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | level | ||
) |
Compute the linear id of a given element in a hypothetical uniform refinement of a given level.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element whose id we compute. |
[in] | level | The level of the uniform refinement to consider. |
int t8_element_is_family | ( | const t8_eclass_scheme_c * | ts, |
t8_element_t *const * | fam | ||
) |
Query whether a given set of elements is a family or not.
[in] | ts | Implementation of a class scheme. |
[in] | fam | An array of as many elements as an element of class ts has children. |
int t8_element_is_root_boundary | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | face | ||
) |
Compute whether a given element shares a given face with its root tree.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The input element. |
[in] | face | A face of elem. |
int t8_element_is_valid | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem | ||
) |
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.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element to be checked. |
void t8_element_last_descendant | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
t8_element_t * | desc, | ||
int | level | ||
) |
Compute the last descendant of a given element.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element whose descendant is computed. |
[out] | desc | The last element in a uniform refinement of elem of the maximum possible level. |
void t8_element_last_descendant_face | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | face, | ||
t8_element_t * | last_desc, | ||
int | level | ||
) |
Construct the last descendant of an element at a given level that touches a given face.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The input element. |
[in] | face | A face of elem. |
[in,out] | last_desc | 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. |
[in] | level | The level, at which the last descendant is constructed |
int t8_element_max_num_faces | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem | ||
) |
Compute the maximum number of faces of a given element and all of its descendants.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element. |
int t8_element_maxlevel | ( | const t8_eclass_scheme_c * | ts | ) |
Return the maximum allowed level for any element of a given class.
[in] | ts | Implementation of a class scheme. |
void t8_element_MPI_Pack | ( | const t8_eclass_scheme_c * | ts, |
t8_element_t **const | elements, | ||
const unsigned int | count, | ||
void * | send_buffer, | ||
const int | buffer_size, | ||
int * | position, | ||
sc_MPI_Comm | comm | ||
) |
Pack multiple elements into contiguous memory, so they can be sent via MPI.
[in] | ts | Implementation of a class scheme. |
[in] | elements | Array of elements that are to be packed |
[in] | count | Number of elements to pack |
[in,out] | send_buffer | Buffer in which to pack the elements |
[in] | buffer_size | size of the buffer (in order to check that we don't access out of range) |
[in,out] | position | the position of the first byte that is not already packed |
[in] | comm | MPI Communicator |
void t8_element_MPI_Pack_size | ( | const t8_eclass_scheme_c * | ts, |
const unsigned int | count, | ||
sc_MPI_Comm | comm, | ||
int * | pack_size | ||
) |
Determine an upper bound for the size of the packed message of count elements.
[in] | ts | Implementation of a class scheme. |
[in] | count | Number of elements to pack |
[in] | comm | MPI Communicator |
[out] | pack_size | upper bound on the message size |
void t8_element_MPI_Unpack | ( | const t8_eclass_scheme_c * | ts, |
void * | recvbuf, | ||
const int | buffer_size, | ||
int * | position, | ||
t8_element_t ** | elements, | ||
const unsigned int | count, | ||
sc_MPI_Comm | comm | ||
) |
Unpack multiple elements from contiguous memory that was received via MPI.
[in] | ts | Implementation of a class scheme. |
[in] | recvbuf | Buffer from which to unpack the elements |
[in] | buffer_size | size of the buffer (in order to check that we don't access out of range) |
[in,out] | position | the position of the first byte that is not already packed |
[in] | elements | Array of initialised elements that is to be filled from the message |
[in] | count | Number of elements to unpack |
[in] | comm | MPI Communicator |
void t8_element_nca | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem1, | ||
const t8_element_t * | elem2, | ||
t8_element_t * | nca | ||
) |
Compute the nearest common ancestor of two elements.
That is, the element with highest level that still has both given elements as descendants.
[in] | ts | Implementation of a class scheme. |
[in] | elem1 | The first of the two input elements. |
[in] | elem2 | The second of the two input elements. |
[in,out] | nca | 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. |
void t8_element_new | ( | const t8_eclass_scheme_c * | ts, |
int | length, | ||
t8_element_t ** | elems | ||
) |
Allocate memory for an array of elements of a given class and initialize them.
[in] | ts | Implementation of a class scheme. |
[in] | length | The number of elements to be allocated. |
[in,out] | elems | On input an array of length many unallocated element pointers. On output all these pointers will point to an allocated and initialized element. |
int t8_element_num_children | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem | ||
) |
Compute the number of children of an element when it is refined.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element. |
int t8_element_num_corners | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem | ||
) |
Compute the number of corners of an element.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element. |
int t8_element_num_face_children | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | face | ||
) |
Compute the number of children of an element's face when the element is refined.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element. |
[in] | face | A face of elem. |
int t8_element_num_faces | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem | ||
) |
Compute the number of faces of an element.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element. |
int t8_element_num_siblings | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem | ||
) |
Compute the number of siblings of an element.
That is the number of Children of its parent.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element. |
void t8_element_parent | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
t8_element_t * | parent | ||
) |
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.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element whose parent will be computed. |
[in,out] | parent | 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. |
int t8_element_refines_irregular | ( | const t8_eclass_scheme_c * | ts | ) |
Returns true, if there is one element in the tree, that does not refine into 2^dim children.
Returns false otherwise.
void t8_element_root | ( | const t8_eclass_scheme_c * | ts, |
t8_element_t * | elem | ||
) |
Fills an element with the root element.
[in] | ts | Implementation of a class scheme. |
[in,out] | elem | The element to be filled with root. |
void t8_element_set_linear_id | ( | const t8_eclass_scheme_c * | ts, |
t8_element_t * | elem, | ||
int | level, | ||
t8_linearidx_t | id | ||
) |
Initialize the entries of an allocated element according to a given linear id in a uniform refinement.
[in] | ts | Implementation of a class scheme. |
[in,out] | elem | The element whose entries will be set. |
[in] | level | The level of the uniform refinement to consider. |
[in] | id | The linear id. id must fulfil 0 <= id < 'number of leaves in the uniform refinement' |
t8_element_shape_t t8_element_shape | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem | ||
) |
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.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element to be considered |
void t8_element_sibling | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | sibid, | ||
t8_element_t * | sibling | ||
) |
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 i-th sibling.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element whose sibling will be computed. |
[in] | sibid | The id of the sibling computed. |
[in,out] | sibling | 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. |
size_t t8_element_size | ( | const t8_eclass_scheme_c * | ts | ) |
Return the size of any element of a given class.
void t8_element_successor | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem1, | ||
t8_element_t * | elem2 | ||
) |
Construct the successor in a uniform refinement of a given element.
[in] | ts | Implementation of a class scheme. |
[in] | elem1 | The element whose successor should be constructed. |
[in,out] | elem2 | The element whose entries will be set. |
[in] | level | The level of the uniform refinement to consider. |
void t8_element_to_string | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
char * | debug_string, | ||
const int | string_size | ||
) |
Fill a string with readable information about the element.
[in] | elem | The element to translate into human-readable information |
[in,out] | debug_string | The string to fill. |
void t8_element_transform_face | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem1, | ||
t8_element_t * | elem2, | ||
int | orientation, | ||
int | sign, | ||
int | is_smaller_face | ||
) |
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.
[in] | ts | Implementation of a class scheme. |
[in] | elem1 | The face element. |
[in,out] | elem2 | On return the face element elem1 with respect to the coordinate system of the other tree. |
[in] | orientation | The orientation of the tree-tree connection. |
[in] | sign | 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. orientattion). t8_eclass_face_orientation |
[in] | is_smaller_face | 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. |
int t8_element_tree_face | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | elem, | ||
int | face | ||
) |
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.
[in] | ts | Implementation of a class scheme. |
[in] | elem | The element. |
[in] | face | The index of a face of elem. |
void t8_element_vertex_reference_coords | ( | const t8_eclass_scheme_c * | ts, |
const t8_element_t * | t, | ||
const int | vertex, | ||
double | coords[] | ||
) |
Compute the coordinates of a given element vertex inside a reference tree that is embedded into [0,1]^d (d = dimension).
[in] | t | The element to be considered. |
[in] | vertex | The id of the vertex whose coordinates shall be computed. |
[out] | coords | An array of at least as many doubles as the element's dimension whose entries will be filled with the coordinates of vertex. |