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

Definitions of pyramid-specific functions. More...

#include "t8_element.h"
#include "t8_dpyramid.h"

Go to the source code of this file.

Functions

void t8_dpyramid_init_linear_id (t8_dpyramid_t *p, const int level, t8_linearidx_t id)
 Initialize a pyramid as the pyramid with a given global id in a uniform refinement of a given level. More...
 
int t8_dpyramid_get_level (const t8_dpyramid_t *p)
 Compute the level of a pyramid. More...
 
void t8_dpyramid_copy (const t8_dpyramid_t *source, t8_dpyramid_t *dest)
 Copy the data from source to dest. More...
 
t8_linearidx_t t8_dpyramid_linear_id (const t8_dpyramid_t *p, const int level)
 Computes the linear position of a pyramid in an uniform grid. More...
 
void t8_dpyramid_child (const t8_dpyramid_t *elem, const int child_id, t8_dpyramid_t *child)
 Compute the childid-th child in Morton order of a pyramid. More...
 
void t8_dpyramid_children (const t8_dpyramid_t *p, t8_dpyramid_t **c)
 Compute the children of a pyramid, array version. More...
 
void t8_dpyramid_children_at_face (const t8_dpyramid_t *p, const int face, t8_dpyramid_t *children[], const int num_children, int *child_indices)
 Given a pyramid and a face, compute all children touching this face. More...
 
int t8_dpyramid_face_child_face (const t8_dpyramid_t *p, const int face, const int face_child)
 Given a face of a pyramid and a child number of a child of that face, return the face number of the child of the pyramid that matches the child face. More...
 
t8_element_shape_t t8_dpyramid_face_shape (const t8_dpyramid_t *pyra, int face)
 Given the facenumber of a pyramid, return the shape of the face. More...
 
int t8_dpyramid_get_face_corner (const t8_dpyramid_t *pyra, int face, int corner)
 Returns the corner number of a pyramid given a face of a pyramid and a corner number regarding that face. More...
 
void t8_dpyramid_boundary_face (const t8_dpyramid_t *p, const int face, t8_element_t *boundary)
 Given a boundary element and a facenumber of this element, compute the boundary face. More...
 
int t8_dpyramid_extrude_face (const t8_element_t *face, t8_dpyramid_t *p, const int root_face)
 Given a boundary face inside the root pyramids's face construct the element inside the root pyramid that has the given face as a face. More...
 
int t8_dpyramid_compare (const t8_dpyramid_t *p1, const t8_dpyramid_t *p2)
 Compare two elements. More...
 
int t8_dpyramid_is_family (t8_dpyramid_t **fam)
 Check wether a collection of 10 pyramids is a family in Morton order. More...
 
int t8_dpyramid_is_root_boundary (const t8_dpyramid_t *p, const int face)
 Compute whether a given pyramid shares a given face with its root tree. More...
 
int t8_dpyramid_face_neighbor_inside (const t8_dpyramid_t *p, t8_dpyramid_t *neigh, const int face, int *neigh_face)
 Compute the neighbor of p along a given face and the number of the dual face if the neighbor is inside the root pyramid. More...
 
int t8_dpyramid_child_id (const t8_dpyramid_t *p)
 Compute the position of the ancestor of this child at level level within its siblings. More...
 
int t8_dpyramid_is_inside_root (const t8_dpyramid_t *p)
 Returns zero if p is not inside root, 1 ow. More...
 
int t8_dpyramid_tet_boundary (const t8_dpyramid_t *p, const int face)
 Check, if a tet of type 0 or 3 has a common face with its pyramid-ancestor. More...
 
int t8_dpyramid_tree_face (const t8_dpyramid_t *p, const int face)
 compute if a given element lies on the tree boundary and return the face number of the tree face. More...
 
void t8_dpyramid_first_descendant (const t8_dpyramid_t *p, t8_dpyramid_t *desc, const int level)
 Compute the first descendant of a pyramid at a given level. More...
 
void t8_dpyramid_first_descendant_face (const t8_dpyramid_t *p, const int face, t8_dpyramid_t *first_desc, const int level)
 Construct the first descendant of a pyramid touching a given face. More...
 
void t8_dpyramid_last_descendant (const t8_dpyramid_t *p, t8_dpyramid_t *desc, int level)
 Compute the last descendant of a pyramid at a given level. More...
 
void t8_dpyramid_last_descendant_face (const t8_dpyramid_t *p, const int face, t8_dpyramid_t *last_desc, const int level)
 Construct the last descendant of a pyramid touching a given face. More...
 
void t8_dpyramid_compute_coords (const t8_dpyramid_t *p, const int vertex, int coords[])
 Compute the coordinates of a vertex of a pyramid. More...
 
void t8_dpyramid_parent (const t8_dpyramid_t *p, t8_dpyramid_t *parent)
 Compute the parent of a given pyramid. More...
 
int t8_dpyramid_num_corners (const t8_dpyramid_t *p)
 Compute the number of corners of a pyramid. More...
 
int t8_dpyramid_num_children (const t8_dpyramid_t *p)
 Compute the number of children of p. More...
 
int t8_dpyramid_num_siblings (const t8_dpyramid_t *p)
 Compute the number of siblings of p. More...
 
int t8_dpyramid_num_faces (const t8_dpyramid_t *p)
 Return the number of faces of p. More...
 
int t8_dpyramid_max_num_faces (const t8_dpyramid_t *p)
 Return the maximal number of faces of an element p. More...
 
