Reference documentation for deal.II version Git 4abc4a1666 2020-07-04 19:58:34 +0200
\(\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\}}\)
mapping.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2000 - 2019 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_mapping_h
17 #define dealii_mapping_h
18 
19 
20 #include <deal.II/base/config.h>
21 
24 
26 
27 #include <deal.II/grid/tria.h>
28 
29 #include <array>
30 #include <cmath>
31 #include <memory>
32 
34 
35 template <typename ElementType, typename MemorySpaceType>
36 class ArrayView;
37 template <int dim>
38 class Quadrature;
39 template <int dim, int spacedim>
40 class FEValues;
41 template <int dim, int spacedim>
42 class FEValuesBase;
43 template <int dim, int spacedim>
44 class FEValues;
45 template <int dim, int spacedim>
46 class FEFaceValues;
47 template <int dim, int spacedim>
48 class FESubfaceValues;
49 
50 
63 {
68  mapping_none = 0x0000,
69 
74 
79 
85 
91 
98  mapping_piola = 0x0100,
99 
105 
113  mapping_nedelec = 0x0200,
114 
119 
124 
135 
141 
147 };
148 
149 
300 template <int dim, int spacedim = dim>
301 class Mapping : public Subscriptor
302 {
303 public:
307  virtual ~Mapping() override = default;
308 
318  virtual std::unique_ptr<Mapping<dim, spacedim>>
319  clone() const = 0;
320 
335  virtual std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
336  get_vertices(
337  const typename Triangulation<dim, spacedim>::cell_iterator &cell) const;
338 
362  virtual Point<spacedim>
364  const bool map_center_of_reference_cell = true) const;
365 
383  virtual BoundingBox<spacedim>
385  const typename Triangulation<dim, spacedim>::cell_iterator &cell) const;
386 
398  virtual bool
399  preserves_vertex_locations() const = 0;
400 
417  virtual Point<spacedim>
419  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
420  const Point<dim> & p) const = 0;
421 
450  virtual Point<dim>
452  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
453  const Point<spacedim> & p) const = 0;
454 
465  Point<dim - 1>
467  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
468  const unsigned int face_no,
469  const Point<spacedim> & p) const;
470 
485 
486 
496  "Computing the mapping between a real space point and a point in reference "
497  "space failed, typically because the given point lies outside the cell "
498  "where the inverse mapping is not unique.");
499 
509  double,
510  int,
511  << "The image of the mapping applied to cell with center ["
512  << arg1 << "] is distorted. The cell geometry or the "
513  << "mapping are invalid, giving a non-positive volume "
514  << "fraction of " << arg2 << " in quadrature point " << arg3
515  << ".");
516 
526 public:
593  {
594  public:
600 
604  InternalDataBase(const InternalDataBase &) = delete;
605 
609  virtual ~InternalDataBase() = default;
610 
626 
630  virtual std::size_t
631  memory_consumption() const;
632  };
633 
634 
635 protected:
659  virtual UpdateFlags
660  requires_update_flags(const UpdateFlags update_flags) const = 0;
661 
710  virtual std::unique_ptr<InternalDataBase>
711  get_data(const UpdateFlags update_flags,
712  const Quadrature<dim> &quadrature) const = 0;
713 
741  virtual std::unique_ptr<InternalDataBase>
742  get_face_data(const UpdateFlags update_flags,
743  const Quadrature<dim - 1> &quadrature) const = 0;
744 
773  virtual std::unique_ptr<InternalDataBase>
774  get_subface_data(const UpdateFlags update_flags,
775  const Quadrature<dim - 1> &quadrature) const = 0;
776 
862  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
863  const CellSimilarity::Similarity cell_similarity,
864  const Quadrature<dim> & quadrature,
865  const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
867  &output_data) const = 0;
868 
893  virtual void
895  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
896  const unsigned int face_no,
897  const Quadrature<dim - 1> & quadrature,
898  const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
900  &output_data) const = 0;
901 
928  virtual void
930  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
931  const unsigned int face_no,
932  const unsigned int subface_no,
933  const Quadrature<dim - 1> & quadrature,
934  const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
936  &output_data) const = 0;
937 
942 public:
1011  virtual void
1012  transform(const ArrayView<const Tensor<1, dim>> & input,
1013  const MappingKind kind,
1014  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1015  const ArrayView<Tensor<1, spacedim>> &output) const = 0;
1016 
1064  virtual void
1066  const MappingKind kind,
1067  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1068  const ArrayView<Tensor<2, spacedim>> &output) const = 0;
1069 
1122  virtual void
1123  transform(const ArrayView<const Tensor<2, dim>> & input,
1124  const MappingKind kind,
1125  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1126  const ArrayView<Tensor<2, spacedim>> &output) const = 0;
1127 
1169  virtual void
1171  const MappingKind kind,
1172  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1173  const ArrayView<Tensor<3, spacedim>> &output) const = 0;
1174 
1222  virtual void
1223  transform(const ArrayView<const Tensor<3, dim>> & input,
1224  const MappingKind kind,
1225  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1226  const ArrayView<Tensor<3, spacedim>> &output) const = 0;
1227 
1233  // Give class @p FEValues access to the private <tt>get_...data</tt> and
1234  // <tt>fill_fe_...values</tt> functions.
1235  friend class FEValuesBase<dim, spacedim>;
1236  friend class FEValues<dim, spacedim>;
1237  friend class FEFaceValues<dim, spacedim>;
1238  friend class FESubfaceValues<dim, spacedim>;
1239 };
1240 
1241 
1243 
1244 #endif
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
Definition: mapping.cc:81
virtual std::unique_ptr< InternalDataBase > get_subface_data(const UpdateFlags update_flags, const Quadrature< dim - 1 > &quadrature) const =0
static ::ExceptionBase & ExcTransformationFailed()
virtual ~InternalDataBase()=default
virtual Point< spacedim > get_center(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const bool map_center_of_reference_cell=true) const
Definition: mapping.cc:43
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 std::size_t memory_consumption() const
Definition: mapping.cc:130
virtual std::array< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
Definition: mapping.cc:28
virtual ~Mapping() override=default
virtual std::unique_ptr< InternalDataBase > get_face_data(const UpdateFlags update_flags, const Quadrature< dim - 1 > &quadrature) const =0
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const =0
static ::ExceptionBase & ExcDistortedMappedCell(Point< spacedim > arg1, double arg2, int arg3)
MappingKind
Definition: mapping.h:62
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 =0
UpdateFlags
Abstract base class for mapping classes.
Definition: mapping.h:301
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:493
#define DeclException0(Exception0)
Definition: exceptions.h:470
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:363
static ::ExceptionBase & ExcInvalidData()
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 BoundingBox< spacedim > get_bounding_box(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
Definition: mapping.cc:68
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:362
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const =0
Definition: fe.h:38
virtual bool preserves_vertex_locations() const =0
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:561
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 Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const =0
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const =0
UpdateFlags update_each
Definition: mapping.h:625
virtual std::unique_ptr< InternalDataBase > get_data(const UpdateFlags update_flags, const Quadrature< dim > &quadrature) const =0