p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
p4est_bits.h File Reference

Routines for manipulating quadrants (neighbors, parents, children, etc.) More...

#include <p4est.h>

Go to the source code of this file.

Functions

void p4est_quadrant_print (int log_priority, const p4est_quadrant_t *q)
 Prints one line with quadrant's x, y and level. More...
 
int p4est_quadrant_is_equal (const p4est_quadrant_t *q1, const p4est_quadrant_t *q2)
 Test if two quadrants have equal Morton indices. More...
 
int p4est_quadrant_overlaps (const p4est_quadrant_t *q1, const p4est_quadrant_t *q2)
 Test if two quadrants overlap. More...
 
int p4est_quadrant_is_equal_piggy (const p4est_quadrant_t *q1, const p4est_quadrant_t *q2)
 Test if two quadrants have equal Morton indices and the same tree id. More...
 
int p4est_quadrant_compare (const void *v1, const void *v2)
 Compare two quadrants in their Morton ordering. More...
 
int p4est_quadrant_disjoint (const void *v1, const void *v2)
 Compare two quadrants in their Morton ordering, with equivalence if the two quadrants overlap. More...
 
int p4est_quadrant_compare_piggy (const void *v1, const void *v2)
 Compare two quadrants in their Morton ordering and the which_tree member. More...
 
int p4est_quadrant_compare_local_num (const void *v1, const void *v2)
 Compare two quadrants with respect to their local_num in the piggy3 member. More...
 
int p4est_quadrant_equal_fn (const void *v1, const void *v2, const void *u)
 Test if two quadrants have equal Morton indices, callback version. More...
 
unsigned p4est_quadrant_hash_fn (const void *v, const void *u)
 Computes a hash value for a quadrant by the lookup3 method.
 
int p4est_node_equal_piggy_fn (const void *v1, const void *v2, const void *u)
 Test if two nodes are in the same tree and have equal Morton indices. More...
 
unsigned p4est_node_hash_piggy_fn (const void *v, const void *u)
 Compute hash value of a node based on its tree and Morton index. More...
 
void p4est_node_clamp_inside (const p4est_quadrant_t *n, p4est_quadrant_t *r)
 Clamp a node inside the unit tree if it sits on a high border. More...
 
void p4est_node_unclamp (p4est_quadrant_t *n)
 Move a clamped node out on the border. More...
 
void p4est_node_to_quadrant (const p4est_quadrant_t *n, int level, p4est_quadrant_t *q)
 Find the enclosing quadrant of a given node at a given level. More...
 
int p4est_quadrant_contains_node (const p4est_quadrant_t *q, const p4est_quadrant_t *n)
 Decide if a node is completely contained within a quadrant. More...
 
int p4est_quadrant_ancestor_id (const p4est_quadrant_t *q, int level)
 Compute the position of the ancestor of this child at level level within its siblings. More...
 
int p4est_quadrant_child_id (const p4est_quadrant_t *q)
 Compute the position of this child within its siblings. More...
 
int p4est_quadrant_is_inside_root (const p4est_quadrant_t *q)
 Test if a quadrant is inside the unit tree. More...
 
int p4est_quadrant_is_inside_3x3 (const p4est_quadrant_t *q)
 Test if a quadrant is inside the 3x3 box around the root tree. More...
 
int p4est_quadrant_is_outside_face (const p4est_quadrant_t *q)
 Test if a quadrant is outside a tree face boundary (no corner). More...
 
int p4est_quadrant_is_outside_corner (const p4est_quadrant_t *q)
 Test if a quadrant is outside a tree corner boundary. More...
 
int p4est_quadrant_is_node (const p4est_quadrant_t *q, int inside)
 Test if a quadrant is used to represent a mesh node. More...
 
int p4est_quadrant_is_valid (const p4est_quadrant_t *q)
 Test if a quadrant has valid Morton indices and is inside the unit tree. More...
 
