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_common_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 
27 #ifndef T8_DEFAULT_COMMON_CXX_HXX
28 #define T8_DEFAULT_COMMON_CXX_HXX
29 
30 #include <t8_element_cxx.hxx>
31 
32 /* Macro to check whether a pointer (VAR) to a base class, comes from an
33  * implementation of a child class (TYPE). */
34 #define T8_COMMON_IS_TYPE(VAR, TYPE) \
35  ((dynamic_cast<TYPE> (VAR)) != NULL)
36 
38 {
39 public:
42 
44  virtual int t8_element_num_corners (const t8_element_t *elem) const;
45 
47  virtual void t8_element_new (int length, t8_element_t **elem) const;
48 
50  virtual void t8_element_destroy (int length,
51  t8_element_t **elem) const;
52 
55  const;
56 
66  int level) const;
67 
74  virtual int t8_element_num_siblings (const t8_element_t *elem)
75  const;
76 
82  virtual t8_gloidx_t t8_element_count_leafs_from_root (int level) const;
83 
94  virtual void t8_element_general_function (const t8_element_t *elem,
95  const void *indata,
96  void *outdata) const;
97 
108  virtual void t8_element_vertex_coords (const t8_element_t *elem,
109  int vertex,
110  int coords[]) const = 0;
111 
120  virtual void t8_element_reference_coords (const t8_element_t *elem,
121  const double *ref_coords,
122  const void *user_data,
123  double *out_coords)
124  const = 0;
125 
136  virtual void t8_element_anchor (const t8_element_t *elem,
137  int anchor[3]) const = 0;
138 };
139 
140 #endif /* !T8_DEFAULT_COMMON_CXX_HXX */
Definition: t8_default_common_cxx.hxx:38
virtual t8_gloidx_t t8_element_count_leafs(const t8_element_t *t, int level) const
Count how many leaf descendants of a given uniform level an element would produce.
Definition: t8_default_common_cxx.cxx:126
virtual void t8_element_vertex_coords(const t8_element_t *elem, int vertex, int coords[]) const =0
Compute the integer coordinates of a given element vertex.
virtual ~ t8_default_scheme_common_c()
Destructor for all default schemes.
virtual int t8_element_num_siblings(const t8_element_t *elem) const
Compute the number of siblings of an element.
Definition: t8_default_common_cxx.cxx:147
virtual t8_element_shape_t t8_element_shape(const t8_element_t *elem) const
Return the shape of an element.
Definition: t8_default_common_cxx.cxx:110
virtual int t8_element_num_corners(const t8_element_t *elem) const
Compute the number of corners of a given element.
Definition: t8_default_common_cxx.cxx:59
virtual void t8_element_destroy(int length, t8_element_t **elem) const
Deallocate space for a bunch of elements.
Definition: t8_default_common_cxx.cxx:73
virtual t8_gloidx_t t8_element_count_leafs_from_root(int level) const
Count how many leaf descendants of a given uniform level the root element will produce.
Definition: t8_default_common_cxx.cxx:156
virtual void t8_element_reference_coords(const t8_element_t *elem, const double *ref_coords, const void *user_data, double *out_coords) const =0
Convert a point in the reference space of an element to a point in the reference space of the tree.
virtual void t8_element_anchor(const t8_element_t *elem, int anchor[3]) const =0
Get the integer coordinates of the anchor node of an element.
virtual void t8_element_general_function(const t8_element_t *elem, const void *indata, void *outdata) const
The common implementation of the general function for the default scheme has no effect.
Definition: t8_default_common_cxx.cxx:166
virtual void t8_element_new(int length, t8_element_t **elem) const
Allocate space for a bunch of elements.
Definition: t8_default_common_cxx.cxx:67
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
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