Reference documentation for deal.II version Git 840703ecf3 2019-10-14 17:15:20 -0400
\(\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 
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 
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 
941 template <int dim, int spacedim = dim>
942 class TransfiniteInterpolationManifold : public Manifold<dim, spacedim>
943 {
944 public:
949 
953  virtual ~TransfiniteInterpolationManifold() override;
954 
958  virtual std::unique_ptr<Manifold<dim, spacedim>>
959  clone() const override;
960 
973  void
974  initialize(const Triangulation<dim, spacedim> &triangulation);
975 
991  virtual Point<spacedim>
992  get_new_point(const ArrayView<const Point<spacedim>> &surrounding_points,
993  const ArrayView<const double> & weights) const override;
994 
1014  virtual void
1015  get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
1016  const Table<2, double> & weights,
1017  ArrayView<Point<spacedim>> new_points) const override;
1018 
1019 private:
1031  std::array<unsigned int, 20>
1032  get_possible_cells_around_points(
1033  const ArrayView<const Point<spacedim>> &surrounding_points) const;
1034 
1043  compute_chart_points(
1044  const ArrayView<const Point<spacedim>> &surrounding_points,
1045  ArrayView<Point<dim>> chart_points) const;
1046 
1063  Point<dim>
1065  const Point<spacedim> & p,
1066  const Point<dim> &initial_guess) const;
1067 
1081  const Point<dim> &chart_point) const;
1082 
1096  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
1097  const Point<dim> & chart_point,
1098  const Point<spacedim> &pushed_forward_chart_point) const;
1099 
1104 
1110 
1116  std::vector<bool> coarse_cell_is_flat;
1117 
1123 
1128  boost::signals2::connection clear_signal;
1129 };
1130 
1131 DEAL_II_NAMESPACE_CLOSE
1132 
1133 #endif
FlatManifold< dim > chart_manifold
const double tolerance
Definition: manifold_lib.h:705
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:739
const std::string pull_back_expression
Definition: manifold_lib.h:724
const Point< spacedim > center
Definition: manifold_lib.h:116
SmartPointer< const Function< spacedim >, FunctionManifold< dim, spacedim, chartdim > > pull_back_function
Definition: manifold_lib.h:698
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:729
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
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:734
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:719
std::array< Tensor< 1, spacedim >, GeometryInfo< dim >::vertices_per_face > FaceVertexNormals
Definition: manifold.h:351
const Tensor< 1, spacedim > normal_direction
Definition: manifold_lib.h:447
const FunctionParser< spacedim >::ConstMap const_map
Definition: manifold_lib.h:684
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
const bool owns_pointers
Definition: manifold_lib.h:714
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