Reference documentation for deal.II version 9.0.0
boundary_lib.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2014 - 2018 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_boundary_lib_h
18 #define dealii_occ_boundary_lib_h
19 
20 #include <deal.II/base/config.h>
21 
22 #ifdef DEAL_II_WITH_OPENCASCADE
23 
24 #include <deal.II/opencascade/utilities.h>
25 #include <deal.II/grid/manifold.h>
26 
27 // opencascade needs "HAVE_CONFIG_H" to be exported...
28 #define HAVE_CONFIG_H
29 #include <Adaptor3d_Curve.hxx>
30 #include <Adaptor3d_HCurve.hxx>
31 #include <BRepAdaptor_Curve.hxx>
32 #undef HAVE_CONFIG_H
33 
34 DEAL_II_NAMESPACE_OPEN
35 
41 namespace OpenCASCADE
42 {
64  template <int dim, int spacedim>
65  class NormalProjectionBoundary : public FlatManifold<dim,spacedim>
66  {
67  public:
68 
76  NormalProjectionBoundary(const TopoDS_Shape &sh,
77  const double tolerance=1e-7);
78 
82  virtual std::unique_ptr<Manifold<dim,spacedim> > clone() const override;
83 
93  virtual Point<spacedim>
94  project_to_manifold (const ArrayView<const Point<spacedim>> &surrounding_points,
95  const Point<spacedim> &candidate) const override;
96 
97 
98  private:
105  const TopoDS_Shape sh;
106 
110  const double tolerance;
111  };
112 
134  template <int dim, int spacedim>
135  class DirectionalProjectionBoundary : public FlatManifold<dim,spacedim>
136  {
137  public:
142  DirectionalProjectionBoundary(const TopoDS_Shape &sh,
144  const double tolerance=1e-7);
145 
149  virtual std::unique_ptr<Manifold<dim,spacedim> > clone() const override;
150 
160  virtual Point<spacedim>
161  project_to_manifold (const ArrayView<const Point<spacedim>> &surrounding_points,
162  const Point<spacedim> &candidate) const override;
163 
164  private:
171  const TopoDS_Shape sh;
172 
177 
181  const double tolerance;
182  };
183 
184 
229  template <int dim, int spacedim>
230  class NormalToMeshProjectionBoundary : public FlatManifold<dim,spacedim>
231  {
232  public:
238  NormalToMeshProjectionBoundary(const TopoDS_Shape &sh,
239  const double tolerance=1e-7);
240 
244  virtual std::unique_ptr<Manifold<dim,spacedim> > clone() const override;
245 
252  virtual Point<spacedim>
253  project_to_manifold (const ArrayView<const Point<spacedim>> &surrounding_points,
254  const Point<spacedim> &candidate) const override;
255 
256  private:
263  const TopoDS_Shape sh;
264 
268  const double tolerance;
269  };
270 
290  template <int dim, int spacedim>
291  class ArclengthProjectionLineManifold : public ChartManifold<dim,spacedim,1>
292  {
293  public:
297  ArclengthProjectionLineManifold(const TopoDS_Shape &sh,
298  const double tolerance=1e-7);
299 
303  virtual std::unique_ptr<Manifold<dim,spacedim> > clone() const override;
304 
310  virtual Point<1>
311  pull_back(const Point<spacedim> &space_point) const override;
312 
316  virtual Point<spacedim>
317  push_forward(const Point<1> &chart_point) const override;
318 
319  private:
323  const TopoDS_Shape sh;
324 
329  Handle_Adaptor3d_HCurve curve;
330 
334  const double tolerance;
335 
340  const double length;
341  };
342 
350  template <int dim, int spacedim>
351  class NURBSPatchManifold : public ChartManifold<dim, spacedim, 2>
352  {
353  public:
359  NURBSPatchManifold(const TopoDS_Face &face, const double tolerance = 1e-7);
360 
364  virtual std::unique_ptr<Manifold<dim,spacedim> > clone() const override;
365 
370  virtual Point<2>
371  pull_back(const Point<spacedim> &space_point) const override;
372 
377  virtual Point<spacedim>
378  push_forward(const Point<2> &chart_point) const override;
379 
392  virtual
394  push_forward_gradient(const Point<2> &chart_point) const override;
395 
396  private:
401  std::tuple<double, double, double, double>
402  get_uv_bounds() const;
403 
407  TopoDS_Face face;
408 
413  double tolerance;
414  };
415 
416 }
417 
420 DEAL_II_NAMESPACE_CLOSE
421 
422 
423 #endif // DEAL_II_WITH_OPENCASCADE
424 
425 /*------------------------------ occ_boundary_lib.h ------------------------------*/
426 #endif
427 /*------------------------------ occ_boundary_lib.h ------------------------------*/
virtual Point< 2 > pull_back(const Point< spacedim > &space_point) const override
virtual Point< spacedim > project_to_manifold(const ArrayView< const Point< spacedim >> &surrounding_points, const Point< spacedim > &candidate) const override
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
virtual Point< spacedim > project_to_manifold(const ArrayView< const Point< spacedim >> &surrounding_points, const Point< spacedim > &candidate) const override
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
Definition: boundary_lib.cc:92
virtual Point< spacedim > push_forward(const Point< 1 > &chart_point) const override
const Tensor< 1, spacedim > direction
Definition: boundary_lib.h:176
virtual Point< spacedim > push_forward(const Point< 2 > &chart_point) const override
NormalToMeshProjectionBoundary(const TopoDS_Shape &sh, const double tolerance=1e-7)
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
virtual Point< spacedim > project_to_manifold(const ArrayView< const Point< spacedim >> &surrounding_points, const Point< spacedim > &candidate) const override
ArclengthProjectionLineManifold(const TopoDS_Shape &sh, const double tolerance=1e-7)
virtual Point< 1 > pull_back(const Point< spacedim > &space_point) const override
std::tuple< double, double, double, double > get_uv_bounds() const
virtual DerivativeForm< 1, 2, spacedim > push_forward_gradient(const Point< 2 > &chart_point) const override
NormalProjectionBoundary(const TopoDS_Shape &sh, const double tolerance=1e-7)
Definition: boundary_lib.cc:80
DirectionalProjectionBoundary(const TopoDS_Shape &sh, const Tensor< 1, spacedim > &direction, const double tolerance=1e-7)