int p4est_quadrant_is_extended (const p4est_quadrant_t *q)
 Test if a quadrant has valid Morton indices in the 3x3 box around root. More...
 
int p4est_quadrant_is_sibling (const p4est_quadrant_t *q1, const p4est_quadrant_t *q2)
 Test if two quadrants are siblings. More...
 
int p4est_quadrant_is_sibling_D (const p4est_quadrant_t *q1, const p4est_quadrant_t *q2)
 Test if two quadrants are siblings. More...
 
int p4est_quadrant_is_family (const p4est_quadrant_t *q0, const p4est_quadrant_t *q1, const p4est_quadrant_t *q2, const p4est_quadrant_t *q3)
 Test if 4 quadrants are siblings in Morton ordering.
 
int p4est_quadrant_is_familyv (const p4est_quadrant_t q[])
 Test if 4 quadrants are siblings in Morton ordering, array version. More...
 
int p4est_quadrant_is_familypv (p4est_quadrant_t *q[])
 Test if 4 quadrants are siblings in Morton ordering, array version. More...
 
int p4est_quadrant_is_parent (const p4est_quadrant_t *q, const p4est_quadrant_t *r)
 Test if a quadrant is the parent of another quadrant. More...
 
int p4est_quadrant_is_parent_D (const p4est_quadrant_t *q, const p4est_quadrant_t *r)
 Test if a quadrant is the parent of another quadrant. More...
 
int p4est_quadrant_is_ancestor (const p4est_quadrant_t *q, const p4est_quadrant_t *r)
 Test if a quadrant is an ancestor of another quadrant. More...
 
int p4est_quadrant_is_ancestor_D (const p4est_quadrant_t *q, const p4est_quadrant_t *r)
 Test if a quadrant is an ancestor of another quadrant. More...
 
int p4est_quadrant_is_next (const p4est_quadrant_t *q, const p4est_quadrant_t *r)
 Test if two quadrants follow each other in the tree with no holes. More...
 
int p4est_quadrant_is_next_D (const p4est_quadrant_t *q, const p4est_quadrant_t *r)
 Test if two quadrants follow each other in the tree with no holes. More...
 
int p4est_quadrant_overlaps_tree (p4est_tree_t *tree, const p4est_quadrant_t *q)
 Test if a quadrant has at least partial overlap with a tree.
 
int p4est_quadrant_is_inside_tree (p4est_tree_t *tree, const p4est_quadrant_t *q)
 Test if a quadrant is completely contained within a tree.
 
void p4est_quadrant_ancestor (const p4est_quadrant_t *q, int level, p4est_quadrant_t *r)
 Compute the ancestor of a quadrant at a given level. More...
 
void p4est_quadrant_parent (const p4est_quadrant_t *q, p4est_quadrant_t *r)
 Compute the parent of a quadrant. More...
 
void p4est_quadrant_sibling (const p4est_quadrant_t *q, p4est_quadrant_t *r, int sibling_id)
 Compute a specific sibling of a quadrant. More...
 
void p4est_quadrant_face_neighbor (const p4est_quadrant_t *q, int face, p4est_quadrant_t *r)
 Compute the face neighbor of a quadrant. More...
 
p4est_topidx_t p4est_quadrant_face_neighbor_extra (const p4est_quadrant_t *q, p4est_topidx_t t, int face, p4est_quadrant_t *r, int *nface, p4est_connectivity_t *conn)
 Compute the face neighbor of a quadrant, transforming across tree boundaries if necessary. More...
 
void p4est_quadrant_half_face_neighbors (const p4est_quadrant_t *q, int face, p4est_quadrant_t n[], p4est_quadrant_t nur[])
 Get the smaller face neighbors of q. More...
 
void p4est_quadrant_all_face_neighbors (const p4est_quadrant_t *q, int face, p4est_quadrant_t n[])
 Create all possible face neighbors of q. More...
 