int t8_dpyramid_face_parent_face (const t8_dpyramid_t *elem, const 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_dpyramid_ancestor_id (const t8_dpyramid_t *p, const int level)
 Return the child-id of the ancestor of p at level level. More...
 
void t8_dpyramid_ancestor (const t8_dpyramid_t *pyra, const int level, t8_dpyramid_t *anc)
 Compute the ancestor of pyra at a given level. More...
 
int t8_dpyramid_type_at_level (const t8_dpyramid_t *p, const int level)
 Compute the type of a pyramid at a given level. More...
 
t8_element_shape_t t8_dpyramid_shape (const t8_dpyramid_t *p)
 Returns the shape of the pyramid (pyramid or tetrahedron) More...
 
void t8_dpyramid_successor (const t8_dpyramid_t *elem, t8_dpyramid_t *s, const int level)
 Computes the successor of a pyramid in a uniform grid of level level. More...
 
void t8_dpyramid_vertex_reference_coords (const t8_dpyramid_t *elem, const int vertex, double coords[])
 Compute the reference coordinates of a vertex of a pyramid when the tree (level 0 triangle) is embedded in [0,1]^3. More...
 
void t8_dpyramid_nearest_common_ancestor (const t8_dpyramid_t *pyra1, const t8_dpyramid_t *pyra2, t8_dpyramid_t *nca)
 Compute the nearest common ancestor of two elements. More...
 
int t8_dpyramid_is_valid (const t8_dpyramid_t *p)
 Query whether all entries of a pyramid are in valid ranges. More...
 
void t8_dpyramid_debug_print (const t8_dpyramid_t *p)
 Print the coordinates, the level and the type of a pyramid. More...
 

Detailed Description

Definitions of pyramid-specific functions.

Function Documentation

◆ t8_dpyramid_ancestor()

void t8_dpyramid_ancestor ( const t8_dpyramid_t pyra,
const int  level,
t8_dpyramid_t anc 
)

Compute the ancestor of pyra at a given level.

Parameters
[in]pyraInput pyramid
[in]levelLevel of the ancestor to compute
[in,out]ancAllocated element that will be filled with the data of the ancestor.

Compute the ancestor of pyra at a given level.

Parameters
[in]pyraInput pyramid
[in]levelThe level at which we want to compute anc
[in,out]ancAllocated input element which will be filled by the data of the anc of pyra at level level

◆ t8_dpyramid_ancestor_id()

int t8_dpyramid_ancestor_id ( const t8_dpyramid_t p,
const int  level 
)

Return the child-id of the ancestor of p at level level.

Parameters
[in]pInput pyramid
[in]levelThe ancestor-level
Returns
The child-id of the ancestor

◆ t8_dpyramid_boundary_face()

void t8_dpyramid_boundary_face ( const t8_dpyramid_t p,
const int  face,
t8_element_t boundary 
)

Given a boundary element and a facenumber of this element, compute the boundary face.

Parameters
[in]pInput pyramid
[in]faceThe face number of an element
[in,out]boundaryThe boundary face

◆ t8_dpyramid_child()

void t8_dpyramid_child ( const t8_dpyramid_t elem,
const int  child_id,
t8_dpyramid_t child 
)

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

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

◆ t8_dpyramid_child_id()

int t8_dpyramid_child_id ( const t8_dpyramid_t p)

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

Parameters
[in]ppyramid to be considered.
Returns
Returns its child id in 0..9

◆ t8_dpyramid_children()

void t8_dpyramid_children ( const t8_dpyramid_t p,
t8_dpyramid_t **  c 
)

Compute the children of a pyramid, array version.

Parameters
[in]pInput pyramid
[in,out]cPointers to the computed children in Morton order

◆ t8_dpyramid_children_at_face()

void t8_dpyramid_children_at_face ( const t8_dpyramid_t p,
const int  face,
t8_dpyramid_t children[],
const int  num_children,
int *  child_indices 
)

Given a pyramid and a face, compute all children touching this face.

Parameters
[in]pInput pyramid
[in]faceThe face to compute the childran at
[in,out]childrenThe children of p at face
[in]num_childremThe number of children at this face
[in,out]child_indicesAn array to be filled with the local-ids of the children.

◆ t8_dpyramid_compare()

int t8_dpyramid_compare ( const t8_dpyramid_t p1,
const t8_dpyramid_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.

Parameters
[in]p1A pyramid
[in]p2Another pyramid
Returns
an integer describing which pyramid is larger.

◆ t8_dpyramid_compute_coords()

void t8_dpyramid_compute_coords ( const t8_dpyramid_t p,
const int  vertex,
int  coords[] 
)

Compute the coordinates of a vertex of a pyramid.

Parameters
[in]pInput pyramid.
[in]vertexThe number of the vertex.
[out]coordsAn array of 3 t8_dpyramid_coord_t that will be filled with the coordinates of the vertex.

◆ t8_dpyramid_copy()

void t8_dpyramid_copy ( const t8_dpyramid_t source,
t8_dpyramid_t dest 
)

Copy the data from source to dest.

Parameters
[in]sourceThe source-pyramid
[in,out]destThe destination

◆ t8_dpyramid_debug_print()

void t8_dpyramid_debug_print ( const t8_dpyramid_t p)

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

Parameters
[in]pThe pyramid to print

◆ t8_dpyramid_extrude_face()

int t8_dpyramid_extrude_face ( const t8_element_t face,
t8_dpyramid_t p,
const int  root_face 
)

Given a boundary face inside the root pyramids's face construct the element inside the root pyramid that has the given face as a face.

Parameters
[in]faceA face element.
[in,out]pAn 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.
Returns
The face number of the face of p that coincides with face.

◆ t8_dpyramid_face_child_face()

int t8_dpyramid_face_child_face ( const t8_dpyramid_t p,
const int  face,
const int  face_child 
)

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

Parameters
[in]pInput pyramid
[in]faceA face of p
[in]face_childA number specifying a child on the face
Returns
The number of the face of the child face_child

◆ t8_dpyramid_face_neighbor_inside()

int t8_dpyramid_face_neighbor_inside ( const t8_dpyramid_t p,
t8_dpyramid_t neigh,
const int  face,
int *  neigh_face 
)

Compute the neighbor of p along a given face and the number of the dual face if the neighbor is inside the root pyramid.

Return 0 if the neighbor is not inside, 1 ow.

Parameters
[in]pInput pyramid
[in,out]neighThe neighbor of p
[in]faceThe face of p along which neigh is computed
[in,out]neigh_faceThe dual face

◆ t8_dpyramid_face_parent_face()

int t8_dpyramid_face_parent_face ( const t8_dpyramid_t elem,
const 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.

Parameters
[in]elemInput pyramid
[in]facea face of elem
Returns
the facenumber of the parent of elem matching face or -1

◆ t8_dpyramid_face_shape()

t8_element_shape_t t8_dpyramid_face_shape ( const t8_dpyramid_t pyra,
int  face 
)

Given the facenumber of a pyramid, return the shape of the face.

Parameters
[in]pyraInput pyramid
[in]faceThe facenumber
Returns
the shape of the face

◆ t8_dpyramid_first_descendant()

void t8_dpyramid_first_descendant ( const t8_dpyramid_t p,
t8_dpyramid_t desc,
const int  level 
)

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

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

Parameters
[in]ppyramid whose descendant is computed.
[out]descExisting pyramid 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_dpyramid_first_descendant_face()

void t8_dpyramid_first_descendant_face ( const t8_dpyramid_t p,
const int  face,
t8_dpyramid_t first_desc,
const int  level 
)

Construct the first descendant of a pyramid touching a given face.

Parameters
[in]ppyramid whose descendant is computed.
[in]faceThe face at which the descendant is computed
[out]first_descExisting pyramid 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_dpyramid_get_face_corner()

int t8_dpyramid_get_face_corner ( const t8_dpyramid_t pyra,
int  face,
int  corner 
)

Returns the corner number of a pyramid given a face of a pyramid and a corner number regarding that face.

Parameters
[in]pyraInput pyramid
[in]faceThe facenumber of a face of pyra
[in]cornerThe cornernumber of a corner of face
Returns
The cornernumber of pyra

◆ t8_dpyramid_get_level()

int t8_dpyramid_get_level ( const t8_dpyramid_t p)

Compute the level of a pyramid.

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

◆ t8_dpyramid_init_linear_id()

void t8_dpyramid_init_linear_id ( t8_dpyramid_t p,
const int  level,
t8_linearidx_t  id 
)

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

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

◆ t8_dpyramid_is_family()

int t8_dpyramid_is_family ( t8_dpyramid_t **  fam)

Check wether a collection of 10 pyramids is a family in Morton order.

Parameters
[in]famA collection of pyramids
Returns
Nonzero if fam is a family of pyramids

◆ t8_dpyramid_is_inside_root()

int t8_dpyramid_is_inside_root ( const t8_dpyramid_t p)

Returns zero if p is not inside root, 1 ow.

Parameters
[in]pPyramid to check
Returns
0 if p is inside root, 1, ow

◆ t8_dpyramid_is_root_boundary()

int t8_dpyramid_is_root_boundary ( const t8_dpyramid_t p,
const int  face 
)

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

Parameters
[in]pThe input pyramid
[in]faceA face of p
Returns
True, if is a subface of the pyramid root element.

◆ t8_dpyramid_is_valid()

int t8_dpyramid_is_valid ( const t8_dpyramid_t p)

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

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

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

◆ t8_dpyramid_last_descendant()

void t8_dpyramid_last_descendant ( const t8_dpyramid_t p,
t8_dpyramid_t desc,
int  level 
)

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

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

Parameters
[in]ppyramid whose descendant is computed.
[out]descExisting pyramid 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_dpyramid_last_descendant_face()

void t8_dpyramid_last_descendant_face ( const t8_dpyramid_t p,
const int  face,
t8_dpyramid_t last_desc,
const int  level 
)

Construct the last descendant of a pyramid touching a given face.

Parameters
[in]ppyramid whose descendant is computed.
[in]faceThe face at which the descendant is computed
[out]last_descExisting pyramid 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_dpyramid_linear_id()

t8_linearidx_t t8_dpyramid_linear_id ( const t8_dpyramid_t p,
const int  level 
)

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

Parameters
[in]ppyramid whose id will be computed.
[in]levelThe level on which the linear-id should be computed.
Returns
Returns the linear position of this pyramid on a grid.

◆ t8_dpyramid_max_num_faces()

int t8_dpyramid_max_num_faces ( const t8_dpyramid_t p)

Return the maximal number of faces of an element p.

Parameters
[in]pInput pyramid
Returns
The maximal number of faces of p

◆ t8_dpyramid_nearest_common_ancestor()

void t8_dpyramid_nearest_common_ancestor ( const t8_dpyramid_t pyra1,
const t8_dpyramid_t pyra2,
t8_dpyramid_t nca 
)

Compute the nearest common ancestor of two elements.

Parameters
[in]pyra1The first pyramid
[in]pyra2The second pyramid
[in,out]ncaExisting pyramid whose data will be filled with the data of pyra1 and pyra2 nearest common ancestor.

◆ t8_dpyramid_num_children()

int t8_dpyramid_num_children ( const t8_dpyramid_t p)

Compute the number of children of p.

Parameters
[in]pInput pyramid.
Returns
The number of children of p.

◆ t8_dpyramid_num_corners()

int t8_dpyramid_num_corners ( const t8_dpyramid_t p)

Compute the number of corners of a pyramid.

If pyramid has type less than 6, it is actually a tetrahedron.

Parameters
[in]pInput pyramid.
Returns
The number of corners of p.

◆ t8_dpyramid_num_faces()

int t8_dpyramid_num_faces ( const t8_dpyramid_t p)

Return the number of faces of p.

Parameters
[in]pInput pyramid
Returns
The number of faces of p

◆ t8_dpyramid_num_siblings()

int t8_dpyramid_num_siblings ( const t8_dpyramid_t p)

Compute the number of siblings of p.

Parameters
[in]pInput pyramid
Returns
The number of siblings of p.

◆ t8_dpyramid_parent()

void t8_dpyramid_parent ( const t8_dpyramid_t p,
t8_dpyramid_t parent 
)

Compute the parent of a given pyramid.

Parameters
[in]pInput pyramid.
[out]parentThe parent of p.

◆ t8_dpyramid_shape()

t8_element_shape_t t8_dpyramid_shape ( const t8_dpyramid_t p)

Returns the shape of the pyramid (pyramid or tetrahedron)

Parameters
[in]pInput pyramid.
Returns
The eclass of the element

◆ t8_dpyramid_successor()

void t8_dpyramid_successor ( const t8_dpyramid_t elem,
t8_dpyramid_t s,
const int  level 
)

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

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

◆ t8_dpyramid_tet_boundary()

int t8_dpyramid_tet_boundary ( const t8_dpyramid_t p,
const int  face 
)

Check, if a tet of type 0 or 3 has a common face with its pyramid-ancestor.

Parameters
[in]pinput pyramid
[in]faceA face of p.
Returns
false if they don't share a face, true otherwise

◆ t8_dpyramid_tree_face()

int t8_dpyramid_tree_face ( const t8_dpyramid_t p,
const int  face 
)

compute if a given element lies on the tree boundary and return the face number of the tree face.

If not the return value is arbitrary

Parameters
[in]elempyramid
[in]facea face of elem
Returns
See discription

◆ t8_dpyramid_type_at_level()

int t8_dpyramid_type_at_level ( const t8_dpyramid_t p,
const int  level 
)

Compute the type of a pyramid at a given level.

Starting from its own level, we iterate over the levels and compute the type of this level. If p is a tetrahedron, we compute it in a tetrahedral fashion up unto the last level where p is a tet and continue in a pyramidal fashion

Parameters
[in]pInput pyramid
[in]levelThe level at which the type is computed
Returns
The type of p at level level.

◆ t8_dpyramid_vertex_reference_coords()

void t8_dpyramid_vertex_reference_coords ( const t8_dpyramid_t elem,
const int  vertex,
double  coords[] 
)

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

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