t8  UNKNOWN
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
t8_element_c_interface.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 
31 #ifndef T8_ELEMENT_C_INTERFACE_H
32 #define T8_ELEMENT_C_INTERFACE_H
33 
34 #include <t8_element.h>
35 
36 T8_EXTERN_C_BEGIN ();
37 
43 size_t
45 
49 int
51 
56 int
58 
59 int
60 t8_element_level (const t8_eclass_scheme_c *ts, const t8_element_t *elem);
61 
70 void
71 t8_element_copy (const t8_eclass_scheme_c *ts, const t8_element_t *source, t8_element_t *dest);
72 
81 int
82 t8_element_compare (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2);
83 
90 int
91 t8_element_equal (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2);
92 
104 void
105 t8_element_parent (const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *parent);
106 
114 int
116 
129 void
130 t8_element_sibling (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int sibid, t8_element_t *sibling);
131 
137 int
139 
145 int
146 t8_element_num_faces (const t8_eclass_scheme_c *ts, const t8_element_t *elem);
147 
154 int
156 
162 int
164 
171 int
172 t8_element_num_face_children (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face);
173 
193 int
194 t8_element_get_face_corner (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, int corner);
195 
209 int
210 t8_element_get_corner_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int corner, int face);
211 
220 void
221 t8_element_child (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int childid, t8_element_t *child);
222 
234 void
235 t8_element_children (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int length, t8_element_t *c[]);
236 
242 int
243 t8_element_child_id (const t8_eclass_scheme_c *ts, const t8_element_t *elem);
244 
252 int
253 t8_element_ancestor_id (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int level);
254 
261 int
262 t8_element_is_family (const t8_eclass_scheme_c *ts, t8_element_t *const *fam);
263 
275 void
276 t8_element_nca (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2, t8_element_t *nca);
277 
288 t8_element_face_shape (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face);
289 
305 void
306 t8_element_children_at_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, t8_element_t *children[],
307  int num_children, int *child_indices);
308 
330 int
331 t8_element_face_child_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, int face_child);
332 
344 int
345 t8_element_face_parent_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face);
346 
357 int
358 t8_element_tree_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face);
359 
382 void
384  int orientation, int sign, int is_smaller_face);
385 
400 int
401 t8_element_extrude_face (const t8_eclass_scheme_c *ts, const t8_element_t *face, const t8_eclass_scheme_c *face_scheme,
402  t8_element_t *elem, int root_face);
403 
416 void
417 t8_element_boundary_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, t8_element_t *boundary,
418  const t8_eclass_scheme_c *boundary_scheme);
419 
429 void
430 t8_element_first_descendant_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face,
431  t8_element_t *first_desc, int level);
432 
442 void
443 t8_element_last_descendant_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face,
444  t8_element_t *last_desc, int level);
445 
452 int
453 t8_element_is_root_boundary (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face);
454 
471 int
472 t8_element_face_neighbor_inside (const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *neigh, int face,
473  int *neigh_face);
474 
483 t8_element_shape (const t8_eclass_scheme_c *ts, const t8_element_t *elem);
484 
493 void
495 
504 t8_element_get_linear_id (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int level);
505 
512 void
513 t8_element_first_descendant (const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *desc, int level);
514 
521 void
522 t8_element_last_descendant (const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *desc, int level);
523 
530 void
531 t8_element_successor (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, t8_element_t *elem2);
532 
542 void
543 t8_element_vertex_reference_coords (const t8_eclass_scheme_c *ts, const t8_element_t *t, const int vertex,
544  double coords[]);
545 
559 t8_element_count_leaves (const t8_eclass_scheme_c *ts, const t8_element_t *t, int level);
560 
572 
573 #ifdef T8_ENABLE_DEBUG
591 int
592 t8_element_is_valid (const t8_eclass_scheme_c *ts, const t8_element_t *elem);
593 
602 void
604 
611 void
612 t8_element_to_string (const t8_eclass_scheme_c *ts, const t8_element_t *elem, char *debug_string,
613  const int string_size);
614 #endif
615 
632 void
633 t8_element_new (const t8_eclass_scheme_c *ts, int length, t8_element_t **elems);
634 
641 void
642 t8_element_destroy (const t8_eclass_scheme_c *ts, int length, t8_element_t **elems);
643 
648 void
650 
660 void
661 t8_element_MPI_Pack (const t8_eclass_scheme_c *ts, t8_element_t **const elements, const unsigned int count,
662  void *send_buffer, const int buffer_size, int *position, sc_MPI_Comm comm);
663 
670 void
671 t8_element_MPI_Pack_size (const t8_eclass_scheme_c *ts, const unsigned int count, sc_MPI_Comm comm, int *pack_size);
672 
682 void
683 t8_element_MPI_Unpack (const t8_eclass_scheme_c *ts, void *recvbuf, const int buffer_size, int *position,
684  t8_element_t **elements, const unsigned int count, sc_MPI_Comm comm);
685 
686 T8_EXTERN_C_END ();
687 
688 #endif /* !T8_ELEMENT_C_INTERFACE_H */
This struct holds virtual functions for a particular element class.
Definition: t8_element_cxx.hxx:41
int64_t t8_gloidx_t
A type for global indexing that holds really big numbers.
Definition: t8.h:100
uint64_t t8_linearidx_t
A type for storing SFC indices.
Definition: t8.h:109
This file defines basic operations on an element in a refinement tree.
struct t8_element t8_element_t
Opaque structure for a generic element, only used as pointer.
Definition: t8_element.h:42
void t8_element_successor(const t8_eclass_scheme_c *ts, const t8_element_t *elem1, t8_element_t *elem2)
Construct the successor in a uniform refinement of a given element.
Definition: t8_element_c_interface.cxx:361
void t8_element_MPI_Unpack(const t8_eclass_scheme_c *ts, void *recvbuf, const int buffer_size, int *position, t8_element_t **elements, const unsigned int count, sc_MPI_Comm comm)
Unpack multiple elements from contiguous memory that was received via MPI.
Definition: t8_element_c_interface.cxx:461
size_t t8_element_size(const t8_eclass_scheme_c *ts)
Return the size of any element of a given class.
Definition: t8_element_c_interface.cxx:34
void t8_element_new(const t8_eclass_scheme_c *ts, int length, t8_element_t **elems)
Allocate memory for an array of elements of a given class and initialize them.
Definition: t8_element_c_interface.cxx:421
int t8_element_get_corner_face(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int corner, int face)
Compute the face numbers of the faces sharing an element's corner.
Definition: t8_element_c_interface.cxx:162
int t8_element_refines_irregular(const t8_eclass_scheme_c *ts)
Returns true, if there is one element in the tree, that does not refine into 2^dim children.
Definition: t8_element_c_interface.cxx:42
t8_linearidx_t t8_element_get_linear_id(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int level)
Compute the linear id of a given element in a hypothetical uniform refinement of a given level.
Definition: t8_element_c_interface.cxx:337
void t8_element_MPI_Pack_size(const t8_eclass_scheme_c *ts, const unsigned int count, sc_MPI_Comm comm, int *pack_size)
Determine an upper bound for the size of the packed message of count elements.
Definition: t8_element_c_interface.cxx:454
void t8_element_nca(const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2, t8_element_t *nca)
Compute the nearest common ancestor of two elements.
Definition: t8_element_c_interface.cxx:210
t8_gloidx_t t8_element_count_leaves(const t8_eclass_scheme_c *ts, const t8_element_t *t, int level)
Count how many leaf descendants of a given uniform level an element would produce.
Definition: t8_element_c_interface.cxx:378
void t8_element_parent(const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *parent)
Compute the parent of a given element elem and store it in parent.
Definition: t8_element_c_interface.cxx:90
int t8_element_num_siblings(const t8_eclass_scheme_c *ts, const t8_element_t *elem)
Compute the number of siblings of an element.
Definition: t8_element_c_interface.cxx:98
void t8_element_vertex_reference_coords(const t8_eclass_scheme_c *ts, const t8_element_t *t, const int vertex, double coords[])
Compute the coordinates of a given element vertex inside a reference tree that is embedded into [0,...
Definition: t8_element_c_interface.cxx:369
int t8_element_extrude_face(const t8_eclass_scheme_c *ts, const t8_element_t *face, const t8_eclass_scheme_c *face_scheme, t8_element_t *elem, int root_face)
Given a boundary face inside a root tree's face construct the element inside the root tree that has t...
Definition: t8_element_c_interface.cxx:268
void t8_element_sibling(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int sibid, t8_element_t *sibling)
Compute a specific sibling of a given element elem and store it in sibling.
Definition: t8_element_c_interface.cxx:106
t8_element_shape_t t8_element_shape(const t8_eclass_scheme_c *ts, const t8_element_t *elem)
Return the shape of an allocated element according its type.
Definition: t8_element_c_interface.cxx:329
int t8_element_compare(const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2)
Compare two elements with respect to the scheme.
Definition: t8_element_c_interface.cxx:74
void t8_element_children(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int length, t8_element_t *c[])
Construct all children of a given element.
Definition: t8_element_c_interface.cxx:178
void t8_element_debug_print(const t8_eclass_scheme_c *ts, const t8_element_t *elem)
Print a given element.
Definition: t8_element_c_interface.cxx:403
void t8_element_copy(const t8_eclass_scheme_c *ts, const t8_element_t *source, t8_element_t *dest)
Copy all entries of source to dest.
Definition: t8_element_c_interface.cxx:66
void t8_element_root(const t8_eclass_scheme_c *ts, t8_element_t *elem)
Fills an element with the root element.
Definition: t8_element_c_interface.cxx:437
int t8_element_face_neighbor_inside(const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *neigh, int face, int *neigh_face)
Construct the face neighbor of a given element if this face neighbor is inside the root tree.
Definition: t8_element_c_interface.cxx:320
int t8_element_is_family(const t8_eclass_scheme_c *ts, t8_element_t *const *fam)
Query whether a given set of elements is a family or not.
Definition: t8_element_c_interface.cxx:202
void t8_element_last_descendant(const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *desc, int level)
Compute the last descendant of a given element.
Definition: t8_element_c_interface.cxx:353
int t8_element_max_num_faces(const t8_eclass_scheme_c *ts, const t8_element_t *elem)
Compute the maximum number of faces of a given element and all of its descendants.
Definition: t8_element_c_interface.cxx:130
int t8_element_child_id(const t8_eclass_scheme_c *ts, const t8_element_t *elem)
Compute the child id of an element.
Definition: t8_element_c_interface.cxx:186
void t8_element_set_linear_id(const t8_eclass_scheme_c *ts, t8_element_t *elem, int level, t8_linearidx_t id)
Initialize the entries of an allocated element according to a given linear id in a uniform refinement...
Definition: t8_element_c_interface.cxx:304
int t8_element_num_face_children(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face)
Compute the number of children of an element's face when the element is refined.
Definition: t8_element_c_interface.cxx:146
int t8_element_equal(const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2)
Check if two elements are equal.
Definition: t8_element_c_interface.cxx:82
int t8_element_maxlevel(const t8_eclass_scheme_c *ts)
Return the maximum allowed level for any element of a given class.
Definition: t8_element_c_interface.cxx:50
int t8_element_ancestor_id(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int level)
Compute the ancestor id of an element, that is the child id at a given level.
Definition: t8_element_c_interface.cxx:194
void t8_element_boundary_face(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, t8_element_t *boundary, const t8_eclass_scheme_c *boundary_scheme)
Construct the boundary element at a specific face.
Definition: t8_element_c_interface.cxx:277
void t8_element_transform_face(const t8_eclass_scheme_c *ts, const t8_element_t *elem1, t8_element_t *elem2, int orientation, int sign, int is_smaller_face)
Suppose we have two trees that share a common face f.
Definition: t8_element_c_interface.cxx:259
int t8_element_num_children(const t8_eclass_scheme_c *ts, const t8_element_t *elem)
Compute the number of children of an element when it is refined.
Definition: t8_element_c_interface.cxx:138
int t8_element_num_faces(const t8_eclass_scheme_c *ts, const t8_element_t *elem)
Compute the number of faces of an element.
Definition: t8_element_c_interface.cxx:122
void t8_element_to_string(const t8_eclass_scheme_c *ts, const t8_element_t *elem, char *debug_string, const int string_size)
Fill a string with readable information about the element.
Definition: t8_element_c_interface.cxx:411
void t8_element_MPI_Pack(const t8_eclass_scheme_c *ts, t8_element_t **const elements, const unsigned int count, void *send_buffer, const int buffer_size, int *position, sc_MPI_Comm comm)
Pack multiple elements into contiguous memory, so they can be sent via MPI.
Definition: t8_element_c_interface.cxx:445
void t8_element_first_descendant(const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *desc, int level)
Compute the first descendant of a given element.
Definition: t8_element_c_interface.cxx:345
int t8_element_is_root_boundary(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face)
Compute whether a given element shares a given face with its root tree.
Definition: t8_element_c_interface.cxx:312
int t8_element_is_valid(const t8_eclass_scheme_c *ts, const t8_element_t *elem)
Query whether a given element can be considered as 'valid' and it is safe to perform any of the above...
Definition: t8_element_c_interface.cxx:395
t8_element_shape_t t8_element_face_shape(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face)
Compute the shape of the face of an element.
Definition: t8_element_c_interface.cxx:218
int t8_element_face_child_face(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, int face_child)
Given a face of an element and a child number of a child of that face, return the face number of the ...
Definition: t8_element_c_interface.cxx:235
void t8_element_first_descendant_face(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, t8_element_t *first_desc, int level)
Construct the first descendant of an element at a given level that touches a given face.
Definition: t8_element_c_interface.cxx:286
void t8_element_children_at_face(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, t8_element_t *children[], int num_children, int *child_indices)
Given an element and a face of the element, compute all children of the element that touch the face.
Definition: t8_element_c_interface.cxx:226
int t8_element_get_face_corner(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, int corner)
Return the corner number of an element's face corner.
Definition: t8_element_c_interface.cxx:154
void t8_element_last_descendant_face(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, t8_element_t *last_desc, int level)
Construct the last descendant of an element at a given level that touches a given face.
Definition: t8_element_c_interface.cxx:295
void t8_element_child(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int childid, t8_element_t *child)
Construct the child element of a given number.
Definition: t8_element_c_interface.cxx:170
int t8_element_num_corners(const t8_eclass_scheme_c *ts, const t8_element_t *elem)
Compute the number of corners of an element.
Definition: t8_element_c_interface.cxx:114
int t8_element_tree_face(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face)
Given an element and a face of this element.
Definition: t8_element_c_interface.cxx:251
void t8_element_destroy(const t8_eclass_scheme_c *ts, int length, t8_element_t **elems)
Deallocate an array of elements.
Definition: t8_element_c_interface.cxx:429
t8_gloidx_t t8_element_count_leaves_from_root(const t8_eclass_scheme_c *ts, int level)
Count how many leaf descendants of a given uniform level the root element will produce.
Definition: t8_element_c_interface.cxx:386
int t8_element_face_parent_face(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face)
Given a face of an element return the face number of the parent of the element that matches the eleme...
Definition: t8_element_c_interface.cxx:243
t8_eclass_t t8_element_shape_t
Type definition for the geometric shape of an element.
Definition: t8_element_shape.h:38