t8  UNKNOWN
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) ((dynamic_cast<TYPE> (VAR)) != NULL)
35 
37  public:
39  virtual ~t8_default_scheme_common_c ();
40 
41  virtual void
42  t8_element_deinit (int length, t8_element_t *elem) const override;
43 
45  virtual int
46  t8_element_num_corners (const t8_element_t *elem) const;
47 
49  virtual void
50  t8_element_new (int length, t8_element_t **elem) const;
51 
53  virtual void
54  t8_element_destroy (int length, t8_element_t **elem) const;
55 
57  virtual t8_element_shape_t
58  t8_element_shape (const t8_element_t *elem) const;
59 
68  virtual t8_gloidx_t
69  t8_element_count_leaves (const t8_element_t *t, int level) const;
70 
77  virtual int
78  t8_element_num_siblings (const t8_element_t *elem) const;
79 
85  virtual t8_gloidx_t
86  t8_element_count_leaves_from_root (int level) const;
87 
98  virtual void
99  t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords,
100  double *out_coords) const
101  = 0;
102 
113  virtual void
114  t8_element_anchor (const t8_element_t *elem, int anchor[3]) const
115  = 0;
116 #if T8_ENABLE_DEBUG
117  virtual void
118  t8_element_debug_print (const t8_element_t *elem) const;
119 #endif
120 };
121 
122 #endif /* !T8_DEFAULT_COMMON_CXX_HXX */
Definition: t8_default_common_cxx.hxx:36
virtual void t8_element_reference_coords(const t8_element_t *elem, const double *ref_coords, const size_t num_coords, double *out_coords) const =0
Convert points in the reference space of an element to points in the reference space of the tree.
virtual t8_gloidx_t t8_element_count_leaves(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:121
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:139
virtual void t8_element_deinit(int length, t8_element_t *elem) const override
Deinitialize an array of allocated elements.
Definition: t8_default_common_cxx.cxx:167
virtual t8_gloidx_t t8_element_count_leaves_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: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:107
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 void t8_element_debug_print(const t8_element_t *elem) const
Print a given element.
Definition: t8_default_common_cxx.cxx:158
virtual ~t8_default_scheme_common_c()
Destructor for all default schemes.
Definition: t8_default_common_cxx.cxx:50
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_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:41
int64_t t8_gloidx_t
A type for global indexing that holds really big numbers.
Definition: t8.h:100
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