t8  1.2.0
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 t8_element_size (const t8_eclass_scheme_c *ts);
44 
49  *ts);
50 
56 
64  int childid);
71  const t8_element_t *elem);
72 
81 void t8_element_copy (const t8_eclass_scheme_c *ts,
82  const t8_element_t *source,
83  t8_element_t *dest);
84 
94  const t8_element_t *elem1,
95  const t8_element_t *elem2);
96 
108 void t8_element_parent (const t8_eclass_scheme_c *ts,
109  const t8_element_t *elem,
110  t8_element_t *parent);
111 
120  const t8_element_t *elem);
121 
134 void t8_element_sibling (const t8_eclass_scheme_c *ts,
135  const t8_element_t *elem, int sibid,
136  t8_element_t *sibling);
137 
144  const t8_element_t *elem);
145 
152  const t8_element_t *elem);
153 
161  const t8_element_t *elem);
162 
169  const t8_element_t *elem);
170 
178  *ts,
179  const t8_element_t *elem,
180  int face);
181 
202  const t8_element_t *elem,
203  int face, int corner);
204 
219  const t8_element_t *elem,
220  int corner, int face);
221 
235 void t8_element_child (const t8_eclass_scheme_c *ts,
236  const t8_element_t *elem, int childid,
237  t8_element_t *child);
238 
252  const t8_element_t *elem,
253  int length, t8_element_t *c[]);
254 
261  const t8_element_t *elem);
262 
271  const t8_element_t *elem,
272  int level);
273 
281  t8_element_t **fam);
282 
294 void t8_element_nca (const t8_eclass_scheme_c *ts,
295  const t8_element_t *elem1,
296  const t8_element_t *elem2,
297  t8_element_t *nca);
298 
309  const t8_element_t *elem,
310  int face);
311 
328  const t8_element_t *elem,
329  int face,
330  t8_element_t *children[],
331  int num_children,
332  int *child_indices);
333 
356  const t8_element_t *elem,
357  int face, int face_child);
358 
371  const t8_element_t *elem,
372  int face);
373 
385  const t8_element_t *elem, int face);
386 
410  const t8_element_t *elem1,
411  t8_element_t *elem2,
412  int orientation,
413  int sign, int is_smaller_face);
414 
430  const t8_element_t *face,
431  const t8_eclass_scheme_c
432  *face_scheme,
433  t8_element_t *elem,
434  int root_face);
435 
449  const t8_element_t *elem,
450  int face,
451  t8_element_t *boundary,
452  const t8_eclass_scheme_c
453  *boundary_scheme);
454 
465  *ts,
466  const t8_element_t
467  *elem, int face,
469  *first_desc, int level);
470 
481  *ts,
482  const t8_element_t *elem,
483  int face,
484  t8_element_t *last_desc,
485  int level);
486 
487 /* TODO: Do we need this function at all?
488  * If not remove it. If so, what to do with prisms and pyramids?
489  * Here the boundary elements are of different eclasses, so we cannot
490  * store them in an array...
491  */
498 /* void t8_element_boundary (t8_eclass_scheme_c *ts,
499  * const t8_element_t *elem,
500  * int min_dim,
501  * int length,
502  * t8_element_t **boundary) = 0;
503  */
504 
512  const t8_element_t *elem,
513  int face);
514 
532  *ts,
533  const t8_element_t *elem,
534  t8_element_t *neigh,
535  int face,
536  int *neigh_face);
537 
546  const t8_element_t *elem);
547 
557  t8_element_t *elem, int level,
558  t8_linearidx_t id);
559 
568  const t8_element_t *elem,
569  int level);
570 
578  const t8_element_t *elem,
579  t8_element_t *desc,
580  int level);
581 
589  const t8_element_t *elem,
590  t8_element_t *desc,
591  int level);
592 
600  const t8_element_t *elem1,
601  t8_element_t *elem2, int level);
602 
610  const t8_element_t *elem);
611 
622  *ts,
623  const t8_element_t *t,
624  const int vertex,
625  double coords[]);
626 
627 /* TODO: deactivate */
635 /* t8_element_t *t8_element_array_index (sc_array_t *array, size_t it); */
636 
650  const t8_element_t *t, int level);
651 
662  *ts, int level);
663 
677  const t8_element_t *elem,
678  const void *indata,
679  void *outdata);
680 
681 #ifdef T8_ENABLE_DEBUG
699 int t8_element_is_valid (const t8_eclass_scheme_c *ts,
700  const t8_element_t *elem);
701 
710 void t8_element_debug_print (const t8_eclass_scheme_c *ts,
711  const t8_element_t *elem);
712 #endif
713 
732 void t8_element_new (const t8_eclass_scheme_c *ts, int length,
733  t8_element_t **elems);
734 
743 void t8_element_destroy (const t8_eclass_scheme_c *ts,
744  int length, t8_element_t **elems);
745 
746 T8_EXTERN_C_END ();
747 
748 #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:105
uint64_t t8_linearidx_t
A type for storing SFC indices.
Definition: t8.h:114
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:475
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:173
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:373
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:225
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:217
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:92
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:101
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:419
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:294
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:110
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:365
int t8_element_compare(const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2)
Compare two elements.
Definition: t8_element_c_interface.cxx:83
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:438
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:191
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:354
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:392
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:137
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:200
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:402
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:336
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:155
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:429
int t8_element_root_len(const t8_eclass_scheme_c *ts, const t8_element_t *elem)
Compute the root lenght of a given element, that is the length of its level 0 ancestor.
Definition: t8_element_c_interface.cxx:411
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:208
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:305
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:283
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:129
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:382
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:446
int t8_element_is_root_boundary(const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face)
Construct all codimension-one boundary elements of a given element.
Definition: t8_element_c_interface.cxx:345
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:234
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:255
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:316
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:243
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:164
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:326
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:182
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:120
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:274
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:484
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:265
t8_eclass_t t8_element_shape_t
Type definition for the geometric shape of an element.
Definition: t8_element_shape.h:38