t8  1.2.0
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
Functions | Variables
t8_dprism_bits.h File Reference

Definition if prism-specific functions. More...

#include <t8_element.h>
#include <t8_schemes/t8_default/t8_default_prism/t8_dprism.h>

Go to the source code of this file.

Functions

int t8_dprism_get_level (const t8_dprism_t *p)
 Compute the level of a prism. More...
 
void t8_dprism_copy (const t8_dprism_t *p, t8_dprism_t *dest)
 Copy all values from one prism to another. More...
 
int t8_dprism_compare (const t8_dprism_t *p1, const t8_dprism_t *p2)
 Compare two elements. More...
 
void t8_dprism_init_linear_id (t8_dprism_t *p, int level, t8_linearidx_t id)
 Initialize a prism as the prism with a given global id in a uniform refinement of a given level. More...
 
void t8_dprism_successor (const t8_dprism_t *p, t8_dprism_t *succ, int level)
 Computes the successor of a prism in a uniform grid of level level. More...
 
void t8_dprism_parent (const t8_dprism_t *p, t8_dprism_t *parent)
 Compute the parent of a prism. More...
 
void t8_dprism_first_descendant (const t8_dprism_t *p, t8_dprism_t *desc, int level)
 Compute the first descendant of a prism at a given level. More...
 
int t8_dprism_child_id (const t8_dprism_t *p)
 Compute the position of the ancestor of this child at level level within its siblings. More...
 
int t8_dprism_is_familypv (t8_dprism_t **fam)
 Check whether a collection of eight prism is a family in Morton order. More...
 
void t8_dprism_nearest_common_ancestor (const t8_dprism_t *p1, const t8_dprism_t *p2, t8_dprism_t *r)
 Computes the nearest common ancestor of two prisms in the same tree. More...
 
void t8_dprism_boundary_face (const t8_dprism_t *p, int face, t8_element_t *boundary)
 Constructs the boundary element of a prism at a given face. More...
 
int t8_dprism_is_root_boundary (const t8_dprism_t *p, int face)
 Compute whether a given prism shares a given face with its root tree. More...
 
int t8_dprism_is_inside_root (t8_dprism_t *p)
 Test if a prism lies inside of the root prism, that is the triangle of level 0, anchor node (0,0) and type 0. More...
 
void t8_dprism_child (const t8_dprism_t *p, int childid, t8_dprism_t *child)
 Compute the childid-th child in Morton order of a prism. More...
 
t8_element_shape_t t8_dprism_face_shape (const t8_dprism_t *p, int face)
 Return the shape of a face. More...
 
int t8_dprism_num_face_children (const t8_dprism_t *p, int face)
 Compute the number of children at a given face. More...
 
int t8_dprism_face_neighbour (const t8_dprism_t *p, int face, t8_dprism_t *neigh)
 Compute the face neighbor of a prism. More...
 
int t8_dprism_get_face_corner (const t8_dprism_t *p, int face, int corner)
 Return the corner number of a prism corresponding to a given face corner. More...
 
void t8_dprism_childrenpv (const t8_dprism_t *p, int length, t8_dprism_t *c[])
 Compute the 8 children of a prism, array version. More...
 
int t8_dprism_ancestor_id (t8_dprism_t *p, int level)
 Compute the position of the ancestor of this child at level level within its siblings. More...
 
void t8_dprism_children_at_face (const t8_dprism_t *p, int face, t8_dprism_t **children, int num_children)
 Given a prism and a face of the prism, compute all children of the prism that touch the face. More...
 
int t8_dprism_face_child_face (const t8_dprism_t *elem, int face, int face_child)
 Given a face of a prism and a child number of a child of that face, return the face number of the child of the prism that matches the child face. More...
 
int t8_dprism_face_parent_face (const t8_dprism_t *prism, int face)
 Given a face of a prism return the face number of the parent of the prism that matches the prism's face. More...
 
int t8_dprism_tree_face (const t8_dprism_t *p, int face)
 Given a prism and a face of this prism. More...
 
int t8_dprism_root_face_to_face (const t8_dprism_t *p, int root_face)
 Given a prism and a face of the root prism. More...
 
