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_dline_bits.h File Reference

Definitions of line-specific functions. More...

#include <t8_element.h>
#include <t8_schemes/t8_default/t8_default_line/t8_dline.h>
#include <t8_schemes/t8_default/t8_default_vertex/t8_dvertex.h>

Go to the source code of this file.

Functions

int t8_dline_get_level (const t8_dline_t *l)
 Compute the level of a line. More...
 
void t8_dline_copy (const t8_dline_t *l, t8_dline_t *dest)
 Copy all values from one line to another. More...
 
int t8_dline_compare (const t8_dline_t *l1, const t8_dline_t *l2)
 Compare two elements. More...
 
void t8_dline_parent (const t8_dline_t *l, t8_dline_t *parent)
 Compute the parent of a line. More...
 
void t8_dline_ancestor (const t8_dline_t *t, int level, t8_dline_t *ancestor)
 Compute the ancestor of a line at a given level. More...
 
void t8_dline_child (const t8_dline_t *l, int childid, t8_dline_t *child)
 Compute the childid-th child in Morton order of a line. More...
 
void t8_dline_face_neighbour (const t8_dline_t *l, t8_dline_t *neigh, int face, int *dual_face)
 Compute the face neighbor of a line. More...
 
void t8_dline_nearest_common_ancestor (const t8_dline_t *t1, const t8_dline_t *t2, t8_dline_t *r)
 Computes the nearest common ancestor of two lines in the same tree. More...
 
int t8_dline_ancestor_id (const t8_dline_t *l, int level)
 Compute the position of the ancestor of this child at level level within its siblings. More...
 
int t8_dline_face_parent_face (const t8_dline_t *l, int face)
 Given a face of a line return the face number of the parent of the line that matches the line's face. More...
 
int t8_dline_child_id (const t8_dline_t *t)
 Compute the position of the ancestor of this child at level level within its siblings. More...
 
void t8_dline_childrenpv (const t8_dline_t *t, t8_dline_t *c[T8_DLINE_CHILDREN])
 Compute the 2 children of a line, array version. More...
 
int t8_dline_is_familypv (const t8_dline_t *f[])
 Check whether a collection of two lines is a family in Morton order. More...
 
int t8_dline_is_root_boundary (const t8_dline_t *p, int face)
 Compute whether a given line shares a given face with its root tree. More...
 
int t8_dline_is_inside_root (const t8_dline_t *l)
 Test if a line lies inside of the root line, that is the line of level 0, anchor node (0,0) More...
 
void t8_dline_init_linear_id (t8_dline_t *l, int level, t8_linearidx_t id)
 Initialize a line as the line with a given global id in a uniform refinement of a given level. More...
 
void t8_dline_successor (const t8_dline_t *l, t8_dline_t *succ, int level)
 Computes the successor of a line in a uniform grid of level level. More...
 
void t8_dline_transform_face (const t8_dline_t *line1, t8_dline_t *line2, int orientation)
 Suppose we have two trees that share a common face f. More...
 
int t8_dline_extrude_face (const t8_dvertex_t *face, int root_face, t8_dline_t *line)
 Given a vertex at the boundary of a line at a root tree boundary, construct the line from it. More...
 
void t8_dline_first_descendant (const t8_dline_t *l, t8_dline_t *s, int level)
 Compute the first descendant of a line at a given level. More...
 
void t8_dline_last_descendant (const t8_dline_t *l, t8_dline_t *s, int level)
 Compute the last descendant of a line at a given level. More...
 
void t8_dline_vertex_coords (const t8_dline_t *elem, const int vertex, int coords[])
 Compute the first or second vertex of a line. More...
 
void t8_dline_vertex_ref_coords (const t8_dline_t *elem, const int vertex, double coordinates[1])
 Compute the coordinates of a vertex of a line when the tree (level 0 line) is embedded in [0,1]^1. More...
 
