Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
mapping.h
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 
22 #include <deal.II/base/derivative_form.h>
23 
24 #include <deal.II/fe/fe_update_flags.h>
25 
26 #include <deal.II/grid/tria.h>
27 
28 #include <array>
29 #include <cmath>
30 #include <memory>
31 
32 DEAL_II_NAMESPACE_OPEN
33 
34 template <typename ElementType, typename MemorySpaceType>
35 class ArrayView;
36 template <int dim>
37 class Quadrature;
38 template <int dim, int spacedim>
39 class FEValues;
40 template <int dim, int spacedim>
41 class FEValuesBase;
42 template <int dim, int spacedim>
43 class FEValues;
44 template <int dim, int spacedim>
45 class FEFaceValues;
46 template <int dim, int spacedim>
47 class FESubfaceValues;
48 
49 
62 {
67  mapping_none = 0x0000,
68 
73 
78 
84 
90 
97  mapping_piola = 0x0100,
98 
104 
112  mapping_nedelec = 0x0200,
113 
118 
123 
134 
140 
146 };
147 
148 
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 
364  virtual Point<spacedim>
366  const bool map_center_of_reference_cell = true) const;
367 
387  virtual BoundingBox<spacedim>
389  const typename Triangulation<dim, spacedim>::cell_iterator &cell) const;
390 
402  virtual bool
403  preserves_vertex_locations() const = 0;
404 
421  virtual Point<spacedim>
423  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
424  const Point<dim> & p) const = 0;
425 
454  virtual Point<dim>
456  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
457  const Point<spacedim> & p) const = 0;
458 
468  Point<dim - 1>
470  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
471  const unsigned int face_no,
472  const Point<spacedim> & p) const;
473 
488 
489 
499  "Computing the mapping between a real space point and a point in reference "
500  "space failed, typically because the given point lies outside the cell "
501  "where the inverse mapping is not unique.");
502 
512  double,
513  int,
514  << "The image of the mapping applied to cell with center ["
515  << arg1 << "] is distorted. The cell geometry or the "
516  << "mapping are invalid, giving a non-positive volume "
517  << "fraction of " << arg2 << " in quadrature point " << arg3
518  << ".");
519 
529 public:
596  {
597  public:
603 
607  InternalDataBase(const InternalDataBase &) = delete;
608 
612  virtual ~InternalDataBase() = default;
613 
629 
633  virtual std::size_t
634  memory_consumption() const;
635  };
636 
637 
638 protected:
662  virtual UpdateFlags
663  requires_update_flags(const UpdateFlags update_flags) const = 0;
664 
713  virtual std::unique_ptr<InternalDataBase>
714  get_data(const UpdateFlags update_flags,
715  const Quadrature<dim> &quadrature) const = 0;
716 
744  virtual std::unique_ptr<InternalDataBase>
745  get_face_data(const UpdateFlags update_flags,
746  const Quadrature<dim - 1> &quadrature) const = 0;
747 
776  virtual std::unique_ptr<InternalDataBase>
777  get_subface_data(const UpdateFlags update_flags,
778  const Quadrature<dim - 1> &quadrature) const = 0;
779 
865  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
866  const CellSimilarity::Similarity cell_similarity,
867  const Quadrature<dim> & quadrature,
868  const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
870  &output_data) const = 0;
871 
896  virtual void
898  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
899  const unsigned int face_no,
900  const Quadrature<dim - 1> & quadrature,
901  const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
903  &output_data) const = 0;
904 
931  virtual void
933  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
934  const unsigned int face_no,
935  const unsigned int subface_no,
936  const Quadrature<dim - 1> & quadrature,
937  const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
939  &output_data) const = 0;
940 
945 public:
1014  virtual void
1015  transform(const ArrayView<const Tensor<1, dim>> & input,
1016  const MappingType type,
1017  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1018  const ArrayView<Tensor<1, spacedim>> &output) const = 0;
1019 
1067  virtual void
1069  const MappingType type,
1070  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1071  const ArrayView<Tensor<2, spacedim>> &output) const = 0;
1072 
1125  virtual void
1126  transform(const ArrayView<const Tensor<2, dim>> & input,
1127  const MappingType type,
1128  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1129  const ArrayView<Tensor<2, spacedim>> &output) const = 0;
1130 
1172  virtual void
1174  const MappingType type,
1175  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1176  const ArrayView<Tensor<3, spacedim>> &output) const = 0;
1177 
1225  virtual void
1226  transform(const ArrayView<const Tensor<3, dim>> & input,
1227  const MappingType type,
1228  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1229  const ArrayView<Tensor<3, spacedim>> &output) const = 0;
1230 
1240  friend class FEValuesBase<dim, spacedim>;
1241  friend class FEValues<dim, spacedim>;
1242  friend class FEFaceValues<dim, spacedim>;
1243  friend class FESubfaceValues<dim, spacedim>;
1244 };
1245 
1246 
1247 DEAL_II_NAMESPACE_CLOSE
1248 
1249 #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
MappingType
Definition: mapping.h:61
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
virtual void transform(const ArrayView< const Tensor< 1, dim >> &input, const MappingType type, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 1, spacedim >> &output) const =0
static ::ExceptionBase & ExcDistortedMappedCell(Point< spacedim > arg1, double arg2, int arg3)
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: dof_tools.h:57
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
#define DeclException0(Exception0)
Definition: exceptions.h:473
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
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:564
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:628
virtual std::unique_ptr< InternalDataBase > get_data(const UpdateFlags update_flags, const Quadrature< dim > &quadrature) const =0