t8  UNKNOWN
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
t8_default_hex_cxx.hxx
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 
26 #ifndef T8_DEFAULT_HEX_HXX
27 #define T8_DEFAULT_HEX_HXX
28 
29 #include <p8est.h>
30 #include <t8_element_cxx.hxx>
33 #include <t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.hxx>
34 
39 typedef p8est_quadrant_t t8_phex_t;
40 
42 {
43  public:
48 
50 
68  virtual void
69  t8_element_new (int length, t8_element_t **elem) const;
70 
88  virtual void
89  t8_element_init (int length, t8_element_t *elem, int called_new) const;
90 
95  virtual int
96  t8_element_level (const t8_element_t *elem) const;
97 
101  virtual int
102  t8_element_maxlevel (void) const;
103 
111  virtual void
112  t8_element_copy (const t8_element_t *source, t8_element_t *dest) const;
113 
121  virtual int
122  t8_element_compare (const t8_element_t *elem1, const t8_element_t *elem2) const;
123 
130  virtual int
131  t8_element_equal (const t8_element_t *elem1, const t8_element_t *elem2) const;
132 
145  virtual void
146  t8_element_parent (const t8_element_t *elem, t8_element_t *parent) const;
147 
159  virtual void
160  t8_element_sibling (const t8_element_t *elem, int sibid, t8_element_t *sibling) const;
161 
166  virtual int
167  t8_element_num_faces (const t8_element_t *elem) const;
168 
174  virtual int
175  t8_element_max_num_faces (const t8_element_t *elem) const;
176 
181  virtual int
182  t8_element_num_children (const t8_element_t *elem) const;
183 
189  virtual int
190  t8_element_num_face_children (const t8_element_t *elem, int face) const;
197  virtual int
198  t8_element_get_face_corner (const t8_element_t *element, int face, int corner) const;
199 
206  virtual int
207  t8_element_get_corner_face (const t8_element_t *element, int corner, int face) const
208  {
209  SC_ABORT ("This function is not implemented yet.\n");
210  return 0; /* suppresses compiler warning */
211  }
212 
218  virtual t8_eclass_t
219  t8_element_child_eclass (int childid) const;
220 
230  virtual void
231  t8_element_child (const t8_element_t *elem, int childid, t8_element_t *child) const;
232 
244  virtual void
245  t8_element_children (const t8_element_t *elem, int length, t8_element_t *c[]) const;
246 
251  virtual int
252  t8_element_child_id (const t8_element_t *elem) const;
253 
260  virtual int
261  t8_element_ancestor_id (const t8_element_t *elem, int level) const;
262 
269  virtual int
270  t8_element_is_family (t8_element_t **fam) const;
271 
282  virtual void
283  t8_element_nca (const t8_element_t *elem1, const t8_element_t *elem2, t8_element_t *nca) const;
284 
290  virtual t8_element_shape_t
291  t8_element_face_shape (const t8_element_t *elem, int face) const;
292 
307  virtual void
308  t8_element_children_at_face (const t8_element_t *elem, int face, t8_element_t *children[], int num_children,
309  int *child_indices) const;
310 
331  virtual int
332  t8_element_face_child_face (const t8_element_t *elem, int face, int face_child) const;
333 
344  virtual int
345  t8_element_face_parent_face (const t8_element_t *elem, int face) const;
346 
356  virtual int
357  t8_element_tree_face (const t8_element_t *elem, int face) const;
358 
380  virtual void
381  t8_element_transform_face (const t8_element_t *elem1, t8_element_t *elem2, int orientation, int sign,
382  int is_smaller_face) const
383  {
384  SC_ABORT ("This function is not implemented yet.\n");
385  return; /* suppresses compiler warning */
386  }
387 
401  virtual int
402  t8_element_extrude_face (const t8_element_t *face, const t8_eclass_scheme_c *face_scheme, t8_element_t *elem,
403  int root_face) const;
404 
413  virtual void
414  t8_element_first_descendant_face (const t8_element_t *elem, int face, t8_element_t *first_desc, int level) const;
415 
424  virtual void
425  t8_element_last_descendant_face (const t8_element_t *elem, int face, t8_element_t *last_desc, int level) const;
426 
436  virtual void
437  t8_element_boundary_face (const t8_element_t *elem, int face, t8_element_t *boundary,
438  const t8_eclass_scheme_c *boundary_scheme) const;
439 
445  virtual int
446  t8_element_is_root_boundary (const t8_element_t *elem, int face) const;
447 
463  virtual int
464  t8_element_face_neighbor_inside (const t8_element_t *elem, t8_element_t *neigh, int face, int *neigh_face) const;
465 
473  virtual void
474  t8_element_set_linear_id (t8_element_t *elem, int level, t8_linearidx_t id) const;
475 
482  virtual t8_linearidx_t
483  t8_element_get_linear_id (const t8_element_t *elem, int level) const;
484 
491  virtual void
492  t8_element_first_descendant (const t8_element_t *elem, t8_element_t *desc, int level) const;
493 
500  virtual void
501  t8_element_last_descendant (const t8_element_t *elem, t8_element_t *desc, int level) const;
502 
508  virtual void
509  t8_element_successor (const t8_element_t *t, t8_element_t *s, int level) const;
510 
521  virtual void
522  t8_element_anchor (const t8_element_t *elem, int anchor[3]) const;
523 
534  virtual void
535  t8_element_vertex_coords (const t8_element_t *elem, int vertex, int coords[]) const;
536 
544  virtual void
545  t8_element_vertex_reference_coords (const t8_element_t *elem, const int vertex, double coords[]) const;
546 
557  virtual void
558  t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords,
559  double *out_coords) const;
560 
565  virtual int
566  t8_element_refines_irregular (void) const;
567 
568 #ifdef T8_ENABLE_DEBUG
583  virtual int
584  t8_element_is_valid (const t8_element_t *t) const;
585 
593  virtual void
594  t8_element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const;
595 #endif
596 };
597 
598 #endif /* !T8_DEFAULT_HEX_HXX */
Definition: t8_default_common_cxx.hxx:36
Definition: t8_default_hex_cxx.hxx:42
virtual int t8_element_get_corner_face(const t8_element_t *element, int corner, int face) const
Return the face numbers of the faces sharing an element's corner.
Definition: t8_default_hex_cxx.hxx:207
virtual int t8_element_max_num_faces(const t8_element_t *elem) const
Compute the maximum number of faces of a given element and all of its descendants.
Definition: t8_default_hex_cxx.cxx:104
virtual int t8_element_face_child_face(const t8_element_t *elem, int face, int face_child) const
Given a face of an element and a child number of a child of that face, return the face number of the ...
Definition: t8_default_hex_cxx.cxx:267
virtual void t8_element_children(const t8_element_t *elem, int length, t8_element_t *c[]) const
Construct all children of a given element.
Definition: t8_default_hex_cxx.cxx:156
virtual void t8_element_first_descendant(const t8_element_t *elem, t8_element_t *desc, int level) const
Compute the first descendant of a given element.
Definition: t8_default_hex_cxx.cxx:506
virtual int t8_element_face_parent_face(const t8_element_t *elem, int face) const
Given a face of an element return the face number of the parent of the element that matches the eleme...
Definition: t8_default_hex_cxx.cxx:275
virtual int t8_element_face_neighbor_inside(const t8_element_t *elem, t8_element_t *neigh, int face, int *neigh_face) const
Construct the face neighbor of a given element if this face neighbor is inside the root tree.
Definition: t8_default_hex_cxx.cxx:461
virtual void t8_element_vertex_reference_coords(const t8_element_t *elem, const int vertex, double coords[]) const
Compute the coordinates of a given element vertex inside a reference tree that is embedded into [0,...
Definition: t8_default_hex_cxx.cxx:562
virtual int t8_element_extrude_face(const t8_element_t *face, const t8_eclass_scheme_c *face_scheme, t8_element_t *elem, int root_face) const
Given a boundary face inside a root tree's face construct the element inside the root tree that has t...
Definition: t8_default_hex_cxx.cxx:304
virtual void t8_element_reference_coords(const t8_element_t *elem, const double *ref_coords, const size_t num_coords, double *out_coords) const
Convert points in the reference space of an element to points in the reference space of the tree.
Definition: t8_default_hex_cxx.cxx:579
virtual int t8_element_num_face_children(const t8_element_t *elem, int face) const
Return the number of children of an element's face when the element is refined.
Definition: t8_default_hex_cxx.cxx:117
virtual int t8_element_is_valid(const t8_element_t *t) const
Query whether a given element can be considered as 'valid' and it is safe to perform any of the above...
Definition: t8_default_hex_cxx.cxx:629
virtual void t8_element_first_descendant_face(const t8_element_t *elem, int face, t8_element_t *first_desc, int level) const
Construct the first descendant of an element at a given level that touches a given face.
Definition: t8_default_hex_cxx.cxx:369
virtual void t8_element_new(int length, t8_element_t **elem) const
Allocate memory for an array of hexaedra and initialize them.
Definition: t8_default_hex_cxx.cxx:594
virtual int t8_element_tree_face(const t8_element_t *elem, int face) const
Given an element and a face of this element.
Definition: t8_default_hex_cxx.cxx:295
virtual void t8_element_child(const t8_element_t *elem, int childid, t8_element_t *child) const
Construct the child element of a given number.
Definition: t8_default_hex_cxx.cxx:134
virtual void t8_element_init(int length, t8_element_t *elem, int called_new) const
Initialize an array of allocated hexaedra.
Definition: t8_default_hex_cxx.cxx:612
virtual void t8_element_parent(const t8_element_t *elem, t8_element_t *parent) const
Compute the parent of a given element elem and store it in parent.
Definition: t8_default_hex_cxx.cxx:81
virtual void t8_element_transform_face(const t8_element_t *elem1, t8_element_t *elem2, int orientation, int sign, int is_smaller_face) const
Suppose we have two trees that share a common face f.
Definition: t8_default_hex_cxx.hxx:381
virtual int t8_element_level(const t8_element_t *elem) const
Return the refinement level of an element.
Definition: t8_default_hex_cxx.cxx:51
virtual int t8_element_num_faces(const t8_element_t *elem) const
Compute the number of faces of a given element.
Definition: t8_default_hex_cxx.cxx:97
virtual void t8_element_successor(const t8_element_t *t, t8_element_t *s, int level) const
Construct the successor in a uniform refinement of a given element.
Definition: t8_default_hex_cxx.cxx:524
virtual void t8_element_last_descendant_face(const t8_element_t *elem, int face, t8_element_t *last_desc, int level) const
Construct the last descendant of an element at a given level that touches a given face.
Definition: t8_default_hex_cxx.cxx:387
virtual int t8_element_ancestor_id(const t8_element_t *elem, int level) const
Compute the ancestor id of an element, that is the child id at a given level.
Definition: t8_default_hex_cxx.cxx:180
virtual int t8_element_equal(const t8_element_t *elem1, const t8_element_t *elem2) const
Check if two elements are equal.
Definition: t8_default_hex_cxx.cxx:75
virtual void t8_element_vertex_coords(const t8_element_t *elem, int vertex, int coords[]) const
Compute the integer coordinates of a given element vertex.
Definition: t8_default_hex_cxx.cxx:545
virtual void t8_element_boundary_face(const t8_element_t *elem, int face, t8_element_t *boundary, const t8_eclass_scheme_c *boundary_scheme) const
Construct the boundary element at a specific face.
Definition: t8_default_hex_cxx.cxx:404
virtual void t8_element_set_linear_id(t8_element_t *elem, int level, t8_linearidx_t id) const
Initialize the entries of an allocated element according to a given linear id in a uniform refinement...
Definition: t8_default_hex_cxx.cxx:487
t8_default_scheme_hex_c()
The virtual table for a particular implementation of an element class.
Definition: t8_default_hex_cxx.cxx:649
virtual void t8_element_last_descendant(const t8_element_t *elem, t8_element_t *desc, int level) const
Compute the last descendant of a given element.
Definition: t8_default_hex_cxx.cxx:515
virtual void t8_element_sibling(const t8_element_t *elem, int sibid, t8_element_t *sibling) const
Compute a specific sibling of a given hex element elem and store it in sibling.
Definition: t8_default_hex_cxx.cxx:89
virtual int t8_element_maxlevel(void) const
Return the maximum allowed level for this element class.
Definition: t8_default_hex_cxx.cxx:37
virtual void t8_element_nca(const t8_element_t *elem1, const t8_element_t *elem2, t8_element_t *nca) const
Compute the nearest common ancestor of two elements.
Definition: t8_default_hex_cxx.cxx:200
virtual int t8_element_get_face_corner(const t8_element_t *element, int face, int corner) const
Return the corner number of an element's face corner.
Definition: t8_default_hex_cxx.cxx:124
virtual t8_eclass_t t8_element_child_eclass(int childid) const
Return the type of each child in the ordering of the implementation.
Definition: t8_default_hex_cxx.cxx:43
virtual t8_element_shape_t t8_element_face_shape(const t8_element_t *elem, int face) const
Compute the shape of the face of an element.
Definition: t8_default_hex_cxx.cxx:209
virtual int t8_element_is_family(t8_element_t **fam) const
Query whether a given set of elements is a family or not.
Definition: t8_default_hex_cxx.cxx:186
virtual void t8_element_anchor(const t8_element_t *elem, int anchor[3]) const
Get the integer coordinates of the anchor node of an element.
Definition: t8_default_hex_cxx.cxx:533
virtual int t8_element_child_id(const t8_element_t *elem) const
Compute the child id of an element.
Definition: t8_default_hex_cxx.cxx:173
virtual void t8_element_copy(const t8_element_t *source, t8_element_t *dest) const
Copy all entries of source to dest.
Definition: t8_default_hex_cxx.cxx:58
virtual int t8_element_compare(const t8_element_t *elem1, const t8_element_t *elem2) const
Compare two elements.
Definition: t8_default_hex_cxx.cxx:66
virtual void t8_element_to_string(const t8_element_t *elem, char *debug_string, const int string_size) const
Print a given element.
Definition: t8_default_hex_cxx.cxx:638
virtual t8_linearidx_t t8_element_get_linear_id(const t8_element_t *elem, int level) const
Compute the linear id of a given element in a hypothetical uniform refinement of a given level.
Definition: t8_default_hex_cxx.cxx:497
virtual int t8_element_is_root_boundary(const t8_element_t *elem, int face) const
Compute whether a given element shares a given face with its root tree.
Definition: t8_default_hex_cxx.cxx:442
virtual int t8_element_refines_irregular(void) const
Returns true, if there is one element in the tree, that does not refine into 2^dim children.
Definition: t8_default_hex_cxx.cxx:587
virtual void t8_element_children_at_face(const t8_element_t *elem, int face, t8_element_t *children[], int num_children, int *child_indices) const
Given an element and a face of the element, compute all children of the element that touch the face.
Definition: t8_default_hex_cxx.cxx:216
virtual int t8_element_num_children(const t8_element_t *elem) const
Return the number of children of an element when it is refined.
Definition: t8_default_hex_cxx.cxx:110
This struct holds virtual functions for a particular element class.
Definition: t8_element_cxx.hxx:47
uint64_t t8_linearidx_t
A type for storing SFC indices.
Definition: t8.h:107
p8est_quadrant_t t8_phex_t
The structure holding a hexahedral element in the default scheme.
Definition: t8_default_hex.h:38
TODO: document this.
Definitions of hex-specific functions.
enum t8_eclass t8_eclass_t
This enumeration contains all possible element classes.
struct t8_element t8_element_t
Opaque structure for a generic element, only used as pointer.
Definition: t8_element.h:42
This file defines basic operations on an element in a refinement tree.
t8_eclass_t t8_element_shape_t
Type definition for the geometric shape of an element.
Definition: t8_element_shape.h:38