t8_linearidx_t t8_dline_linear_id (const t8_dline_t *elem, int level)
 Computes the linear position of a line in an uniform grid. More...
 
int t8_dline_is_valid (const t8_dline_t *l)
 Query whether all entries of a line are in valid ranges. More...
 
void t8_dline_debug_print (const t8_dline_t *l)
 Print a line. More...
 
void t8_dline_init (t8_dline_t *l)
 Set default values for a line, such that it passes t8_dline_is_valid. More...
 

Detailed Description

Definitions of line-specific functions.

Function Documentation

◆ t8_dline_ancestor()

void t8_dline_ancestor ( const t8_dline_t t,
int  level,
t8_dline_t ancestor 
)

Compute the ancestor of a line at a given level.

Parameters
[in]tInput line.
[in]levelA smaller level than t.
[in,out]ancestorExisting line whose data will be filled with the data of t's ancestor on level level.
Note
The line ancestor may point to the same line as t.

◆ t8_dline_ancestor_id()

int t8_dline_ancestor_id ( const t8_dline_t l,
int  level 
)

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

Parameters
[in]lline to be considered.
[in]levellevel to be considered.
Returns
Returns its child id 0 or 1.

◆ t8_dline_child()

void t8_dline_child ( const t8_dline_t l,
int  childid,
t8_dline_t child 
)

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

Parameters
[in]lInput Line.
[in]childidThe id of the child, 0 or 1, in Morton order.
[in,out]childExisting Line whose data will be filled with the date of l's childid-th child.

◆ t8_dline_child_id()

int t8_dline_child_id ( const t8_dline_t t)

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

Parameters
[in]tline to be considered.
Returns
Returns its child id in 0,1

◆ t8_dline_childrenpv()

void t8_dline_childrenpv ( const t8_dline_t t,
t8_dline_t c[T8_DLINE_CHILDREN] 
)

Compute the 2 children of a line, array version.

Parameters
[in]tInput line.
[in,out]cPointers to the 2 computed children in Morton order. t may point to the same quadrant as c[0].

◆ t8_dline_compare()

int t8_dline_compare ( const t8_dline_t l1,
const t8_dline_t l2 
)

Compare two elements.

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

◆ t8_dline_copy()

void t8_dline_copy ( const t8_dline_t l,
t8_dline_t dest 
)

Copy all values from one line to another.

Parameters
[in]lThe line to be copied.
[in,out]destExisting line whose data will be filled with the data of l.

◆ t8_dline_debug_print()

void t8_dline_debug_print ( const t8_dline_t l)

Print a line.

Parameters
[in]lline to be initialized

◆ t8_dline_extrude_face()

int t8_dline_extrude_face ( const t8_dvertex_t face,
int  root_face,
t8_dline_t line 
)

Given a vertex at the boundary of a line at a root tree boundary, construct the line from it.

Parameters
[in]faceThe face element (vertex).
[in]root_faceThe index of the face of the tree.
[out]lineThe line that has face as face element at face root_face
Returns
The face number pf line that coincides with face, thus root_face is returned.

◆ t8_dline_face_neighbour()

void t8_dline_face_neighbour ( const t8_dline_t l,
t8_dline_t neigh,
int  face,
int *  dual_face 
)

Compute the face neighbor of a line.

Parameters
[in]lInput line.
[in,out]neighExisting line whose data will be filled.
[in]faceThe face across which to generate the neighbor.
[out]dual_faceIf not NULL, the face number as seen from neigh is stored.
Note
l may point to the same line as n.

◆ t8_dline_face_parent_face()

int t8_dline_face_parent_face ( const t8_dline_t l,
int  face 
)

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

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

Parameters
[in]lThe line.
[in]faceThe number of the face.
Returns
If face of l is also a face of l's parent, the face number of this face. Otherwise -1.

◆ t8_dline_first_descendant()

