Reference documentation for deal.II version 9.4.1
\(\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\}}\)
Loading...
Searching...
No Matches
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
24
26
28
29// forward declaration
30namespace internal
31{
32 namespace MappingQImplementation
33 {
34 template <int, int>
35 class InverseQuadraticApproximation;
36 }
37} // namespace internal
38
39
69template <int dim, int spacedim = dim>
70class PolarManifold : public ChartManifold<dim, spacedim, spacedim>
71{
72public:
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>
126 const Point<spacedim> &p) const override;
127
132
133private:
140};
141
142
143
235template <int dim, int spacedim = dim>
236class SphericalManifold : public Manifold<dim, spacedim>
237{
238public:
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>
276 const Point<spacedim> &p) const override;
277
281 virtual void
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
319private:
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
389template <int dim, int spacedim = dim>
390class CylindricalManifold : public ChartManifold<dim, spacedim, 3>
391{
392public:
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
454private:
459
464
469
473 const double tolerance;
474
479};
480
512template <int dim, int spacedim = dim>
513class EllipticalManifold : public ChartManifold<dim, spacedim, spacedim>
514{
515public:
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
553private:
565 const double cosh_u;
566 const double sinh_u;
567
576};
577
578
593template <int dim, int spacedim = dim, int chartdim = dim>
594class FunctionManifold : public ChartManifold<dim, spacedim, chartdim>
595{
596public:
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>(),
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
710private:
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
786template <int dim>
787class TorusManifold : public ChartManifold<dim, 3, 3>
788{
789public:
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
824private:
825 double r, R;
826};
827
828
829
967template <int dim, int spacedim = dim>
968class TransfiniteInterpolationManifold : public Manifold<dim, spacedim>
969{
970public:
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
1045private:
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
1091 const Point<spacedim> & p,
1092 const Point<dim> &initial_guess) const;
1093
1107 const Point<dim> &chart_point) const;
1108
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 Point< spacedim > get_new_point(const ArrayView< const Point< spacedim > > &surrounding_points, const ArrayView< const double > &weights) const override
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
const Tensor< 1, spacedim > normal_direction
Definition: manifold_lib.h:458
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
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
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
Definition: point.h:111
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 Point< spacedim > get_new_point(const ArrayView< const Point< spacedim > > &vertices, const ArrayView< const double > &weights) const override
virtual std::unique_ptr< Manifold< dim, spacedim > > clone() const override
const Point< spacedim > center
Definition: manifold_lib.h:317
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
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 void get_new_points(const ArrayView< const Point< spacedim > > &surrounding_points, const Table< 2, double > &weights, ArrayView< Point< spacedim > > new_points) const override
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
Definition: tensor.h:503
virtual Point< 3 > pull_back(const Point< 3 > &p) const override
static const int spacedim
Definition: manifold_lib.h:791
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)
Triangulation< dim, spacedim >::cell_iterator compute_chart_points(const ArrayView< const Point< spacedim > > &surrounding_points, ArrayView< Point< dim > > chart_points) const
virtual ~TransfiniteInterpolationManifold() override
std::array< unsigned int, 20 > get_possible_cells_around_points(const ArrayView< const Point< spacedim > > &surrounding_points) const
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
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim > > &surrounding_points, const ArrayView< const double > &weights) const override
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]