Loading [MathJax]/jax/output/HTML-CSS/config.js
 Reference documentation for deal.II version 8.5.1
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
utilities.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2014 - 2017 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #ifndef dealii__occ_utilities_h
18 #define dealii__occ_utilities_h
19 
20 #include <deal.II/base/config.h>
21 
22 #ifdef DEAL_II_WITH_OPENCASCADE
23 
24 #include <deal.II/grid/tria.h>
25 #include <deal.II/base/point.h>
26 
27 #include <string>
28 
29 // opencascade needs "HAVE_CONFIG_H" to be exported...
30 DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
31 #define HAVE_CONFIG_H
32 #include <TopoDS_Shape.hxx>
33 #include <TopoDS_Face.hxx>
34 #include <TopoDS_Edge.hxx>
35 #include <TopoDS_Vertex.hxx>
36 #include <TopoDS_Compound.hxx>
37 #include <TopoDS_CompSolid.hxx>
38 #include <TopoDS_Solid.hxx>
39 #include <TopoDS_Shell.hxx>
40 #include <TopoDS_Wire.hxx>
41 #include <IFSelect_ReturnStatus.hxx>
42 #include <gp_Pnt.hxx>
43 #undef HAVE_CONFIG_H
44 DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
45 
46 
47 
48 DEAL_II_NAMESPACE_OPEN
49 
96 namespace OpenCASCADE
97 {
105  std_cxx11::tuple<unsigned int, unsigned int, unsigned int>
106  count_elements(const TopoDS_Shape &shape);
107 
115  TopoDS_Shape read_IGES(const std::string &filename,
116  const double scale_factor=1e-3);
117 
121  void write_IGES(const TopoDS_Shape &shape,
122  const std::string &filename);
123 
131  TopoDS_Shape read_STEP(const std::string &filename,
132  const double scale_factor=1e-3);
133 
134 
138  void write_STEP(const TopoDS_Shape &shape,
139  const std::string &filename);
140 
153  double get_shape_tolerance(const TopoDS_Shape &shape);
154 
161  TopoDS_Shape intersect_plane(const TopoDS_Shape &in_shape,
162  const double c_x,
163  const double c_y,
164  const double c_z,
165  const double c,
166  const double tolerance=1e-7);
167 
175  TopoDS_Edge join_edges(const TopoDS_Shape &in_shape,
176  const double tolerance=1e-7);
177 
195  TopoDS_Edge interpolation_curve(std::vector<Point<3> > &curve_points,
196  const Tensor<1,3> &direction=Tensor<1,3>(),
197  const bool closed=false,
198  const double tolerance=1e-7);
199 
205  void extract_geometrical_shapes(const TopoDS_Shape &shape,
206  std::vector<TopoDS_Face> &faces,
207  std::vector<TopoDS_Edge> &edges,
208  std::vector<TopoDS_Vertex> &vertices);
209 
219  void create_triangulation(const TopoDS_Face &face,
220  Triangulation<2,3> &tria);
221 
227  void extract_compound_shapes(const TopoDS_Shape &shape,
228  std::vector<TopoDS_Compound> &compounds,
229  std::vector<TopoDS_CompSolid> &compsolids,
230  std::vector<TopoDS_Solid> &solids,
231  std::vector<TopoDS_Shell> &shells,
232  std::vector<TopoDS_Wire> &wires);
233 
248  std_cxx11::tuple<Point<3>, TopoDS_Shape, double, double>
249  project_point_and_pull_back(const TopoDS_Shape &in_shape,
250  const Point<3> &origin,
251  const double tolerance=1e-7);
252 
259  Point<3> closest_point(const TopoDS_Shape &in_shape,
260  const Point<3> &origin,
261  const double tolerance=1e-7);
262 
271  Point<3> push_forward(const TopoDS_Shape &in_shape,
272  const double u,
273  const double v);
274 
275 
281  std_cxx11::tuple<Point<3>, Tensor<1,3>, double, double>
282  push_forward_and_differential_forms(const TopoDS_Face &face,
283  const double u,
284  const double v,
285  const double tolerance=1e-7);
286 
287 
295  std_cxx11::tuple<Point<3>, Tensor<1,3>, double, double>
296  closest_point_and_differential_forms(const TopoDS_Shape &in_shape,
297  const Point<3> &origin,
298  const double tolerance=1e-7);
299 
300 
308  Point<3> line_intersection(const TopoDS_Shape &in_shape,
309  const Point<3> &origin,
310  const Tensor<1,3> &direction,
311  const double tolerance=1e-7);
312 
313 
317  Point<3> point(const gp_Pnt &p);
318 
319 
323  gp_Pnt point(const Point<3> &p);
324 
325 
332  bool point_compare(const Point<3> &p1, const Point<3> &p2,
333  const Tensor<1,3> &direction=Tensor<1,3>(),
334  const double tolerance=1e-10);
335 
336 
342  Point<3>,
343  <<"The point [ "<<arg1<<" ] is not on the manifold.");
344 
350  Point<3>,
351  <<"Projection of point [ "<< arg1
352  << " ] failed.");
353 
358  IFSelect_ReturnStatus,
359  <<"An OpenCASCADE routine failed with return status "
360  <<arg1);
361 
366 
371 }
372 
373 
374 DEAL_II_NAMESPACE_CLOSE
375 
376 #endif // DEAL_II_WITH_OPENCASCADE
377 
378 /*------------------------------ occ_utilities.h ------------------------------*/
379 #endif
380 /*------------------------------ occ_utilities.h ------------------------------*/
TopoDS_Shape read_IGES(const std::string &filename, const double scale_factor=1e-3)
Definition: utilities.cc:201
std_cxx11::tuple< Point< 3 >, Tensor< 1, 3 >, double, double > closest_point_and_differential_forms(const TopoDS_Shape &in_shape, const Point< 3 > &origin, const double tolerance=1e-7)
Definition: utilities.cc:554
Point< 3 > line_intersection(const TopoDS_Shape &in_shape, const Point< 3 > &origin, const Tensor< 1, 3 > &direction, const double tolerance=1e-7)
Definition: utilities.cc:392
TopoDS_Shape intersect_plane(const TopoDS_Shape &in_shape, const double c_x, const double c_y, const double c_z, const double c, const double tolerance=1e-7)
Definition: utilities.cc:315
TopoDS_Shape read_STEP(const std::string &filename, const double scale_factor=1e-3)
Definition: utilities.cc:244
static ::ExceptionBase & ExcProjectionFailed(Point< 3 > arg1)
static ::ExceptionBase & ExcOCCError(IFSelect_ReturnStatus arg1)
static ::ExceptionBase & ExcEdgeIsDegenerate()
Point< 3 > push_forward(const TopoDS_Shape &in_shape, const double u, const double v)
Definition: utilities.cc:586
void write_IGES(const TopoDS_Shape &shape, const std::string &filename)
Definition: utilities.cc:232
TopoDS_Edge interpolation_curve(std::vector< Point< 3 > > &curve_points, const Tensor< 1, 3 > &direction=Tensor< 1, 3 >(), const bool closed=false, const double tolerance=1e-7)
Definition: utilities.cc:432
std_cxx11::tuple< unsigned int, unsigned int, unsigned int > count_elements(const TopoDS_Shape &shape)
Definition: utilities.cc:93
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:564
void write_STEP(const TopoDS_Shape &shape, const std::string &filename)
Definition: utilities.cc:275
static ::ExceptionBase & ExcPointNotOnManifold(Point< 3 > arg1)
#define DeclException0(Exception0)
Definition: exceptions.h:541
std_cxx11::tuple< Point< 3 >, Tensor< 1, 3 >, double, double > push_forward_and_differential_forms(const TopoDS_Face &face, const double u, const double v, const double tolerance=1e-7)
Definition: utilities.cc:609
void extract_compound_shapes(const TopoDS_Shape &shape, std::vector< TopoDS_Compound > &compounds, std::vector< TopoDS_CompSolid > &compsolids, std::vector< TopoDS_Solid > &solids, std::vector< TopoDS_Shell > &shells, std::vector< TopoDS_Wire > &wires)
Definition: utilities.cc:134
std_cxx11::tuple< Point< 3 >, TopoDS_Shape, double, double > project_point_and_pull_back(const TopoDS_Shape &in_shape, const Point< 3 > &origin, const double tolerance=1e-7)
Definition: utilities.cc:464
Point< 3 > closest_point(const TopoDS_Shape &in_shape, const Point< 3 > &origin, const double tolerance=1e-7)
Definition: utilities.cc:544
double get_shape_tolerance(const TopoDS_Shape &shape)
Definition: utilities.cc:289
TopoDS_Edge join_edges(const TopoDS_Shape &in_shape, const double tolerance=1e-7)
Definition: utilities.cc:328
Definition: mpi.h:41
void extract_geometrical_shapes(const TopoDS_Shape &shape, std::vector< TopoDS_Face > &faces, std::vector< TopoDS_Edge > &edges, std::vector< TopoDS_Vertex > &vertices)
Definition: utilities.cc:109
static ::ExceptionBase & ExcUnsupportedShape()
Point< 3 > point(const gp_Pnt &p)
Definition: utilities.cc:176
bool point_compare(const Point< 3 > &p1, const Point< 3 > &p2, const Tensor< 1, 3 > &direction=Tensor< 1, 3 >(), const double tolerance=1e-10)
Definition: utilities.cc:181
void create_triangulation(const TopoDS_Face &face, Triangulation< 2, 3 > &tria)
Definition: utilities.cc:640