t8  UNKNOWN
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
t8_geometry_base.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 
28 #ifndef T8_GEOMETRY_BASE_HXX
29 #define T8_GEOMETRY_BASE_HXX
30 
31 #include <t8.h>
32 #include <t8_cmesh.h>
33 #include <t8_forest/t8_forest.h>
35 
36 #include <string>
37 #include <functional>
38 
39 T8_EXTERN_C_BEGIN ();
40 
48 {
49  public:
50  /* Basic constructor that sets the dimension, the name, and the name for the attribute. */
51  t8_geometry (int dim, std::string name): dimension (dim), name (name), hash (std::hash<std::string> {}(name))
52  {
53  T8_ASSERT (0 <= dim && dim <= T8_ECLASS_MAX_DIM);
54  }
55 
56  /* Base constructor with no arguments. We need this since it
57  * is called from derived class constructors.
58  * Sets dimension and name to invalid values. */
59  t8_geometry (): t8_geometry (-1, "Invalid")
60  {
61  }
62 
68  virtual ~t8_geometry ()
69  {
70  }
71 
80  virtual void
81  t8_geom_evaluate (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords,
82  double *out_coords) const
83  = 0;
84 
94  virtual void
95  t8_geom_evaluate_jacobian (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords,
96  double *jacobian) const
97  = 0;
98 
106  virtual void
108  = 0;
109 
125  virtual void
127  const double *points, const int num_points, int *is_inside,
128  const double tolerance) const
129  {
130  SC_ABORTF ("Point batch inside element function not implemented");
131  };
132 
137  virtual bool
139  {
140  SC_ABORTF ("Tree negative volume function not implemented");
141  /* To suppress compiler warnings. */
142  return 0;
143  };
144 
149  inline int
151  {
152  return dimension;
153  }
154 
159  inline const std::string
161  {
162  return name;
163  }
164 
165  inline const size_t
166  t8_geom_get_hash () const
167  {
168  return hash;
169  }
170 
175  virtual t8_geometry_type_t
177  = 0;
178 
179  protected:
183  std::string name;
186  size_t hash;
188 };
189 
190 T8_EXTERN_C_END ();
191 
192 #endif /* !T8_GEOMETRY_BASE_HXX */
This structure holds the connectivity data of the coarse mesh.
Definition: t8_cmesh_types.h:88
This structure is private to the implementation.
Definition: t8_forest_types.h:69
The base class for all geometries.
Definition: t8_geometry_base.hxx:48
int dimension
The dimension of reference space for which this is a geometry.
Definition: t8_geometry_base.hxx:180
size_t hash
The hash of the name of this geometry.
Definition: t8_geometry_base.hxx:186
const std::string t8_geom_get_name() const
Get the name of this geometry.
Definition: t8_geometry_base.hxx:160
virtual bool t8_geom_tree_negative_volume() const
Check if the currently active tree has a negative volume.
Definition: t8_geometry_base.hxx:138
virtual void t8_geom_evaluate(t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, double *out_coords) const =0
Maps points in the reference space .
virtual void t8_geom_point_batch_inside_element(t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double *points, const int num_points, int *is_inside, const double tolerance) const
Query whether a batch of points lies inside an element.
Definition: t8_geometry_base.hxx:126
virtual void t8_geom_evaluate_jacobian(t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, double *jacobian) const =0
Compute the jacobian of the t8_geom_evaluate map at a point in the reference space .
virtual t8_geometry_type_t t8_geom_get_type() const =0
Get the type of this geometry.
int t8_geom_get_dimension() const
Get the dimension of this geometry.
Definition: t8_geometry_base.hxx:150
virtual ~t8_geometry()
The destructor.
Definition: t8_geometry_base.hxx:68
std::string name
The name of this geometry.
Definition: t8_geometry_base.hxx:183
virtual void t8_geom_load_tree_data(t8_cmesh_t cmesh, t8_gloidx_t gtreeid)=0
Update a possible internal data buffer for per tree data.
This is the administrative header file for t8code.
int64_t t8_gloidx_t
A type for global indexing that holds really big numbers.
Definition: t8.h:100
int32_t t8_locidx_t
A type for processor-local indexing.
Definition: t8.h:89
#define T8_ASSERT(c)
Widely used assertion.
Definition: t8.h:71
We define the coarse mesh of trees in this file.
#define T8_ECLASS_MAX_DIM
The maximal possible dimension for an eclass.
Definition: t8_eclass.h:77
struct t8_element t8_element_t
Opaque structure for a generic element, only used as pointer.
Definition: t8_element.h:42
Includes all headers based on previous t8_forest.h.
Typedef for the t8_geometry class in order to be usable as a pointer from .c files.
enum t8_geometry_type t8_geometry_type_t
This enumeration contains all possible geometries.