t8  1.2.0
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
t8_dtet_bits.h
Go to the documentation of this file.
1 /*
2  This file is part of t8code.
3  t8code is a C library to manage a collection (a forest) of multiple
4  connected adaptive space-trees of general element classes in parallel.
5 
6  Copyright (C) 2015 the developers
7 
8  t8code is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  t8code is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with t8code; if not, write to the Free Software Foundation, Inc.,
20  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22 
30 #ifndef T8_DTET_BITS_H
31 #define T8_DTET_BITS_H
32 
33 #include <t8_element.h>
35 
36 T8_EXTERN_C_BEGIN ();
37 
44 void t8_dtet_compute_coords (const t8_dtet_t *elem, int vertex,
45  t8_dtet_coord_t coordinates[3]);
46 
55  int vertex,
56  double coordinates[3]);
57 
65  coordinates[4][3]);
66 
72 void t8_dtet_copy (const t8_dtet_t *t, t8_dtet_t *dest);
73 
79 int t8_dtet_compare (const t8_dtet_t *t1,
80  const t8_dtet_t *t2);
81 
88 void t8_dtet_parent (const t8_dtet_t *t, t8_dtet_t *parent);
89 
98 void t8_dtet_ancestor (const t8_dtet_t *t, int level,
99  t8_dtet_t *ancestor);
100 
107 void t8_dtet_child (const t8_dtet_t *elem,
108  int childid, t8_dtet_t *child);
109 
117 
123 
130 void t8_dtet_sibling (const t8_dtet_t *elem,
131  int sibid, t8_dtet_t *sibling);
132 
139 int t8_dtet_face_neighbour (const t8_dtet_t *t, int face,
140  t8_dtet_t *n);
141 
149  const t8_dtet_t *t2,
150  t8_dtet_t *r);
151 
163  int face,
164  t8_dtet_t *children[],
165  int num_children,
166  int *child_indices);
167 
177  int face, int face_child);
178 
188 int t8_dtet_face_parent_face (const t8_dtet_t *tet, int face);
189 
200 int t8_dtet_tree_face (t8_dtet_t *t, int face);
201 
212 int t8_dtet_root_face_to_face (t8_dtet_t *t, int root_face);
213 
221 
227 int t8_dtet_is_root_boundary (const t8_dtet_t *t, int face);
228 
233  const t8_dtet_t *t2);
234 
241  const t8_dtet_t *t2);
242 
249  const t8_dtet_t *c);
250 
257  const t8_dtet_t *c);
258 
266 
277  t8_linearidx_t id,
278  int start_level,
279  int end_level,
281  parenttype);
282 
290  int level);
291 
296 
304  int level);
305 
314  t8_dtet_t *s, int level);
315 
324  t8_dtet_t *s, int level);
325 
335  t8_dtet_t *s, int corner,
336  int level);
337 
345  int level);
346 
353 int t8_dtet_ancestor_id (const t8_dtet_t *t, int level);
354 
361 
367 
375 
376 void t8_dtet_debug_print (const t8_dtet_t *t);
377 
382 
383 T8_EXTERN_C_END ();
384 
385 #endif /* T8_DTET_BITS_H */
This data type stores a tetrahedron.
Definition: t8_dtet.h:71
uint64_t t8_linearidx_t
A type for storing SFC indices.
Definition: t8.h:114
TODO: document this.
int32_t t8_dtet_coord_t
The coordinates of a tetrahedron are integers relative to the maximum refinement.
Definition: t8_dtet.h:67
int8_t t8_dtet_type_t
The type of a tetrahedron designates its position relative to the surrounding cube.
Definition: t8_dtet.h:64
#define T8_DTET_CHILDREN
The number of children that a tetrahedron is refined into.
Definition: t8_dtet.h:35
int t8_dtet_get_level(const t8_dtet_t *t)
Return the level of a tetrahedron.
void t8_dtet_childrenpv(const t8_dtet_t *t, t8_dtet_t *c[T8_DTET_CHILDREN])
Compute the 8 children of a tetrahedron, array version.
void t8_dtet_compute_all_coords(const t8_dtet_t *elem, t8_dtet_coord_t coordinates[4][3])
Compute the coordinates of the four vertices of a tetrahedron.
void t8_dtet_children_at_face(const t8_dtet_t *tet, int face, t8_dtet_t *children[], int num_children, int *child_indices)
Given a tetrahedron and a face of the tetrahedron, compute all children of the tetrahedron that touch...
void t8_dtet_init_linear_id(t8_dtet_t *t, t8_linearidx_t id, int level)
Initialize a tetrahedron as the tetrahedron with a given global id in a uniform refinement of a given...
void t8_dtet_last_descendant(const t8_dtet_t *t, t8_dtet_t *s, int level)
Compute the last descendant of a tetrahedron at a given level.
void t8_dtet_init_root(t8_dtet_t *t)
Initialize a tetrahedron as the root tetrahedron (type 0 at level 0)
int t8_dtet_face_neighbour(const t8_dtet_t *t, int face, t8_dtet_t *n)
Compute the face neighbor of a tetrahedron.
void t8_dtet_init(t8_dtet_t *t)
Set sensible default values for a tet.
int t8_dtet_is_equal(const t8_dtet_t *t1, const t8_dtet_t *t2)
Test if two tetrahedra have the same coordinates, type and level.
int t8_dtet_face_child_face(const t8_dtet_t *tet, int face, int face_child)
Given a face of an tetrahedron and a child number of a child of that face, return the face number of ...
int t8_dtet_is_sibling(const t8_dtet_t *t1, const t8_dtet_t *t2)
Test if two tetrahedra are siblings.
void t8_dtet_successor(const t8_dtet_t *t, t8_dtet_t *s, int level)
Computes the successor of a tetrahedron in a uniform grid of level level.
void t8_dtet_predecessor(const t8_dtet_t *t, t8_dtet_t *s, int level)
Computes the predecessor of a tetrahedron in a uniform grid of level level.
void t8_dtet_corner_descendant(const t8_dtet_t *t, t8_dtet_t *s, int corner, int level)
Compute the descendant of a tetrahedron in a given corner.
void t8_dtet_first_descendant(const t8_dtet_t *t, t8_dtet_t *s, int level)
Compute the first descendant of a tetrahedron at a given level.
void t8_dtet_compute_vertex_ref_coords(const t8_dtet_t *elem, int vertex, double coordinates[3])
Compute the coordinates of a vertex of a tetrahedron when the tree (level 0 tetrahedron) is embedded ...
void t8_dtet_ancestor(const t8_dtet_t *t, int level, t8_dtet_t *ancestor)
Compute the ancestor of a tetrahedron at a given level.
int t8_dtet_is_inside_root(t8_dtet_t *t)
Test if a tetrahedron lies inside of the root tetrahedron, that is the tetrahedron of level 0,...
int t8_dtet_ancestor_id(const t8_dtet_t *t, int level)
Compute the position of the ancestor of this child at level level within its siblings.
void t8_dtet_sibling(const t8_dtet_t *elem, int sibid, t8_dtet_t *sibling)
Compute a specific sibling of a tetrahedron.
void t8_dtet_child(const t8_dtet_t *elem, int childid, t8_dtet_t *child)
Compute the childid-th child in Morton order of a tetrahedron t.
void t8_dtet_copy(const t8_dtet_t *t, t8_dtet_t *dest)
Copy the values of one tetrahedron to another.
int t8_dtet_tree_face(t8_dtet_t *t, int face)
Given a tetrahedron and a face of this tetrahedron.
int t8_dtet_compare(const t8_dtet_t *t1, const t8_dtet_t *t2)
Compare two tets in their linear order.
void t8_dtet_compute_coords(const t8_dtet_t *elem, int vertex, t8_dtet_coord_t coordinates[3])
Compute the coordinates of a vertex of a tetrahedron.
int t8_dtet_root_face_to_face(t8_dtet_t *t, int root_face)
Given a tetrahedron and a face of the root tetrahedron.
int t8_dtet_child_id(const t8_dtet_t *t)
Compute the position of the ancestor of this child at level level within its siblings.
int t8_dtet_is_parent(const t8_dtet_t *t, const t8_dtet_t *c)
Test if a tetrahedron is the parent of another tetrahedron.
int t8_dtet_is_root_boundary(const t8_dtet_t *t, int face)
Compute whether a given tetrahedron shares a given face with its root tree.
void t8_dtet_init_linear_id_with_level(t8_dtet_t *t, t8_linearidx_t id, int start_level, int end_level, t8_dtet_type_t parenttype)
Same as init_linear_id, but we only consider the subtree.
int t8_dtet_is_valid(const t8_dtet_t *t)
Query whether all entries of a tet are in valid ranges.
int t8_dtet_face_parent_face(const t8_dtet_t *tet, int face)
Given a face of an tet return the face number of the parent of the tet that matches the tet's face.
void t8_dtet_parent(const t8_dtet_t *t, t8_dtet_t *parent)
Compute the parent of a tetrahedron.
int t8_dtet_is_familypv(const t8_dtet_t *f[])
Check whether a collection of eight tetrahedra is a family in Morton order.
void t8_dtet_nearest_common_ancestor(const t8_dtet_t *t1, const t8_dtet_t *t2, t8_dtet_t *r)
Computes the nearest common ancestor of two tetrahedra in the same tree.
int t8_dtet_is_ancestor(const t8_dtet_t *t, const t8_dtet_t *c)
Test if a tetrahedron is an ancestor of another tetrahedron.
t8_linearidx_t t8_dtet_linear_id(const t8_dtet_t *t, int level)
Computes the linear position of a tetrahedron in a uniform grid.
This file defines basic operations on an element in a refinement tree.