t8  UNKNOWN
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>
37 
38 #if T8_WITH_OCC
39 
40 #include <TopoDS_Shape.hxx>
41 #include <TopExp.hxx>
42 #include <gp_Pnt.hxx>
43 #include <Geom_Curve.hxx>
44 #include <Geom_Surface.hxx>
45 
47 {
48  public:
61  t8_geometry_occ (int dim, const char *fileprefix, const char *name);
62 
76  t8_geometry_occ (int dim, const TopoDS_Shape occ_shape, const char *name);
77 
81  virtual ~t8_geometry_occ ()
82  {
83  /* Nothing to do. */
84  }
85 
90  inline t8_geometry_type_t
92  {
93  return T8_GEOMETRY_TYPE_OCC;
94  };
95 
104  virtual void
105  t8_geom_evaluate (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords,
106  double *out_coords) const;
107 
117  virtual void
118  t8_geom_evaluate_jacobian (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords,
119  double *jacobian) const;
120 
128  virtual void
130 
135  int
136  t8_geom_is_line (const int curve_index) const;
137 
142  int
143  t8_geom_is_plane (const int surface_index) const;
144 
149  const gp_Pnt
150  t8_geom_get_occ_point (const int index) const;
151 
156  const Handle_Geom_Curve
157  t8_geom_get_occ_curve (const int index) const;
158 
163  const Handle_Geom_Surface
164  t8_geom_get_occ_surface (const int index) const;
165 
169  const TopTools_IndexedMapOfShape
171 
175  const TopTools_IndexedMapOfShape
177 
181  const TopTools_IndexedMapOfShape
183 
189  int
190  t8_geom_get_common_edge (const int vertex1_index, const int vertex2_index) const;
191 
197  int
198  t8_geom_get_common_face (const int edge1_index, const int edge2_index) const;
199 
205  int
206  t8_geom_is_vertex_on_edge (const int vertex_index, const int edge_index) const;
207 
213  int
214  t8_geom_is_edge_on_face (const int edge_index, const int face_index) const;
215 
221  int
222  t8_geom_is_vertex_on_face (const int vertex_index, const int face_index) const;
223 
230  void
231  t8_geom_get_parameter_of_vertex_on_edge (const int vertex_index, const int edge_index, double *edge_param) const;
232 
239  void
240  t8_geom_get_parameters_of_vertex_on_face (const int vertex_index, const int face_index, double *face_params) const;
241 
256  void
257  t8_geom_edge_parameter_to_face_parameters (const int edge_index, const int face_index, const int num_face_nodes,
258  const double edge_param, const double *surface_params,
259  double *face_params) const;
260 
265  void
266  t8_geom_get_face_parametric_bounds (const int surface_index, double *bounds) const;
267 
272  void
273  t8_geom_get_edge_parametric_bounds (const int edge_index, double *bounds) const;
274 
279  int
280  t8_geom_is_edge_closed (int edge_index) const;
281 
288  int
289  t8_geom_is_surface_closed (int geometry_index, int parameter) const;
290 
291  private:
300  void
301  t8_geom_evaluate_occ_triangle (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords,
302  const size_t num_coords, double *out_coords) const;
303 
312  void
313  t8_geom_evaluate_occ_quad (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords,
314  double *out_coords) const;
315 
324  void
325  t8_geom_evaluate_occ_hex (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords,
326  double *out_coords) const;
327 
328  const int *edges;
329  const int *faces;
330  TopoDS_Shape occ_shape;
331  TopTools_IndexedMapOfShape occ_shape_vertex_map;
332  TopTools_IndexedMapOfShape occ_shape_edge_map;
333  TopTools_IndexedMapOfShape occ_shape_face_map;
334  TopTools_IndexedDataMapOfShapeListOfShape
335  occ_shape_vertex2edge_map;
336  TopTools_IndexedDataMapOfShapeListOfShape
337  occ_shape_edge2face_map;
338 };
339 
340 #endif /* T8_WITH_OCC */
341 
342 #endif /* !T8_GEOMETRY_OCC_HXX! */
Definition: t8_geometry_with_vertices.hxx:38
This structure holds the connectivity data of the coarse mesh.
Definition: t8_cmesh_types.h:88
Definition: t8_geometry_occ.hxx:47
t8_geometry_type_t t8_geom_get_type() const
Get the type of this geometry.
Definition: t8_geometry_occ.hxx:91
int t8_geom_is_plane(const int surface_index) const
Check if a occ_surface is a plane.
Definition: t8_geometry_occ.cxx:842
int t8_geom_is_edge_closed(int edge_index) const
Checks if an edge is closed in its U parameter.
Definition: t8_geometry_occ.cxx:1040
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_occ.cxx:141
const gp_Pnt t8_geom_get_occ_point(const int index) const
Get an occ point from the occ_shape.
Definition: t8_geometry_occ.cxx:850
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
Compute the jacobian of the t8_geom_evaluate map at a point in the reference space .
Definition: t8_geometry_occ.cxx:110
virtual ~t8_geometry_occ()
The destructor.
Definition: t8_geometry_occ.hxx:81
const Handle_Geom_Curve t8_geom_get_occ_curve(const int index) const
Get an occ curve from the occ_shape.
Definition: t8_geometry_occ.cxx:857
int t8_geom_is_line(const int curve_index) const
Check if a occ_curve is a line.
Definition: t8_geometry_occ.cxx:834
int t8_geom_is_surface_closed(int geometry_index, int parameter) const
Checks if a surface is closed in its U parameter or V parameter.
Definition: t8_geometry_occ.cxx:1047
int t8_geom_is_vertex_on_face(const int vertex_index, const int face_index) const
Check if a occ vertex lies on an occ face.
Definition: t8_geometry_occ.cxx:936
void t8_geom_edge_parameter_to_face_parameters(const int edge_index, const int face_index, const int num_face_nodes, const double edge_param, const double *surface_params, double *face_params) const
Converts the parameters of an occ edge to the corresponding parameters on an occ face.
Definition: t8_geometry_occ.cxx:972
int t8_geom_get_common_edge(const int vertex1_index, const int vertex2_index) const
Check if two occ points share a common occ edge.
Definition: t8_geometry_occ.cxx:890
t8_geometry_occ(int dim, const char *fileprefix, const char *name)
Constructor of the occ geometry with a given dimension.
Definition: t8_geometry_occ.cxx:44
int t8_geom_is_vertex_on_edge(const int vertex_index, const int edge_index) const
Check if a occ vertex lies on an occ edge.
Definition: t8_geometry_occ.cxx:922
int t8_geom_get_common_face(const int edge1_index, const int edge2_index) const
Check if two occ edges share a common occ face.
Definition: t8_geometry_occ.cxx:906
const Handle_Geom_Surface t8_geom_get_occ_surface(const int index) const
Get an occ surface from the occ_shape.
Definition: t8_geometry_occ.cxx:865
const TopTools_IndexedMapOfShape t8_geom_get_occ_shape_face_map() const
Get the occ_shape_face_map.
Definition: t8_geometry_occ.cxx:884
void t8_geom_get_parameter_of_vertex_on_edge(const int vertex_index, const int edge_index, double *edge_param) const
Retrieves the parameter of an occ vertex on an occ edge.
Definition: t8_geometry_occ.cxx:949
void t8_geom_get_parameters_of_vertex_on_face(const int vertex_index, const int face_index, double *face_params) const
Retrieves the parameters of an occ vertex on a occ face.
Definition: t8_geometry_occ.cxx:959
void t8_geom_get_face_parametric_bounds(const int surface_index, double *bounds) const
Finds the parametric bounds of an occ face.
Definition: t8_geometry_occ.cxx:1025
int t8_geom_is_edge_on_face(const int edge_index, const int face_index) const
Check if a occ vertex lies on an occ edge.
Definition: t8_geometry_occ.cxx:929
const TopTools_IndexedMapOfShape t8_geom_get_occ_shape_edge_map() const
Get the occ_shape_edge2face_map.
Definition: t8_geometry_occ.cxx:878
const TopTools_IndexedMapOfShape t8_geom_get_occ_shape_vertex_map() const
Get the occ_shape_vertex2edge_map.
Definition: t8_geometry_occ.cxx:872
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
Maps points in the reference space .
Definition: t8_geometry_occ.cxx:89
void t8_geom_get_edge_parametric_bounds(const int edge_index, double *bounds) const
Finds the parametric bounds of an occ edge.
Definition: t8_geometry_occ.cxx:1032
const char * name
The name of this geometry.
Definition: t8_geometry_base.hxx:130
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:98
We define here the datatypes needed for internal cmesh routines.
@ T8_GEOMETRY_TYPE_OCC
The OCC geometry uses OCC CAD shapes to map trees exactly to the underlying CAD model.
Definition: t8_geometry.h:45
enum t8_geometry_type t8_geometry_type_t
This enumeration contains all possible geometries.
This header provides the C interface to create a occ geometry.
This header file provides a C interface for functions for the t8_geometry_with_vertices class.
Implements the inherited class t8_geometry_with_vertices, which can be used for geometries that use v...