Reference documentation for deal.II version 9.0.0
mapping.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2000 - 2018 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 at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_mapping_h
17 #define dealii_mapping_h
18 
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/derivative_form.h>
22 #include <deal.II/grid/tria.h>
23 #include <deal.II/fe/fe_update_flags.h>
24 
25 #include <array>
26 #include <cmath>
27 #include <memory>
28 
29 DEAL_II_NAMESPACE_OPEN
30 
31 template <typename ElementType> class ArrayView;
32 template <int dim> class Quadrature;
33 template <int dim, int spacedim> class FEValues;
34 template <int dim, int spacedim> class FEValuesBase;
35 template <int dim, int spacedim> class FEValues;
36 template <int dim, int spacedim> class FEFaceValues;
37 template <int dim, int spacedim> class FESubfaceValues;
38 
39 
52 {
57  mapping_none = 0x0000,
58 
63 
68 
74 
80 
87  mapping_piola = 0x0100,
88 
94 
102  mapping_nedelec = 0x0200,
103 
108 
113 
124 
130 
136 };
137 
138 
287 template <int dim, int spacedim=dim>
288 class Mapping : public Subscriptor
289 {
290 public:
291 
295  virtual
296  ~Mapping () override = default;
297 
307  virtual
308  std::unique_ptr<Mapping<dim,spacedim>> clone () const = 0;
309 
324  virtual
325  std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
326  get_vertices (const typename Triangulation<dim,spacedim>::cell_iterator &cell) const;
327 
339  virtual
340  bool preserves_vertex_locations () const = 0;
341 
358  virtual
361  const Point<dim> &p) const = 0;
362 
391  virtual
392  Point<dim>
394  const Point<spacedim> &p) const = 0;
395 
405  Point<dim-1>
407  const unsigned int &face_no,
408  const Point<spacedim> &p) const;
409 
424 
425 
434  "Computing the mapping between a real space point and a point in reference "
435  "space failed, typically because the given point lies outside the cell "
436  "where the inverse mapping is not unique.");
437 
446  Point<spacedim>, double, int,
447  << "The image of the mapping applied to cell with center ["
448  << arg1 << "] is distorted. The cell geometry or the "
449  << "mapping are invalid, giving a non-positive volume "
450  << "fraction of " << arg2 << " in quadrature point "
451  << arg3 << ".");
452 
462 public:
529  {
530  public:
535  InternalDataBase ();
536 
540  InternalDataBase (const InternalDataBase &) = delete;
541 
545  virtual
546  ~InternalDataBase () = default;
547 
563 
567  virtual
568  std::size_t memory_consumption () const;
569  };
570 
571 
572 protected:
596  virtual
598  requires_update_flags (const UpdateFlags update_flags) const = 0;
599 
648  virtual
649  std::unique_ptr<InternalDataBase>
650  get_data (const UpdateFlags update_flags,
651  const Quadrature<dim> &quadrature) const = 0;
652 
680  virtual
681  std::unique_ptr<InternalDataBase>
682  get_face_data (const UpdateFlags update_flags,
683  const Quadrature<dim-1> &quadrature) const = 0;
684 
713  virtual
714  std::unique_ptr<InternalDataBase>
715  get_subface_data (const UpdateFlags update_flags,
716  const Quadrature<dim-1> &quadrature) const = 0;
717 
801  virtual
804  const CellSimilarity::Similarity cell_similarity,
805  const Quadrature<dim> &quadrature,
806  const typename Mapping<dim,spacedim>::InternalDataBase &internal_data,
808 
833  virtual
834  void
836  const unsigned int face_no,
837  const Quadrature<dim-1> &quadrature,
838  const typename Mapping<dim,spacedim>::InternalDataBase &internal_data,
840 
867  virtual
868  void
870  const unsigned int face_no,
871  const unsigned int subface_no,
872  const Quadrature<dim-1> &quadrature,
873  const typename Mapping<dim,spacedim>::InternalDataBase &internal_data,
875 
880 public:
881 
949  virtual
950  void
951  transform (const ArrayView<const Tensor<1,dim> > &input,
952  const MappingType type,
953  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
954  const ArrayView<Tensor<1,spacedim> > &output) const = 0;
955 
1002  virtual
1003  void
1005  const MappingType type,
1006  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
1007  const ArrayView<Tensor<2,spacedim> > &output) const = 0;
1008 
1060  virtual
1061  void
1062  transform (const ArrayView<const Tensor<2, dim> > &input,
1063  const MappingType type,
1064  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
1065  const ArrayView<Tensor<2,spacedim> > &output) const = 0;
1066 
1106  virtual
1107  void
1109  const MappingType type,
1110  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
1111  const ArrayView<Tensor<3,spacedim> > &output) const = 0;
1112 
1160  virtual
1161  void
1162  transform (const ArrayView<const Tensor<3, dim> > &input,
1163  const MappingType type,
1164  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
1165  const ArrayView<Tensor<3,spacedim> > &output) const = 0;
1166 
1176  friend class FEValuesBase<dim,spacedim>;
1177  friend class FEValues<dim,spacedim>;
1178  friend class FEFaceValues<dim,spacedim>;
1179  friend class FESubfaceValues<dim,spacedim>;
1180 };
1181 
1182 
1183 DEAL_II_NAMESPACE_CLOSE
1184 
1185 #endif
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 & ExcTransformationFailed()
virtual ~InternalDataBase()=default
MappingType
Definition: mapping.h:51
virtual std::size_t memory_consumption() const
Definition: mapping.cc:86
virtual std::array< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
Definition: mapping.cc:25
virtual ~Mapping() override=default
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)
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< Mapping< dim, spacedim > > clone() const =0
UpdateFlags
Abstract base class for mapping classes.
Definition: dof_tools.h:46
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:335
#define DeclException0(Exception0)
Definition: exceptions.h:323
virtual std::unique_ptr< InternalDataBase > get_subface_data(const UpdateFlags update_flags, const Quadrature< dim-1 > &quadrature) const =0
static ::ExceptionBase & ExcInvalidData()
virtual std::unique_ptr< InternalDataBase > get_face_data(const UpdateFlags update_flags, const Quadrature< dim-1 > &quadrature) const =0
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:40
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 UpdateFlags requires_update_flags(const UpdateFlags update_flags) const =0
Definition: fe.h:33
virtual bool preserves_vertex_locations() 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 =0
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:370
virtual Point< spacedim > transform_unit_to_real_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< dim > &p) const =0
UpdateFlags update_each
Definition: mapping.h:562
virtual std::unique_ptr< InternalDataBase > get_data(const UpdateFlags update_flags, const Quadrature< dim > &quadrature) const =0