deal.II version GIT relicensing-1941-ga9013bea74 2024-10-08 06:50: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
mapping.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2001 - 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_mapping_h
16#define dealii_mapping_h
17
18
19#include <deal.II/base/config.h>
20
23
26
27#include <deal.II/grid/tria.h>
28
30
32
33#include <array>
34#include <cmath>
35#include <memory>
36
38
39template <typename ElementType, typename MemorySpaceType>
40class ArrayView;
41template <int dim>
42class Quadrature;
43template <int dim, int spacedim>
44class FEValues;
45template <int dim, int spacedim>
46class FEValuesBase;
47template <int dim, int spacedim>
48class FEValues;
49template <int dim, int spacedim>
50class FEFaceValues;
51template <int dim, int spacedim>
52class FESubfaceValues;
53namespace NonMatching
54{
55 template <int dim>
57 namespace internal
58 {
59 template <int dim, int spacedim>
61 }
62 template <int dim, int spacedim, typename Number>
63 class MappingInfo;
64} // namespace NonMatching
65
66
164
165
316template <int dim, int spacedim = dim>
317class Mapping : public Subscriptor
318{
319public:
323 virtual ~Mapping() override = default;
324
334 virtual std::unique_ptr<Mapping<dim, spacedim>>
335 clone() const = 0;
336
351 virtual boost::container::small_vector<Point<spacedim>,
354 const typename Triangulation<dim, spacedim>::cell_iterator &cell) const;
355
364 boost::container::small_vector<Point<spacedim>,
367 const unsigned int face_no) const;
368
392 virtual Point<spacedim>
394 const bool map_barycenter_of_reference_cell = true) const;
395
415 const typename Triangulation<dim, spacedim>::cell_iterator &cell) const;
416
428 virtual bool
430
435 virtual bool
436 is_compatible_with(const ReferenceCell &reference_cell) const = 0;
437
454 virtual Point<spacedim>
457 const Point<dim> &p) const = 0;
458
487 virtual Point<dim>
490 const Point<spacedim> &p) const = 0;
491
503 virtual void
506 const ArrayView<const Point<spacedim>> &real_points,
507 const ArrayView<Point<dim>> &unit_points) const;
508
519 Point<dim - 1>
522 const unsigned int face_no,
523 const Point<spacedim> &p) const;
524
539
540
550 "Computing the mapping between a real space point and a point in reference "
551 "space failed, typically because the given point lies outside the cell "
552 "where the inverse mapping is not unique.");
553
563 double,
564 int,
565 << "The image of the mapping applied to cell with center ["
566 << arg1 << "] is distorted. The cell geometry or the "
567 << "mapping are invalid, giving a non-positive volume "
568 << "fraction of " << arg2 << " in quadrature point " << arg3
569 << '.');
570
580public:
647 {
648 public:
654
659
669 virtual void
670 reinit(const UpdateFlags update_flags, const Quadrature<dim> &quadrature);
671
675 virtual ~InternalDataBase() = default;
676
692
696 virtual std::size_t
698 };
699
700protected:
724 virtual UpdateFlags
725 requires_update_flags(const UpdateFlags update_flags) const = 0;
726
775 virtual std::unique_ptr<InternalDataBase>
776 get_data(const UpdateFlags update_flags,
777 const Quadrature<dim> &quadrature) const = 0;
778
806 virtual std::unique_ptr<InternalDataBase>
807 get_face_data(const UpdateFlags update_flags,
808 const hp::QCollection<dim - 1> &quadrature) const;
809
813 virtual std::unique_ptr<InternalDataBase>
814 get_face_data(const UpdateFlags update_flags,
815 const Quadrature<dim - 1> &quadrature) const;
816
845 virtual std::unique_ptr<InternalDataBase>
846 get_subface_data(const UpdateFlags update_flags,
847 const Quadrature<dim - 1> &quadrature) const = 0;
848
935 const CellSimilarity::Similarity cell_similarity,
936 const Quadrature<dim> &quadrature,
937 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
939 &output_data) const = 0;
940
965 virtual void
968 const unsigned int face_no,
969 const hp::QCollection<dim - 1> &quadrature,
970 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
972 &output_data) const;
973
977 virtual void
980 const unsigned int face_no,
981 const Quadrature<dim - 1> &quadrature,
982 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
984 &output_data) const;
985
1012 virtual void
1015 const unsigned int face_no,
1016 const unsigned int subface_no,
1017 const Quadrature<dim - 1> &quadrature,
1018 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
1020 &output_data) const = 0;
1021
1028 virtual void
1032 const typename Mapping<dim, spacedim>::InternalDataBase &internal_data,
1034 &output_data) const;
1035
1040public:
1109 virtual void
1111 const MappingKind kind,
1113 const ArrayView<Tensor<1, spacedim>> &output) const = 0;
1114
1162 virtual void
1164 const MappingKind kind,
1166 const ArrayView<Tensor<2, spacedim>> &output) const = 0;
1167
1220 virtual void
1222 const MappingKind kind,
1224 const ArrayView<Tensor<2, spacedim>> &output) const = 0;
1225
1267 virtual void
1269 const MappingKind kind,
1271 const ArrayView<Tensor<3, spacedim>> &output) const = 0;
1272
1320 virtual void
1322 const MappingKind kind,
1324 const ArrayView<Tensor<3, spacedim>> &output) const = 0;
1325
1331 // Give class @p FEValues access to the private <tt>get_...data</tt> and
1332 // <tt>fill_fe_...values</tt> functions.
1333 friend class FEValuesBase<dim, spacedim>;
1334 friend class FEValues<dim, spacedim>;
1335 friend class FEFaceValues<dim, spacedim>;
1336 friend class FESubfaceValues<dim, spacedim>;
1337 friend class NonMatching::FEImmersedSurfaceValues<dim>;
1338 friend class NonMatching::internal::ComputeMappingDataHelper<dim, spacedim>;
1339 template <int, int, typename>
1341};
1342
1343
1351template <int dim, int spacedim>
1354
1355
1357
1358#endif
UpdateFlags update_each
Definition mapping.h:691
InternalDataBase(const InternalDataBase &)=delete
virtual ~InternalDataBase()=default
virtual std::size_t memory_consumption() const
virtual void reinit(const UpdateFlags update_flags, const Quadrature< dim > &quadrature)
Abstract base class for mapping classes.
Definition mapping.h:318
virtual ~Mapping() override=default
Point< dim - 1 > project_real_point_to_unit_point_on_face(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const Point< spacedim > &p) const
virtual bool is_compatible_with(const ReferenceCell &reference_cell) const =0
virtual void transform(const ArrayView< const Tensor< 1, dim > > &input, const MappingKind kind, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 1, spacedim > > &output) const =0
virtual void fill_fe_subface_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no, const Quadrature< dim - 1 > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const =0
virtual std::unique_ptr< InternalDataBase > get_data(const UpdateFlags update_flags, const Quadrature< dim > &quadrature) const =0
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const =0
virtual BoundingBox< spacedim > get_bounding_box(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
virtual void fill_fe_immersed_surface_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const NonMatching::ImmersedSurfaceQuadrature< dim > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const
virtual void fill_fe_face_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const hp::QCollection< dim - 1 > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const =0
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const =0
virtual void transform_points_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const ArrayView< const Point< spacedim > > &real_points, const ArrayView< Point< dim > > &unit_points) const
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const =0
virtual void transform(const ArrayView< const DerivativeForm< 1, dim, spacedim > > &input, const MappingKind kind, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 2, spacedim > > &output) const =0
virtual void transform(const ArrayView< const DerivativeForm< 2, dim, spacedim > > &input, const MappingKind kind, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 3, spacedim > > &output) const =0
virtual void fill_fe_face_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const Quadrature< dim - 1 > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const
virtual std::unique_ptr< InternalDataBase > get_face_data(const UpdateFlags update_flags, const Quadrature< dim - 1 > &quadrature) const
virtual bool preserves_vertex_locations() const =0
boost::container::small_vector< Point< spacedim >, GeometryInfo< dim >::vertices_per_face > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no) const
virtual CellSimilarity::Similarity fill_fe_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellSimilarity::Similarity cell_similarity, const Quadrature< dim > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const =0
virtual void transform(const ArrayView< const Tensor< 2, dim > > &input, const MappingKind kind, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 2, spacedim > > &output) const =0
virtual boost::container::small_vector< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
virtual Point< spacedim > get_center(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const bool map_barycenter_of_reference_cell=true) const
virtual std::unique_ptr< InternalDataBase > get_face_data(const UpdateFlags update_flags, const hp::QCollection< dim - 1 > &quadrature) const
virtual std::unique_ptr< InternalDataBase > get_subface_data(const UpdateFlags update_flags, const Quadrature< dim - 1 > &quadrature) const =0
Definition point.h:111
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
#define DeclException0(Exception0)
Definition exceptions.h:466
static ::ExceptionBase & ExcDistortedMappedCell(Point< spacedim > arg1, double arg2, int arg3)
static ::ExceptionBase & ExcTransformationFailed()
#define DeclExceptionMsg(Exception, defaulttext)
Definition exceptions.h:489
static ::ExceptionBase & ExcInvalidData()
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition exceptions.h:557
UpdateFlags
MappingKind
Definition mapping.h:79
@ mapping_piola
Definition mapping.h:114
@ mapping_covariant_gradient
Definition mapping.h:100
@ mapping_covariant
Definition mapping.h:89
@ mapping_nedelec
Definition mapping.h:129
@ mapping_contravariant
Definition mapping.h:94
@ mapping_raviart_thomas
Definition mapping.h:134
@ mapping_contravariant_hessian
Definition mapping.h:156
@ mapping_covariant_hessian
Definition mapping.h:150
@ mapping_contravariant_gradient
Definition mapping.h:106
@ mapping_none
Definition mapping.h:84
@ mapping_bdm
Definition mapping.h:139
@ mapping_piola_gradient
Definition mapping.h:120
@ mapping_piola_hessian
Definition mapping.h:162
const Mapping< dim, spacedim > & get_default_linear_mapping(const Triangulation< dim, spacedim > &triangulation)
Definition mapping.cc:294
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation