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 
66 t8_element_child_eclass (const t8_eclass_scheme_c *ts, int childid);
72 int
73 t8_element_level (const t8_eclass_scheme_c *ts, const t8_element_t *elem);
74 
83 void
84 t8_element_copy (const t8_eclass_scheme_c *ts, const t8_element_t *source, t8_element_t *dest);
85 
94 int
95 t8_element_compare (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2);
96 
103 int
104 t8_element_equal (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2);
105 
117 void
118 t8_element_parent (const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *parent);
119 
127 int
129 
142 void
143 t8_element_sibling (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int sibid, t8_element_t *sibling);
144 
150 int
152 
158 int
159 t8_element_num_faces (const t8_eclass_scheme_c *ts, const t8_element_t *elem);
160 
167 int
169 
175 int
177 
184 int
185 t8_element_num_face_children (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face);
186 
206 int
207 t8_element_get_face_corner (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, int corner);
208 
222 int
223 t8_element_get_corner_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int corner, int face);
224 
238 void
239 t8_element_child (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int childid, t8_element_t *child);
240 
253 void
254 t8_element_children (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int length, t8_element_t *c[]);
255 
261 int
262 t8_element_child_id (const t8_eclass_scheme_c *ts, const t8_element_t *elem);
263 
271 int
272 t8_element_ancestor_id (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int level);
273 
280 int
282 
294 void
295 t8_element_nca (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2, t8_element_t *nca);
296 
307 t8_element_face_shape (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face);
308 
324 void
325 t8_element_children_at_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, t8_element_t *children[],
326  int num_children, int *child_indices);
327 
349 int
350 t8_element_face_child_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, int face_child);
351 
363 int
364 t8_element_face_parent_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face);
365 
376 int
377 t8_element_tree_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face);
378 
401 void
403  int orientation, int sign, int is_smaller_face);
404 
419 int
420 t8_element_extrude_face (const t8_eclass_scheme_c *ts, const t8_element_t *face, const t8_eclass_scheme_c *face_scheme,
421  t8_element_t *elem, int root_face);
422 
435 void
436 t8_element_boundary_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, t8_element_t *boundary,
437  const t8_eclass_scheme_c *boundary_scheme);
438 
448 void
449 t8_element_first_descendant_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face,
450  t8_element_t *first_desc, int level);
451 
461 void
462 t8_element_last_descendant_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face,
463  t8_element_t *last_desc, int level);
464 
471 int
472 t8_element_is_root_boundary (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face);
473 
490 int
491 t8_element_face_neighbor_inside (const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *neigh, int face,
492  int *neigh_face);
493 
502 t8_element_shape (const t8_eclass_scheme_c *ts, const t8_element_t *elem);
503 
512 void
514 
523 t8_element_get_linear_id (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int level);
524 
531 void
532 t8_element_first_descendant (const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *desc, int level);
533 
540 void
541 t8_element_last_descendant (const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *desc, int level);
542 
549 void
550 t8_element_successor (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, t8_element_t *elem2, int level);
551 
560 void
561 t8_element_vertex_reference_coords (const t8_eclass_scheme_c *ts, const t8_element_t *t, const int vertex,
562  double coords[]);
563 
564 /* TODO: deactivate */
572 /* t8_element_t *t8_element_array_index (sc_array_t *array, size_t it); */
573 
587 t8_element_count_leafs (const t8_eclass_scheme_c *ts, const t8_element_t *t, int level);
588 
600 
613 void
614 t8_element_general_function (const t8_eclass_scheme_c *ts, const t8_element_t *elem, const void *indata, void *outdata);
615 
616 #ifdef T8_ENABLE_DEBUG
634 int
635 t8_element_is_valid (const t8_eclass_scheme_c *ts, const t8_element_t *elem);
636 
645 void
647 
654 void
655 t8_element_to_string (const t8_eclass_scheme_c *ts, const t8_element_t *elem, char *debug_string,
656  const int string_size);
657 #endif
658 
675 void
676 t8_element_new (const t8_eclass_scheme_c *ts, int length, t8_element_t **elems);
677 
684 void
685 t8_element_destroy (const t8_eclass_scheme_c *ts, int length, t8_element_t **elems);
686 
687 T8_EXTERN_C_END ();
688 
689 #endif /* !T8_ELEMENT_C_INTERFACE_H */
This struct holds virtual functions for a particular element class.
Definition: t8_element_cxx.hxx:47
int64_t t8_gloidx_t
A type for global indexing that holds really big numbers.
Definition: t8.h:98
uint64_t t8_linearidx_t
A type for storing SFC indices.
Definition: t8.h:107
enum t8_eclass t8_eclass_t
This enumeration contains all possible element classes.
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
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:437
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:170
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:345
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:218
int t8_element_is_family(const t8_eclass_scheme_c *ts, t8_element_t **fam)
Query whether a given set of elements is a family or not.
Definition: t8_element_c_interface.cxx:210
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:98
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:106
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:377
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:276
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:114
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:337
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:82
t8_gloidx_t t8_element_count_leafs_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:394
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:186
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:419
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:74
t8_eclass_t t8_element_child_eclass(const t8_eclass_scheme_c *ts, int childid)
Return the type of each child in the ordering of the implementation.
Definition: t8_element_c_interface.cxx:58
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:328
int t8_element_level(const t8_eclass_scheme_c *ts, const t8_element_t *elem)
Return the level of a particular element.
Definition: t8_element_c_interface.cxx:66
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:361
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:138
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:194
void t8_element_successor(const t8_eclass_scheme_c *ts, const t8_element_t *elem1, t8_element_t *elem2, int level)
Construct the successor in a uniform refinement of a given element.
Definition: t8_element_c_interface.cxx:369
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:312
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:154
t8_gloidx_t t8_element_count_leafs(const t8_eclass_scheme_c *ts, const t8_element_t *t, int level)
Return a pointer to a t8_element in an array indexed by a size_t.
Definition: t8_element_c_interface.cxx:386
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:90
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:202
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:285
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:267
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:146
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:130
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:427
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:353
void t8_element_general_function(const t8_eclass_scheme_c *ts, const t8_element_t *elem, const void *indata, void *outdata)
This function has no defined effect but each implementation is free to provide its own meaning of it.
Definition: t8_element_c_interface.cxx:402
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:320
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:411
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:226
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:243
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:294
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:234
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:162
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:303
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:178
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:122
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:259
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:445
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:251
t8_eclass_t t8_element_shape_t
Type definition for the geometric shape of an element.
Definition: t8_element_shape.h:38