Reference documentation for deal.II version Git 3ff8e288d2 2020-02-20 17:30:00 +0100
\(\newcommand{\vcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\vcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
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 
398  CylindricalManifold(const Tensor<1, spacedim> &direction,
399  const Point<spacedim> & point_on_axis,
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:
598  const Function<chartdim> & push_forward_function,
599  const Function<spacedim> & pull_back_function,
600  const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(),
601  const double tolerance = 1e-10);
602 
615  std::unique_ptr<Function<chartdim>> push_forward_function,
616  std::unique_ptr<Function<spacedim>> pull_back_function,
617  const Tensor<1, chartdim> & periodicity = Tensor<1, chartdim>(),
618  const double tolerance = 1e-10);
619 
635  const std::string push_forward_expression,
636  const std::string pull_back_expression,
637  const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(),
638  const typename FunctionParser<spacedim>::ConstMap =
640  const std::string chart_vars =
642  const std::string space_vars =
644  const double tolerance = 1e-10,
645  const double h = 1e-8);
646 
650  virtual ~FunctionManifold() override;
651 
655  virtual std::unique_ptr<Manifold<dim, spacedim>>
656  clone() const override;
657 
663  virtual Point<spacedim>
664  push_forward(const Point<chartdim> &chart_point) const override;
665 
687  push_forward_gradient(const Point<chartdim> &chart_point) const override;
688 
694  virtual Point<chartdim>
695  pull_back(const Point<spacedim> &space_point) const override;
696 
697 private:
702 
709 
716 
722  const double tolerance;
723 
732 
736  const std::string push_forward_expression;
737 
741  const std::string pull_back_expression;
742 
746  const std::string chart_vars;
747 
751  const std::string space_vars;
752 
757 };
758 
759 
760 
775 template <int dim>
776 class TorusManifold : public ChartManifold<dim, 3, 3>
777 {
778 public:
779  static const int chartdim = 3;
780  static const int spacedim = 3;
781 
787  TorusManifold(const double R, const double r);
788 
792  virtual std::unique_ptr<Manifold<dim, 3>>
793  clone() const override;
794 
798  virtual Point<3>
799  pull_back(const Point<3> &p) const override;
800 
804  virtual Point<3>
805  push_forward(const Point<3> &chart_point) const override;
806 
811  push_forward_gradient(const Point<3> &chart_point) const override;
812 
813 private:
814  double r, R;
815 };
816 
817 
818 
958 template <int dim, int spacedim = dim>
959 class TransfiniteInterpolationManifold : public Manifold<dim, spacedim>
960 {
961 public:
966 
970  virtual ~TransfiniteInterpolationManifold() override;
971 
975  virtual std::unique_ptr<Manifold<dim, spacedim>>
976  clone() const override;
977 
990  void
991  initialize(const Triangulation<dim, spacedim> &triangulation);
992 
1008  virtual Point<spacedim>
1009  get_new_point(const ArrayView<const Point<spacedim>> &surrounding_points,
1010  const ArrayView<const double> & weights) const override;
1011 
1031  virtual void
1032  get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
1033  const Table<2, double> & weights,
1034  ArrayView<Point<spacedim>> new_points) const override;
1035 
1036 private:
1048  std::array<unsigned int, 20>
1049  get_possible_cells_around_points(
1050  const ArrayView<const Point<spacedim>> &surrounding_points) const;
1051 
1060  compute_chart_points(
1061  const ArrayView<const Point<spacedim>> &surrounding_points,
1062  ArrayView<Point<dim>> chart_points) const;
1063 
1080  Point<dim>
1082  const Point<spacedim> & p,
1083  const Point<dim> &initial_guess) const;
1084 
1098  const Point<dim> &chart_point) const;
1099 
1113  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
1114  const Point<dim> & chart_point,
1115  const Point<spacedim> &pushed_forward_chart_point) const;
1116 
1121 
1127 
1133  std::vector<bool> coarse_cell_is_flat;
1134 
1140 
1145  boost::signals2::connection clear_signal;
1146 };
1147 
1148 DEAL_II_NAMESPACE_CLOSE
1149 
1150 #endif
FlatManifold< dim > chart_manifold
const double tolerance
Definition: manifold_lib.h:722
static Tensor< 1, spacedim > get_periodicity()
const Triangulation< dim, spacedim > * triangulation
const Point< spacedim > point_on_axis
Definition: manifold_lib.h:457
std::vector< bool > coarse_cell_is_flat
const double finite_difference_step
Definition: manifold_lib.h:756
const std::string pull_back_expression
Definition: manifold_lib.h:741
const Point< spacedim > center
Definition: manifold_lib.h:116
SmartPointer< const Function< spacedim >, FunctionManifold< dim, spacedim, chartdim > > pull_back_function
Definition: manifold_lib.h:715
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
const std::string chart_vars
Definition: manifold_lib.h:746
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:708
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
Definition: manifold.cc:1010
virtual Tensor< 1, spacedim > get_tangent_vector(const Point< spacedim > &x1, const Point< spacedim > &x2) const override
Definition: manifold.cc:1052
virtual Point< spacedim > pull_back(const Point< spacedim > &space_point) const override
const std::string space_vars
Definition: manifold_lib.h:751
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &surrounding_points, const ArrayView< const double > &weights) const override
Definition: manifold.cc:989
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:736
std::array< Tensor< 1, spacedim >, GeometryInfo< dim >::vertices_per_face > FaceVertexNormals
Definition: manifold.h:355
const Tensor< 1, spacedim > normal_direction
Definition: manifold_lib.h:447
const FunctionParser< spacedim >::ConstMap const_map
Definition: manifold_lib.h:701
virtual Tensor< 1, spacedim > normal_vector(const typename Triangulation< dim, spacedim >::face_iterator &face, const Point< spacedim > &p) const
Definition: manifold.cc:237
boost::signals2::connection clear_signal
const Point< spacedim > center
Definition: manifold_lib.h:549
virtual void get_normals_at_vertices(const typename Triangulation< dim, spacedim >::face_iterator &face, FaceVertexNormals &face_vertex_normals) const
Definition: manifold.cc:301
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 Point< spacedim > get_intermediate_point(const Point< spacedim > &p1, const Point< spacedim > &p2, const double w) const override
Definition: manifold.cc:974