Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
manifold_lib.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2019 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>
23 #include <deal.II/base/function_parser.h>
24 
25 #include <deal.II/grid/manifold.h>
26 
27 #include <boost/container/small_vector.hpp>
28 
29 DEAL_II_NAMESPACE_OPEN
30 
62 template <int dim, int spacedim = dim>
63 class PolarManifold : public ChartManifold<dim, spacedim, spacedim>
64 {
65 public:
75 
79  virtual std::unique_ptr<Manifold<dim, spacedim>>
80  clone() const override;
81 
87  virtual Point<spacedim>
88  pull_back(const Point<spacedim> &space_point) const override;
89 
95  virtual Point<spacedim>
96  push_forward(const Point<spacedim> &chart_point) const override;
97 
111  push_forward_gradient(const Point<spacedim> &chart_point) const override;
112 
117 
118 private:
123  static Tensor<1, spacedim>
124  get_periodicity();
125 };
126 
127 
128 
222 template <int dim, int spacedim = dim>
223 class SphericalManifold : public Manifold<dim, spacedim>
224 {
225 public:
230 
234  virtual std::unique_ptr<Manifold<dim, spacedim>>
235  clone() const override;
236 
244  virtual Point<spacedim>
246  const Point<spacedim> &p2,
247  const double w) const override;
248 
253  virtual Tensor<1, spacedim>
255  const Point<spacedim> &x2) const override;
256 
260  virtual Tensor<1, spacedim>
262  const typename Triangulation<dim, spacedim>::face_iterator &face,
263  const Point<spacedim> &p) const override;
264 
268  virtual void
270  const typename Triangulation<dim, spacedim>::face_iterator &face,
271  typename Manifold<dim, spacedim>::FaceVertexNormals &face_vertex_normals)
272  const override;
273 
288  virtual void
289  get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
290  const Table<2, double> & weights,
291  ArrayView<Point<spacedim>> new_points) const override;
292 
297  virtual Point<spacedim>
298  get_new_point(const ArrayView<const Point<spacedim>> &vertices,
299  const ArrayView<const double> & weights) const override;
300 
305 
306 private:
313  std::pair<double, Tensor<1, spacedim>>
314  guess_new_point(const ArrayView<const Tensor<1, spacedim>> &directions,
315  const ArrayView<const double> & distances,
316  const ArrayView<const double> & weights) const;
317 
334  get_new_point(const ArrayView<const Tensor<1, spacedim>> &directions,
335  const ArrayView<const double> & distances,
336  const ArrayView<const double> & weights,
337  const Point<spacedim> &candidate_point) const;
338 
352  virtual void
353  get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
354  const ArrayView<const double> & weights,
355  ArrayView<Point<spacedim>> new_points) const;
356 
361 };
362 
378 template <int dim, int spacedim = dim>
379 class CylindricalManifold : public ChartManifold<dim, spacedim, 3>
380 {
381 public:
388  CylindricalManifold(const unsigned int axis = 0,
389  const double tolerance = 1e-10);
390 
400  const double tolerance = 1e-10);
401 
405  virtual std::unique_ptr<Manifold<dim, spacedim>>
406  clone() const override;
407 
414  virtual Point<3>
415  pull_back(const Point<spacedim> &space_point) const override;
416 
423  virtual Point<spacedim>
424  push_forward(const Point<3> &chart_point) const override;
425 
433  push_forward_gradient(const Point<3> &chart_point) const override;
434 
439  virtual Point<spacedim>
440  get_new_point(const ArrayView<const Point<spacedim>> &surrounding_points,
441  const ArrayView<const double> & weights) const override;
442 
443 protected:
448 
453 
458 
459 private:
463  double tolerance;
464 };
465 
499 template <int dim, int spacedim = dim>
500 class EllipticalManifold : public ChartManifold<dim, spacedim, spacedim>
501 {
502 public:
516  const Tensor<1, spacedim> &major_axis_direction,
517  const double eccentricity);
518 
519  virtual std::unique_ptr<Manifold<dim, spacedim>>
520  clone() const override;
521 
525  virtual Point<spacedim>
526  pull_back(const Point<spacedim> &space_point) const override;
527 
531  virtual Point<spacedim>
532  push_forward(const Point<spacedim> &chart_point) const override;
533 
538  push_forward_gradient(const Point<spacedim> &chart_point) const override;
539 
540 
541 protected:
553  const double cosh_u;
554  const double sinh_u;
555 
556 private:
563  static Tensor<1, spacedim>
564  get_periodicity();
565 };
566 
567 
584 template <int dim, int spacedim = dim, int chartdim = dim>
585 class FunctionManifold : public ChartManifold<dim, spacedim, chartdim>
586 {
587 public:
600  const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(),
601  const double tolerance = 1e-10);
602 
618  const std::string push_forward_expression,
619  const std::string pull_back_expression,
620  const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(),
621  const typename FunctionParser<spacedim>::ConstMap =
623  const std::string chart_vars =
625  const std::string space_vars =
627  const double tolerance = 1e-10,
628  const double h = 1e-8);
629 
633  virtual ~FunctionManifold() override;
634 
638  virtual std::unique_ptr<Manifold<dim, spacedim>>
639  clone() const override;
640 
646  virtual Point<spacedim>
647  push_forward(const Point<chartdim> &chart_point) const override;
648 
670  push_forward_gradient(const Point<chartdim> &chart_point) const override;
671 
677  virtual Point<chartdim>
678  pull_back(const Point<spacedim> &space_point) const override;
679 
680 private:
685 
692 
699 
705  const double tolerance;
706 
714  const bool owns_pointers;
715 
719  const std::string push_forward_expression;
720 
724  const std::string pull_back_expression;
725 
729  const std::string chart_vars;
730 
734  const std::string space_vars;
735 
740 };
741 
742 
743 
758 template <int dim>
759 class TorusManifold : public ChartManifold<dim, 3, 3>
760 {
761 public:
762  static const int chartdim = 3;
763  static const int spacedim = 3;
764 
770  TorusManifold(const double R, const double r);
771 
775  virtual std::unique_ptr<Manifold<dim, 3>>
776  clone() const override;
777 
781  virtual Point<3>
782  pull_back(const Point<3> &p) const override;
783 
787  virtual Point<3>
788  push_forward(const Point<3> &chart_point) const override;
789 
794  push_forward_gradient(const Point<3> &chart_point) const override;
795 
796 private:
797  double r, R;
798 };
799 
800 
801 
940 template <int dim, int spacedim = dim>
941 class TransfiniteInterpolationManifold : public Manifold<dim, spacedim>
942 {
943 public:
948 
952  virtual ~TransfiniteInterpolationManifold() override;
953 
957  virtual std::unique_ptr<Manifold<dim, spacedim>>
958  clone() const override;
959 
972  void
974 
990  virtual Point<spacedim>
991  get_new_point(const ArrayView<const Point<spacedim>> &surrounding_points,
992  const ArrayView<const double> & weights) const override;
993 
1013  virtual void
1014  get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
1015  const Table<2, double> & weights,
1016  ArrayView<Point<spacedim>> new_points) const override;
1017 
1018 private:
1030  std::array<unsigned int, 20>
1032  const ArrayView<const Point<spacedim>> &surrounding_points) const;
1033 
1043  const ArrayView<const Point<spacedim>> &surrounding_points,
1044  ArrayView<Point<dim>> chart_points) const;
1045 
1062  Point<dim>
1064  const Point<spacedim> & p,
1065  const Point<dim> &initial_guess) const;
1066 
1080  const Point<dim> &chart_point) const;
1081 
1095  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
1096  const Point<dim> & chart_point,
1097  const Point<spacedim> &pushed_forward_chart_point) const;
1098 
1103 
1109 
1115  std::vector<bool> coarse_cell_is_flat;
1116 
1122 
1127  boost::signals2::connection clear_signal;
1128 };
1129 
1130 DEAL_II_NAMESPACE_CLOSE
1131 
1132 #endif
DerivativeForm< 1, dim, spacedim > push_forward_gradient(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &chart_point, const Point< spacedim > &pushed_forward_chart_point) const
FlatManifold< dim > chart_manifold
Triangulation< dim, spacedim >::cell_iterator compute_chart_points(const ArrayView< const Point< spacedim >> &surrounding_points, ArrayView< Point< dim >> chart_points) const
const double tolerance
Definition: manifold_lib.h:705
virtual Point< spacedim > push_forward(const Point< 3 > &chart_point) const override
FunctionManifold(const Function< chartdim > &push_forward_function, const Function< spacedim > &pull_back_function, const Tensor< 1, chartdim > &periodicity=Tensor< 1, chartdim >(), const double tolerance=1e-10)
EllipticalManifold(const Point< spacedim > &center, const Tensor< 1, spacedim > &major_axis_direction, const double eccentricity)
static Tensor< 1, spacedim > get_periodicity()
const Triangulation< dim, spacedim > * triangulation
std::array< unsigned int, 20 > get_possible_cells_around_points(const ArrayView< const Point< spacedim >> &surrounding_points) const
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &surrounding_points, const ArrayView< const double > &weights) const override
const Point< spacedim > point_on_axis
Definition: manifold_lib.h:457
std::vector< bool > coarse_cell_is_flat
virtual std::unique_ptr< Manifold< dim, 3 > > clone() const override
virtual void get_new_points(const ArrayView< const Point< spacedim >> &surrounding_points, const Table< 2, double > &weights, ArrayView< Point< spacedim >> new_points) const override
static Tensor< 1, spacedim > get_periodicity()
const double finite_difference_step
Definition: manifold_lib.h:739
const std::string pull_back_expression
Definition: manifold_lib.h:724
virtual DerivativeForm< 1, 3, 3 > push_forward_gradient(const Point< 3 > &chart_point) const override
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &vertices, const ArrayView< const double > &weights) const override
virtual Point< 3 > pull_back(const Point< 3 > &p) const override
TorusManifold(const double R, const double r)
void initialize(const Triangulation< dim, spacedim > &triangulation)
virtual Point< spacedim > push_forward(const Point< spacedim > &chart_point) const override
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
const Point< spacedim > center
Definition: manifold_lib.h:116
virtual Point< 3 > push_forward(const Point< 3 > &chart_point) const override
virtual DerivativeForm< 1, 3, spacedim > push_forward_gradient(const Point< 3 > &chart_point) const override
CylindricalManifold(const unsigned int axis=0, const double tolerance=1e-10)
virtual Point< spacedim > pull_back(const Point< spacedim > &space_point) const override
SmartPointer< const Function< spacedim >, FunctionManifold< dim, spacedim, chartdim > > pull_back_function
Definition: manifold_lib.h:698
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
Tensor< 1, spacedim > direction
Definition: manifold_lib.h:545
PolarManifold(const Point< spacedim > center=Point< spacedim >())
const PolarManifold< spacedim > polar_manifold
Definition: manifold_lib.h:360
virtual ~FunctionManifold() override
const std::string chart_vars
Definition: manifold_lib.h:729
virtual Point< chartdim > pull_back(const Point< spacedim > &space_point) const override
virtual Point< 3 > pull_back(const Point< spacedim > &space_point) const override
virtual Tensor< 1, spacedim > get_tangent_vector(const Point< spacedim > &x1, const Point< spacedim > &x2) const override
Point< spacedim > push_forward(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &chart_point) const
virtual Point< spacedim > push_forward(const Point< spacedim > &chart_point) const override
SmartPointer< const Function< chartdim >, FunctionManifold< dim, spacedim, chartdim > > push_forward_function
Definition: manifold_lib.h:691
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &surrounding_points, const ArrayView< const double > &weights) const override
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
virtual void get_normals_at_vertices(const typename Triangulation< dim, spacedim >::face_iterator &face, typename Manifold< dim, spacedim >::FaceVertexNormals &face_vertex_normals) const override
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
const Point< spacedim > center
Definition: manifold_lib.h:304
virtual void get_new_points(const ArrayView< const Point< spacedim >> &surrounding_points, const Table< 2, double > &weights, ArrayView< Point< spacedim >> new_points) const override
virtual ~TransfiniteInterpolationManifold() override
virtual Point< spacedim > push_forward(const Point< chartdim > &chart_point) const override
virtual Point< spacedim > pull_back(const Point< spacedim > &space_point) const override
virtual DerivativeForm< 1, chartdim, spacedim > push_forward_gradient(const Point< chartdim > &chart_point) const override
const std::string space_vars
Definition: manifold_lib.h:734
Point< dim > pull_back(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p, const Point< dim > &initial_guess) const
virtual DerivativeForm< 1, spacedim, spacedim > push_forward_gradient(const Point< spacedim > &chart_point) const override
const double cosh_u
Definition: manifold_lib.h:553
const Tensor< 1, spacedim > direction
Definition: manifold_lib.h:452
const std::string push_forward_expression
Definition: manifold_lib.h:719
std::array< Tensor< 1, spacedim >, GeometryInfo< dim >::vertices_per_face > FaceVertexNormals
Definition: manifold.h:350
std::pair< double, Tensor< 1, spacedim > > guess_new_point(const ArrayView< const Tensor< 1, spacedim >> &directions, const ArrayView< const double > &distances, const ArrayView< const double > &weights) const
const Tensor< 1, spacedim > normal_direction
Definition: manifold_lib.h:447
const FunctionParser< spacedim >::ConstMap const_map
Definition: manifold_lib.h:684
boost::signals2::connection clear_signal
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
const Point< spacedim > center
Definition: manifold_lib.h:549
const bool owns_pointers
Definition: manifold_lib.h:714
SphericalManifold(const Point< spacedim > center=Point< spacedim >())
virtual Point< spacedim > get_intermediate_point(const Point< spacedim > &p1, const Point< spacedim > &p2, const double w) const override
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
virtual DerivativeForm< 1, spacedim, spacedim > push_forward_gradient(const Point< spacedim > &chart_point) const override
virtual Tensor< 1, spacedim > normal_vector(const typename Triangulation< dim, spacedim >::face_iterator &face, const Point< spacedim > &p) const override