Program Listing for File t8_cad.hxx

Return to documentation for file (src/t8_cad/t8_cad.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_HXX
#define T8_CAD_HXX

#include <gp_Pnt.hxx>
#include <TopExp.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>

class t8_cad {
 public:
  t8_cad (std::string fileprefix);

  t8_cad (const TopoDS_Shape cad_shape);

  t8_cad ();

  int
  t8_geom_is_line (const int curve_index) const;

  int
  t8_geom_is_plane (const int surface_index) const;

  const gp_Pnt
  t8_geom_get_cad_point (const int index) const;

  const Handle_Geom_Curve
  t8_geom_get_cad_curve (const int index) const;

  const Handle_Geom_Surface
  t8_geom_get_cad_surface (const int index) const;

  const TopTools_IndexedMapOfShape
  t8_geom_get_cad_shape_vertex_map () const;

  const TopTools_IndexedMapOfShape
  t8_geom_get_cad_shape_edge_map () const;

  const TopTools_IndexedMapOfShape
  t8_geom_get_cad_shape_face_map () const;

  int
  t8_geom_get_common_edge (const int vertex1_index, const int vertex2_index) const;

  int
  t8_geom_get_common_face (const int edge1_index, const int edge2_index) const;

  int
  t8_geom_is_vertex_on_edge (const int vertex_index, const int edge_index) const;

  int
  t8_geom_is_edge_on_face (const int edge_index, const int face_index) const;

  int
  t8_geom_is_vertex_on_face (const int vertex_index, const int face_index) const;

  void
  t8_geom_get_parameter_of_vertex_on_edge (const int vertex_index, const int edge_index, double *edge_param) const;

  void
  t8_geom_get_parameters_of_vertex_on_face (const int vertex_index, const int face_index, double *face_params) const;

  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;

  void
  t8_geom_get_face_parametric_bounds (const int surface_index, double *bounds) const;

  void
  t8_geom_get_edge_parametric_bounds (const int edge_index, double *bounds) const;

  int
  t8_geom_is_edge_closed (int edge_index) const;

  int
  t8_geom_is_surface_closed (int geometry_index, int parameter) const;

 private:
  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;
};

#endif /* !T8_CAD_HXX */