t8  UNKNOWN
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 
43 void
44 t8_dtet_compute_integer_coords (const t8_dtet_t *elem, int vertex, t8_dtet_coord_t coordinates[3]);
45 
52 void
53 t8_dtet_compute_vertex_ref_coords (const t8_dtet_t *elem, int vertex, double coordinates[3]);
54 
65 void
66 t8_dtet_compute_reference_coords (const t8_dtet_t *elem, const double *ref_coords, const size_t num_coords,
67  double *out_coords);
68 
73 void
74 t8_dtet_compute_all_coords (const t8_dtet_t *elem, t8_dtet_coord_t coordinates[4][3]);
75 
80 void
81 t8_dtet_copy (const t8_dtet_t *t, t8_dtet_t *dest);
82 
88 int
89 t8_dtet_compare (const t8_dtet_t *t1, const t8_dtet_t *t2);
90 
96 int
97 t8_dtet_equal (const t8_dtet_t *elem1, const t8_dtet_t *elem2);
98 
104 void
105 t8_dtet_parent (const t8_dtet_t *t, t8_dtet_t *parent);
106 
114 void
115 t8_dtet_ancestor (const t8_dtet_t *t, int level, t8_dtet_t *ancestor);
116 
122 void
123 t8_dtet_child (const t8_dtet_t *elem, int childid, t8_dtet_t *child);
124 
129 void
131 
136 int
138 
145 void
146 t8_dtet_sibling (const t8_dtet_t *elem, int sibid, t8_dtet_t *sibling);
147 
154 int
155 t8_dtet_face_neighbour (const t8_dtet_t *t, int face, t8_dtet_t *n);
156 
163 void
165 
174 void
175 t8_dtet_children_at_face (const t8_dtet_t *tet, int face, t8_dtet_t *children[], int num_children, int *child_indices);
176 
184 int
185 t8_dtet_face_child_face (const t8_dtet_t *tet, int face, int face_child);
186 
194 int
195 t8_dtet_face_parent_face (const t8_dtet_t *tet, int face);
196 
205 int
207 
216 int
218 
224 int
226 
232 int
233 t8_dtet_is_root_boundary (const t8_dtet_t *t, int face);
234 
238 int
239 t8_dtet_is_equal (const t8_dtet_t *t1, const t8_dtet_t *t2);
240 
246 int
247 t8_dtet_is_sibling (const t8_dtet_t *t1, const t8_dtet_t *t2);
248 
254 int
255 t8_dtet_is_parent (const t8_dtet_t *t, const t8_dtet_t *c);
256 
262 int
264 
272 t8_dtet_linear_id (const t8_dtet_t *t, int level);
273 
283 void
284 t8_dtet_init_linear_id_with_level (t8_dtet_t *t, t8_linearidx_t id, int start_level, int end_level,
285  t8_dtet_type_t parenttype);
286 
292 void
294 
298 void
300 
307 void
308 t8_dtet_successor (const t8_dtet_t *t, t8_dtet_t *s, int level);
309 
317 void
318 t8_dtet_first_descendant (const t8_dtet_t *t, t8_dtet_t *s, int level);
319 
326 void
327 t8_dtet_last_descendant (const t8_dtet_t *t, t8_dtet_t *s, int level);
328 
335 void
336 t8_dtet_corner_descendant (const t8_dtet_t *t, t8_dtet_t *s, int corner, int level);
337 
343 void
344 t8_dtet_predecessor (const t8_dtet_t *t, t8_dtet_t *s, int level);
345 
351 int
352 t8_dtet_ancestor_id (const t8_dtet_t *t, int level);
353 
358 int
360 
365 int
367 
372 int
374 
378 void
380 
381 void
382 t8_dtet_element_pack (t8_dtet_t **const elements, const unsigned int count, void *send_buffer, const int buffer_size,
383  int *position, sc_MPI_Comm comm);
384 
385 void
386 t8_dtet_element_pack_size (const unsigned int count, sc_MPI_Comm comm, int *pack_size);
387 
388 void
389 t8_dtet_element_unpack (void *recvbuf, const int buffer_size, int *position, t8_dtet_t **elements,
390  const unsigned int count, sc_MPI_Comm comm);
391 
392 T8_EXTERN_C_END ();
393 
394 #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:109
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_compute_integer_coords(const t8_dtet_t *elem, int vertex, t8_dtet_coord_t coordinates[3])
Compute the coordinates of a vertex of a tetrahedron.
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_equal(const t8_dtet_t *elem1, const t8_dtet_t *elem2)
Check if two elements are equal.
int t8_dtet_compare(const t8_dtet_t *t1, const t8_dtet_t *t2)
Compare two tets in their linear order.
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.
void t8_dtet_compute_reference_coords(const t8_dtet_t *elem, const double *ref_coords, const size_t num_coords, double *out_coords)
Convert points in the reference space of a tet element to points in the reference space of the tree (...
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.