void p4est_quadrant_corner_neighbor (const p4est_quadrant_t *q, int corner, p4est_quadrant_t *r)
 Compute the corner neighbor of a quadrant. More...
 
void p4est_quadrant_corner_neighbor_extra (const p4est_quadrant_t *q, p4est_locidx_t t, int corner, sc_array_t *quads, sc_array_t *treeids, sc_array_t *ncorners, p4est_connectivity_t *conn)
 Compute the corner neighbors of a quadrant, transforming across tree boundaries if necessary. More...
 
void p4est_quadrant_half_corner_neighbor (const p4est_quadrant_t *q, int corner, p4est_quadrant_t *r)
 Compute the half size corner neighbor of a quadrant. More...
 
void p4est_quadrant_corner_node (const p4est_quadrant_t *q, int corner, p4est_quadrant_t *r)
 Compute the corner node of a quadrant. More...
 
void p4est_quadrant_children (const p4est_quadrant_t *q, p4est_quadrant_t *c0, p4est_quadrant_t *c1, p4est_quadrant_t *c2, p4est_quadrant_t *c3)
 Compute the 4 children of a quadrant. More...
 
void p4est_quadrant_childrenv (const p4est_quadrant_t *q, p4est_quadrant_t c[])
 Compute the 4 children of a quadrant, array version. More...
 
void p4est_quadrant_childrenpv (const p4est_quadrant_t *q, p4est_quadrant_t *c[])
 Compute the 4 children of a quadrant, array version. More...
 
void p4est_quadrant_first_descendant (const p4est_quadrant_t *q, p4est_quadrant_t *fd, int level)
 Compute the first descendant of a quadrant on a given level. More...
 
void p4est_quadrant_last_descendant (const p4est_quadrant_t *q, p4est_quadrant_t *ld, int level)
 Compute the last descendant of a quadrant on a given level. More...
 
void p4est_quadrant_corner_descendant (const p4est_quadrant_t *q, p4est_quadrant_t *r, int c, int level)
 Compute the descendant of a quadrant touching a given corner. More...
 
void p4est_nearest_common_ancestor (const p4est_quadrant_t *q1, const p4est_quadrant_t *q2, p4est_quadrant_t *r)
 Computes the nearest common ancestor of two quadrants in the same tree. More...
 
void p4est_nearest_common_ancestor_D (const p4est_quadrant_t *q1, const p4est_quadrant_t *q2, p4est_quadrant_t *r)
 Computes the nearest common ancestor of two quadrants in the same tree. More...
 
void p4est_quadrant_transform_face (const p4est_quadrant_t *q, p4est_quadrant_t *r, const int ftransform[])
 Transforms a quadrant/node across a face between trees. More...
 
int p4est_quadrant_touches_corner (const p4est_quadrant_t *q, int corner, int inside)
 Checks if a quadrant touches a corner (diagonally inside or outside).
 
void p4est_quadrant_transform_corner (p4est_quadrant_t *q, int icorner, int inside)
 Move a quadrant inside or diagonally outside a corner position. More...
 
void p4est_quadrant_shift_corner (const p4est_quadrant_t *q, p4est_quadrant_t *r, int corner)
 Shifts a quadrant until it touches the specified corner from the inside. More...
 
uint64_t p4est_quadrant_linear_id (const p4est_quadrant_t *quadrant, int level)
 Computes the linear position of a quadrant in a uniform grid. More...
 
void p4est_quadrant_set_morton (p4est_quadrant_t *quadrant, int level, uint64_t id)
 Set quadrant Morton indices based on linear position in uniform grid. More...
 

Detailed Description

Routines for manipulating quadrants (neighbors, parents, children, etc.)

Function Documentation

void p4est_nearest_common_ancestor ( const p4est_quadrant_t q1,
const p4est_quadrant_t q2,
p4est_quadrant_t r 
)

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

