Reference documentation for deal.II version 9.2.0
\(\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 
27 #include <boost/container/small_vector.hpp>
28 
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 
116  virtual Tensor<1, spacedim>
118  const typename Triangulation<dim, spacedim>::face_iterator &face,
119  const Point<spacedim> &p) const override;
120 
125 
126 private:
131  static Tensor<1, spacedim>
132  get_periodicity();
133 };
134 
135 
136 
230 template <int dim, int spacedim = dim>
231 class SphericalManifold : public Manifold<dim, spacedim>
232 {
233 public:
238 
242  virtual std::unique_ptr<Manifold<dim, spacedim>>
243  clone() const override;
244 
252  virtual Point<spacedim>
254  const Point<spacedim> &p2,
255  const double w) const override;
256 
261  virtual Tensor<1, spacedim>
263  const Point<spacedim> &x2) const override;
264 
268  virtual Tensor<1, spacedim>
270  const typename Triangulation<dim, spacedim>::face_iterator &face,
271  const Point<spacedim> &p) const override;
272 
276  virtual void
278  const typename Triangulation<dim, spacedim>::face_iterator &face,
279  typename Manifold<dim, spacedim>::FaceVertexNormals &face_vertex_normals)
280  const override;
281 
296  virtual void
297  get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
298  const Table<2, double> & weights,
299  ArrayView<Point<spacedim>> new_points) const override;
300 
305  virtual Point<spacedim>
307  const ArrayView<const double> & weights) const override;
308 
313 
314 private:
321  std::pair<double, Tensor<1, spacedim>>
322  guess_new_point(const ArrayView<const Tensor<1, spacedim>> &directions,
323  const ArrayView<const double> & distances,
324  const ArrayView<const double> & weights) const;
325 
342  get_new_point(const ArrayView<const Tensor<1, spacedim>> &directions,
343  const ArrayView<const double> & distances,
344  const ArrayView<const double> & weights,
345  const Point<spacedim> &candidate_point) const;
346 
360  virtual void
361  get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
362  const ArrayView<const double> & weights,
363  ArrayView<Point<spacedim>> new_points) const;
364 
369 };
370 
386 template <int dim, int spacedim = dim>
387 class CylindricalManifold : public ChartManifold<dim, spacedim, 3>
388 {
389 public:
396  CylindricalManifold(const unsigned int axis = 0,
397  const double tolerance = 1e-10);
398 
406  CylindricalManifold(const Tensor<1, spacedim> &direction,
407  const Point<spacedim> & point_on_axis,
408  const double tolerance = 1e-10);
409 
413  virtual std::unique_ptr<Manifold<dim, spacedim>>
414  clone() const override;
415 
422  virtual Point<3>
423  pull_back(const Point<spacedim> &space_point) const override;
424 
431  virtual Point<spacedim>
432  push_forward(const Point<3> &chart_point) const override;
433 
441  push_forward_gradient(const Point<3> &chart_point) const override;
442 
447  virtual Point<spacedim>
448  get_new_point(const ArrayView<const Point<spacedim>> &surrounding_points,
449  const ArrayView<const double> & weights) const override;
450 
451 protected:
456 
461 
466 
467 private:
471  double tolerance;
472 };
473 
507 template <int dim, int spacedim = dim>
508 class EllipticalManifold : public ChartManifold<dim, spacedim, spacedim>
509 {
510 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 
592 template <int dim, int spacedim = dim, int chartdim = dim>
593 class FunctionManifold : public ChartManifold<dim, spacedim, chartdim>
594 {
595 public:
610  const Function<chartdim> & push_forward_function,
611  const Function<spacedim> & pull_back_function,
612  const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(),
613  const double tolerance = 1e-10);
614 
627  std::unique_ptr<Function<chartdim>> push_forward,
628  std::unique_ptr<Function<spacedim>> pull_back,
629  const Tensor<1, chartdim> & periodicity = Tensor<1, chartdim>(),
630  const double tolerance = 1e-10);
631 
647  const std::string push_forward_expression,
648  const std::string pull_back_expression,
649  const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(),
650  const typename FunctionParser<spacedim>::ConstMap =
652  const std::string chart_vars =
654  const std::string space_vars =
656  const double tolerance = 1e-10,
657  const double h = 1e-8);
658 
662  virtual ~FunctionManifold() override;
663 
667  virtual std::unique_ptr<Manifold<dim, spacedim>>
668  clone() const override;
669 
675  virtual Point<spacedim>
676  push_forward(const Point<chartdim> &chart_point) const override;
677 
699  push_forward_gradient(const Point<chartdim> &chart_point) const override;
700 
706  virtual Point<chartdim>
707  pull_back(const Point<spacedim> &space_point) const override;
708 
709 private:
714 
721 
728 
734  const double tolerance;
735 
744 
748  const std::string push_forward_expression;
749 
753  const std::string pull_back_expression;
754 
758  const std::string chart_vars;
759 
763  const std::string space_vars;
764 
769 };
770 
771 
772 
787 template <int dim>
788 class TorusManifold : public ChartManifold<dim, 3, 3>
789 {
790 public:
791  static const int chartdim = 3;
792  static const int spacedim = 3;
793 
799  TorusManifold(const double R, const double r);
800 
804  virtual std::unique_ptr<Manifold<dim, 3>>
805  clone() const override;
806 
810  virtual Point<3>
811  pull_back(const Point<3> &p) const override;
812 
816  virtual Point<3>
817  push_forward(const Point<3> &chart_point) const override;
818 
823  push_forward_gradient(const Point<3> &chart_point) const override;
824 
825 private:
826  double r, R;
827 };
828 
829 
830 
970 template <int dim, int spacedim = dim>
971 class TransfiniteInterpolationManifold : public Manifold<dim, spacedim>
972 {
973 public:
978 
982  virtual ~TransfiniteInterpolationManifold() override;
983 
987  virtual std::unique_ptr<Manifold<dim, spacedim>>
988  clone() const override;
989 
1002  void
1003  initialize(const Triangulation<dim, spacedim> &triangulation);
1004 
1020  virtual Point<spacedim>
1021  get_new_point(const ArrayView<const Point<spacedim>> &surrounding_points,
1022  const ArrayView<const double> & weights) const override;
1023 
1043  virtual void
1044  get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
1045  const Table<2, double> & weights,
1046  ArrayView<Point<spacedim>> new_points) const override;
1047 
1048 private:
1060  std::array<unsigned int, 20>
1061  get_possible_cells_around_points(
1062  const ArrayView<const Point<spacedim>> &surrounding_points) const;
1063 
1072  compute_chart_points(
1073  const ArrayView<const Point<spacedim>> &surrounding_points,
1074  ArrayView<Point<dim>> chart_points) const;
1075 
1092  Point<dim>
1094  const Point<spacedim> & p,
1095  const Point<dim> &initial_guess) const;
1096 
1110  const Point<dim> &chart_point) const;
1111 
1125  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
1126  const Point<dim> & chart_point,
1127  const Point<spacedim> &pushed_forward_chart_point) const;
1128 
1133 
1139 
1145  std::vector<bool> coarse_cell_is_flat;
1146 
1152 
1157  boost::signals2::connection clear_signal;
1158 };
1159 
1161 
1162 #endif
FlatManifold< dim > chart_manifold
const double tolerance
Definition: manifold_lib.h:734
const double sinh_u
Definition: manifold_lib.h:562
static Tensor< 1, spacedim > get_periodicity()
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:465
std::vector< bool > coarse_cell_is_flat
const double finite_difference_step
Definition: manifold_lib.h:768
const std::string pull_back_expression
Definition: manifold_lib.h:753
const Point< spacedim > center
Definition: manifold_lib.h:124
SmartPointer< const Function< spacedim >, FunctionManifold< dim, spacedim, chartdim > > pull_back_function
Definition: manifold_lib.h:727
Tensor< 1, spacedim > direction
Definition: manifold_lib.h:553
PolarManifold(const Point< spacedim > center=Point< spacedim >())
const PolarManifold< spacedim > polar_manifold
Definition: manifold_lib.h:368
const std::string chart_vars
Definition: manifold_lib.h:758
virtual Point< spacedim > push_forward(const Point< spacedim > &chart_point) const override
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
SmartPointer< const Function< chartdim >, FunctionManifold< dim, spacedim, chartdim > > push_forward_function
Definition: manifold_lib.h:720
Point< 3 > vertices[4]
const Point< spacedim > center
Definition: manifold_lib.h:312
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:1008
virtual Tensor< 1, spacedim > get_tangent_vector(const Point< spacedim > &x1, const Point< spacedim > &x2) const override
Definition: manifold.cc:1050
Tensor< 2, dim, Number > w(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
virtual Point< spacedim > pull_back(const Point< spacedim > &space_point) const override
const std::string space_vars
Definition: manifold_lib.h:763
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &surrounding_points, const ArrayView< const double > &weights) const override
Definition: manifold.cc:987
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
const double cosh_u
Definition: manifold_lib.h:561
const Tensor< 1, spacedim > direction
Definition: manifold_lib.h:460
const std::string push_forward_expression
Definition: manifold_lib.h:748
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:455
const FunctionParser< spacedim >::ConstMap const_map
Definition: manifold_lib.h:713
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
boost::signals2::connection clear_signal
const Point< spacedim > center
Definition: manifold_lib.h:557
virtual Tensor< 1, spacedim > normal_vector(const typename Triangulation< dim, spacedim >::face_iterator &face, const Point< spacedim > &p) const override
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:972