t8  UNKNOWN
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
t8_default_pyramid_cxx.hxx
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 
29 #ifndef T8_DEFAULT_PYRAMID_CXX_HXX
30 #define T8_DEFAULT_PYRAMID_CXX_HXX
31 
32 #include <t8_element_cxx.hxx>
34 
40 {
41  public:
46 
65  virtual void
66  t8_element_new (int length, t8_element_t **elem) const;
67 
83  virtual void
84  t8_element_init (int length, t8_element_t *elem) const;
85 
90  virtual int
91  t8_element_level (const t8_element_t *elem) const;
92 
96  virtual int
97  t8_element_maxlevel (void) const;
98 
104  virtual void
105  t8_element_copy (const t8_element_t *source, t8_element_t *dest) const;
106 
113  virtual int
114  t8_element_compare (const t8_element_t *elem1, const t8_element_t *elem2) const;
115 
122  virtual int
123  t8_element_equal (const t8_element_t *elem1, const t8_element_t *elem2) const;
124 
134  virtual void
135  t8_element_parent (const t8_element_t *elem, t8_element_t *parent) const;
136 
142  virtual int
143  t8_element_num_siblings (const t8_element_t *elem) const;
144 
154  virtual void
155  t8_element_sibling (const t8_element_t *elem, int sibid, t8_element_t *sibling) const
156  {
157  SC_ABORT ("This function is not implemented yet.\n");
158  return; /* suppresses compiler warning */
159  }
160 
165  virtual int
166  t8_element_num_faces (const t8_element_t *elem) const;
167 
172  virtual int
173  t8_element_max_num_faces (const t8_element_t *elem) const;
174 
179  virtual int
180  t8_element_num_children (const t8_element_t *elem) const;
181 
187  virtual int
188  t8_element_num_face_children (const t8_element_t *elem, int face) const;
195  virtual int
196  t8_element_get_face_corner (const t8_element_t *element, int face, int corner) const;
197 
202  virtual int
203  t8_element_num_corners (const t8_element_t *elem) const;
204 
211  virtual int
212  t8_element_get_corner_face (const t8_element_t *element, int corner, int face) const
213  {
214  SC_ABORT ("Not implemented.\n");
215  return 0; /* prevents compiler warning */
216  }
217 
225  virtual void
226  t8_element_child (const t8_element_t *elem, int childid, t8_element_t *child) const;
227 
236  virtual void
237  t8_element_children (const t8_element_t *elem, int length, t8_element_t *c[]) const;
238 
243  virtual int
244  t8_element_child_id (const t8_element_t *elem) const;
245 
251  virtual int
252  t8_element_ancestor_id (const t8_element_t *elem, int level) const;
253 
259  virtual int
260  t8_element_is_family (t8_element_t *const *fam) const;
261 
269  virtual void
270  t8_element_nca (const t8_element_t *elem1, const t8_element_t *elem2, t8_element_t *nca) const;
271 
277  virtual t8_element_shape_t
278  t8_element_shape (const t8_element_t *elem) const;
279 
285  virtual t8_element_shape_t
286  t8_element_face_shape (const t8_element_t *elem, int face) const;
287 
299  virtual void
300  t8_element_children_at_face (const t8_element_t *elem, int face, t8_element_t *children[], int num_children,
301  int *child_indices) const;
302 
321  virtual int
322  t8_element_face_child_face (const t8_element_t *elem, int face, int face_child) const;
323 
332  virtual int
333  t8_element_face_parent_face (const t8_element_t *elem, int face) const;
334 
343  virtual int
344  t8_element_tree_face (const t8_element_t *elem, int face) const;
345 
360  virtual void
361  t8_element_transform_face (const t8_element_t *elem1, t8_element_t *elem2, int orientation, int sign,
362  int is_smaller_face) const
363  {
364  SC_ABORT ("This function is not implemented yet.\n");
365  }
366 
376  virtual int
377  t8_element_extrude_face (const t8_element_t *face, const t8_eclass_scheme_c *face_scheme, t8_element_t *elem,
378  int root_face) const;
379 
387  virtual void
388  t8_element_first_descendant_face (const t8_element_t *elem, int face, t8_element_t *first_desc, int level) const;
389 
397  virtual void
398  t8_element_last_descendant_face (const t8_element_t *elem, int face, t8_element_t *last_desc, int level) const;
399 
407  virtual void
408  t8_element_boundary_face (const t8_element_t *elem, int face, t8_element_t *boundary,
409  const t8_eclass_scheme_c *boundary_scheme) const;
410 
416  virtual int
417  t8_element_is_root_boundary (const t8_element_t *elem, int face) const;
418 
430  virtual int
431  t8_element_face_neighbor_inside (const t8_element_t *elem, t8_element_t *neigh, int face, int *neigh_face) const;
432 
439  virtual void
440  t8_element_set_linear_id (t8_element_t *elem, int level, t8_linearidx_t id) const;
441 
447  virtual t8_linearidx_t
448  t8_element_get_linear_id (const t8_element_t *elem, int level) const;
449 
455  virtual void
456  t8_element_first_descendant (const t8_element_t *elem, t8_element_t *desc, int level) const;
457 
463  virtual void
464  t8_element_last_descendant (const t8_element_t *elem, t8_element_t *desc, int level) const;
465 
471  virtual void
472  t8_element_successor (const t8_element_t *elem, t8_element_t *succ) const;
473 
481  virtual void
482  t8_element_anchor (const t8_element_t *elem, int anchor[3]) const;
483 
493  virtual void
494  t8_element_vertex_reference_coords (const t8_element_t *elem, const int vertex, double coords[]) const;
495 
506  virtual void
507  t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords,
508  double *out_coords) const;
509 
514  virtual int
515  t8_element_refines_irregular (void) const;
516 
517 #ifdef T8_ENABLE_DEBUG
532  virtual int
533  t8_element_is_valid (const t8_element_t *t) const;
534 
542  virtual void
543  t8_element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const;
544 #endif
545 
549  void
550  t8_element_root (t8_element_t *elem) const;
551 
560  virtual void
561  t8_element_MPI_Pack (t8_element_t **const elements, const unsigned int count, void *send_buffer, int buffer_size,
562  int *position, sc_MPI_Comm comm) const;
563 
569  virtual void
570  t8_element_MPI_Pack_size (const unsigned int count, sc_MPI_Comm comm, int *pack_size) const;
571 
580  virtual void
581  t8_element_MPI_Unpack (void *recvbuf, const int buffer_size, int *position, t8_element_t **elements,
582  const unsigned int count, sc_MPI_Comm comm) const;
583 };
584 
585 #endif /* !T8_DEFAULT_pyramid_CXX_HXX */
Definition: t8_default_common_cxx.hxx:36
Provide an implementation for the pyramid element class.
Definition: t8_default_pyramid_cxx.hxx:40
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_pyramid_cxx.cxx:72
virtual int t8_element_is_family(t8_element_t *const *fam) const
Query whether a given set of elements is a family or not.
Definition: t8_default_pyramid_cxx.cxx:246
virtual void t8_element_successor(const t8_element_t *elem, t8_element_t *succ) const
Construct the successor in a uniform refinement of a given element.
Definition: t8_default_pyramid_cxx.cxx:336
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_pyramid_cxx.cxx:239
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_pyramid_cxx.cxx:123
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_pyramid_cxx.cxx:258
virtual void t8_element_MPI_Unpack(void *recvbuf, const int buffer_size, int *position, t8_element_t **elements, const unsigned int count, sc_MPI_Comm comm) const
Unpack multiple elements from contiguous memory that was received via MPI.
Definition: t8_default_pyramid_cxx.cxx:472
virtual void t8_element_init(int length, t8_element_t *elem) const
Initialize an array of allocated elements.
Definition: t8_default_pyramid_cxx.cxx:52
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_pyramid_cxx.hxx:361
virtual int t8_element_level(const t8_element_t *elem) const
Return the refinement level of an element.
Definition: t8_default_pyramid_cxx.cxx:232
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_pyramid_cxx.cxx:328
virtual int t8_element_compare(const t8_element_t *elem1, const t8_element_t *elem2) const
Compare two elements.
Definition: t8_default_pyramid_cxx.cxx:115
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_pyramid_cxx.cxx:179
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_pyramid_cxx.cxx:297
virtual void t8_element_sibling(const t8_element_t *elem, int sibid, t8_element_t *sibling) const
Compute a specific sibling of a given pyramid element elem and store it in sibling.
Definition: t8_default_pyramid_cxx.hxx:155
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_pyramid_cxx.hxx:212
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_pyramid_cxx.cxx:201
virtual int t8_element_child_id(const t8_element_t *elem) const
Compute the child id of an element.
Definition: t8_default_pyramid_cxx.cxx:186
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_pyramid_cxx.cxx:290
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_pyramid_cxx.cxx:208
virtual t8_element_shape_t t8_element_shape(const t8_element_t *elem) const
Return the shape of an allocated element according its type.
Definition: t8_default_pyramid_cxx.cxx:283
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_pyramid_cxx.cxx:398
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_pyramid_cxx.cxx:367
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_pyramid_cxx.cxx:274
virtual void t8_element_new(int length, t8_element_t **elem) const
Allocate memory for an array of pyramids and initialize them.
Definition: t8_default_pyramid_cxx.cxx:35
virtual int t8_element_num_corners(const t8_element_t *elem) const
Compute the number of corners of a given element.
Definition: t8_default_pyramid_cxx.cxx:94
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_pyramid_cxx.cxx:311
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_pyramid_cxx.cxx:344
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_pyramid_cxx.cxx:304
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_pyramid_cxx.cxx:172
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_pyramid_cxx.cxx:225
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_pyramid_cxx.cxx:87
virtual int t8_element_maxlevel(void) const
Return the maximum allowed level for this element class.
Definition: t8_default_pyramid_cxx.cxx:66
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_pyramid_cxx.cxx:216
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_pyramid_cxx.cxx:265
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_pyramid_cxx.cxx:129
virtual void t8_element_MPI_Pack(t8_element_t **const elements, const unsigned int count, void *send_buffer, int buffer_size, int *position, sc_MPI_Comm comm) const
Pack multiple elements into contiguous memory, so they can be sent via MPI.
Definition: t8_default_pyramid_cxx.cxx:439
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_pyramid_cxx.cxx:383
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_pyramid_cxx.cxx:375
t8_default_scheme_pyramid_c(void)
The virtual table for a particular implementation of an element class.
Definition: t8_default_pyramid_cxx.cxx:411
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_pyramid_cxx.cxx:391
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_pyramid_cxx.cxx:146
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_pyramid_cxx.cxx:319
virtual int t8_element_num_faces(const t8_element_t *elem) const
Compute the number of faces of a given element.
Definition: t8_default_pyramid_cxx.cxx:108
virtual int t8_element_num_siblings(const t8_element_t *elem) const
Compute the number of siblings of an element.
Definition: t8_default_pyramid_cxx.cxx:101
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_pyramid_cxx.cxx:355
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_pyramid_cxx.cxx:193
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_pyramid_cxx.cxx:79
virtual void t8_element_MPI_Pack_size(const unsigned int count, sc_MPI_Comm comm, int *pack_size) const
Determine an upper bound for the size of the packed message of count elements.
Definition: t8_default_pyramid_cxx.cxx:455
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_pyramid_cxx.cxx:137
void t8_element_root(t8_element_t *elem) const
Fills an element with the root element.
Definition: t8_default_pyramid_cxx.cxx:427
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_pyramid_cxx.cxx:158
This struct holds virtual functions for a particular element class.
Definition: t8_element_cxx.hxx:41
uint64_t t8_linearidx_t
A type for storing SFC indices.
Definition: t8.h:109
We provide some functions that are useful across 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