Reference documentation for deal.II version GIT c415589cf0 2022-08-14 18:50:02+00:00
\(\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 - 2022 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>
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>
259  const Point<spacedim> &p2,
260  const double w) const override;
261 
266  virtual Tensor<1, spacedim>
268  const Point<spacedim> &x2) const override;
269 
273  virtual Tensor<1, spacedim>
275  const typename Triangulation<dim, spacedim>::face_iterator &face,
276  const Point<spacedim> &p) const override;
277 
281  virtual void
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>
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 
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 private:
459 
464 
469 
473  const double tolerance;
474 
479 };
480 
512 template <int dim, int spacedim = dim>
513 class EllipticalManifold : public ChartManifold<dim, spacedim, spacedim>
514 {
515 public:
528  const Tensor<1, spacedim> &major_axis_direction,
529  const double eccentricity);
530 
531  virtual std::unique_ptr<Manifold<dim, spacedim>>
532  clone() const override;
533 
537  virtual Point<spacedim>
538  pull_back(const Point<spacedim> &space_point) const override;
539 
543  virtual Point<spacedim>
544  push_forward(const Point<spacedim> &chart_point) const override;
545 
550  push_forward_gradient(const Point<spacedim> &chart_point) const override;
551 
552 
553 private:
565  const double cosh_u;
566  const double sinh_u;
567 
574  static Tensor<1, spacedim>
575  get_periodicity();
576 };
577 
578 
593 template <int dim, int spacedim = dim, int chartdim = dim>
594 class FunctionManifold : public ChartManifold<dim, spacedim, chartdim>
595 {
596 public:
613  const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(),
614  const double tolerance = 1e-10);
615 
628  std::unique_ptr<Function<chartdim>> push_forward,
629  std::unique_ptr<Function<spacedim>> pull_back,
630  const Tensor<1, chartdim> & periodicity = Tensor<1, chartdim>(),
631  const double tolerance = 1e-10);
632 
648  const std::string push_forward_expression,
649  const std::string pull_back_expression,
650  const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(),
651  const typename FunctionParser<spacedim>::ConstMap =
653  const std::string chart_vars =
655  const std::string space_vars =
657  const double tolerance = 1e-10,
658  const double h = 1e-8);
659 
663  virtual ~FunctionManifold() override;
664 
668  virtual std::unique_ptr<Manifold<dim, spacedim>>
669  clone() const override;
670 
676  virtual Point<spacedim>
677  push_forward(const Point<chartdim> &chart_point) const override;
678 
700  push_forward_gradient(const Point<chartdim> &chart_point) const override;
701 
707  virtual Point<chartdim>
708  pull_back(const Point<spacedim> &space_point) const override;
709 
710 private:
715 
722 
729 
735  const double tolerance;
736 
745 
749  const std::string push_forward_expression;
750 
754  const std::string pull_back_expression;
755 
759  const std::string chart_vars;
760 
764  const std::string space_vars;
765 
770 };
771 
772 
773 
786 template <int dim>
787 class TorusManifold : public ChartManifold<dim, 3, 3>
788 {
789 public:
790  static const int chartdim = 3;
791  static const int spacedim = 3;
792 
798  TorusManifold(const double R, const double r);
799 
803  virtual std::unique_ptr<Manifold<dim, 3>>
804  clone() const override;
805 
809  virtual Point<3>
810  pull_back(const Point<3> &p) const override;
811 
815  virtual Point<3>
816  push_forward(const Point<3> &chart_point) const override;
817 
822  push_forward_gradient(const Point<3> &chart_point) const override;
823 
824 private:
825  double r, R;
826 };
827 
828 
829 
967 template <int dim, int spacedim = dim>
968 class TransfiniteInterpolationManifold : public Manifold<dim, spacedim>
969 {
970 public:
975 
979  virtual ~TransfiniteInterpolationManifold() override;
980 
984  virtual std::unique_ptr<Manifold<dim, spacedim>>
985  clone() const override;
986 
999  void
1001 
1017  virtual Point<spacedim>
1018  get_new_point(const ArrayView<const Point<spacedim>> &surrounding_points,
1019  const ArrayView<const double> & weights) const override;
1020 
1040  virtual void
1041  get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
1042  const Table<2, double> & weights,
1043  ArrayView<Point<spacedim>> new_points) const override;
1044 
1045 private:
1057  std::array<unsigned int, 20>
1059  const ArrayView<const Point<spacedim>> &surrounding_points) const;
1060 
1070  const ArrayView<const Point<spacedim>> &surrounding_points,
1071  ArrayView<Point<dim>> chart_points) const;
1072 
1089  Point<dim>
1091  const Point<spacedim> & p,
1092  const Point<dim> &initial_guess) const;
1093 
1107  const Point<dim> &chart_point) const;
1108 
1122  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
1123  const Point<dim> & chart_point,
1124  const Point<spacedim> &pushed_forward_chart_point) const;
1125 
1130 
1136 
1142  std::vector<bool> coarse_cell_is_flat;
1143 
1149 
1154  std::vector<internal::MappingQImplementation::
1155  InverseQuadraticApproximation<dim, spacedim>>
1157 
1162  boost::signals2::connection clear_signal;
1163 };
1164 
1166 
1167 #endif
virtual Point< spacedim > push_forward(const Point< 3 > &chart_point) const override
const Tensor< 1, spacedim > dxn
Definition: manifold_lib.h:478
virtual DerivativeForm< 1, 3, spacedim > push_forward_gradient(const Point< 3 > &chart_point) const override
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &surrounding_points, const ArrayView< const double > &weights) const override
const Tensor< 1, spacedim > normal_direction
Definition: manifold_lib.h:458
CylindricalManifold(const unsigned int axis=0, const double tolerance=1e-10)
const Point< spacedim > point_on_axis
Definition: manifold_lib.h:468
const double tolerance
Definition: manifold_lib.h:473
const Tensor< 1, spacedim > direction
Definition: manifold_lib.h:463
virtual Point< 3 > pull_back(const Point< spacedim > &space_point) const override
Tensor< 1, spacedim > direction
Definition: manifold_lib.h:557
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
const Point< spacedim > center
Definition: manifold_lib.h:561
virtual Point< spacedim > push_forward(const Point< spacedim > &chart_point) const override
EllipticalManifold(const Point< spacedim > &center, const Tensor< 1, spacedim > &major_axis_direction, const double eccentricity)
virtual DerivativeForm< 1, spacedim, spacedim > push_forward_gradient(const Point< spacedim > &chart_point) const override
virtual Point< spacedim > pull_back(const Point< spacedim > &space_point) const override
static Tensor< 1, spacedim > get_periodicity()
const double sinh_u
Definition: manifold_lib.h:566
const double cosh_u
Definition: manifold_lib.h:565
SmartPointer< const Function< spacedim >, FunctionManifold< dim, spacedim, chartdim > > pull_back_function
Definition: manifold_lib.h:728
const double tolerance
Definition: manifold_lib.h:735
const FunctionParser< spacedim >::ConstMap const_map
Definition: manifold_lib.h:714
const std::string chart_vars
Definition: manifold_lib.h:759
const std::string pull_back_expression
Definition: manifold_lib.h:754
virtual DerivativeForm< 1, chartdim, spacedim > push_forward_gradient(const Point< chartdim > &chart_point) const override
SmartPointer< const Function< chartdim >, FunctionManifold< dim, spacedim, chartdim > > push_forward_function
Definition: manifold_lib.h:721
const std::string space_vars
Definition: manifold_lib.h:764
virtual Point< spacedim > push_forward(const Point< chartdim > &chart_point) const override
const double finite_difference_step
Definition: manifold_lib.h:769
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)
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
const std::string push_forward_expression
Definition: manifold_lib.h:749
virtual Point< chartdim > pull_back(const Point< spacedim > &space_point) const override
virtual ~FunctionManifold() override
std::map< std::string, double > ConstMap
std::array< Tensor< 1, spacedim >, GeometryInfo< dim >::vertices_per_face > FaceVertexNormals
Definition: manifold.h:307
PolarManifold(const Point< spacedim > center=Point< spacedim >())
static Tensor< 1, spacedim > get_periodicity()
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
const Point< spacedim > center
Definition: manifold_lib.h:131
virtual Tensor< 1, spacedim > normal_vector(const typename Triangulation< dim, spacedim >::face_iterator &face, const Point< spacedim > &p) const override
virtual Point< spacedim > push_forward(const Point< spacedim > &chart_point) const override
virtual Point< spacedim > pull_back(const Point< spacedim > &space_point) const override
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
const Point< spacedim > center
Definition: manifold_lib.h:317
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
virtual Point< spacedim > get_intermediate_point(const Point< spacedim > &p1, const Point< spacedim > &p2, const double w) const override
const PolarManifold< spacedim > polar_manifold
Definition: manifold_lib.h:373
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 Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &vertices, const ArrayView< const double > &weights) 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
SphericalManifold(const Point< spacedim > center=Point< spacedim >())
virtual Tensor< 1, spacedim > get_tangent_vector(const Point< spacedim > &x1, const Point< spacedim > &x2) const override
virtual Tensor< 1, spacedim > normal_vector(const typename Triangulation< dim, spacedim >::face_iterator &face, const Point< spacedim > &p) const override
virtual Point< 3 > pull_back(const Point< 3 > &p) const override
static const int spacedim
Definition: manifold_lib.h:791
TorusManifold(const double R, const double r)
virtual DerivativeForm< 1, 3, 3 > push_forward_gradient(const Point< 3 > &chart_point) const override
virtual Point< 3 > push_forward(const Point< 3 > &chart_point) const override
static const int chartdim
Definition: manifold_lib.h:790
virtual std::unique_ptr< Manifold< dim, 3 > > clone() const override
const Triangulation< dim, spacedim > * triangulation
boost::signals2::connection clear_signal
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
std::vector< internal::MappingQImplementation::InverseQuadraticApproximation< dim, spacedim > > quadratic_approximation
void initialize(const Triangulation< dim, spacedim > &triangulation)
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &surrounding_points, const ArrayView< const double > &weights) const override
virtual ~TransfiniteInterpolationManifold() override
FlatManifold< dim > chart_manifold
Point< dim > pull_back(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p, const Point< dim > &initial_guess) const
virtual void get_new_points(const ArrayView< const Point< spacedim >> &surrounding_points, const Table< 2, double > &weights, ArrayView< Point< spacedim >> new_points) const override
std::array< unsigned int, 20 > get_possible_cells_around_points(const ArrayView< const Point< spacedim >> &surrounding_points) const
Triangulation< dim, spacedim >::cell_iterator compute_chart_points(const ArrayView< const Point< spacedim >> &surrounding_points, ArrayView< Point< dim >> chart_points) const
std::vector< bool > coarse_cell_is_flat
Point< spacedim > push_forward(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &chart_point) const
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
Point< 3 > vertices[4]
Tensor< 2, dim, Number > w(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)