Program Listing for File t8_cad_handle.hxx
↰ Return to documentation for file (src/t8_cad/t8_cad_handle.hxx)
/*
This file is part of t8code.
t8code is a C library to manage a collection (a forest) of multiple
connected adaptive space-trees of general element classes in parallel.
Copyright (C) 2025 the developers
t8code is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
t8code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with t8code; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef T8_CAD_HANDLE_HXX
#define T8_CAD_HANDLE_HXX
#include <gp_Pnt.hxx>
#include <TopExp.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <optional>
#include <span>
#include <string_view>
#include <t8_cmesh/t8_cmesh.h>
class t8_cad_handle {
public:
t8_cad_handle (const std::string_view fileprefix);
t8_cad_handle (TopoDS_Shape cad_shape_in);
t8_cad_handle ();
~t8_cad_handle ();
void
load (const std::string_view fileprefix);
void
load (TopoDS_Shape cad_shape_in);
int
is_line (const int curve_index) const;
int
is_plane (const int surface_index) const;
const TopoDS_Vertex
get_cad_vertex (const int index) const;
const TopoDS_Edge
get_cad_edge (const int index) const;
const TopoDS_Face
get_cad_face (const int index) const;
const gp_Pnt
get_cad_point (const int index) const;
const Handle_Geom_Curve
get_cad_curve (const int index) const;
const Handle_Geom_Surface
get_cad_surface (const int index) const;
const TopTools_IndexedMapOfShape
get_cad_shape_vertex_map () const;
const TopTools_IndexedMapOfShape
get_cad_shape_edge_map () const;
const TopTools_IndexedMapOfShape
get_cad_shape_face_map () const;
int
get_common_edge_of_vertices (const int vertex1_index, const int vertex2_index) const;
int
get_common_face_of_edges (const int edge1_index, const int edge2_index) const;
int
get_common_face_of_vertex_and_edge (const int vertex_index, const int edge_index) const;
int
get_common_face_of_vertices (const int vertex1_index, const int vertex2_index) const;
int
is_vertex_on_edge (const int vertex_index, const int edge_index) const;
int
is_edge_on_face (const int edge_index, const int face_index) const;
int
is_vertex_on_face (const int vertex_index, const int face_index) const;
bool
vertex_is_seam (const int vertex_index, const int edge_index) const;
bool
vertex_is_on_seam_edge (const int vertex_index, const int face_index) const;
bool
edge_is_seam (const int edge_index, const int face_index) const;
void
get_parameter_of_vertex_on_edge (const int vertex_index, const int edge_index, double *edge_param,
std::optional<double> reference_edge_param = std::nullopt) const;
void
get_parameters_of_vertex_on_face (const int vertex_index, const int face_index, double face_params[2],
std::optional<std::span<const double, 2> > reference_face_params
= std::nullopt) const;
void
edge_parameter_to_face_parameters (const int edge_index, const int face_index, const double edge_param,
double face_params_out[2],
std::optional<std::span<const double, 2> > reference_face_params
= std::nullopt) const;
void
get_face_parametric_bounds (const int surface_index, double *bounds) const;
void
get_edge_parametric_bounds (const int edge_index, double *bounds) const;
int
edge_is_closed (int edge_index) const;
inline void
ref ()
{
t8_refcount_ref (&rc);
}
inline void
unref ()
{
if (t8_refcount_unref (&rc)) {
t8_debugf ("Deleting the cad_handle.\n");
delete this;
}
}
bool
surface_is_closed (int geometry_index) const;
bool
surface_is_closed (int geometry_index, int direction) const;
private:
void
map ();
TopoDS_Shape cad_shape;
TopTools_IndexedMapOfShape cad_shape_vertex_map;
TopTools_IndexedMapOfShape cad_shape_edge_map;
TopTools_IndexedMapOfShape cad_shape_face_map;
TopTools_IndexedDataMapOfShapeListOfShape
cad_shape_vertex2edge_map;
TopTools_IndexedDataMapOfShapeListOfShape
cad_shape_edge2face_map;
TopTools_IndexedDataMapOfShapeListOfShape
cad_shape_vertex2face_map;
t8_refcount_t rc;
};
#endif /* !T8_CAD_HANDLE_HXX */