Parameters
[in]q1First input quadrant.
[in]q2Second input quadrant.
[in,out]rExisting quadrant whose Morton index will be filled. Its user_data will be untouched.
Note
q1, q2, r may point to the same quadrant. The user_data of r is never modified.
void p4est_nearest_common_ancestor_D ( const p4est_quadrant_t q1,
const p4est_quadrant_t q2,
p4est_quadrant_t r 
)

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

Descriptive, slower version of p4est_nearest_common_ancestor. For debugging and educationial purposes only.

void p4est_node_clamp_inside ( const p4est_quadrant_t n,
p4est_quadrant_t r 
)

Clamp a node inside the unit tree if it sits on a high border.

Parameters
[in]nNode to be clamped. Must not yet be clamped.
[out]rExisting node overwritten by the clamped result.
int p4est_node_equal_piggy_fn ( const void *  v1,
const void *  v2,
const void *  u 
)

Test if two nodes are in the same tree and have equal Morton indices.

Parameters
[in]v1Pointer to a clamped or unclamped node, depending on u.
[in]v2Pointer to a clamped or unclamped node, depending on u.
[in]uUser data, points to an int holding the clamped-flag.
unsigned p4est_node_hash_piggy_fn ( const void *  v,
const void *  u 
)

Compute hash value of a node based on its tree and Morton index.

Parameters
[in]vPointer to a clamped or unclamped node, depending on u.
[in]uUser data, points to an int holding the clamped-flag.
void p4est_node_to_quadrant ( const p4est_quadrant_t n,
int  level,
p4est_quadrant_t q 
)

Find the enclosing quadrant of a given node at a given level.

Parameters
[in]nClamped node.
[in]levelLevel of the quadrant to be created.
[out]qOutput quadrant, n == q is permitted.
void p4est_node_unclamp ( p4est_quadrant_t n)

Move a clamped node out on the border.

Parameters
[in]nNode to be unclamped in-place.
void p4est_quadrant_all_face_neighbors ( const p4est_quadrant_t q,
int  face,
p4est_quadrant_t  n[] 
)

Create all possible face neighbors of q.

Gets the face neighbors, possible assuming the 2-1 constraint. If the larger or smaller quadrants do not exist than they are returned as initialized by P4EST_QUADRANT_INIT.

The order of n[0] through n[3] are given in Morton ordering.

Parameters
[in]qThe quadrant whose face neighbors will be constructed.
[in]faceThe face across which to generate the neighbors.
[out]n[0]..n[1]Filled with the smaller possible face neighbors, which are half of the size if they exist or initialized to P4EST_QUADRANT_INIT.
[out]n[2]Filled with the face neighbor, which is the same size.
[out]n[3]Filled with the face neighbor, which is twice the size if it exists or initialized to P4EST_QUADRANT_INIT.
void p4est_quadrant_ancestor ( const p4est_quadrant_t q,
int  level,
p4est_quadrant_t r 
)

Compute the ancestor of a quadrant at a given level.

Parameters
[in]qInput quadrant.
[in]levelA smaller level than q.
[in,out]rExisting quadrent whose Morton index will be filled with the ancestor of q at the given level.
Note
The quadrant q may point to the same quadrant as r. The user_data of r are never modified.
int p4est_quadrant_ancestor_id ( const p4est_quadrant_t q,
int  level 
)

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

Returns
Returns its child id in 0..3
int p4est_quadrant_child_id ( const p4est_quadrant_t q)

Compute the position of this child within its siblings.

Returns
Returns its child id in 0..3
void p4est_quadrant_children ( const p4est_quadrant_t q,
p4est_quadrant_t c0,
p4est_quadrant_t c1,
p4est_quadrant_t c2,
p4est_quadrant_t c3 
)

Compute the 4 children of a quadrant.

Parameters
[in]qInput quadrant.
[in,out]c0First computed child. q may point to the same quadrant as c0.
Note
The user_data of c0, c1, c2, c3 is never modified.
void p4est_quadrant_childrenpv ( const p4est_quadrant_t q,
p4est_quadrant_t c[] 
)

Compute the 4 children of a quadrant, array version.

Parameters
[in]qInput quadrant.
[in,out]cPointers to the 4 computed children in z-order. q may point to the same quadrant as c[0].
Note
The user_data of c[i] is never modified.
void p4est_quadrant_childrenv ( const p4est_quadrant_t q,
p4est_quadrant_t  c[] 
)

Compute the 4 children of a quadrant, array version.

Parameters
[in]qInput quadrant.
[in,out]cThe 4 computed children in z-order. q may point to the same quadrant as c[0].
Note
The user_data of c[i] is never modified.
int p4est_quadrant_compare ( const void *  v1,
const void *  v2 
)

Compare two quadrants in their Morton ordering.

Both quadrants must be valid.

Returns
Returns < 0 if v1 < v2, 0 if v1 == v2, > 0 if v1 > v2
int p4est_quadrant_compare_local_num ( const void *  v1,
const void *  v2 
)

Compare two quadrants with respect to their local_num in the piggy3 member.

Returns
Returns < 0 if v1 < v2, 0 if v1 == v2, > 0 if v1 > v2
int p4est_quadrant_compare_piggy ( const void *  v1,
const void *  v2 
)

Compare two quadrants in their Morton ordering and the which_tree member.

Both quadrants must be extended (superset of valid, see below).

Returns
Returns < 0 if v1 < v2, 0 if v1 == v2, > 0 if v1 > v2
int p4est_quadrant_contains_node ( const p4est_quadrant_t q,
const p4est_quadrant_t n 
)

Decide if a node is completely contained within a quadrant.

Parameters
[in]qValid quadrant.
[in]nClamped node.
void p4est_quadrant_corner_descendant ( const p4est_quadrant_t q,
p4est_quadrant_t r,
int  c,
int  level 
)

Compute the descendant of a quadrant touching a given corner.

Parameters
[in]qInput quadrant.
[in,out]rExisting quadrant whose Morton index will be filled. Its user_data will be untouched.
[in]cThe corner of q that r touches.
[in]levelThe size of r.
void p4est_quadrant_corner_neighbor ( const p4est_quadrant_t q,
int  corner,
p4est_quadrant_t r 
)

Compute the corner neighbor of a quadrant.

Parameters
[in]qInput quadrant, must be valid.
[in]cornerThe corner across which to generate the neighbor.
[in,out]rExisting quadrant whose Morton index will be filled.
Note
q may point to the same quadrant as r.
void p4est_quadrant_corner_neighbor_extra ( const p4est_quadrant_t q,
p4est_locidx_t  t,
int  corner,
sc_array_t quads,
sc_array_t treeids,
sc_array_t ncorners,
p4est_connectivity_t conn 
)

Compute the corner neighbors of a quadrant, transforming across tree boundaries if necessary.

Only computes neighbors that are not face or edge neighbors.

Parameters
[in]qInput quadrant, must be valid.
[in]tTree that contains .
[in]cornerThe corner across which to generate the neighbor.
[in,out]quadsAn initialized but empty array where the corner neighbors will be placed.
[in,out]treeidsAn initialized but empty array where the ids of the trees containing the corner neighbors will be placed.
[in,out]ncornersif not NULL, filled with the corners of quads that neighbor .
[in]connThe connectivity structure for the forest.
void p4est_quadrant_corner_node ( const p4est_quadrant_t q,
int  corner,
p4est_quadrant_t r 
)

Compute the corner node of a quadrant.

Parameters
[in]qInput quadrant, must be valid.
[in]cornerThe corner across which to generate the neighbor.
[in,out]rNode that will not be clamped inside.
Note
q may point to the same quadrant as r.
int p4est_quadrant_disjoint ( const void *  v1,
const void *  v2 
)

Compare two quadrants in their Morton ordering, with equivalence if the two quadrants overlap.

Returns
Returns < 0 if v1 < v2 and v1 and v2 do not overlap, 0 if v1 and v2 overlap, > 0 if v1 > v2 and v1 and v2 do not overlap.
int p4est_quadrant_equal_fn ( const void *  v1,
const void *  v2,
const void *  u 
)

Test if two quadrants have equal Morton indices, callback version.

Returns
true if v1 describes the same quadrant as v2.
void p4est_quadrant_face_neighbor ( const p4est_quadrant_t q,
int  face,
p4est_quadrant_t r 
)

Compute the face neighbor of a quadrant.

Parameters
[in]qInput quadrant, must be valid.
[in]faceThe face across which to generate the neighbor.
[in,out]rExisting quadrant whose Morton index will be filled.
Note
q may point to the same quadrant as r.
p4est_topidx_t p4est_quadrant_face_neighbor_extra ( const p4est_quadrant_t q,
p4est_topidx_t  t,
int  face,
p4est_quadrant_t r,
int *  nface,
p4est_connectivity_t conn 
)

Compute the face neighbor of a quadrant, transforming across tree boundaries if necessary.

Parameters
[in]qInput quadrant, must be valid.
[in]tTree that contains .
[in]faceThe face across which to generate the neighbor.
[in,out]rExisting quadrant whose Morton index will be filled. By convention, if there is no tree across , has the same Morton index as .
[in,out]nfaceif not NULL, set to the face of that neighbors . nface is encoded with orientation information in the same manner as the tree_to_face array in the p4est_connectivity_t struct.
[in]connThe connectivity structure for the forest.
Returns
Returns the tree that contains . By convention, if there is no tree across , then -1 is returned.
void p4est_quadrant_first_descendant ( const p4est_quadrant_t q,
p4est_quadrant_t fd,
int  level 
)

Compute the first descendant of a quadrant on a given level.

Parameters
[in]qInput quadrant.
[out]fdFirst descendant of q on level level.
[in]levelLevel must be greater equal than q's level.
void p4est_quadrant_half_corner_neighbor ( const p4est_quadrant_t q,
int  corner,
p4est_quadrant_t r 
)

Compute the half size corner neighbor of a quadrant.

Parameters
[in]qThe quadrant whose corner neighbor will be constructed.
[in]cornerThe corner across which to generate the neighbor.
[out]rMorton index filled with the half size corner neighbor.
void p4est_quadrant_half_face_neighbors ( const p4est_quadrant_t q,
int  face,
p4est_quadrant_t  n[],
p4est_quadrant_t  nur[] 
)

Get the smaller face neighbors of q.

Gets the smaller face neighbors, which are half of the size assuming the 2-1 constant.

The order of the n[i] is given in the Morton ordering.

Parameters
[in]qThe quadrant whose face neighbors will be constructed.
[in]faceThe face across which to generate the neighbors.
[out]n[0]..n[1]Filled with the four smaller face neighbors.
[out]nur[0]..nur[1]If not NULL, filled with smallest quadrants that fit in the upper right corners of n.
int p4est_quadrant_is_ancestor ( const p4est_quadrant_t q,
const p4est_quadrant_t r 
)

Test if a quadrant is an ancestor of another quadrant.

Parameters
[in]qQuadrant to be tested.
[in]rDescendent quadrant.
Returns
true if q is unequal to and an ancestor of r.
int p4est_quadrant_is_ancestor_D ( const p4est_quadrant_t q,
const p4est_quadrant_t r 
)

Test if a quadrant is an ancestor of another quadrant.

Descriptive, slower version of p4est_quadrant_is_ancestor. Contrary to p4est_quadrant_is_ancestor, it aborts for inter-tree q, r. For debugging and educational purposes only.

int p4est_quadrant_is_equal ( const p4est_quadrant_t q1,
const p4est_quadrant_t q2 
)

Test if two quadrants have equal Morton indices.

Returns
true if q1 describes the same quadrant as q2.
int p4est_quadrant_is_equal_piggy ( const p4est_quadrant_t q1,
const p4est_quadrant_t q2 
)

Test if two quadrants have equal Morton indices and the same tree id.

Returns
true if q1 describes the same quadrant as q2 and the p.which_tree fields are equal.
int p4est_quadrant_is_extended ( const p4est_quadrant_t q)

Test if a quadrant has valid Morton indices in the 3x3 box around root.

Parameters
[in]qQuadrant to be tested.
Returns
Returns true if q is extended.
int p4est_quadrant_is_familypv ( p4est_quadrant_t q[])

Test if 4 quadrants are siblings in Morton ordering, array version.

Parameters
[in]qArray of 4 pointers to quadrants.
int p4est_quadrant_is_familyv ( const p4est_quadrant_t  q[])

Test if 4 quadrants are siblings in Morton ordering, array version.

Parameters
[in]qArray of 4 quadrants.
int p4est_quadrant_is_inside_3x3 ( const p4est_quadrant_t q)

Test if a quadrant is inside the 3x3 box around the root tree.

Parameters
[in]qQuadrant to be tested.
Returns
Returns true if q is inside the unit tree.
int p4est_quadrant_is_inside_root ( const p4est_quadrant_t q)

Test if a quadrant is inside the unit tree.

Parameters
[in]qQuadrant to be tested.
Returns
Returns true if q is inside the unit tree.
int p4est_quadrant_is_next ( const p4est_quadrant_t q,
const p4est_quadrant_t r 
)

Test if two quadrants follow each other in the tree with no holes.

Parameters
[in]qA quadrant
[in]rAnother quadrant
Returns
true if q is immediately before r in the tree.
Note
for every q there are between 0 and P4EST_MAXLEVEL+1 possible nexts.
int p4est_quadrant_is_next_D ( const p4est_quadrant_t q,
const p4est_quadrant_t r 
)

Test if two quadrants follow each other in the tree with no holes.

Descriptive, slower version of p4est_quadrant_is_next. For debugging and educational purposes only.

int p4est_quadrant_is_node ( const p4est_quadrant_t q,
int  inside 
)

Test if a quadrant is used to represent a mesh node.

Parameters
[in]qQuadrant to be tested.
[in]insideIf true, boundary nodes must be clamped inside. If false, nodes must align with the quadrant grid.
Returns
Returns true if q is a node.
int p4est_quadrant_is_outside_corner ( const p4est_quadrant_t q)

Test if a quadrant is outside a tree corner boundary.

Parameters
[in]qQuadrant to be tested.
Returns
Returns true if q is outside across a unit tree corner.
int p4est_quadrant_is_outside_face ( const p4est_quadrant_t q)

Test if a quadrant is outside a tree face boundary (no corner).

Parameters
[in]qQuadrant to be tested.
Returns
Returns true if q is outside across a unit tree face.
int p4est_quadrant_is_parent ( const p4est_quadrant_t q,
const p4est_quadrant_t r 
)

Test if a quadrant is the parent of another quadrant.

Parameters
[in]qQuadrant to be tested.
[in]rPossible child quadrant.
Returns
true if q is the parent of r.
int p4est_quadrant_is_parent_D ( const p4est_quadrant_t q,
const p4est_quadrant_t r 
)

Test if a quadrant is the parent of another quadrant.

Descriptive, slower version of p4est_quadrant_is_parent. For debugging and educational purposes only.

int p4est_quadrant_is_sibling ( const p4est_quadrant_t q1,
const p4est_quadrant_t q2 
)

Test if two quadrants are siblings.

Parameters
[in]q1First quadrant to be tested.
[in]q2Second quadrant to be tested.
Returns
true if q1 is unequal to and a sibling of q2.
int p4est_quadrant_is_sibling_D ( const p4est_quadrant_t q1,
const p4est_quadrant_t q2 
)

Test if two quadrants are siblings.

Descriptive, slower version of p4est_quadrant_is_sibling. For debugging and educational purposes only.

