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 
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:
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
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>
1062  const ArrayView<const Point<spacedim>> &surrounding_points) const;
1063 
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
FunctionManifold::finite_difference_step
const double finite_difference_step
Definition: manifold_lib.h:768
CylindricalManifold::clone
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
Definition: manifold_lib.cc:1073
TransfiniteInterpolationManifold::compute_chart_points
Triangulation< dim, spacedim >::cell_iterator compute_chart_points(const ArrayView< const Point< spacedim >> &surrounding_points, ArrayView< Point< dim >> chart_points) const
Definition: manifold_lib.cc:2302
PolarManifold::center
const Point< spacedim > center
Definition: manifold_lib.h:124
PolarManifold::clone
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
Definition: manifold_lib.cc:132
ChartManifold
Definition: manifold.h:951
SphericalManifold::normal_vector
virtual Tensor< 1, spacedim > normal_vector(const typename Triangulation< dim, spacedim >::face_iterator &face, const Point< spacedim > &p) const override
Definition: manifold_lib.cc:489
TorusManifold
Definition: manifold_lib.h:788
TorusManifold::push_forward_gradient
virtual DerivativeForm< 1, 3, 3 > push_forward_gradient(const Point< 3 > &chart_point) const override
Definition: manifold_lib.cc:1606
PolarManifold::get_periodicity
static Tensor< 1, spacedim > get_periodicity()
Definition: manifold_lib.cc:141
EllipticalManifold::push_forward_gradient
virtual DerivativeForm< 1, spacedim, spacedim > push_forward_gradient(const Point< spacedim > &chart_point) const override
Definition: manifold_lib.cc:1325
TransfiniteInterpolationManifold::get_possible_cells_around_points
std::array< unsigned int, 20 > get_possible_cells_around_points(const ArrayView< const Point< spacedim >> &surrounding_points) const
Definition: manifold_lib.cc:2217
TorusManifold::spacedim
static const int spacedim
Definition: manifold_lib.h:792
EllipticalManifold::clone
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
Definition: manifold_lib.cc:1231
Triangulation
Definition: tria.h:1109
ArrayView
Definition: array_view.h:77
FunctionManifold::const_map
const FunctionParser< spacedim >::ConstMap const_map
Definition: manifold_lib.h:713
EllipticalManifold::pull_back
virtual Point< spacedim > pull_back(const Point< spacedim > &space_point) const override
Definition: manifold_lib.cc:1283
TransfiniteInterpolationManifold::chart_manifold
FlatManifold< dim > chart_manifold
Definition: manifold_lib.h:1151
FunctionManifold::clone
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
Definition: manifold_lib.cc:1448
TransfiniteInterpolationManifold::coarse_cell_is_flat
std::vector< bool > coarse_cell_is_flat
Definition: manifold_lib.h:1145
PolarManifold
Definition: manifold_lib.h:63
TorusManifold::r
double r
Definition: manifold_lib.h:826
SphericalManifold::get_new_point
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &vertices, const ArrayView< const double > &weights) const override
Definition: manifold_lib.cc:585
FunctionManifold::pull_back_function
SmartPointer< const Function< spacedim >, FunctionManifold< dim, spacedim, chartdim > > pull_back_function
Definition: manifold_lib.h:727
SphericalManifold
Definition: manifold_lib.h:231
Physics::Elasticity::Kinematics::e
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
PolarManifold::normal_vector
virtual Tensor< 1, spacedim > normal_vector(const typename Triangulation< dim, spacedim >::face_iterator &face, const Point< spacedim > &p) const override
Definition: manifold_lib.cc:320
FunctionManifold::chart_vars
const std::string chart_vars
Definition: manifold_lib.h:758
FunctionManifold::push_forward_function
SmartPointer< const Function< chartdim >, FunctionManifold< dim, spacedim, chartdim > > push_forward_function
Definition: manifold_lib.h:720
TransfiniteInterpolationManifold::initialize
void initialize(const Triangulation< dim, spacedim > &triangulation)
Definition: manifold_lib.cc:1669
FunctionManifold::push_forward_gradient
virtual DerivativeForm< 1, chartdim, spacedim > push_forward_gradient(const Point< chartdim > &chart_point) const override
Definition: manifold_lib.cc:1516
Table< 2, double >
SphericalManifold::get_new_points
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_lib.cc:568
EllipticalManifold
Definition: manifold_lib.h:508
CylindricalManifold
Definition: manifold_lib.h:387
CylindricalManifold::tolerance
double tolerance
Definition: manifold_lib.h:471
DerivativeForm
Definition: derivative_form.h:60
FunctionManifold::push_forward_expression
const std::string push_forward_expression
Definition: manifold_lib.h:748
TorusManifold::R
double R
Definition: manifold_lib.h:826
Physics::Elasticity::Kinematics::w
Tensor< 2, dim, Number > w(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
FunctionManifold::space_vars
const std::string space_vars
Definition: manifold_lib.h:763
TransfiniteInterpolationManifold
Definition: manifold_lib.h:971
TorusManifold::push_forward
virtual Point< 3 > push_forward(const Point< 3 > &chart_point) const override
Definition: manifold_lib.cc:1568
FunctionParser::ConstMap
std::map< std::string, double > ConstMap
Definition: function_parser.h:285
SphericalManifold::get_tangent_vector
virtual Tensor< 1, spacedim > get_tangent_vector(const Point< spacedim > &x1, const Point< spacedim > &x2) const override
Definition: manifold_lib.cc:438
TransfiniteInterpolationManifold::clone
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
Definition: manifold_lib.cc:1657
TransfiniteInterpolationManifold::level_coarse
int level_coarse
Definition: manifold_lib.h:1138
SphericalManifold::clone
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
Definition: manifold_lib.cc:363
TransfiniteInterpolationManifold::pull_back
Point< dim > pull_back(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p, const Point< dim > &initial_guess) const
Definition: manifold_lib.cc:2066
Tensor< 1, spacedim >
CylindricalManifold::normal_direction
const Tensor< 1, spacedim > normal_direction
Definition: manifold_lib.h:455
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
SphericalManifold::polar_manifold
const PolarManifold< spacedim > polar_manifold
Definition: manifold_lib.h:368
EllipticalManifold::sinh_u
const double sinh_u
Definition: manifold_lib.h:562
Manifold::FaceVertexNormals
std::array< Tensor< 1, spacedim >, GeometryInfo< dim >::vertices_per_face > FaceVertexNormals
Definition: manifold.h:355
TransfiniteInterpolationManifold::get_new_points
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_lib.cc:2583
manifold.h
FunctionManifold::FunctionManifold
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)
Definition: manifold_lib.cc:1360
PolarManifold::push_forward
virtual Point< spacedim > push_forward(const Point< spacedim > &chart_point) const override
Definition: manifold_lib.cc:158
FlatManifold< dim >
TransfiniteInterpolationManifold::TransfiniteInterpolationManifold
TransfiniteInterpolationManifold()
Definition: manifold_lib.cc:1636
FunctionManifold::pull_back_expression
const std::string pull_back_expression
Definition: manifold_lib.h:753
function_parser.h
FunctionManifold
Definition: manifold_lib.h:593
SphericalManifold::center
const Point< spacedim > center
Definition: manifold_lib.h:312
EllipticalManifold::direction
Tensor< 1, spacedim > direction
Definition: manifold_lib.h:553
EllipticalManifold::cosh_u
const double cosh_u
Definition: manifold_lib.h:561
TransfiniteInterpolationManifold::push_forward
Point< spacedim > push_forward(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &chart_point) const
Definition: manifold_lib.cc:2016
CylindricalManifold::pull_back
virtual Point< 3 > pull_back(const Point< spacedim > &space_point) const override
Definition: manifold_lib.cc:1112
SmartPointer
Definition: smartpointer.h:68
EllipticalManifold::get_periodicity
static Tensor< 1, spacedim > get_periodicity()
Definition: manifold_lib.cc:1242
CylindricalManifold::push_forward_gradient
virtual DerivativeForm< 1, 3, spacedim > push_forward_gradient(const Point< 3 > &chart_point) const override
Definition: manifold_lib.cc:1159
EllipticalManifold::EllipticalManifold
EllipticalManifold(const Point< spacedim > &center, const Tensor< 1, spacedim > &major_axis_direction, const double eccentricity)
Definition: manifold_lib.cc:1203
vertices
Point< 3 > vertices[4]
Definition: data_out_base.cc:174
CylindricalManifold::get_new_point
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &surrounding_points, const ArrayView< const double > &weights) const override
Definition: manifold_lib.cc:1083
FunctionManifold::tolerance
const double tolerance
Definition: manifold_lib.h:734
function.h
TransfiniteInterpolationManifold::get_new_point
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim >> &surrounding_points, const ArrayView< const double > &weights) const override
Definition: manifold_lib.cc:2563
FunctionManifold::owns_pointers
bool owns_pointers
Definition: manifold_lib.h:743
CylindricalManifold::push_forward
virtual Point< spacedim > push_forward(const Point< 3 > &chart_point) const override
Definition: manifold_lib.cc:1138
EllipticalManifold::center
const Point< spacedim > center
Definition: manifold_lib.h:557
PolarManifold::pull_back
virtual Point< spacedim > pull_back(const Point< spacedim > &space_point) const override
Definition: manifold_lib.cc:192
FunctionManifold::~FunctionManifold
virtual ~FunctionManifold() override
Definition: manifold_lib.cc:1430
CylindricalManifold::CylindricalManifold
CylindricalManifold(const unsigned int axis=0, const double tolerance=1e-10)
Definition: manifold_lib.cc:1038
SphericalManifold::get_normals_at_vertices
virtual void get_normals_at_vertices(const typename Triangulation< dim, spacedim >::face_iterator &face, typename Manifold< dim, spacedim >::FaceVertexNormals &face_vertex_normals) const override
Definition: manifold_lib.cc:541
PolarManifold::PolarManifold
PolarManifold(const Point< spacedim > center=Point< spacedim >())
Definition: manifold_lib.cc:122
SphericalManifold::get_intermediate_point
virtual Point< spacedim > get_intermediate_point(const Point< spacedim > &p1, const Point< spacedim > &p2, const double w) const override
Definition: manifold_lib.cc:372
Point< spacedim >
FunctionManifold::pull_back
virtual Point< chartdim > pull_back(const Point< spacedim > &space_point) const override
Definition: manifold_lib.cc:1533
CylindricalManifold::point_on_axis
const Point< spacedim > point_on_axis
Definition: manifold_lib.h:465
TransfiniteInterpolationManifold::~TransfiniteInterpolationManifold
virtual ~TransfiniteInterpolationManifold() override
Definition: manifold_lib.cc:1647
config.h
Function
Definition: function.h:151
TransfiniteInterpolationManifold::clear_signal
boost::signals2::connection clear_signal
Definition: manifold_lib.h:1157
TorusManifold::clone
virtual std::unique_ptr< Manifold< dim, 3 > > clone() const override
Definition: manifold_lib.cc:1597
TorusManifold::chartdim
static const int chartdim
Definition: manifold_lib.h:791
Manifold
Definition: manifold.h:334
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
TransfiniteInterpolationManifold::push_forward_gradient
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
Definition: manifold_lib.cc:2037
EllipticalManifold::push_forward
virtual Point< spacedim > push_forward(const Point< spacedim > &chart_point) const override
Definition: manifold_lib.cc:1255
PolarManifold::push_forward_gradient
virtual DerivativeForm< 1, spacedim, spacedim > push_forward_gradient(const Point< spacedim > &chart_point) const override
Definition: manifold_lib.cc:231
TorusManifold::pull_back
virtual Point< 3 > pull_back(const Point< 3 > &p) const override
Definition: manifold_lib.cc:1551
TriaIterator
Definition: tria_iterator.h:578
CylindricalManifold::direction
const Tensor< 1, spacedim > direction
Definition: manifold_lib.h:460
FunctionParser
Definition: function_parser.h:224
SphericalManifold::SphericalManifold
SphericalManifold(const Point< spacedim > center=Point< spacedim >())
Definition: manifold_lib.cc:353
TorusManifold::TorusManifold
TorusManifold(const double R, const double r)
Definition: manifold_lib.cc:1582
FunctionManifold::push_forward
virtual Point< spacedim > push_forward(const Point< chartdim > &chart_point) const override
Definition: manifold_lib.cc:1488
SphericalManifold::guess_new_point
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
Definition: manifold_lib.cc:812
TransfiniteInterpolationManifold::triangulation
const Triangulation< dim, spacedim > * triangulation
Definition: manifold_lib.h:1132