p4est 2.8.6
p4est is a software library for parallel adaptive mesh refinement.
|
Routines for manipulating quadrants (neighbors, parents, children, etc.) More...
Go to the source code of this file.
Functions | |
void | p4est_quadrant_pad (p4est_quadrant_t *q) |
Write -1 into the pad8 and pad16 members of a quadrant. More... | |
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... | |
void | p4est_quadrant_copy (const p4est_quadrant_t *q, p4est_quadrant_t *copy) |
Copy the Morton indices of the quadrant q. 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_coordinates_compare (const p4est_qcoord_t v1[], const p4est_qcoord_t v2[]) |
Compare two sets of coordinates 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_coordinates_is_inside_root (const p4est_qcoord_t coord[]) |
Test if Morton indices are inside the unit tree. 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_coordinates_is_valid (const p4est_qcoord_t coord[], int level) |
Test if Morton indices are valid and are inside the unit tree. 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. | |
int | p4est_quadrant_is_first_last (const p4est_quadrant_t *f, const p4est_quadrant_t *l, const p4est_quadrant_t *a) |
Whether two descendants of a quadrant are first and last, up to size. More... | |
void | p4est_quadrant_enlarge_first (const p4est_quadrant_t *a, p4est_quadrant_t *q) |
Enlarge a quadrant as long as its first corner stays the same. More... | |
void | p4est_quadrant_enlarge_last (const p4est_quadrant_t *a, p4est_quadrant_t *q) |
Enlarge a quadrant as long as its last corner stays the same. More... | |
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_child (const p4est_quadrant_t *q, p4est_quadrant_t *r, int child_id) |
Compute a specific child 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... | |
void | p4est_coordinates_transform_face (const p4est_qcoord_t coords_in[], p4est_qcoord_t coords_out[], const int ftransform[]) |
Transforms coordinates 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... | |
void | p4est_quadrant_successor (const p4est_quadrant_t *quadrant, p4est_quadrant_t *result) |
Compute the successor according to the Morton index in a uniform mesh. More... | |
void | p4est_quadrant_predecessor (const p4est_quadrant_t *quadrant, p4est_quadrant_t *result) |
Compute the predecessor according to the Morton index in a uniform mesh. More... | |
void | p4est_quadrant_srand (const p4est_quadrant_t *q, sc_rand_state_t *rstate) |
Initialize a random number generator by quadrant coordinates. More... | |
void | p4est_neighbor_transform_quadrant (const p4est_neighbor_transform_t *nt, const p4est_quadrant_t *self_quad, p4est_quadrant_t *neigh_quad) |
Transform a quadrant from self's coordinate system to neighbor's coordinate system. More... | |
void | p4est_neighbor_transform_quadrant_reverse (const p4est_neighbor_transform_t *nt, const p4est_quadrant_t *neigh_quad, p4est_quadrant_t *self_quad) |
Transform a quadrant from a neighbors's coordinate system to self's coordinate system. More... | |
int | p4est_quadrant_is_ancestor_face (const p4est_quadrant_t *descendant, const p4est_quadrant_t *ancestor, int face) |
Check if a descendant shares a face with a (strict) ancestor. More... | |
int | p4est_quadrant_is_ancestor_corner (const p4est_quadrant_t *descendant, const p4est_quadrant_t *ancestor, int corner) |
Check if a descendant shares a corner with a (strict) ancestor. More... | |
Routines for manipulating quadrants (neighbors, parents, children, etc.)
int p4est_coordinates_compare | ( | const p4est_qcoord_t | v1[], |
const p4est_qcoord_t | v2[] | ||
) |
Compare two sets of coordinates in their Morton ordering.
Coordinates are signed, but the sorted order will treat them as unsigned, with negative coordinates being greater than positive coordinates because of their representation in twos-complement.
[in] | v1,v2 | Two sets of 2d coordinates. |
int p4est_coordinates_is_inside_root | ( | const p4est_qcoord_t | coord[] | ) |
Test if Morton indices are inside the unit tree.
[in] | coord | 2d coordinates. |
int p4est_coordinates_is_valid | ( | const p4est_qcoord_t | coord[], |
int | level | ||
) |
Test if Morton indices are valid and are inside the unit tree.
[in] | coord | 2d coordinates. |
[in] | level | level |
void p4est_coordinates_transform_face | ( | const p4est_qcoord_t | coords_in[], |
p4est_qcoord_t | coords_out[], | ||
const int | ftransform[] | ||
) |
Transforms coordinates across a face between trees.
[in] | coords_in | Input coordinates. |
[out] | coords_out | Output coordinates. |
[in] | ftransform | This 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). |
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.
[in] | q1 | First input quadrant. |
[in] | q2 | Second input quadrant. |
[in,out] | r | Existing quadrant whose Morton index will be filled. Its user_data will be untouched. |
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_neighbor_transform_quadrant | ( | const p4est_neighbor_transform_t * | nt, |
const p4est_quadrant_t * | self_quad, | ||
p4est_quadrant_t * | neigh_quad | ||
) |
Transform a quadrant from self's coordinate system to neighbor's coordinate system.
[in] | nt | A neighbor transform. |
[in] | self_quad | Input quadrant in self coordinates. |
[out] | neigh_coords | Quad transformed into neighbor coordinates. |
void p4est_neighbor_transform_quadrant_reverse | ( | const p4est_neighbor_transform_t * | nt, |
const p4est_quadrant_t * | neigh_quad, | ||
p4est_quadrant_t * | self_quad | ||
) |
Transform a quadrant from a neighbors's coordinate system to self's coordinate system.
[in] | nt | A neighbor transform. |
[in] | neigh_coords | Input quadrant in neighbor coordinates. |
[out] | self_coords | Quad transformed into self coordinates. |
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.
[in] | n | Node to be clamped. Must not yet be clamped. |
[out] | r | Existing 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.
[in] | v1 | Pointer to a clamped or unclamped node, depending on u. |
[in] | v2 | Pointer to a clamped or unclamped node, depending on u. |
[in] | u | User 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.
[in] | v | Pointer to a clamped or unclamped node, depending on u. |
[in] | u | User 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.
[in] | n | Clamped node. |
[in] | level | Level of the quadrant to be created. |
[out] | q | Output quadrant, n == q is permitted. |
void p4est_node_unclamp | ( | p4est_quadrant_t * | n | ) |
Move a clamped node out on the border.
[in] | n | Node 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.
[in] | q | The quadrant whose face neighbors will be constructed. |
[in] | face | The 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.
[in] | q | Input quadrant. |
[in] | level | A smaller level than q. |
[in,out] | r | Existing quadrant whose Morton index will be filled with the ancestor of q at the given level. |
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.
void p4est_quadrant_child | ( | const p4est_quadrant_t * | q, |
p4est_quadrant_t * | r, | ||
int | child_id | ||
) |
Compute a specific child of a quadrant.
[in] | q | Input quadrant. |
[in,out] | r | Existing quadrant whose Morton index will be filled with the coordinates of its child no. child_id. |
[in] | child_id | The id of the child computed, 0..3. |
int p4est_quadrant_child_id | ( | const p4est_quadrant_t * | q | ) |
Compute the position of this child within its siblings.
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.
[in] | q | Input quadrant. |
[in,out] | c0 | First computed child. q may point to the same quadrant as c0. |
void p4est_quadrant_childrenpv | ( | const p4est_quadrant_t * | q, |
p4est_quadrant_t * | c[] | ||
) |
Compute the 4 children of a quadrant, array version.
[in] | q | Input quadrant. |
[in,out] | c | Pointers to the 4 computed children in z-order. q may point to the same quadrant as c[0]. |
void p4est_quadrant_childrenv | ( | const p4est_quadrant_t * | q, |
p4est_quadrant_t | c[] | ||
) |
Compute the 4 children of a quadrant, array version.
[in] | q | Input quadrant. |
[in,out] | c | The 4 computed children in z-order. q may point to the same quadrant as c[0]. |
int p4est_quadrant_compare | ( | const void * | v1, |
const void * | v2 | ||
) |
Compare two quadrants in their Morton ordering.
Both quadrants must be valid.
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.
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).
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.
[in] | q | Valid quadrant. |
[in] | n | Clamped node. |
void p4est_quadrant_copy | ( | const p4est_quadrant_t * | q, |
p4est_quadrant_t * | copy | ||
) |
Copy the Morton indices of the quadrant q.
[in] | q | An extended quadrant. |
[in,out] | copy | An existing quadrant that Morton indices will be set to the Morton indices of q. |
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.
[in] | q | Input quadrant. |
[in,out] | r | Existing quadrant whose Morton index will be filled. Its user_data will be untouched. |
[in] | c | The corner of q that r touches. |
[in] | level | The 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.
[in] | q | Input quadrant, must be valid. |
[in] | corner | The corner across which to generate the neighbor. |
[in,out] | r | Existing quadrant whose Morton index will be filled. |
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.
[in] | q | Input quadrant, must be valid. |
[in] | t | Tree that contains q. |
[in] | corner | The corner across which to generate the neighbor. |
[in,out] | quads | An initialized but empty array where the corner neighbors will be placed. |
[in,out] | treeids | An initialized but empty array where the ids of the trees containing the corner neighbors will be placed. |
[in,out] | ncorners | if not NULL, filled with the corners of quads that neighbor q. |
[in] | conn | The 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.
[in] | q | Input quadrant, must be valid. |
[in] | corner | The corner across which to generate the neighbor. |
[in,out] | r | Node that will not be clamped inside. |
int p4est_quadrant_disjoint | ( | const void * | v1, |
const void * | v2 | ||
) |
Compare two quadrants in their Morton ordering, with equivalence if the two quadrants overlap.
void p4est_quadrant_enlarge_first | ( | const p4est_quadrant_t * | a, |
p4est_quadrant_t * | q | ||
) |
Enlarge a quadrant as long as its first corner stays the same.
We limit the enlargement by containing it in an ancestor quadrant.
[in] | a | Extended quadrant. On input and output, equal to or strict ancestor of the quadrant q to be modified. |
[in,out] | q | On input and output, an extended quadrant and also equal or a strict descendant of a. Possibly enlarged by this function. |
void p4est_quadrant_enlarge_last | ( | const p4est_quadrant_t * | a, |
p4est_quadrant_t * | q | ||
) |
Enlarge a quadrant as long as its last corner stays the same.
We limit the enlargement by containing it in an ancestor quadrant.
[in] | a | Extended quadrant. On input and output, equal to or strict ancestor of the quadrant q to be modified. |
[in,out] | q | On input and output, an extended quadrant and also equal or a strict descendant of a. Possibly enlarged by this function. |
int p4est_quadrant_equal_fn | ( | const void * | v1, |
const void * | v2, | ||
const void * | u | ||
) |
Test if two quadrants have equal Morton indices, callback version.
void p4est_quadrant_face_neighbor | ( | const p4est_quadrant_t * | q, |
int | face, | ||
p4est_quadrant_t * | r | ||
) |
Compute the face neighbor of a quadrant.
[in] | q | Input quadrant, must be valid. |
[in] | face | The face across which to generate the neighbor. |
[in,out] | r | Existing quadrant whose Morton index will be filled. |
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.
[in] | q | Input quadrant, must be valid. |
[in] | t | Tree that contains q. |
[in] | face | The face across which to generate the neighbor. |
[in,out] | r | Existing quadrant whose Morton index will be filled. By convention, if there is no tree across face, r has the same Morton index as q. |
[in,out] | nface | if not NULL, set to the face of r that neighbors q. nface is encoded with orientation information in the same manner as the tree_to_face array in the p4est_connectivity_t struct. |
[in] | conn | The connectivity structure for the forest. |
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.
[in] | q | Input quadrant. |
[out] | fd | First descendant of q on level level. |
[in] | level | Level 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.
[in] | q | The quadrant whose corner neighbor will be constructed. |
[in] | corner | The corner across which to generate the neighbor. |
[out] | r | Morton 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.
[in] | q | The quadrant whose face neighbors will be constructed. |
[in] | face | The 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.
[in] | q | Quadrant to be tested. |
[in] | r | Descendent quadrant. |
int p4est_quadrant_is_ancestor_corner | ( | const p4est_quadrant_t * | descendant, |
const p4est_quadrant_t * | ancestor, | ||
int | corner | ||
) |
Check if a descendant shares a corner with a (strict) ancestor.
[in] | descendant | The descendant in question. |
[in] | ancestor | The ancestor must not be equal to the descendant. |
[in] | corner | The corner of the descendant. |
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_ancestor_face | ( | const p4est_quadrant_t * | descendant, |
const p4est_quadrant_t * | ancestor, | ||
int | face | ||
) |
Check if a descendant shares a face with a (strict) ancestor.
[in] | descendant | The descendant in question. |
[in] | ancestor | The ancestor must not be equal to the descendant. |
[in] | face | The face of the descendant. |
int p4est_quadrant_is_equal | ( | const p4est_quadrant_t * | q1, |
const p4est_quadrant_t * | q2 | ||
) |
Test if two quadrants have equal Morton indices.
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.
int p4est_quadrant_is_extended | ( | const p4est_quadrant_t * | q | ) |
Test if a quadrant has valid Morton indices in the 3x3 box around root.
[in] | q | Quadrant to be tested. |
int p4est_quadrant_is_familypv | ( | p4est_quadrant_t * | q[] | ) |
Test if 4 quadrants are siblings in Morton ordering, array version.
[in] | q | Array 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.
[in] | q | Array of 4 quadrants. |
int p4est_quadrant_is_first_last | ( | const p4est_quadrant_t * | f, |
const p4est_quadrant_t * | l, | ||
const p4est_quadrant_t * | a | ||
) |
Whether two descendants of a quadrant are first and last, up to size.
[in] | f | An extended quadrant, need not be of maximum level. |
[in] | l | An extended quadrant, need not be of maximum level. It must be greater equal f in the space filling curve. |
[in] | a | An extended quadrant, equal to or ancestor of f, and likewise to/of l. |
int p4est_quadrant_is_inside_3x3 | ( | const p4est_quadrant_t * | q | ) |
Test if a quadrant is inside the 3x3 box around the root tree.
[in] | q | Quadrant to be tested. |
int p4est_quadrant_is_inside_root | ( | const p4est_quadrant_t * | q | ) |
Test if a quadrant is inside the unit tree.
[in] | q | Quadrant to be tested. |
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.
[in] | q | A quadrant |
[in] | r | Another quadrant |
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.
[in] | q | Quadrant to be tested. |
[in] | inside | If true, boundary nodes must be clamped inside. If false, nodes must align with the quadrant grid. |
int p4est_quadrant_is_outside_corner | ( | const p4est_quadrant_t * | q | ) |
Test if a quadrant is outside a tree corner boundary.
[in] | q | Quadrant to be tested. |
int p4est_quadrant_is_outside_face | ( | const p4est_quadrant_t * | q | ) |
Test if a quadrant is outside a tree face boundary (no corner).
[in] | q | Quadrant to be tested. |
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.
[in] | q | Quadrant to be tested. |
[in] | r | Possible child quadrant. |
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.
[in] | q1 | First quadrant to be tested. |
[in] | q2 | Second quadrant to be tested. |
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.
[in] | q | Quadrant to be tested. |
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.
[in] | q | Input quadrant. |
[out] | ld | Last descendant of q on level level. |
[in] | level | Level 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.
The grid and quadrant levels need not coincide. If they do, this is the inverse of p4est_quadrant_set_morton.
[in] | quadrant | Quadrant whose linear index will be computed. If the quadrant is smaller than the grid (has a higher quadrant->level), the result is computed from its ancestor at the grid's level. If the quadrant has a smaller level than the grid (it is bigger than a grid cell), the grid cell sharing its lower left corner is used as reference. |
[in] | level | The level of the regular grid compared to which the linear position is to be computed. |
int p4est_quadrant_overlaps | ( | const p4est_quadrant_t * | q1, |
const p4est_quadrant_t * | q2 | ||
) |
Test if two quadrants overlap.
void p4est_quadrant_pad | ( | p4est_quadrant_t * | q | ) |
Write -1 into the pad8 and pad16 members of a quadrant.
This helps with valgrind cleanliness if a quadrant is sent over MPI.
void p4est_quadrant_parent | ( | const p4est_quadrant_t * | q, |
p4est_quadrant_t * | r | ||
) |
Compute the parent of a quadrant.
[in] | q | Input quadrant. |
[in,out] | r | Existing quadrant whose Morton index will be filled with the Morton index of the parent of q. Its user_data will be untouched. |
void p4est_quadrant_predecessor | ( | const p4est_quadrant_t * | quadrant, |
p4est_quadrant_t * | result | ||
) |
Compute the predecessor according to the Morton index in a uniform mesh.
[in] | quadrant | Quadrant whose Morton predecessor will be computed. Must not be the first (bottom left) quadrant in the tree. |
[in,out] | result | The coordinates and level of the predecessor of quadrant will be saved in result. |
void p4est_quadrant_print | ( | int | log_priority, |
const p4est_quadrant_t * | q | ||
) |
Prints one line with quadrant's x, y and level.
[in] | log_priority | see logpriorities in sc.h for the meanings of numerical priority values |
[in] | q | quadrant 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.
This is the inverse operation of p4est_quadrant_linear_id.
[in,out] | quadrant | Quadrant whose Morton indices will be set. |
[in] | level | Level of the grid and of the resulting quadrant. |
[in] | id | Linear index of the quadrant on a uniform grid. |
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.
[in] | q | Valid input quadrant. |
[in,out] | r | Quadrant whose Morton index will be filled. |
[in] | corner | Corner index. |
void p4est_quadrant_sibling | ( | const p4est_quadrant_t * | q, |
p4est_quadrant_t * | r, | ||
int | sibling_id | ||
) |
Compute a specific sibling of a quadrant.
[in] | q | Input quadrant. |
[in,out] | r | Existing quadrant whose Morton index will be filled with the coordinates of sibling no. sibling_id of q. |
[in] | sibling_id | The id of the sibling computed, 0..3. |
void p4est_quadrant_srand | ( | const p4est_quadrant_t * | q, |
sc_rand_state_t * | rstate | ||
) |
Initialize a random number generator by quadrant coordinates.
This serves to generate partition-independent and reproducible samples.
[in] | q | Valid quadrant. |
[out] | rstate | New state of random number generator. |
void p4est_quadrant_successor | ( | const p4est_quadrant_t * | quadrant, |
p4est_quadrant_t * | result | ||
) |
Compute the successor according to the Morton index in a uniform mesh.
[in] | quadrant | Quadrant whose Morton successor will be computed. Must not be the last (top right) quadrant in the tree. |
[in,out] | result | The coordinates and level of the successor of quadrant will be saved in result. |
void p4est_quadrant_transform_corner | ( | p4est_quadrant_t * | q, |
int | icorner, | ||
int | inside | ||
) |
Move a quadrant inside or diagonally outside a corner position.
[in,out] | q | This quadrant only requires a valid level. |
[in] | icorner | Number 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.
[in] | q | Input quadrant/non-clamped node. |
[in,out] | r | Quadrant/node whose Morton index will be filled. |
[in] | ftransform | This 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). |