t8  1.2.0
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
t8_geometry_occ.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_GEOMETRY_OCC_HXX
30 #define T8_GEOMETRY_OCC_HXX
31 
32 #include <t8.h>
35 
36 #if T8_WITH_OCC
37 
38 #include <TopoDS_Shape.hxx>
39 #include <TopExp.hxx>
40 #include <gp_Pnt.hxx>
41 #include <Geom_Curve.hxx>
42 #include <Geom_Surface.hxx>
43 
44 #endif /* T8_WITH_OCC */
45 
48 
50 extern const int t8_edge_to_face[T8_ECLASS_MAX_EDGES][2];
51 
53 extern const int
55 
56 #if T8_WITH_OCC
57 
68 typedef void (*t8_geom_occ_fn) (t8_cmesh_t cmesh,
69  t8_gloidx_t gtreeid,
70  const double *ref_coords,
71  double out_coords[3],
72  const void *tree_data);
73 
74 /* *INDENT-OFF* */
75 struct t8_geometry_occ:public t8_geometry_w_vertices
76 {
77 public:
78 
85  t8_geometry_occ (int dimension, const char *fileprefix, const char *name);
86 
93  t8_geometry_occ (int dimension, const TopoDS_Shape occ_shape,
94  const char *name);
95 
99  virtual ~t8_geometry_occ ()
100  {
101  /* Nothing to do. */
102  }
103 
111  virtual void
113  t8_gloidx_t gtreeid,
114  const double *ref_coords,
115  double out_coords[3]) const;
116 
125  virtual void
127  t8_gloidx_t gtreeid,
128  const double *ref_coords,
129  double *jacobian) const;
130 
131 
139  virtual void
141  t8_gloidx_t gtreeid);
142 
147  const gp_Pnt
148  t8_geom_get_occ_point (const int index) const;
149 
154  const Handle_Geom_Curve
155  t8_geom_get_occ_curve (const int index) const;
156 
161  const Handle_Geom_Surface
162  t8_geom_get_occ_surface (const int index) const;
163 
167  const TopTools_IndexedMapOfShape
168  t8_geom_get_occ_shape_vertex_map() const;
169 
173  const TopTools_IndexedMapOfShape
174  t8_geom_get_occ_shape_edge_map() const;
175 
179  const TopTools_IndexedMapOfShape
180  t8_geom_get_occ_shape_face_map() const;
181 
187  int
188  t8_geom_get_common_edge (const int vertex1_index,
189  const int vertex2_index) const;
190 
196  int
197  t8_geom_get_common_face (const int edge1_index,
198  const int edge2_index) const;
199 
205  int
206  t8_geom_is_vertex_on_edge (const int vertex_index,
207  const int edge_index) const;
208 
214  int
215  t8_geom_is_edge_on_face (const int edge_index,
216  const int face_index) const;
217 
223  int
224  t8_geom_is_vertex_on_face (const int vertex_index,
225  const int face_index) const;
226 
233  void
234  t8_geom_get_parameter_of_vertex_on_edge(const int vertex_index,
235  const int edge_index,
236  double* edge_param) const;
237 
244  void
245  t8_geom_get_parameters_of_vertex_on_face(const int vertex_index,
246  const int face_index,
247  double* face_params) const;
248 
256  void
257  t8_geom_edge_parameter_to_face_parameters(const int edge_index,
258  const int face_index,
259  const double edge_param,
260  double* face_params) const;
261 
262 private:
270  void
271  t8_geom_evaluate_occ_quad (t8_cmesh_t cmesh,
272  t8_gloidx_t gtreeid,
273  const double *ref_coords,
274  double out_coords[3]) const;
275 
283  void
284  t8_geom_evaluate_occ_hex (t8_cmesh_t cmesh,
285  t8_gloidx_t gtreeid,
286  const double *ref_coords,
287  double out_coords[3]) const;
288 
289  const int *edges;
290  const int *faces;
291  TopoDS_Shape occ_shape;
292  TopTools_IndexedMapOfShape occ_shape_vertex_map;
293  TopTools_IndexedMapOfShape occ_shape_edge_map;
294  TopTools_IndexedMapOfShape occ_shape_face_map;
295  TopTools_IndexedDataMapOfShapeListOfShape occ_shape_vertex2edge_map;
296  TopTools_IndexedDataMapOfShapeListOfShape occ_shape_edge2face_map;
297 };
298 /* *INDENT-ON* */
299 
300 #endif /* T8_WITH_OCC */
301 
302 #endif /* !T8_GEOMETRY_OCC_HXX! */
Definition: t8_geometry_base.hxx:125
virtual void t8_geom_load_tree_data(t8_cmesh_t cmesh, t8_gloidx_t gtreeid)
Update a possible internal data buffer for per tree data.
Definition: t8_geometry_base.cxx:33
This structure holds the connectivity data of the coarse mesh.
Definition: t8_cmesh_types.h:83
virtual void t8_geom_evaluate(t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, double out_coords[3]) const =0
Map a point in the reference space $$[0,1]^dimension$$ to $$\mathbb R^3$$.
virtual void t8_geom_evalute_jacobian(t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, double *jacobian) const =0
Compute the jacobian of the t8_geom_evaluate map at a point in the reference space $$[0,...
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:105
We define here the datatypes needed for internal cmesh routines.
#define T8_ECLASS_MAX_EDGES
The maximum number of boundary edges an element class can have.
Definition: t8_eclass.h:72
#define T8_ECLASS_MAX_FACES
The maximum number of boundary faces an element class can have.
Definition: t8_eclass.h:70
#define T8_ECLASS_MAX_EDGES_2D
The maximum number of boundary edges a 2D element class can have.
Definition: t8_eclass.h:74
Implements the base pure virtual class t8_geometry and the inherited class t8_geometry_w_vertices.
const int t8_face_edge_to_tree_edge[T8_ECLASS_MAX_FACES][T8_ECLASS_MAX_EDGES_2D]
The edges of a face to the edges of a tree.
Definition: t8_geometry_occ.cxx:58
const int t8_edge_to_face[T8_ECLASS_MAX_EDGES][2]
The faces connected to each edge.
Definition: t8_geometry_occ.cxx:52
const int t8_edge_vertex_to_tree_vertex[T8_ECLASS_MAX_EDGES][2]
The vertices of each edge of a hexahedron.
Definition: t8_geometry_occ.cxx:47