deal.II version GIT relicensing-2206-gaa53ff9447 2024-12-02 09:10:00+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\}}\)
Loading...
Searching...
No Matches
manifold_lib.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2014 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_manifold_lib_h
16#define dealii_manifold_lib_h
17
18
19#include <deal.II/base/config.h>
20
23
25
27
28// forward declaration
29namespace internal
30{
31 namespace MappingQImplementation
32 {
33 template <int, int>
34 class InverseQuadraticApproximation;
35 }
36} // namespace internal
37
38
82template <int dim, int spacedim = dim>
83class PolarManifold : public ChartManifold<dim, spacedim, spacedim>
84{
85public:
93
97 virtual std::unique_ptr<Manifold<dim, spacedim>>
98 clone() const override;
99
104 virtual Point<spacedim>
105 pull_back(const Point<spacedim> &space_point) const override;
106
111 virtual Point<spacedim>
112 push_forward(const Point<spacedim> &chart_point) const override;
113
127 push_forward_gradient(const Point<spacedim> &chart_point) const override;
128
132 virtual Tensor<1, spacedim>
135 const Point<spacedim> &p) const override;
136
140 const Point<spacedim> &
141 get_center() const;
142
149 "Access the center with get_center() instead.")
150 const Point<spacedim> center;
151
152private:
158 const Point<spacedim> p_center;
159
164 static Tensor<1, spacedim>
166};
167
168
169
261template <int dim, int spacedim = dim>
262class SphericalManifold : public Manifold<dim, spacedim>
263{
264public:
272
276 virtual std::unique_ptr<Manifold<dim, spacedim>>
277 clone() const override;
278
286 virtual Point<spacedim>
288 const Point<spacedim> &p2,
289 const double w) const override;
290
295 virtual Tensor<1, spacedim>
297 const Point<spacedim> &x2) const override;
298
302 virtual Tensor<1, spacedim>
305 const Point<spacedim> &p) const override;
306
310 virtual void
313 typename Manifold<dim, spacedim>::FaceVertexNormals &face_vertex_normals)
314 const override;
315
330 virtual void
331 get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
332 const Table<2, double> &weights,
333 ArrayView<Point<spacedim>> new_points) const override;
334
339 virtual Point<spacedim>
340 get_new_point(const ArrayView<const Point<spacedim>> &vertices,
341 const ArrayView<const double> &weights) const override;
342
346 const Point<spacedim> &
347 get_center() const;
348
355 "Access the center with get_center() instead.")
356 const Point<spacedim> center;
357
358private:
364 const Point<spacedim> p_center;
365
372 std::pair<double, Tensor<1, spacedim>>
373 guess_new_point(const ArrayView<const Tensor<1, spacedim>> &directions,
374 const ArrayView<const double> &distances,
375 const ArrayView<const double> &weights) const;
376
394 void
395 do_get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
396 const ArrayView<const double> &weights,
397 ArrayView<Point<spacedim>> new_points) const;
398
402 const PolarManifold<spacedim> polar_manifold;
403};
404
418template <int dim, int spacedim = dim>
419class CylindricalManifold : public ChartManifold<dim, spacedim, 3>
420{
421public:
428 CylindricalManifold(const unsigned int axis = 0,
429 const double tolerance = 1e-10);
430
439 const Point<spacedim> &point_on_axis,
440 const double tolerance = 1e-10);
441
445 virtual std::unique_ptr<Manifold<dim, spacedim>>
446 clone() const override;
447
454 virtual Point<3>
455 pull_back(const Point<spacedim> &space_point) const override;
456
463 virtual Point<spacedim>
464 push_forward(const Point<3> &chart_point) const override;
465
473 push_forward_gradient(const Point<3> &chart_point) const override;
474
479 virtual Point<spacedim>
480 get_new_point(const ArrayView<const Point<spacedim>> &surrounding_points,
481 const ArrayView<const double> &weights) const override;
482
486 const Tensor<1, spacedim> &
487 get_direction() const;
488
495 const Point<spacedim> &
496 get_point_on_axis() const;
497
501 double
502 get_tolerance() const;
503
504private:
509
514
519
523 const double tolerance;
524
529};
530
562template <int dim, int spacedim = dim>
563class EllipticalManifold : public ChartManifold<dim, spacedim, spacedim>
564{
565public:
578 const Tensor<1, spacedim> &major_axis_direction,
579 const double eccentricity);
580
581 virtual std::unique_ptr<Manifold<dim, spacedim>>
582 clone() const override;
583
587 virtual Point<spacedim>
588 pull_back(const Point<spacedim> &space_point) const override;
589
593 virtual Point<spacedim>
594 push_forward(const Point<spacedim> &chart_point) const override;
595
600 push_forward_gradient(const Point<spacedim> &chart_point) const override;
601
605 const Tensor<1, spacedim> &
606 get_major_axis_direction() const;
607
611 const Point<spacedim> &
612 get_center() const;
613
617 double
618 get_eccentricity() const;
619
620private:
625
630
634 const double eccentricity;
635
639 const double cosh_u;
640 const double sinh_u;
641
649 get_periodicity();
650};
651
652
667template <int dim, int spacedim = dim, int chartdim = dim>
668class FunctionManifold : public ChartManifold<dim, spacedim, chartdim>
669{
670public:
685 const Function<chartdim> &push_forward_function,
686 const Function<spacedim> &pull_back_function,
687 const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(),
688 const double tolerance = 1e-10);
689
702 std::unique_ptr<Function<chartdim>> push_forward,
703 std::unique_ptr<Function<spacedim>> pull_back,
704 const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(),
705 const double tolerance = 1e-10);
706
722 const std::string push_forward_expression,
723 const std::string pull_back_expression,
724 const Tensor<1, chartdim> &periodicity = Tensor<1, chartdim>(),
727 const std::string chart_vars =
729 const std::string space_vars =
731 const double tolerance = 1e-10,
732 const double h = 1e-8);
733
737 virtual ~FunctionManifold() override;
738
742 virtual std::unique_ptr<Manifold<dim, spacedim>>
743 clone() const override;
744
750 virtual Point<spacedim>
751 push_forward(const Point<chartdim> &chart_point) const override;
752
774 push_forward_gradient(const Point<chartdim> &chart_point) const override;
775
781 virtual Point<chartdim>
782 pull_back(const Point<spacedim> &space_point) const override;
783
784private:
789
796
803
809 const double tolerance;
810
819
823 const std::string push_forward_expression;
824
828 const std::string pull_back_expression;
829
833 const std::string chart_vars;
834
838 const std::string space_vars;
839
844};
845
846
847
860template <int dim>
861class TorusManifold : public ChartManifold<dim, 3, 3>
862{
863public:
864 static const int chartdim = 3;
865 static const int spacedim = 3;
866
872 TorusManifold(const double centerline_radius, const double inner_radius);
873
877 virtual std::unique_ptr<Manifold<dim, 3>>
878 clone() const override;
879
883 virtual Point<3>
884 pull_back(const Point<3> &p) const override;
885
889 virtual Point<3>
890 push_forward(const Point<3> &chart_point) const override;
891
896 push_forward_gradient(const Point<3> &chart_point) const override;
897
901 double
902 get_centerline_radius() const;
903
907 double
908 get_inner_radius() const;
909
910private:
912
914};
915
916
917
1055template <int dim, int spacedim = dim>
1056class TransfiniteInterpolationManifold : public Manifold<dim, spacedim>
1057{
1058public:
1063
1067 virtual ~TransfiniteInterpolationManifold() override;
1068
1072 virtual std::unique_ptr<Manifold<dim, spacedim>>
1073 clone() const override;
1074
1087 void
1089
1105 virtual Point<spacedim>
1106 get_new_point(const ArrayView<const Point<spacedim>> &surrounding_points,
1107 const ArrayView<const double> &weights) const override;
1108
1128 virtual void
1129 get_new_points(const ArrayView<const Point<spacedim>> &surrounding_points,
1130 const Table<2, double> &weights,
1131 ArrayView<Point<spacedim>> new_points) const override;
1132
1133private:
1145 std::array<unsigned int, 20>
1146 get_possible_cells_around_points(
1147 const ArrayView<const Point<spacedim>> &surrounding_points) const;
1148
1157 compute_chart_points(
1158 const ArrayView<const Point<spacedim>> &surrounding_points,
1159 ArrayView<Point<dim>> chart_points) const;
1160
1178 pull_back(const typename Triangulation<dim, spacedim>::cell_iterator &cell,
1179 const Point<spacedim> &p,
1180 const Point<dim> &initial_guess) const;
1181
1194 push_forward(const typename Triangulation<dim, spacedim>::cell_iterator &cell,
1195 const Point<dim> &chart_point) const;
1196
1209 push_forward_gradient(
1211 const Point<dim> &chart_point,
1212 const Point<spacedim> &pushed_forward_chart_point) const;
1213
1218
1224
1230 std::vector<bool> coarse_cell_is_flat;
1231
1237
1242 std::vector<internal::MappingQImplementation::
1243 InverseQuadraticApproximation<dim, spacedim>>
1245
1250 boost::signals2::connection clear_signal;
1251};
1252
1253/*----------------------------- inline functions -----------------------------*/
1254
1255template <int dim, int spacedim>
1256inline const Point<spacedim> &
1261
1262
1263
1264template <int dim, int spacedim>
1265inline const Point<spacedim> &
1270
1271
1272
1273template <int dim, int spacedim>
1274inline const Tensor<1, spacedim> &
1276{
1277 return direction;
1278}
1279
1280
1281
1282template <int dim, int spacedim>
1283inline const Point<spacedim> &
1285{
1286 return point_on_axis;
1287}
1288
1289
1290
1291template <int dim, int spacedim>
1292inline double
1294{
1295 return tolerance;
1296}
1297
1298
1299
1300template <int dim, int spacedim>
1301inline const Tensor<1, spacedim> &
1303{
1304 return direction;
1305}
1306
1307
1308
1309template <int dim, int spacedim>
1310inline const Point<spacedim> &
1315
1316
1317
1318template <int dim, int spacedim>
1319inline double
1321{
1322 return eccentricity;
1323}
1324
1325
1326
1327template <int dim>
1328inline double
1330{
1331 return centerline_radius;
1332}
1333
1334
1335
1336template <int dim>
1337inline double
1339{
1340 return inner_radius;
1341}
1342
1344
1345#endif
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:1048
virtual Tensor< 1, spacedim > get_tangent_vector(const Point< spacedim > &x1, const Point< spacedim > &x2) const override
Definition manifold.cc:1087
virtual Point< spacedim > get_intermediate_point(const Point< spacedim > &p1, const Point< spacedim > &p2, const double w) const override
Definition manifold.cc:1013
virtual Point< spacedim > get_new_point(const ArrayView< const Point< spacedim > > &surrounding_points, const ArrayView< const double > &weights) const override
Definition manifold.cc:1027
const Tensor< 1, spacedim > dxn
const Tensor< 1, spacedim > normal_direction
const Point< spacedim > point_on_axis
const double tolerance
const Tensor< 1, spacedim > direction
double get_tolerance() const
const Point< spacedim > & get_point_on_axis() const
const Tensor< 1, spacedim > & get_direction() const
const Tensor< 1, spacedim > & get_major_axis_direction() const
const Point< spacedim > & get_center() const
double get_eccentricity() const
const Point< spacedim > center
const double eccentricity
const Tensor< 1, spacedim > direction
const double sinh_u
const double cosh_u
const double tolerance
const FunctionParser< spacedim >::ConstMap const_map
const std::string chart_vars
const std::string pull_back_expression
const std::string space_vars
const double finite_difference_step
const std::string push_forward_expression
ObserverPointer< const Function< chartdim >, FunctionManifold< dim, spacedim, chartdim > > push_forward_function
ObserverPointer< const Function< spacedim >, FunctionManifold< dim, spacedim, chartdim > > pull_back_function
std::map< std::string, double > ConstMap
virtual void get_normals_at_vertices(const typename Triangulation< dim, spacedim >::face_iterator &face, FaceVertexNormals &face_vertex_normals) const
std::array< Tensor< 1, spacedim >, GeometryInfo< dim >::vertices_per_face > FaceVertexNormals
Definition manifold.h:306
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
const Point< spacedim > p_center
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
const Point< spacedim > & get_center() const
const Point< spacedim > & get_center() const
double inner_radius
double get_centerline_radius() const
double centerline_radius
double get_inner_radius() const
const Triangulation< dim, spacedim > * triangulation
boost::signals2::connection clear_signal
std::vector< internal::MappingQImplementation::InverseQuadraticApproximation< dim, spacedim > > quadratic_approximation
FlatManifold< dim > chart_manifold
std::vector< bool > coarse_cell_is_flat
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_DEPRECATED_WITH_COMMENT(comment)
Definition config.h:206
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
STL namespace.
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation