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

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

#include <p8est.h>

Go to the source code of this file.

Functions

void p8est_quadrant_print (int log_priority, const p8est_quadrant_t *q)
 Prints one line with quadrant's x, y, z and level. More...
 
int p8est_quadrant_is_equal (const p8est_quadrant_t *q1, const p8est_quadrant_t *q2)
 Test if two quadrants have equal Morton indices. More...
 
int p8est_quadrant_overlaps (const p8est_quadrant_t *q1, const p8est_quadrant_t *q2)
 Test if two quadrants overlap. More...
 
int p8est_quadrant_is_equal_piggy (const p8est_quadrant_t *q1, const p8est_quadrant_t *q2)
 Test if two quadrants have equal Morton indices and the same tree id. More...
 
int p8est_quadrant_compare (const void *v1, const void *v2)
 Compare two quadrants in their Morton ordering. More...
 
int p8est_quadrant_disjoint (const void *v1, const void *v2)
 Compare two quadrants in their Morton ordering, with equivalence if the two quadrants overlap. More...
 
int p8est_quadrant_compare_piggy (const void *v1, const void *v2)
 Compare two quadrants in their Morton ordering and the which_tree member. More...
 
int p8est_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 p8est_quadrant_equal_fn (const void *v1, const void *v2, const void *u)
 Test if two quadrants have equal Morton indices, callback version. More...
 
unsigned p8est_quadrant_hash_fn (const void *v, const void *u)
 Computes a hash value for a quadrant by the lookup3 method.
 
int p8est_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 p8est_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 p8est_node_clamp_inside (const p8est_quadrant_t *n, p8est_quadrant_t *r)
 Clamp a node inside the unit tree if it sits on a high border. More...
 
void p8est_node_unclamp (p8est_quadrant_t *n)
 Move a clamped node out on the border. More...
 
void p8est_node_to_quadrant (const p8est_quadrant_t *n, int level, p8est_quadrant_t *q)
 Find the enclosing quadrant of a given node at a given level. More...
 
int p8est_quadrant_contains_node (const p8est_quadrant_t *q, const p8est_quadrant_t *n)
 Decide if a node is completely contained within a quadrant. More...
 
int p8est_quadrant_ancestor_id (const p8est_quadrant_t *q, int level)
 Compute the position of the ancestor of this child at level level within its siblings. More...
 
int p8est_quadrant_child_id (const p8est_quadrant_t *q)
 Compute the position of this child within its siblings. More...
 
int p8est_quadrant_is_inside_root (const p8est_quadrant_t *q)
 Test if a quadrant is inside the unit tree. More...
 
int p8est_quadrant_is_inside_3x3 (const p8est_quadrant_t *q)
 Test if a quadrant is inside the 3x3 box around the root tree. More...
 
int p8est_quadrant_is_outside_face (const p8est_quadrant_t *q)
 Test if a quadrant is outside a tree face boundary (no edge or corner). More...
 
int p8est_quadrant_is_outside_edge (const p8est_quadrant_t *q)
 Test if a quadrant is outside a tree edge boundary (no corner). More...
 
int p8est_quadrant_is_outside_edge_extra (const p8est_quadrant_t *q, int *edge)
 Test if a quadrant is outside a tree edge boundary (no corner). More...
 
int p8est_quadrant_is_outside_corner (const p8est_quadrant_t *q)
 Test if a quadrant is outside a tree corner boundary. More...
 
int p8est_quadrant_is_node (const p8est_quadrant_t *q, int inside)
 Test if a quadrant is used to represent a mesh node. More...
 
int p8est_quadrant_is_valid (const p8est_quadrant_t *q)
 Test if a quadrant has valid Morton indices and is inside the unit tree. More...
 
int p8est_quadrant_is_extended (const p8est_quadrant_t *q)
 Test if a quadrant has valid Morton indices in the 3x3 box around root. More...
 
int p8est_quadrant_is_sibling (const p8est_quadrant_t *q1, const p8est_quadrant_t *q2)
 Test if two quadrants are siblings. More...
 
int p8est_quadrant_is_sibling_D (const p8est_quadrant_t *q1, const p8est_quadrant_t *q2)
 Test if two quadrants are siblings. More...
 
int p8est_quadrant_is_family (const p8est_quadrant_t *q0, const p8est_quadrant_t *q1, const p8est_quadrant_t *q2, const p8est_quadrant_t *q3, const p8est_quadrant_t *q4, const p8est_quadrant_t *q5, const p8est_quadrant_t *q6, const p8est_quadrant_t *q7)
 Test if 8 quadrants are siblings in Morton ordering.
 
int p8est_quadrant_is_familyv (const p8est_quadrant_t q[])
 Test if 8 quadrants are siblings in Morton ordering, array version. More...
 
int p8est_quadrant_is_familypv (p8est_quadrant_t *q[])
 Test if 8 quadrants are siblings in Morton ordering, array version. More...
 
int p8est_quadrant_is_parent (const p8est_quadrant_t *q, const p8est_quadrant_t *r)
 Test if a quadrant is the parent of another quadrant. More...
 
int p8est_quadrant_is_parent_D (const p8est_quadrant_t *q, const p8est_quadrant_t *r)
 Test if a quadrant is the parent of another quadrant. More...
 
int p8est_quadrant_is_ancestor (const p8est_quadrant_t *q, const p8est_quadrant_t *r)
 Test if a quadrant is an ancestor of another quadrant. More...
 
int p8est_quadrant_is_ancestor_D (const p8est_quadrant_t *q, const p8est_quadrant_t *r)
 Test if a quadrant is an ancestor of another quadrant. More...
 
int p8est_quadrant_is_next (const p8est_quadrant_t *q, const p8est_quadrant_t *r)
 Test if two quadrants follow each other in the tree with no holes. More...
 
int p8est_quadrant_is_next_D (const p8est_quadrant_t *q, const p8est_quadrant_t *r)
 Test if two quadrants follow each other in the tree with no holes. More...
 
int p8est_quadrant_overlaps_tree (p8est_tree_t *tree, const p8est_quadrant_t *q)
 Test if a quadrant has at least partial overlap with a tree.
 
int p8est_quadrant_is_inside_tree (p8est_tree_t *tree, const p8est_quadrant_t *q)
 Test if a quadrant is completely contained within a tree.
 
void p8est_quadrant_ancestor (const p8est_quadrant_t *q, int level, p8est_quadrant_t *r)
 Compute the ancestor of a quadrant at a given level. More...
 
void p8est_quadrant_parent (const p8est_quadrant_t *q, p8est_quadrant_t *r)
 Compute the parent of a quadrant. More...
 
void p8est_quadrant_sibling (const p8est_quadrant_t *q, p8est_quadrant_t *r, int sibling_id)
 Compute a specific sibling of a quadrant. More...
 
void p8est_quadrant_face_neighbor (const p8est_quadrant_t *q, int face, p8est_quadrant_t *r)
 Compute the face neighbor of a quadrant. More...
 
p4est_locidx_t p8est_quadrant_face_neighbor_extra (const p8est_quadrant_t *q, p4est_topidx_t t, int face, p8est_quadrant_t *r, int *nface, p8est_connectivity_t *conn)
 Compute the face neighbor of a quadrant, transforming across tree boundaries if necessary. More...
 
void p8est_quadrant_half_face_neighbors (const p8est_quadrant_t *q, int face, p8est_quadrant_t n[], p8est_quadrant_t nur[])
 Get the smaller face neighbors of q. More...
 
void p8est_quadrant_all_face_neighbors (const p8est_quadrant_t *q, int face, p8est_quadrant_t n[])
 Create all possible face neighbors of q. More...
 
void p8est_quadrant_edge_neighbor (const p8est_quadrant_t *q, int edge, p8est_quadrant_t *r)
 Compute the edge neighbor of a quadrant. More...
 
void p8est_quadrant_edge_neighbor_extra (const p8est_quadrant_t *q, p4est_locidx_t t, int edge, sc_array_t *quads, sc_array_t *treeids, sc_array_t *nedges, p8est_connectivity_t *conn)
 Compute the edge neighbors of a quadrant, transforming across tree boundaries if necessary. More...
 
void p8est_quadrant_corner_neighbor (const p8est_quadrant_t *q, int corner, p8est_quadrant_t *r)
 Compute the corner neighbor of a quadrant. More...
 
void p8est_quadrant_corner_neighbor_extra (const p8est_quadrant_t *q, p4est_locidx_t t, int corner, sc_array_t *quads, sc_array_t *treeids, sc_array_t *ncorners, p8est_connectivity_t *conn)
 Compute the corner neighbors of a quadrant, transforming across tree boundaries if necessary. More...
 
void p8est_quadrant_half_corner_neighbor (const p8est_quadrant_t *q, int corner, p8est_quadrant_t *r)
 Compute the half size corner neighbor of a quadrant. More...
 
void p8est_quadrant_corner_node (const p8est_quadrant_t *q, int corner, p8est_quadrant_t *r)
 Compute the corner node of a quadrant. More...
 
void p8est_quadrant_children (const p8est_quadrant_t *q, p8est_quadrant_t *c0, p8est_quadrant_t *c1, p8est_quadrant_t *c2, p8est_quadrant_t *c3, p8est_quadrant_t *c4, p8est_quadrant_t *c5, p8est_quadrant_t *c6, p8est_quadrant_t *c7)
 Compute the 8 children of a quadrant. More...
 
void p8est_quadrant_childrenv (const p8est_quadrant_t *q, p8est_quadrant_t c[])
 Compute the 8 children of a quadrant, array version. More...
 
void p8est_quadrant_childrenpv (const p8est_quadrant_t *q, p8est_quadrant_t *c[])
 Compute the 8 children of a quadrant, array version. More...
 
void p8est_quadrant_first_descendant (const p8est_quadrant_t *q, p8est_quadrant_t *fd, int level)
 Compute the first descendant of a quadrant on a given level. More...
 
void p8est_quadrant_last_descendant (const p8est_quadrant_t *q, p8est_quadrant_t *ld, int level)
 Compute the last descendant of a quadrant on a given level. More...
 
void p8est_quadrant_corner_descendant (const p8est_quadrant_t *q, p8est_quadrant_t *r, int c, int level)
 Compute the descendant of a quadrant touching a given corner. More...
 
void p8est_nearest_common_ancestor (const p8est_quadrant_t *q1, const p8est_quadrant_t *q2, p8est_quadrant_t *r)
 Computes the nearest common ancestor of two quadrants in the same tree. More...
 
void p8est_nearest_common_ancestor_D (const p8est_quadrant_t *q1, const p8est_quadrant_t *q2, p8est_quadrant_t *r)
 Computes the nearest common ancestor of two quadrants in the same tree. More...
 
void p8est_quadrant_transform_face (const p8est_quadrant_t *q, p8est_quadrant_t *r, const int ftransform[])
 Transforms a quadrant/node across a face between trees. More...
 
int p8est_quadrant_touches_edge (const p8est_quadrant_t *q, int edge, int inside)
 Checks if a quadrant touches an edge (diagonally inside or outside).
 
void p8est_quadrant_transform_edge (const p8est_quadrant_t *q, p8est_quadrant_t *r, const p8est_edge_info_t *ei, const p8est_edge_transform_t *et, int inside)
 Transforms a quadrant across an edge between trees. More...
 
void p8est_quadrant_shift_edge (const p8est_quadrant_t *q, p8est_quadrant_t *r, p8est_quadrant_t *rup, p8est_quadrant_t *rdown, int edge)
 Shifts a quadrant until it touches the specified edge from the inside. More...
 
int p8est_quadrant_touches_corner (const p8est_quadrant_t *q, int corner, int inside)
 Checks if a quadrant touches a corner (diagonally inside or outside).
 
void p8est_quadrant_transform_corner (p8est_quadrant_t *r, int corner, int inside)
 Move a quadrant inside or diagonally outside a corner position. More...
 
void p8est_quadrant_shift_corner (const p8est_quadrant_t *q, p8est_quadrant_t *r, int corner)
 Shifts a quadrant until it touches the specified corner from the inside. More...
 
uint64_t p8est_quadrant_linear_id (const p8est_quadrant_t *quadrant, int level)
 Computes the linear position of a quadrant in a uniform grid. More...
 
void p8est_quadrant_set_morton (p8est_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 p8est_nearest_common_ancestor ( const p8est_quadrant_t q1,
const p8est_quadrant_t q2,
p8est_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 p8est_nearest_common_ancestor_D ( const p8est_quadrant_t q1,
const p8est_quadrant_t q2,
p8est_quadrant_t r 
)

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

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

void p8est_node_clamp_inside ( const p8est_quadrant_t n,
p8est_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 p8est_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 p8est_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 p8est_node_to_quadrant ( const p8est_quadrant_t n,
int  level,
p8est_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 p8est_node_unclamp ( p8est_quadrant_t n)

Move a clamped node out on the border.

Parameters
[in]nNode to be unclamped in-place.
void p8est_quadrant_all_face_neighbors ( const p8est_quadrant_t q,
int  face,
p8est_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[3]Filled with the smaller possible face neighbors, which are half of the size if they exist or initialized to P4EST_QUADRANT_INIT.
[out]n[4]Filled with the face neighbor, which is the same size.
[out]n[5]Filled with the face neighbor, which is twice the size if it exists or initialized to P4EST_QUADRANT_INIT.
void p8est_quadrant_ancestor ( const p8est_quadrant_t q,
int  level,
p8est_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 p8est_quadrant_ancestor_id ( const p8est_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..7
int p8est_quadrant_child_id ( const p8est_quadrant_t q)

Compute the position of this child within its siblings.

Returns
Returns its child id in 0..7
void p8est_quadrant_children ( const p8est_quadrant_t q,
p8est_quadrant_t c0,
p8est_quadrant_t c1,
p8est_quadrant_t c2,
p8est_quadrant_t c3,
p8est_quadrant_t c4,
p8est_quadrant_t c5,
p8est_quadrant_t c6,
p8est_quadrant_t c7 
)

Compute the 8 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, c4, c5, c6, c7 is never modified.
void p8est_quadrant_childrenpv ( const p8est_quadrant_t q,
p8est_quadrant_t c[] 
)

Compute the 8 children of a quadrant, array version.

Parameters
[in]qInput quadrant.
[in,out]cPointers to the 8 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 p8est_quadrant_childrenv ( const p8est_quadrant_t q,
p8est_quadrant_t  c[] 
)

Compute the 8 children of a quadrant, array version.

Parameters
[in]qInput quadrant.
[in,out]cThe 8 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 p8est_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 p8est_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 p8est_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 p8est_quadrant_contains_node ( const p8est_quadrant_t q,
const p8est_quadrant_t n 
)

Decide if a node is completely contained within a quadrant.

Parameters
[in]qValid quadrant.
[in]nClamped node.
void p8est_quadrant_corner_descendant ( const p8est_quadrant_t q,
p8est_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 p8est_quadrant_corner_neighbor ( const p8est_quadrant_t q,
int  corner,
p8est_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 p8est_quadrant_corner_neighbor_extra ( const p8est_quadrant_t q,
p4est_locidx_t  t,
int  corner,
sc_array_t quads,
sc_array_t treeids,
sc_array_t ncorners,
p8est_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 p8est_quadrant_corner_node ( const p8est_quadrant_t q,
int  corner,
p8est_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 p8est_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 do not overlap, 0 if v1 and v2 overlap, > 0 if v1 > v2 and v1 and do not overlap.
void p8est_quadrant_edge_neighbor ( const p8est_quadrant_t q,
int  edge,
p8est_quadrant_t r 
)

Compute the edge neighbor of a quadrant.

Parameters
[in]qInput quadrant, must be valid.
[in]edgeThe edge 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 p8est_quadrant_edge_neighbor_extra ( const p8est_quadrant_t q,
p4est_locidx_t  t,
int  edge,
sc_array_t quads,
sc_array_t treeids,
sc_array_t nedges,
p8est_connectivity_t conn 
)

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

Only computes neighbors that are not face neighbors.

Parameters
[in]qInput quadrant, must be valid.
[in]tTree that contains .
[in]edgeThe edge across which to generate the neighbor.
[in,out]quadsAn initialized but empty array where the edge neighbors will be placed.
[in,out]treeidsAn initialized but empty array where the ids of the trees containing the edge neighbors will be placed.
[in,out]nedgesif not NULL, filled with the edges of quads that neighbor . the ints in are encoded with orientation informatin like the edge_to_edge array in the p8est_connectivity_t struct
[in]connThe connectivity structure for the forest.
int p8est_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 p8est_quadrant_face_neighbor ( const p8est_quadrant_t q,
int  face,
p8est_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_locidx_t p8est_quadrant_face_neighbor_extra ( const p8est_quadrant_t q,
p4est_topidx_t  t,
int  face,
p8est_quadrant_t r,
int *  nface,
p8est_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 p8est_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 p8est_quadrant_first_descendant ( const p8est_quadrant_t q,
p8est_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 p8est_quadrant_half_corner_neighbor ( const p8est_quadrant_t q,
int  corner,
p8est_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 p8est_quadrant_half_face_neighbors ( const p8est_quadrant_t q,
int  face,
p8est_quadrant_t  n[],
p8est_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[3]Filled with the four smaller face neighbors.
[out]nur[0]..nur[3]If not NULL, filled with smallest quadrants that fit in the upper right corners of n.
int p8est_quadrant_is_ancestor ( const p8est_quadrant_t q,
const p8est_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 p8est_quadrant_is_ancestor_D ( const p8est_quadrant_t q,
const p8est_quadrant_t r 
)

Test if a quadrant is an ancestor of another quadrant.

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

int p8est_quadrant_is_equal ( const p8est_quadrant_t q1,
const p8est_quadrant_t q2 
)

Test if two quadrants have equal Morton indices.

Returns
true if q1 describes the same quadrant as q2.
int p8est_quadrant_is_equal_piggy ( const p8est_quadrant_t q1,
const p8est_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 p8est_quadrant_is_extended ( const p8est_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 p8est_quadrant_is_familypv ( p8est_quadrant_t q[])

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

Parameters
[in]qArray of 8 pointers to quadrants.
int p8est_quadrant_is_familyv ( const p8est_quadrant_t  q[])

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

Parameters
[in]qArray of 8 quadrants.
int p8est_quadrant_is_inside_3x3 ( const p8est_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 p8est_quadrant_is_inside_root ( const p8est_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 p8est_quadrant_is_next ( const p8est_quadrant_t q,
const p8est_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 P8EST_MAXLEVEL+1 possible nexts.
int p8est_quadrant_is_next_D ( const p8est_quadrant_t q,
const p8est_quadrant_t r 
)

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

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

int p8est_quadrant_is_node ( const p8est_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 p8est_quadrant_is_outside_corner ( const p8est_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 p8est_quadrant_is_outside_edge ( const p8est_quadrant_t q)

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

Parameters
[in]qQuadrant to be tested.
Returns
Returns true if q is outside across a unit tree edge.
int p8est_quadrant_is_outside_edge_extra ( const p8est_quadrant_t q,
int *  edge 
)

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

Parameters
[in]qQuadrant to be tested.
[out]edgeThe tree edge number is computed if outside edge. This pointer may be NULL.
Returns
Returns true if q is outside across a unit tree edge.
int p8est_quadrant_is_outside_face ( const p8est_quadrant_t q)

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

Parameters
[in]qQuadrant to be tested.
Returns
Returns true if q is outside across a unit tree face.
int p8est_quadrant_is_parent ( const p8est_quadrant_t q,
const p8est_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 p8est_quadrant_is_parent_D ( const p8est_quadrant_t q,
const p8est_quadrant_t r 
)

Test if a quadrant is the parent of another quadrant.

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

int p8est_quadrant_is_sibling ( const p8est_quadrant_t q1,
const p8est_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 p8est_quadrant_is_sibling_D ( const p8est_quadrant_t q1,
const p8est_quadrant_t q2 
)

Test if two quadrants are siblings.

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

int p8est_quadrant_is_valid ( const p8est_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 p8est_quadrant_last_descendant ( const p8est_quadrant_t q,
p8est_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 p8est_quadrant_linear_id ( const p8est_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 p8est_quadrant_set_morton. The user_data of quadrant is never modified.
int p8est_quadrant_overlaps ( const p8est_quadrant_t q1,
const p8est_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 p8est_quadrant_parent ( const p8est_quadrant_t q,
p8est_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 p8est_quadrant_print ( int  log_priority,
const p8est_quadrant_t q 
)

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

Parameters
[in]log_prioritysee log priorities in sc.h for the meanings of numerical priority values
[in]qquadrant to print
void p8est_quadrant_set_morton ( p8est_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 p8est_quadrant_linear_id. The user_data of quadrant is never modified.
void p8est_quadrant_shift_corner ( const p8est_quadrant_t q,
p8est_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 p8est_quadrant_shift_edge ( const p8est_quadrant_t q,
p8est_quadrant_t r,
p8est_quadrant_t rup,
p8est_quadrant_t rdown,
int  edge 
)

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

If this shift is meant to recreate the effects of q on balancing across the edge, then r, rup, and rdown may all be necessary for that recreation.

Parameters
[in]qValid input quadrant.
[out]rQuadrant whose Morton index will be filled. This quadrant results from shifting q laterally towards the edge.
[out]rupQuadrant whose Morton index will be filled (may be NULL). This quadrant results from shifting q diagonally towards edge's higher corner.
[out]rdownQuadrant whose Morton index will be filled (may be NULL). This quadrant results from shifting q diagonally towards edge's lower corner.
[in]edgeEdge index.
void p8est_quadrant_sibling ( const p8est_quadrant_t q,
p8est_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 p8est_quadrant_transform_corner ( p8est_quadrant_t r,
int  corner,
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..7.
[int]inside Boolean flag for inside or diagonally outside.
void p8est_quadrant_transform_edge ( const p8est_quadrant_t q,
p8est_quadrant_t r,
const p8est_edge_info_t ei,
const p8est_edge_transform_t et,
int  inside 
)

Transforms a quadrant across an edge between trees.

Parameters
[in]qInput quadrant.
[in,out]rQuadrant whose Morton index will be filled.
[in]edgeEdge index of the originating quadrant.
[in]eiEdge information computed previously.
[in]insideThe quadrant will be placed inside or outside.
void p8est_quadrant_transform_face ( const p8est_quadrant_t q,
p8est_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 axes 0, 1; face code for 2.
Note
q and r may NOT point to the same quadrant structure.