void t8_dprism_extrude_face (const t8_element_t *face, 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_dprism_last_descendant (const t8_dprism_t *p, t8_dprism_t *s, int level)
 Compute the last descendant of a prism at a given level. More...
 
void t8_dprism_corner_descendant (const t8_dprism_t *p, t8_dprism_t *s, int corner, int level)
 Compute the descendant of a prism in a given corner. More...
 
void t8_dprism_vertex_coords (const t8_dprism_t *elem, int vertex, int coords[3])
 Compute the coordinates of a vertex of a prism. More...
 
void t8_dprism_vertex_ref_coords (const t8_dprism_t *elem, int vertex, double coords[3])
 Compute the reference coordinates of a vertex of a prism when the tree (level 0) is embedded in [0,1]^3. More...
 
t8_linearidx_t t8_dprism_linear_id (const t8_dprism_t *p, int level)
 Computes the linear position of a prism in an uniform grid. More...
 
int t8_dprism_is_valid (const t8_dprism_t *p)
 Query whether all entries of a prism are in valid ranges. More...
 
void t8_dprism_debug_print (const t8_dprism_t *p)
 Print the coordinates, the level and the type of a prism. More...
 

Variables

int t8_dprism_face_corners [5][4]
 Look-up table for the corners of each face.
 

Detailed Description

Definition if prism-specific functions.

Function Documentation

◆ t8_dprism_ancestor_id()

int t8_dprism_ancestor_id ( t8_dprism_t p,
int  level 
)

Compute the position of the ancestor of this child at level level within its siblings.

Parameters
[in]pprism to be considered.
[in]levellevel to be considered.
Returns
Returns its child id in 0..7

◆ t8_dprism_boundary_face()

void t8_dprism_boundary_face ( const t8_dprism_t p,
int  face,
t8_element_t boundary 
)

Constructs the boundary element of a prism at a given face.

Parameters
[in]pThe input prism.
[in]faceA face of p
[in,out]boundaryThe boundary element at face of p

◆ t8_dprism_child()

void t8_dprism_child ( const t8_dprism_t p,
int  childid,
t8_dprism_t child 
)

Compute the childid-th child in Morton order of a prism.

Parameters
[in]pInput prism.
[in]childidThe id of the child, in 0 - 7, in Morton order.
[in,out]childExisting prism whose data will be filled with the date of p's childid-th child.

◆ t8_dprism_child_id()

int t8_dprism_child_id ( const t8_dprism_t p)

Compute the position of the ancestor of this child at level level within its siblings.

Parameters
[in]pprism to be considered.
Returns
Returns its child id in 0 - 7

◆ t8_dprism_children_at_face()

void t8_dprism_children_at_face ( const t8_dprism_t p,
int  face,
t8_dprism_t **  children,
int  num_children 
)

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

Parameters
[in]pThe prism.
[in]faceA face of p.
[in,out]childrenAllocated prism, in which the children of p that share a face with face are stored. They will be stored in order of their child_id.
[in]num_childrenThe number of prisms in children. Must match the number of children that touch face.

◆ t8_dprism_childrenpv()

void t8_dprism_childrenpv ( const t8_dprism_t p,
int  length,
t8_dprism_t c[] 
)

Compute the 8 children of a prism, array version.

Parameters
[in]pInput prism.
[in,out]cPointers to the 8 computed children in Morton order.

◆ t8_dprism_compare()

int t8_dprism_compare ( const t8_dprism_t p1,
const t8_dprism_t p2 
)

Compare two elements.

returns negativ if p1 < p2, zero if p1 equals p2 and positiv if p1 > p2. If p2 is a copy of p1 then the elements are equal.

◆ t8_dprism_copy()

void t8_dprism_copy ( const t8_dprism_t p,
t8_dprism_t dest 
)

Copy all values from one prism to another.

Parameters
[in]pThe prism to be copied.
[in,out]destExisting prism whose data will be filled with the data of p.

◆ t8_dprism_corner_descendant()

void t8_dprism_corner_descendant ( const t8_dprism_t p,
t8_dprism_t s,
int  corner,
int  level 
)

Compute the descendant of a prism in a given corner.

Parameters
[in]pPrism whose descendant is computed.
[out]sExisting prism whose data will be filled with the data of p's descendant in corner.
[in]cornerThe corner in which the descendant should lie.
[in]levelThe refinement level of the descendant. Must be greater or equal to p's level.

◆ t8_dprism_debug_print()

void t8_dprism_debug_print ( const t8_dprism_t p)

Print the coordinates, the level and the type of a prism.

Parameters
[in]pprism to be considered.

◆ t8_dprism_extrude_face()

void t8_dprism_extrude_face ( const t8_element_t face,
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.

Parameters
[in]faceA face element.
[in,out]elemAn 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_faceThe index of the face of the root tree in which face lies.

◆ t8_dprism_face_child_face()

int t8_dprism_face_child_face ( const t8_dprism_t elem,
int  face,
int  face_child 
)

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

Parameters
[in]elemThe prism.
[in]faceThe number of the face.
[in]face_childThe child number of a child of the face prism.
Returns
The face number of the face of a child of p that conincides with face_child.

◆ t8_dprism_face_neighbour()

int t8_dprism_face_neighbour ( const t8_dprism_t p,
int  face,
t8_dprism_t neigh 
)

Compute the face neighbor of a prism.

Parameters
[in]pInput prism.
[in]faceThe face across which to generate the neighbor.
[in,out]nExisting prism whose data will be filled.
Note
p may point to the same prism as n.
Returns
The face number of neigh of the respective face.

◆ t8_dprism_face_parent_face()

int t8_dprism_face_parent_face ( const t8_dprism_t prism,
int  face 
)

Given a face of a prism return the face number of the parent of the prism that matches the prism's face.

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

Parameters
[in]prismThe prism.
[in]faceThen number of the face.
Returns
If face of prism is also a face of prism's parent, the face number of this face. Otherwise -1.

◆ t8_dprism_face_shape()

t8_element_shape_t t8_dprism_face_shape ( const t8_dprism_t p,
int  face 
)

Return the shape of a face.

Parameters
[in]pInput prism.
[in]faceA face id for p.
Returns
The shape of face.

◆ t8_dprism_first_descendant()

void t8_dprism_first_descendant ( const t8_dprism_t p,
t8_dprism_t desc,
int  level 
)

Compute the first descendant of a prism at a given level.

This is the descendant of the prism in a uniform level refinement that has the smallest id.

Parameters
[in]pPrism whose descendant is computed.
[out]sExisting prism whose data will be filled with the data of p's first descendant on level level.
[in]levelThe refinement level. Must be greater than p's refinement level.

◆ t8_dprism_get_face_corner()

int t8_dprism_get_face_corner ( const t8_dprism_t p,
int  face,
int  corner 
)

Return the corner number of a prism corresponding to a given face corner.

Parameters
[in]pInput prism.
[in]faceThe face number.
[in]cornerA corner of face
Returns
The corner index of p corresponding to the corner-th corner of face.

◆ t8_dprism_get_level()

int t8_dprism_get_level ( const t8_dprism_t p)

Compute the level of a prism.

Parameters
[in]pLine whose prism is computed.
Returns
The level of p.

◆ t8_dprism_init_linear_id()

void t8_dprism_init_linear_id ( t8_dprism_t p,
int  level,
t8_linearidx_t  id 
)

Initialize a prism as the prism with a given global id in a uniform refinement of a given level.

  • Parameters
    [in,out]pExisting prism whose data will be filled.
    [in]idIndex to be considered.
    [in]levellevel of uniform grid to be considered.

◆ t8_dprism_is_familypv()

int t8_dprism_is_familypv ( t8_dprism_t **  fam)

Check whether a collection of eight prism is a family in Morton order.

Parameters
[in]famAn array of eight prism.
Returns
Nonzero if fam is a family of prism.

◆ t8_dprism_is_inside_root()

int t8_dprism_is_inside_root ( t8_dprism_t p)

Test if a prism lies inside of the root prism, that is the triangle of level 0, anchor node (0,0) and type 0.

Parameters
[in]pInput prism.
Returns
true If p lies inside of the root pris.

◆ t8_dprism_is_root_boundary()

int t8_dprism_is_root_boundary ( const t8_dprism_t p,
int  face 
)

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

Parameters
[in]pThe input prism.
[in]faceA face of p.
Returns
True if face is a subface of the triangle's root element.

◆ t8_dprism_is_valid()

int t8_dprism_is_valid ( const t8_dprism_t p)

Query whether all entries of a prism are in valid ranges.

A prism is valid if and only if its triangle and line member are valid.

Parameters
[in]pprism to be considered.
Returns
True, if p is a valid prism and it is safe to call any function in this file on p. False otherwise.

◆ t8_dprism_last_descendant()

void t8_dprism_last_descendant ( const t8_dprism_t p,
t8_dprism_t s,
int  level 
)

Compute the last descendant of a prism at a given level.

This is the descendant of the prism in a uniform level refinement that has the largest id.

Parameters
[in]pPrism whose descendant is computed.
[out]sExisting prism whose data will be filled with the data of p's last descendant on level level.
[in]levelThe refinement level. Must be greater than p's refinement level.

◆ t8_dprism_linear_id()

t8_linearidx_t t8_dprism_linear_id ( const t8_dprism_t p,
int  level 
)

Computes the linear position of a prism in an uniform grid.

Parameters
[in]pPrism whose id will be computed.
Returns
Returns the linear position of this prism on a grid.

◆ t8_dprism_nearest_common_ancestor()

void t8_dprism_nearest_common_ancestor ( const t8_dprism_t p1,
const t8_dprism_t p2,
t8_dprism_t r 
)

Computes the nearest common ancestor of two prisms in the same tree.

Parameters
[in]p1First input tetrahedron.
[in]p2Second input tetrahedron.
[in,out]rExisting tetrahedron whose data will be filled.
Note
t1, t2, r may point to the same tetrahedron.

◆ t8_dprism_num_face_children()

int t8_dprism_num_face_children ( const t8_dprism_t p,
int  face 
)

Compute the number of children at a given face.

Parameters
[in]pInput prism.
[in]faceThe face number
Returns
Number of Children at face

◆ t8_dprism_parent()

void t8_dprism_parent ( const t8_dprism_t p,
t8_dprism_t parent 
)

Compute the parent of a prism.

Parameters
[in]pInput prism.
[in,out]parentExisting prism whose data will be filled with the data of p's parent.
Note
p may point to the same prism as parent.

◆ t8_dprism_root_face_to_face()

int t8_dprism_root_face_to_face ( const t8_dprism_t p,
int  root_face 
)

Given a prism and a face of the root prism.

If the prism lies on the tree boundary, return the corresponding face number of the prism. If not the return value is arbitrary.

Parameters
[in]pThe prism.
[in]faceThe index of a face of the root element.
Returns
The index of the face of p that is a subface of face, if p is on the tree boundary. Any arbitrary integer if p is not at a tree boundary.
Note
For boundary prism, this function is the inverse of t8_dprism_tree_face

◆ t8_dprism_successor()

void t8_dprism_successor ( const t8_dprism_t p,
t8_dprism_t succ,
int  level 
)

Computes the successor of a prism in a uniform grid of level level.

Parameters
[in]pprism whose id will be computed.
[in,out]sExisting prism whose data will be filled with the data of l's successor on level level.
[in]levellevel of uniform grid to be considered.

◆ t8_dprism_tree_face()

int t8_dprism_tree_face ( const t8_dprism_t p,
int  face 
)

Given a prism and a face of this prism.

If the face lies on the tree boundary, return the face number of the tree face. If not the return value is arbitrary.

Parameters
[in]pThe prism.
[in]faceThe 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.

◆ t8_dprism_vertex_coords()

void t8_dprism_vertex_coords ( const t8_dprism_t elem,
int  vertex,
int  coords[3] 
)

Compute the coordinates of a vertex of a prism.

Parameters
[in]elemInput prism.
[in]vertexThe number of the vertex.
[out]coordinatesAn array of 3 t8_dprism_coord_t that will be filled with the coordinates of the vertex.

◆ t8_dprism_vertex_ref_coords()

void t8_dprism_vertex_ref_coords ( const t8_dprism_t elem,
int  vertex,
double  coords[3] 
)

Compute the reference coordinates of a vertex of a prism when the tree (level 0) is embedded in [0,1]^3.

Parameters
[in]elemInput prism.
[in]vertexThe number of the vertex.
[out]coordinatesAn array of 3 double that will be filled with the reference coordinates of the vertex.