void t8_dline_first_descendant ( const t8_dline_t l,
t8_dline_t s,
int  level 
)

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

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

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

◆ t8_dline_get_level()

int t8_dline_get_level ( const t8_dline_t l)

Compute the level of a line.

Parameters
[in]lLine whose level is computed.
Returns
The level of l.

◆ t8_dline_init()

void t8_dline_init ( t8_dline_t l)

Set default values for a line, such that it passes t8_dline_is_valid.

Parameters
[in]lline to be initialized

◆ t8_dline_init_linear_id()

void t8_dline_init_linear_id ( t8_dline_t l,
int  level,
t8_linearidx_t  id 
)

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

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

◆ t8_dline_is_familypv()

int t8_dline_is_familypv ( const t8_dline_t f[])

Check whether a collection of two lines is a family in Morton order.

Parameters
[in]fAn array of two lines.
Returns
Nonzero if f is a family of lines.

◆ t8_dline_is_inside_root()

int t8_dline_is_inside_root ( const t8_dline_t l)

Test if a line lies inside of the root line, that is the line of level 0, anchor node (0,0)

Parameters
[in]lInput line.
Returns
true If l lies inside of the root line.

◆ t8_dline_is_root_boundary()

int t8_dline_is_root_boundary ( const t8_dline_t p,
int  face 
)

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

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

◆ t8_dline_is_valid()

int t8_dline_is_valid ( const t8_dline_t l)

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

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

◆ t8_dline_last_descendant()

void t8_dline_last_descendant ( const t8_dline_t l,
t8_dline_t s,
int  level 
)

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

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

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

◆ t8_dline_linear_id()

t8_linearidx_t t8_dline_linear_id ( const t8_dline_t elem,
int  level 
)

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

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

◆ t8_dline_nearest_common_ancestor()

void t8_dline_nearest_common_ancestor ( const t8_dline_t t1,
const t8_dline_t t2,
t8_dline_t r 
)

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

Parameters
[in]l1First input line.
[in]l2Second input line.
[in,out]rExisting line whose data will be filled.
Note
l1, l2, r may point to the same line.

◆ t8_dline_parent()

void t8_dline_parent ( const t8_dline_t l,
t8_dline_t parent 
)

Compute the parent of a line.

Parameters
[in]lThe input line.
[in,out]parentExisting line whose data will be filled with the parent data of l.

◆ t8_dline_successor()

void t8_dline_successor ( const t8_dline_t l,
t8_dline_t succ,
int  level 
)

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

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

◆ t8_dline_transform_face()

void t8_dline_transform_face ( const t8_dline_t line1,
t8_dline_t line2,
int  orientation 
)

Suppose we have two trees that share a common face f.

Given a Line e that is a subface of f in one of the trees and given the orientation of the tree connection, construct the face Line of the respective tree neighbor that logically coincides with e but lies in the coordinate system of the neighbor tree.

Parameters
[in]elem1The face element.
[in,out]elem2On return the face elment elem1 with respective to the coordinate system of the other tree.
[in]orientationThe orientation of the tree-tree connection. 0 if vertex 0 of face 0 coincides with vertex 0 of face 1. 1 if vertex 0 of face 0 coincides with vertex 1 of face 1.

◆ t8_dline_vertex_coords()

void t8_dline_vertex_coords ( const t8_dline_t elem,
const int  vertex,
int  coords[] 
)

Compute the first or second vertex of a line.

Parameters
[in]elemLine whose vertex is computed.
[in]vertexThe number of the vertex of elem
[out]coordsThe coordinates of the computed vertex

◆ t8_dline_vertex_ref_coords()

void t8_dline_vertex_ref_coords ( const t8_dline_t elem,
const int  vertex,
double  coordinates[1] 
)

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

Parameters
[in]tInput line.
[in]vertexThe number of the vertex.
[out]coordinatesAn array of 1 double that will be filled with the reference coordinates of the vertex.