Reference documentation for deal.II version Git 5a2787e538 2021-09-21 14:55:10 -0600
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
manifold_lib.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2020 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.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_manifold_lib_h
17 #define dealii_manifold_lib_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/base/function.h>
24 
25 #include <deal.II/grid/manifold.h>
26 
28 
29 // forward declaration
30 namespace internal
31 {
32  namespace MappingQImplementation
33  {
34  template <int, int>
35  class InverseQuadraticApproximation;
36  }
37 } // namespace internal
38 
39 
69 template <int dim, int spacedim = dim>
70 class PolarManifold : public ChartManifold<dim, spacedim, spacedim>
71 {
72 public:
82 
86  virtual std::unique_ptr<Manifold<dim, spacedim>>
87  clone() const override;
88 
94  virtual Point<spacedim>
95  pull_back(const Point<spacedim> &space_point) const override;
96 
102  virtual Point<spacedim>
103  push_forward(const Point<spacedim> &chart_point) const override;
104 
118  push_forward_gradient(const Point<spacedim> &chart_point) const override;
119 
123  virtual Tensor<1, spacedim>
124  normal_vector(
125  const typename Triangulation<dim, spacedim>::face_iterator &face,
126  const Point<spacedim> &p) const override;
127 
132 
133 private:
138  static Tensor<1, spacedim>
139  get_periodicity();
140 };
141 
142 
143 
235 template <int dim, int spacedim = dim>
236 class SphericalManifold : public Manifold<dim, spacedim>
237 {
238 public:
243 
247  virtual std::unique_ptr<Manifold<dim, spacedim>>
248  clone() const override;
249 
257  virtual Point<spacedim>
258  get_intermediate_point(const Point<spacedim> &p1,
259  const Point<spacedim> &p2,
260  const double w) const override;
261 
266  virtual Tensor<1, spacedim>
267  get_tangent_vector(const Point<spacedim> &x1,
268  const Point<spacedim> &x2) const override;
269 
273  virtual Tensor<1, spacedim>
274  normal_vector(
275  const typename Triangulation<dim, spacedim>::face_iterator &face,
276  const Point<spacedim> &p) const override;
277 
281  virtual void
282  get_normals_at_vertices(
283  const typename Triangulation<dim, spacedim>::face_iterator &face,
284  typename Manifold<dim, spacedim>::FaceVertexNormals &face_vertex_normals)
285  const override;
286 
301  virtual void
302  get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
303  const Table<2, double> & weights,
304  ArrayView<Point<spacedim>> new_points) const override;
305 
310  virtual Point<spacedim>
311  get_new_point(const ArrayView<const Point<spacedim>> &vertices,
312  const ArrayView<const double> & weights) const override;
313 
318 
319 private:
326  std::pair<double, Tensor<1, spacedim>>
327  guess_new_point(const ArrayView<const Tensor<1, spacedim>> &directions,
328  const ArrayView<const double> & distances,
329  const ArrayView<const double> & weights) const;
330 
347  get_new_point(const ArrayView<const Tensor<1, spacedim>> &directions,
348  const ArrayView<const double> & distances,
349  const ArrayView<const double> & weights,
350  const Point<spacedim> &candidate_point) const;
351 
365  virtual void
366  get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
367  const ArrayView<const double> & weights,
368  ArrayView<Point<spacedim>> new_points) const;
369 
374 };
375 
389 template <int dim, int spacedim = dim>
390 class CylindricalManifold : public ChartManifold<dim, spacedim, 3>
391 {
392 public:
399  CylindricalManifold(const unsigned int axis = 0,
400  const double tolerance = 1e-10);
401 
409  CylindricalManifold(const Tensor<1, spacedim> &direction,
410  const Point<spacedim> & point_on_axis,
411  const double tolerance = 1e-10);
412 
416  virtual std::unique_ptr<Manifold<dim, spacedim>>
417  clone() const override;
418 
425  virtual Point<3>
426  pull_back(const Point<spacedim> &space_point) const override;
427 
434  virtual Point<spacedim>
435  push_forward(const Point<3> &chart_point) const override;
436 
444  push_forward_gradient(const Point<3> &chart_point) const override;
445 
450  virtual Point<spacedim>
451  get_new_point(const ArrayView<const Point<spacedim>> &surrounding_points,
452  const ArrayView<const double> & weights) const override;
453 
454 protected:
459 
464 
469 
470 private:
474  double tolerance;
475 };
476 
508 template <int dim, int spacedim = dim>
509 class EllipticalManifold : public ChartManifold<dim, spacedim, spacedim>
510 {
511 public:
524  const Tensor<1, spacedim> &major_axis_direction,
525  const double eccentricity);
526 
527  virtual std::unique_ptr<Manifold<dim, spacedim>>
528  clone() const override;
529 
533  virtual Point<spacedim>
534  pull_back(const Point<spacedim> &space_point) const override;
535 
539  virtual Point<spacedim>
540  push_forward(const Point<spacedim> &chart_point) const override;
541 
546  push_forward_gradient(const Point<spacedim> &chart_point) const override;
547 
548 
549 protected:
561  const double cosh_u;
562  const double sinh_u;
563 
564 private:
571  static Tensor<1, spacedim>
572  get_periodicity();
573 };
574 
575 
590 template <int dim, int spacedim = dim, int chartdim = dim>
591 class FunctionManifold : public ChartManifold<dim, spacedim, chartdim>
592 {
593 public:
608  const Function<chartdim> & push_forward_function,
609  const Function<spacedim> & pull_back_function,
610  const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(),
611  const double tolerance = 1e-10);
612 
625  std::unique_ptr<Function<chartdim>> push_forward,
626  std::unique_ptr<Function<spacedim>> pull_back,
627  const Tensor<1, chartdim> & periodicity = Tensor<1, chartdim>(),
628  const double tolerance = 1e-10);
629 
645  const std::string push_forward_expression,
646  const std::string pull_back_expression,
647  const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(),
648  const typename FunctionParser<spacedim>::ConstMap =
650  const std::string chart_vars =
652  const std::string space_vars =
654  const double tolerance = 1e-10,
655  const double h = 1e-8);
656 
660  virtual ~FunctionManifold() override;
661 
665  virtual std::unique_ptr<Manifold<dim, spacedim>>
666  clone() const override;
667 
673  virtual Point<spacedim>
674  push_forward(const Point<chartdim> &chart_point) const override;
675 
697  push_forward_gradient(const Point<chartdim> &chart_point) const override;
698 
704  virtual Point<chartdim>
705  pull_back(const Point<spacedim> &space_point) const override;
706 
707 private:
712 
719 
726 
732  const double tolerance;
733 
742 
746  const std::string push_forward_expression;
747 
751  const std::string pull_back_expression;
752 
756  const std::string chart_vars;
757 
761  const std::string space_vars;
762 
767 };
768 
769 
770 
783 template <int dim>
784 class TorusManifold : public ChartManifold<dim, 3, 3>
785 {
786 public:
787  static const int chartdim = 3;
788  static const int spacedim = 3;
789 
795  TorusManifold(const double R, const double r);
796 
800  virtual std::unique_ptr<Manifold<dim, 3>>
801  clone() const override;
802 
806  virtual Point<3>
807  pull_back(const Point<3> &p) const override;
808 
812  virtual Point<3>
813  push_forward(const Point<3> &chart_point) const override;
814 
819  push_forward_gradient(const Point<3> &chart_point) const override;
820 
821 private:
822  double r, R;
823 };
824 
825 
826 
964 template <int dim, int spacedim = dim>
965 class TransfiniteInterpolationManifold : public Manifold<dim, spacedim>
966 {
967 public:
972 
976  virtual ~TransfiniteInterpolationManifold() override;
977 
981  virtual std::unique_ptr<Manifold<dim, spacedim>>
982  clone() const override;
983 
996  void
997  initialize(const Triangulation<dim, spacedim> &triangulation);
998 
1014  virtual Point<spacedim>
1015  get_new_point(const ArrayView<const Point<spacedim>> &surrounding_points,
1016  const ArrayView<const double> & weights) const override;
1017 
1037  virtual void
1038  get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
1039  const Table<2, double> & weights,
1040  ArrayView<Point<spacedim>> new_points) const override;
1041 
1042 private:
1054  std::array<unsigned int, 20>
1055  get_possible_cells_around_points(
1056  const ArrayView<const Point<spacedim>> &surrounding_points) const;
1057 
1066  compute_chart_points(
1067  const ArrayView<const Point<spacedim>> &surrounding_points,
1068  ArrayView<Point<dim>> chart_points) const;
1069 
1086  Point<dim>
1088  const Point<spacedim> & p,
1089  const Point<dim> &initial_guess) const;
1090 
1104  const Point<dim> &chart_point) const;
1105 
1118  push_forward_gradient(
1119  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
1120  const Point<dim> & chart_point,
1121  const Point<spacedim> &pushed_forward_chart_point) const;
1122 
1127 
1133 
1139  std::vector<bool> coarse_cell_is_flat;
1140 
1146 
1151  std::vector<internal::MappingQImplementation::
1152  InverseQuadraticApproximation<dim, spacedim>>
1154 
1159  boost::signals2::connection clear_signal;
1160 };
1161 
1163 
1164 #endif
FlatManifold< dim > chart_manifold
const double tolerance
Definition: manifold_lib.h:732
Point< dim > push_forward(const TopoDS_Shape &in_shape, const double u, const double v)
Definition: utilities.cc:824
const double sinh_u
Definition: manifold_lib.h:562
const Triangulation< dim, spacedim > * triangulation
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
const Point< spacedim > point_on_axis
Definition: manifold_lib.h:468
std::vector< bool > coarse_cell_is_flat
const double finite_difference_step
Definition: manifold_lib.h:766
const std::string pull_back_expression
Definition: manifold_lib.h:751
const Point< spacedim > center
Definition: manifold_lib.h:131
std::vector< internal::MappingQImplementation::InverseQuadraticApproximation< dim, spacedim > > quadratic_approximation
SmartPointer< const Function< spacedim >, FunctionManifold< dim, spacedim, chartdim > > pull_back_function
Definition: manifold_lib.h:725
Tensor< 1, spacedim > direction
Definition: manifold_lib.h:553
const PolarManifold< spacedim > polar_manifold
Definition: manifold_lib.h:373
const std::string chart_vars
Definition: manifold_lib.h:756
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:401
SmartPointer< const Function< chartdim >, FunctionManifold< dim, spacedim, chartdim > > push_forward_function
Definition: manifold_lib.h:718
Point< 3 > vertices[4]
const Point< spacedim > center
Definition: manifold_lib.h:317
Tensor< 2, dim, Number > w(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
Tensor< 1, dim, Number > pull_back(const Tensor< 1, dim, Number > &v, const Tensor< 2, dim, Number > &F)
const std::string space_vars
Definition: manifold_lib.h:761
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:400
const double cosh_u
Definition: manifold_lib.h:561
const Tensor< 1, spacedim > direction
Definition: manifold_lib.h:463
const std::string push_forward_expression
Definition: manifold_lib.h:746
std::array< Tensor< 1, spacedim >, GeometryInfo< dim >::vertices_per_face > FaceVertexNormals
Definition: manifold.h:307
Point< 3 > center
const Tensor< 1, spacedim > normal_direction
Definition: manifold_lib.h:458
const FunctionParser< spacedim >::ConstMap const_map
Definition: manifold_lib.h:711
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
boost::signals2::connection clear_signal
const Point< spacedim > center
Definition: manifold_lib.h:557