p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p4est_bits.h
Go to the documentation of this file.
1 /*
2  This file is part of p4est.
3  p4est is a C library to manage a collection (a forest) of multiple
4  connected adaptive quadtrees or octrees in parallel.
5 
6  Copyright (C) 2010 The University of Texas System
7  Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac
8 
9  p4est is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  p4est is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with p4est; if not, write to the Free Software Foundation, Inc.,
21  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 */
23 
31 #ifndef P4EST_BITS_H
32 #define P4EST_BITS_H
33 
34 #include <p4est.h>
35 
36 SC_EXTERN_C_BEGIN;
37 
43 void p4est_quadrant_print (int log_priority,
44  const p4est_quadrant_t * q);
45 
50  const p4est_quadrant_t * q2);
51 
57  const p4est_quadrant_t * q2);
58 
64  q1,
65  const p4est_quadrant_t *
66  q2);
67 
74 int p4est_quadrant_compare (const void *v1, const void *v2);
75 
82 int p4est_quadrant_disjoint (const void *v1, const void *v2);
83 
90 int p4est_quadrant_compare_piggy (const void *v1,
91  const void *v2);
92 
98 int p4est_quadrant_compare_local_num (const void *v1,
99  const void *v2);
100 
104 int p4est_quadrant_equal_fn (const void *v1, const void *v2,
105  const void *u);
106 
109 unsigned p4est_quadrant_hash_fn (const void *v, const void *u);
110 
116 int p4est_node_equal_piggy_fn (const void *v1,
117  const void *v2, const void *u);
118 
123 unsigned p4est_node_hash_piggy_fn (const void *v, const void *u);
124 
130  p4est_quadrant_t * r);
131 
136 
143  int level, p4est_quadrant_t * q);
144 
150  const p4est_quadrant_t * n);
151 
157  int level);
158 
163 
169  q);
170 
176 
182  q);
183 
189  q);
190 
198  int inside);
199 
205 
211 
218  const p4est_quadrant_t * q2);
219 
225  const p4est_quadrant_t * q2);
226 
230  const p4est_quadrant_t * q1,
231  const p4est_quadrant_t * q2,
232  const p4est_quadrant_t * q3);
233 
238 
243 
250  const p4est_quadrant_t * r);
251 
257  const p4est_quadrant_t * r);
258 
265  const p4est_quadrant_t * r);
266 
273  const p4est_quadrant_t * r);
274 
282  const p4est_quadrant_t * r);
283 
289  const p4est_quadrant_t * r);
290 
294  const p4est_quadrant_t * q);
295 
299  const p4est_quadrant_t *
300  q);
301 
311  int level, p4est_quadrant_t * r);
312 
322  p4est_quadrant_t * r);
323 
331  p4est_quadrant_t * r,
332  int sibling_id);
333 
341  int face,
342  p4est_quadrant_t * r);
343 
361  * q, p4est_topidx_t t,
362  int face,
363  p4est_quadrant_t * r,
364  int *nface,
366  conn);
367 
382  * q, int face,
383  p4est_quadrant_t n[],
385  nur[]);
386 
405  * q, int face,
406  p4est_quadrant_t n[]);
407 
415  q, int corner,
416  p4est_quadrant_t * r);
417 
434  q, p4est_locidx_t t,
435  int corner,
436  sc_array_t * quads,
437  sc_array_t *
438  treeids,
439  sc_array_t *
440  ncorners,
442  * conn);
443 
451  p4est_quadrant_t * q,
452  int corner,
454  r);
455 
463  int corner,
464  p4est_quadrant_t * r);
465 
473  p4est_quadrant_t * c0,
474  p4est_quadrant_t * c1,
475  p4est_quadrant_t * c2,
476  p4est_quadrant_t * c3);
477 
485  p4est_quadrant_t c[]);
486 
494  p4est_quadrant_t * c[]);
495 
502  q, p4est_quadrant_t * fd,
503  int level);
504 
511  q, p4est_quadrant_t * ld,
512  int level);
513 
522  q, p4est_quadrant_t * r,
523  int c, int level);
524 
534  q1,
535  const p4est_quadrant_t *
536  q2, p4est_quadrant_t * r);
537 
543  q1,
544  const p4est_quadrant_t *
545  q2,
546  p4est_quadrant_t * r);
547 
559  p4est_quadrant_t * r,
560  const int ftransform[]);
561 
565  int corner, int inside);
566 
573  int icorner, int inside);
574 
581  p4est_quadrant_t * r,
582  int corner);
583 
591  quadrant, int level);
592 
600  int level, uint64_t id);
601 
602 SC_EXTERN_C_END;
603 
604 #endif /* !P4EST_BITS_H */
void p4est_quadrant_print(int log_priority, const p4est_quadrant_t *q)
Prints one line with quadrant's x, y and level.
Definition: p4est_bits.c:31
void p4est_node_unclamp(p4est_quadrant_t *n)
Move a clamped node out on the border.
Definition: p4est_bits.c:284
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.
Definition: p4est_bits.c:595
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.
Definition: p4est_bits.c:225
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.
Definition: p4est_bits.c:1311
int p4est_quadrant_is_outside_face(const p4est_quadrant_t *q)
Test if a quadrant is outside a tree face boundary (no corner).
Definition: p4est_bits.c:390
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.
Definition: p4est_bits.c:693
unsigned p4est_quadrant_hash_fn(const void *v, const void *u)
Computes a hash value for a quadrant by the lookup3 method.
Definition: p4est_bits.c:203
void p4est_quadrant_childrenv(const p4est_quadrant_t *q, p4est_quadrant_t c[])
Compute the 4 children of a quadrant, array version.
Definition: p4est_bits.c:1276
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.
Definition: p4est_bits.c:744
int p4est_quadrant_equal_fn(const void *v1, const void *v2, const void *u)
Test if two quadrants have equal Morton indices, callback version.
Definition: p4est_bits.c:187
int p4est_quadrant_child_id(const p4est_quadrant_t *q)
Compute the position of this child within its siblings.
Definition: p4est_bits.c:357
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.
Definition: p4est_bits.c:1202
void p4est_quadrant_transform_corner(p4est_quadrant_t *q, int icorner, int inside)
Move a quadrant inside or diagonally outside a corner position.
Definition: p4est_bits.c:1594
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.
Definition: p4est_bits.c:1384
int p4est_quadrant_is_inside_3x3(const p4est_quadrant_t *q)
Test if a quadrant is inside the 3x3 box around the root tree.
Definition: p4est_bits.c:375
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.
Definition: p4est_bits.c:578
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.
Definition: p4est_bits.c:771
int p4est_quadrant_is_valid(const p4est_quadrant_t *q)
Test if a quadrant has valid Morton indices and is inside the unit tree.
Definition: p4est_bits.c:441
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.
Definition: p4est_bits.c:1732
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.
Definition: p4est_bits.c:77
int p4est_quadrant_is_familyv(const p4est_quadrant_t q[])
Test if 4 quadrants are siblings in Morton ordering, array version.
Definition: p4est_bits.c:558
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.
Definition: p4est_bits.c:1345
int p4est_quadrant_is_outside_corner(const p4est_quadrant_t *q)
Test if a quadrant is outside a tree corner boundary.
Definition: p4est_bits.c:408
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.
Definition: p4est_bits.c:317
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.
Definition: p4est_bits.c:1620
The top-level 2D p4est interface.
int p4est_quadrant_compare(const void *v1, const void *v2)
Compare two quadrants in their Morton ordering.
Definition: p4est_bits.c:85
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.
Definition: p4est_bits.c:719
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.
Definition: p4est_bits.c:1421
void p4est_quadrant_sibling(const p4est_quadrant_t *q, p4est_quadrant_t *r, int sibling_id)
Compute a specific sibling of a quadrant.
Definition: p4est_bits.c:802
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.
Definition: p4est_bits.c:881
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.
Definition: p4est_bits.c:642
This structure holds the 2D inter-tree connectivity information.
Definition: p4est_connectivity.h:139
int p4est_quadrant_compare_piggy(const void *v1, const void *v2)
Compare two quadrants in their Morton ordering and the which_tree member.
Definition: p4est_bits.c:159
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.
Definition: p4est_bits.c:614
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).
Definition: p4est_bits.c:1544
void p4est_quadrant_corner_node(const p4est_quadrant_t *q, int corner, p4est_quadrant_t *r)
Compute the corner node of a quadrant.
Definition: p4est_bits.c:1184
int p4est_quadrant_is_inside_root(const p4est_quadrant_t *q)
Test if a quadrant is inside the unit tree.
Definition: p4est_bits.c:363
int p4est_quadrant_disjoint(const void *v1, const void *v2)
Compare two quadrants in their Morton ordering, with equivalence if the two quadrants overlap...
Definition: p4est_bits.c:139
int p4est_quadrant_is_sibling_D(const p4est_quadrant_t *q1, const p4est_quadrant_t *q2)
Test if two quadrants are siblings.
Definition: p4est_bits.c:507
int p4est_quadrant_is_familypv(p4est_quadrant_t *q[])
Test if 4 quadrants are siblings in Morton ordering, array version.
Definition: p4est_bits.c:568
The sc_array object provides a large array of equal-size elements.
Definition: sc_containers.h:92
int p4est_quadrant_is_sibling(const p4est_quadrant_t *q1, const p4est_quadrant_t *q2)
Test if two quadrants are siblings.
Definition: p4est_bits.c:467
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.
Definition: p4est_bits.c:177
uint64_t p4est_quadrant_linear_id(const p4est_quadrant_t *quadrant, int level)
Computes the linear position of a quadrant in a uniform grid.
Definition: p4est_bits.c:1700
void p4est_quadrant_parent(const p4est_quadrant_t *q, p4est_quadrant_t *r)
Compute the parent of a quadrant.
Definition: p4est_bits.c:787
void p4est_quadrant_face_neighbor(const p4est_quadrant_t *q, int face, p4est_quadrant_t *r)
Compute the face neighbor of a quadrant.
Definition: p4est_bits.c:826
The p4est tree datatype.
Definition: p4est.h:108
void p4est_quadrant_corner_neighbor(const p4est_quadrant_t *q, int corner, p4est_quadrant_t *r)
Compute the corner neighbor of a quadrant.
Definition: p4est_bits.c:984
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.
Definition: p4est_bits.c:659
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.
Definition: p4est_bits.c:844
int p4est_quadrant_is_node(const p4est_quadrant_t *q, int inside)
Test if a quadrant is used to represent a mesh node.
Definition: p4est_bits.c:420
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.
Definition: p4est_bits.c:1296
int32_t p4est_topidx_t
Typedef for counting topological entities (trees, tree vertices).
Definition: p4est_base.h:63
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.
Definition: p4est_bits.c:245
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.
Definition: p4est_bits.c:531
int32_t p4est_locidx_t
Typedef for processor-local indexing of quadrants and nodes.
Definition: p4est_base.h:74
int p4est_quadrant_overlaps(const p4est_quadrant_t *q1, const p4est_quadrant_t *q2)
Test if two quadrants overlap.
Definition: p4est_bits.c:58
int p4est_quadrant_is_equal(const p4est_quadrant_t *q1, const p4est_quadrant_t *q2)
Test if two quadrants have equal Morton indices.
Definition: p4est_bits.c:42
void p4est_quadrant_childrenpv(const p4est_quadrant_t *q, p4est_quadrant_t *c[])
Compute the 4 children of a quadrant, array version.
Definition: p4est_bits.c:1286
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.
Definition: p4est_bits.c:335
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.
Definition: p4est_bits.c:1164
The 2D quadrant datatype.
Definition: p4est.h:65
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.
Definition: p4est_bits.c:1330
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.
Definition: p4est_bits.c:270
void p4est_quadrant_all_face_neighbors(const p4est_quadrant_t *q, int face, p4est_quadrant_t n[])
Create all possible face neighbors of q.
Definition: p4est_bits.c:951
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...
Definition: p4est_bits.c:1002
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.
Definition: p4est_bits.c:300
int p4est_quadrant_is_extended(const p4est_quadrant_t *q)
Test if a quadrant has valid Morton indices in the 3x3 box around root.
Definition: p4est_bits.c:454