t8  1.2.0
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
t8_default_quad_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 
31 #ifndef T8_DEFAULT_QUAD_CXX_HXX
32 #define T8_DEFAULT_QUAD_CXX_HXX
33 
34 #include <p4est.h>
35 #include <t8_element_cxx.hxx>
36 #include <t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx>
38 
43 typedef p4est_quadrant_t t8_pquad_t;
44 
46 #define T8_QUAD_GET_TDIM(quad) ((int) (quad)->pad8)
47 
51 #define T8_QUAD_GET_TNORMAL(quad) \
52  ( T8_ASSERT (T8_QUAD_GET_TDIM(quad) == 3), \
53  ((int) (quad)->pad16) )
54 
58 #define T8_QUAD_GET_TCOORD(quad) \
59  ( T8_ASSERT (T8_QUAD_GET_TDIM(quad) == 3), \
60  ((int) (quad)->p.user_long) )
61 
63 #define T8_QUAD_SET_TDIM(quad,dim) \
64  do { T8_ASSERT ((dim) == 2 || (dim) == 3); \
65  (quad)->pad8 = (int8_t) (dim); } while (0)
66 
68 #define T8_QUAD_SET_TNORMAL(quad,normal) \
69  do { T8_ASSERT ((normal) >= 0 && (normal) < 3); \
70  (quad)->pad16 = (int16_t) (normal); } while (0)
71 
73 #define T8_QUAD_SET_TCOORD(quad,coord) \
74  do { (quad)->p.user_long = (long) (coord); } while (0)
75 
77 {
78 public:
83 
85 
103  virtual void t8_element_new (int length, t8_element_t **elem) const;
104 
122  virtual void t8_element_init (int length, t8_element_t *elem,
123  int called_new) const;
124 
129  virtual int t8_element_level (const t8_element_t *elem) const;
130 
134  virtual int t8_element_maxlevel (void) const;
135 
143  virtual void t8_element_copy (const t8_element_t *source,
144  t8_element_t *dest) const;
145 
153  virtual int t8_element_compare (const t8_element_t *elem1,
154  const t8_element_t *elem2) const;
155 
168  virtual void t8_element_parent (const t8_element_t *elem,
169  t8_element_t *parent) const;
170 
182  virtual void t8_element_sibling (const t8_element_t *elem,
183  int sibid,
184  t8_element_t *sibling) const;
185 
190  virtual int t8_element_num_faces (const t8_element_t *elem) const;
191 
197  virtual int t8_element_max_num_faces (const t8_element_t *elem)
198  const;
199 
204  virtual int t8_element_num_children (const t8_element_t *elem)
205  const;
206 
212  virtual int t8_element_num_face_children (const t8_element_t *elem,
213  int face) const;
220  virtual int t8_element_get_face_corner (const t8_element_t *element,
221  int face, int corner) const;
222 
229  virtual int t8_element_get_corner_face (const t8_element_t *element,
230  int corner, int face) const;
231 
237  virtual t8_eclass_t t8_element_child_eclass (int childid) const;
238 
248  virtual void t8_element_child (const t8_element_t *elem,
249  int childid,
250  t8_element_t *child) const;
251 
263  virtual void t8_element_children (const t8_element_t *elem,
264  int length,
265  t8_element_t *c[]) const;
266 
271  virtual int t8_element_child_id (const t8_element_t *elem) const;
272 
279  virtual int t8_element_ancestor_id (const t8_element_t *elem,
280  int level) const;
281 
288  virtual int t8_element_is_family (t8_element_t **fam) const;
289 
300  virtual void t8_element_nca (const t8_element_t *elem1,
301  const t8_element_t *elem2,
302  t8_element_t *nca) const;
303 
310  int face) const;
311 
326  virtual void t8_element_children_at_face (const t8_element_t *elem,
327  int face,
328  t8_element_t *children[],
329  int num_children,
330  int *child_indices) const;
331 
352  virtual int t8_element_face_child_face (const t8_element_t *elem,
353  int face,
354  int face_child) const;
355 
366  virtual int t8_element_face_parent_face (const t8_element_t *elem,
367  int face) const;
368 
378  virtual int t8_element_tree_face (const t8_element_t *elem,
379  int face) const;
380 
402  virtual void t8_element_transform_face (const t8_element_t *elem1,
403  t8_element_t *elem2,
404  int orientation, int sign,
405  int is_smaller_face) const;
406 
420  virtual int t8_element_extrude_face (const t8_element_t *face,
421  const t8_eclass_scheme_c
422  *face_scheme,
423  t8_element_t *elem,
424  int root_face) const;
425 
435  *elem, int face,
437  *first_desc,
438  int level) const;
439 
449  *elem, int face,
451  *last_desc,
452  int level) const;
453 
463  virtual void t8_element_boundary_face (const t8_element_t *elem,
464  int face,
465  t8_element_t *boundary,
466  const t8_eclass_scheme_c
467  *boundary_scheme) const;
468 
474  virtual void t8_element_boundary (const t8_element_t *elem,
475  int min_dim, int length,
476  t8_element_t **boundary) const;
477 
483  virtual int t8_element_is_root_boundary (const t8_element_t *elem,
484  int face) const;
485 
502  *elem,
503  t8_element_t *neigh,
504  int face,
505  int *neigh_face) const;
506 
514  virtual void t8_element_set_linear_id (t8_element_t *elem,
515  int level,
516  t8_linearidx_t id) const;
517 
525  t8_element_t *elem,
526  int level) const;
527 
534  virtual void t8_element_first_descendant (const t8_element_t *elem,
535  t8_element_t *desc,
536  int level) const;
537 
544  virtual void t8_element_last_descendant (const t8_element_t *elem,
545  t8_element_t *desc,
546  int level) const;
547 
553  virtual void t8_element_successor (const t8_element_t *t,
554  t8_element_t *s, int level) const;
555 
566  virtual void t8_element_anchor (const t8_element_t *elem,
567  int anchor[3]) const;
568 
574  virtual int t8_element_root_len (const t8_element_t *elem) const;
575 
586  virtual void t8_element_vertex_coords (const t8_element_t *elem,
587  int vertex,
588  int coords[]) const;
589 
598  *elem,
599  const int vertex,
600  double coords[])
601  const;
602 
611  virtual void t8_element_reference_coords (const t8_element_t *elem,
612  const double *ref_coords,
613  const void *user_data,
614  double *out_coords)
615  const;
616 
621  virtual int t8_element_refines_irregular (void) const;
622 
623 #ifdef T8_ENABLE_DEBUG
638  virtual int t8_element_is_valid (const t8_element_t *t) const;
639 
647  virtual void t8_element_debug_print (const t8_element_t *elem) const;
648 #endif
649 };
650 
651 #endif /* !T8_DEFAULT_QUAD_CXX_HXX */
Definition: t8_default_common_cxx.hxx:38
Definition: t8_default_quad_cxx.hxx:77
virtual void t8_element_reference_coords(const t8_element_t *elem, const double *ref_coords, const void *user_data, double *out_coords) const
Convert a point in the reference space of an element to a point in the reference space of the tree.
Definition: t8_default_quad_cxx.cxx:794
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_quad_cxx.cxx:538
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_quad_cxx.cxx:75
virtual int t8_element_maxlevel(void) const
Return the maximum allowed level for this element class.
Definition: t8_default_quad_cxx.cxx:41
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_quad_cxx.cxx:344
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_quad_cxx.cxx:647
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_quad_cxx.cxx:595
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_quad_cxx.cxx:352
virtual void t8_element_init(int length, t8_element_t *elem, int called_new) const
Initialize an array of allocated quad elements.
Definition: t8_default_quad_cxx.cxx:823
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_quad_cxx.cxx:212
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_quad_cxx.cxx:150
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_quad_cxx.cxx:314
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_quad_cxx.cxx:455
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_quad_cxx.cxx:251
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_quad_cxx.cxx:48
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_quad_cxx.cxx:137
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_quad_cxx.cxx:735
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_quad_cxx.cxx:328
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_quad_cxx.cxx:755
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_quad_cxx.cxx:300
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_quad_cxx.cxx:434
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_quad_cxx.cxx:244
virtual int t8_element_root_len(const t8_element_t *elem) const
Compute the root length of a given element, that is the length of its level 0 ancestor.
Definition: t8_default_quad_cxx.cxx:749
virtual int t8_element_num_faces(const t8_element_t *elem) const
Compute the number of faces of a given element.
Definition: t8_default_quad_cxx.cxx:130
virtual int t8_element_child_id(const t8_element_t *elem) const
Compute the child id of an element.
Definition: t8_default_quad_cxx.cxx:237
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_quad_cxx.cxx:143
virtual void t8_element_new(int length, t8_element_t **elem) const
Allocate memory for an array of quadrilaterals and initialize them.
Definition: t8_default_quad_cxx.cxx:806
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_quad_cxx.cxx:689
virtual int t8_element_level(const t8_element_t *elem) const
Return the refinement level of an element.
Definition: t8_default_quad_cxx.cxx:58
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_quad_cxx.cxx:844
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_quad_cxx.cxx:424
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_quad_cxx.cxx:158
t8_default_scheme_quad_c()
The virtual table for a particular implementation of an element class.
Definition: t8_default_quad_cxx.cxx:872
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_quad_cxx.cxx:708
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_quad_cxx.cxx:178
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_quad_cxx.cxx:773
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_quad_cxx.cxx:103
virtual void t8_element_boundary(const t8_element_t *elem, int min_dim, int length, t8_element_t **boundary) const
Construct all codimension-one boundary elements of a given element.
Definition: t8_default_quad_cxx.cxx:681
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_quad_cxx.cxx:189
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_quad_cxx.cxx:606
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_quad_cxx.cxx:627
virtual void t8_element_sibling(const t8_element_t *elem, int sibid, t8_element_t *sibling) const
Compute a specific sibling of a given quad element elem and store it in sibling.
Definition: t8_default_quad_cxx.cxx:116
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_quad_cxx.cxx:263
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_quad_cxx.cxx:276
virtual int t8_element_compare(const t8_element_t *elem1, const t8_element_t *elem2) const
Compare two elements.
Definition: t8_default_quad_cxx.cxx:92
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_quad_cxx.cxx:286
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:114
We provide some functions that are useful across element classes.
p4est_quadrant_t t8_pquad_t
The structure holding a quadrilateral element in the default scheme.
Definition: t8_default_quad.h:41
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