int p4est_quadrant_is_valid ( const p4est_quadrant_t q)

Test if a quadrant has valid Morton indices and is inside the unit tree.

Parameters
[in]qQuadrant to be tested.
Returns
Returns true if q is valid.
void p4est_quadrant_last_descendant ( const p4est_quadrant_t q,
p4est_quadrant_t ld,
int  level 
)

Compute the last descendant of a quadrant on a given level.

Parameters
[in]qInput quadrant.
[out]ldLast descendant of q on level level.
[in]levelLevel must be greater equal than q's level.
uint64_t p4est_quadrant_linear_id ( const p4est_quadrant_t quadrant,
int  level 
)

Computes the linear position of a quadrant in a uniform grid.

Parameters
[in]quadrantQuadrant whose id will be computed.
Returns
Returns the linear position of this quadrant on a grid.
Note
This is the inverse operation of p4est_quadrant_set_morton. The user_data of quadrant is never modified.
int p4est_quadrant_overlaps ( const p4est_quadrant_t q1,
const p4est_quadrant_t q2 
)

Test if two quadrants overlap.

Returns
true if q1 and q2 are equal or one is the ancestor of the other.
void p4est_quadrant_parent ( const p4est_quadrant_t q,
p4est_quadrant_t r 
)

Compute the parent of a quadrant.

Parameters
[in]qInput quadrant.
[in,out]rExisting quadrant whose Morton index will be filled with the Morton index of the parent of q. Its user_data will be untouched.
Note
q may point to the same quadrant as r. The user_data of r is never modified.
void p4est_quadrant_print ( int  log_priority,
const p4est_quadrant_t q 
)

Prints one line with quadrant's x, y and level.

Parameters
[in]log_prioritysee log priorities in sc.h for the meanings of numerical priority values
[in]qquadrant to print
void p4est_quadrant_set_morton ( p4est_quadrant_t quadrant,
int  level,
uint64_t  id 
)

Set quadrant Morton indices based on linear position in uniform grid.

Parameters
[in,out]quadrantQuadrant whose Morton indices will be set.
[in]idThe linear position of this quadrant on a grid.
Note
This is the inverse operation of p4est_quadrant_linear_id. The user_data of quadrant is never modified.
void p4est_quadrant_shift_corner ( const p4est_quadrant_t q,
p4est_quadrant_t r,
int  corner 
)

Shifts a quadrant until it touches the specified corner from the inside.

Parameters
[in]qValid input quadrant.
[in,out]rQuadrant whose Morton index will be filled.
[in]cornerCorner index.
void p4est_quadrant_sibling ( const p4est_quadrant_t q,
p4est_quadrant_t r,
int  sibling_id 
)

Compute a specific sibling of a quadrant.

Parameters
[in]qInput quadrant.
[in,out]rExisting quadrant whose Morton index will be filled with the coordinates of sibling no. sibling_id of q.
[in]sibling_idThe id of the sibling computed, 0..3.
void p4est_quadrant_transform_corner ( p4est_quadrant_t q,
int  icorner,
int  inside 
)

Move a quadrant inside or diagonally outside a corner position.

Parameters
[in,out]qThis quadrant only requires a valid level.
[in]icornerNumber of the corner in 0..3.
[int]inside Boolean flag for inside or diagonally outside.
void p4est_quadrant_transform_face ( const p4est_quadrant_t q,
p4est_quadrant_t r,
const int  ftransform[] 
)

Transforms a quadrant/node across a face between trees.

Parameters
[in]qInput quadrant/non-clamped node.
[in,out]rQuadrant/node whose Morton index will be filled.
[in]ftransformThis array holds 9 integers. [0,2] The coordinate axis sequence of the origin face. [3,5] The coordinate axis sequence of the target face. [6,8] Edge reverse flag for axis 0; face code for 1. [1,4,7] 0 (unused for compatibility with 3D).
Note
q and r may NOT point to the same quadrant structure.