t8  UNKNOWN
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
t8_dtri_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 
27 #ifndef T8_DTRI_BITS_H
28 #define T8_DTRI_BITS_H
29 
30 #include <t8_element.h>
32 
33 T8_EXTERN_C_BEGIN ();
34 
40 void
41 t8_dtri_copy (const t8_dtri_t *t, t8_dtri_t *dest);
42 
48 int
49 t8_dtri_compare (const t8_dtri_t *t1, const t8_dtri_t *t2);
50 
56 int
57 t8_dtri_equal (const t8_dtri_t *elem1, const t8_dtri_t *elem2);
58 
64 void
65 t8_dtri_parent (const t8_dtri_t *t, t8_dtri_t *parent);
66 
74 void
75 t8_dtri_ancestor (const t8_dtri_t *t, int level, t8_dtri_t *ancestor);
76 
82 void
83 t8_dtri_compute_integer_coords (const t8_dtri_t *elem, const int vertex, t8_dtri_coord_t coordinates[2]);
84 
91 void
92 t8_dtri_compute_vertex_ref_coords (const t8_dtri_t *elem, const int vertex, double coordinates[2]);
93 
108 void
109 t8_dtri_compute_reference_coords (const t8_dtri_t *elem, const double *ref_coords, const size_t num_coords,
110  const size_t skip_coords, double *out_coords);
111 
116 void
117 t8_dtri_compute_all_coords (const t8_dtri_t *elem, t8_dtri_coord_t coordinates[3][2]);
118 
124 void
125 t8_dtri_child (const t8_dtri_t *t, int childid, t8_dtri_t *child);
126 
131 void
133 
138 int
139 t8_dtri_is_familypv (const t8_dtri_t *f[]);
140 
147 void
148 t8_dtri_sibling (const t8_dtri_t *elem, int sibid, t8_dtri_t *sibling);
149 
156 int
157 t8_dtri_face_neighbour (const t8_dtri_t *t, int face, t8_dtri_t *n);
158 
165 void
167 
176 void
177 t8_dtri_children_at_face (const t8_dtri_t *tri, int face, t8_dtri_t *children[], int num_children, int *child_indices);
178 
186 int
187 t8_dtri_face_child_face (const t8_dtri_t *triangle, int face, int face_child);
188 
196 int
197 t8_dtri_face_parent_face (const t8_dtri_t *triangle, int face);
198 
207 int
208 t8_dtri_tree_face (t8_dtri_t *t, int face);
209 
218 int
219 t8_dtri_root_face_to_face (t8_dtri_t *t, int root_face);
220 
236 void
237 t8_dtri_transform_face (const t8_dtri_t *trianglein, t8_dtri_t *triangle2, int orientation, int sign,
238  int is_smaller_face);
239 
244 int
246 
252 int
253 t8_dtri_is_root_boundary (const t8_dtri_t *t, int face);
254 
258 int
259 t8_dtri_is_equal (const t8_dtri_t *t1, const t8_dtri_t *t2);
260 
266 int
267 t8_dtri_is_sibling (const t8_dtri_t *t1, const t8_dtri_t *t2);
268 
274 int
275 t8_dtri_is_parent (const t8_dtri_t *t, const t8_dtri_t *c);
276 
282 int
283 t8_dtri_is_ancestor (const t8_dtri_t *t, const t8_dtri_t *c);
284 
292 t8_dtri_linear_id (const t8_dtri_t *t, int level);
293 
303 void
304 t8_dtri_init_linear_id_with_level (t8_dtri_t *t, t8_linearidx_t id, const int start_level, const int end_level,
305  t8_dtri_type_t parenttype);
306 
312 void
314 
318 void
320 
327 void
328 t8_dtri_successor (const t8_dtri_t *t, t8_dtri_t *s, int level);
329 
337 void
338 t8_dtri_first_descendant (const t8_dtri_t *t, t8_dtri_t *s, int level);
339 
347 void
348 t8_dtri_last_descendant (const t8_dtri_t *t, t8_dtri_t *s, int level);
349 
358 void
359 t8_dtri_corner_descendant (const t8_dtri_t *t, t8_dtri_t *s, int corner, int level);
360 
367 void
368 t8_dtri_predecessor (const t8_dtri_t *t, t8_dtri_t *s, int level);
369 
375 int
376 t8_dtri_ancestor_id (const t8_dtri_t *t, int level);
377 
382 int
383 t8_dtri_child_id (const t8_dtri_t *t);
384 
389 int
390 t8_dtri_get_level (const t8_dtri_t *t);
391 
396 int
397 t8_dtri_is_valid (const t8_dtri_t *t);
398 
399 #ifdef T8_ENABLE_DEBUG
403 void
405 #endif
406 
407 void
408 t8_dtri_element_pack (t8_dtri_t **const elements, const unsigned int count, void *send_buffer, const int buffer_size,
409  int *position, sc_MPI_Comm comm);
410 
411 void
412 t8_dtri_element_pack_size (const unsigned int count, sc_MPI_Comm comm, int *pack_size);
413 
414 void
415 t8_dtri_element_unpack (void *recvbuf, const int buffer_size, int *position, t8_dtri_t **elements,
416  const unsigned int count, sc_MPI_Comm comm);
417 
418 T8_EXTERN_C_END ();
419 
420 #endif /* T8_DTRI_BITS_H */
Definition: t8_dtri.h:66
uint64_t t8_linearidx_t
A type for storing SFC indices.
Definition: t8.h:109
TODO: document this.
#define T8_DTRI_CHILDREN
The number of children that a triangle is refined into.
Definition: t8_dtri.h:35
void t8_dtri_compute_reference_coords(const t8_dtri_t *elem, const double *ref_coords, const size_t num_coords, const size_t skip_coords, double *out_coords)
Convert points in the reference space of a tri element to points in the reference space of the tree (...
Definition: t8_dtri_bits.c:374
int t8_dtri_compare(const t8_dtri_t *t1, const t8_dtri_t *t2)
Compare two triangle in their linear order.
Definition: t8_dtri_bits.c:119
int t8_dtri_face_child_face(const t8_dtri_t *triangle, int face, int face_child)
Given a face of a triangle and a child number of a child of that face, return the face number of the ...
Definition: t8_dtri_bits.c:912
void t8_dtri_ancestor(const t8_dtri_t *t, int level, t8_dtri_t *ancestor)
Compute the ancestor of a triangle at a given level.
Definition: t8_dtri_bits.c:160
void t8_dtri_init_linear_id_with_level(t8_dtri_t *t, t8_linearidx_t id, const int start_level, const int end_level, t8_dtri_type_t parenttype)
Same as init_linear_id, but we only consider the subtree.
Definition: t8_dtri_bits.c:1445
int t8_dtri_ancestor_id(const t8_dtri_t *t, int level)
Compute the position of the ancestor of this child at level level within its siblings.
Definition: t8_dtri_bits.c:1641
void t8_dtri_compute_integer_coords(const t8_dtri_t *elem, const int vertex, t8_dtri_coord_t coordinates[2])
Compute the coordinates of a vertex of a triangle.
int t8_dtri_face_neighbour(const t8_dtri_t *t, int face, t8_dtri_t *n)
Compute the face neighbor of a triangle.
Definition: t8_dtri_bits.c:679
int t8_dtri_equal(const t8_dtri_t *elem1, const t8_dtri_t *elem2)
Check if two elements are equal.
Definition: t8_dtri_bits.c:109
void t8_dtri_copy(const t8_dtri_t *t, t8_dtri_t *dest)
Copy the values of one triangle to another.
Definition: t8_dtri_bits.c:99
void t8_dtri_predecessor(const t8_dtri_t *t, t8_dtri_t *s, int level)
Computes the predecessor of a triangle in a uniform grid of level level.
Definition: t8_dtri_bits.c:1634
t8_linearidx_t t8_dtri_linear_id(const t8_dtri_t *t, int level)
Computes the linear position of a triangle in a uniform grid.
Definition: t8_dtri_bits.c:1412
void t8_dtri_init_linear_id(t8_dtri_t *t, t8_linearidx_t id, int level)
Initialize a triangle as the triangle with a given global id in a uniform refinement of a given level...
Definition: t8_dtri_bits.c:1480
int t8_dtri_child_id(const t8_dtri_t *t)
Compute the position of the ancestor of this child at level level within its siblings.
Definition: t8_dtri_bits.c:1655
int t8_dtri_face_parent_face(const t8_dtri_t *triangle, int face)
Given a face of an triangle return the face number of the parent of the triangle that matches the tri...
Definition: t8_dtri_bits.c:947
int t8_dtri_is_inside_root(t8_dtri_t *t)
Test if a triangle lies inside of the root triangle, that is the triangle of level 0,...
Definition: t8_dtri_bits.c:1100
int t8_dtri_is_sibling(const t8_dtri_t *t1, const t8_dtri_t *t2)
Test if two triangles are siblings.
Definition: t8_dtri_bits.c:1208
int t8_dtri_is_familypv(const t8_dtri_t *f[])
Check whether a collection of eight triangles is a family in Morton order.
Definition: t8_dtri_bits.c:634
void t8_dtri_nearest_common_ancestor(const t8_dtri_t *t1, const t8_dtri_t *t2, t8_dtri_t *r)
Computes the nearest common ancestor of two triangles in the same tree.
Definition: t8_dtri_bits.c:754
void t8_dtri_compute_vertex_ref_coords(const t8_dtri_t *elem, const int vertex, double coordinates[2])
Compute the reference coordinates of a vertex of a triangle when the tree (level 0 triangle) is embed...
void t8_dtri_init_root(t8_dtri_t *t)
Initialize a triangle as the root triangle (type 0 at level 0)
Definition: t8_dtri_bits.c:1515
void t8_dtri_last_descendant(const t8_dtri_t *t, t8_dtri_t *s, int level)
Compute the last descendant of a triangle at a given level.
Definition: t8_dtri_bits.c:1592
int t8_dtri_tree_face(t8_dtri_t *t, int face)
Given a triangle and a face of this triangle.
Definition: t8_dtri_bits.c:832
int t8_dtri_is_root_boundary(const t8_dtri_t *t, int face)
Compute whether a given triangle shares a given face with its root tree.
Definition: t8_dtri_bits.c:1139
void t8_dtri_first_descendant(const t8_dtri_t *t, t8_dtri_t *s, int level)
Compute the first descendant of a triangle at a given level.
Definition: t8_dtri_bits.c:1580
void t8_dtri_childrenpv(const t8_dtri_t *t, t8_dtri_t *c[T8_DTRI_CHILDREN])
Compute the 4 children of a triangle, array version.
Definition: t8_dtri_bits.c:578
void t8_dtri_successor(const t8_dtri_t *t, t8_dtri_t *s, int level)
Computes the successor of a triangle in a uniform grid of level level.
Definition: t8_dtri_bits.c:1573
void t8_dtri_compute_all_coords(const t8_dtri_t *elem, t8_dtri_coord_t coordinates[3][2])
Compute the coordinates of the four vertices of a triangle.
void t8_dtri_init(t8_dtri_t *t)
Set sensible default values for a triangle.
Definition: t8_dtri_bits.c:1693
void t8_dtri_corner_descendant(const t8_dtri_t *t, t8_dtri_t *s, int corner, int level)
Compute the descendant of a triangle in a given corner.
Definition: t8_dtri_bits.c:1604
int t8_dtri_is_ancestor(const t8_dtri_t *t, const t8_dtri_t *c)
Test if a triangle is an ancestor of another triangle.
Definition: t8_dtri_bits.c:1256
void t8_dtri_child(const t8_dtri_t *t, int childid, t8_dtri_t *child)
Compute the childid-th child in Morton order of a triangle.
Definition: t8_dtri_bits.c:537
int t8_dtri_is_valid(const t8_dtri_t *t)
Query whether all entries of a triangle are in valid ranges.
Definition: t8_dtri_bits.c:1667
void t8_dtri_transform_face(const t8_dtri_t *trianglein, t8_dtri_t *triangle2, int orientation, int sign, int is_smaller_face)
Suppose we have two trees that share a common triangle f.
Definition: t8_dtri_bits.c:1020
void t8_dtri_sibling(const t8_dtri_t *elem, int sibid, t8_dtri_t *sibling)
Compute a specific sibling of a triangle.
Definition: t8_dtri_bits.c:668
int t8_dtri_is_parent(const t8_dtri_t *t, const t8_dtri_t *c)
Test if a triangle is the parent of another triangle.
Definition: t8_dtri_bits.c:1242
int t8_dtri_root_face_to_face(t8_dtri_t *t, int root_face)
Given a triangle and a face of the root triangle.
Definition: t8_dtri_bits.c:871
int t8_dtri_get_level(const t8_dtri_t *t)
Return the level of a triangle.
Definition: t8_dtri_bits.c:1661
void t8_dtri_parent(const t8_dtri_t *t, t8_dtri_t *parent)
Compute the parent of a triangle.
Definition: t8_dtri_bits.c:139
void t8_dtri_children_at_face(const t8_dtri_t *tri, int face, t8_dtri_t *children[], int num_children, int *child_indices)
Given a triangle and a face of the triangle, compute all children of the triangle that touch the face...
Definition: t8_dtri_bits.c:796
int t8_dtri_is_equal(const t8_dtri_t *t1, const t8_dtri_t *t2)
Test if two triangles have the same coordinates, type and level.
Definition: t8_dtri_bits.c:1196
This file defines basic operations on an element in a refinement tree.