Reference documentation for deal.II version Git 6a05540 2018-06-21 10:59:02 -0400
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.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>
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 
350  virtual bool
351  preserves_vertex_locations() const = 0;
352 
369  virtual Point<spacedim>
371  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
372  const Point<dim> & p) const = 0;
373 
402  virtual Point<dim>
404  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
405  const Point<spacedim> & p) const = 0;
406 
416  Point<dim - 1>
418  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
419  const unsigned int & face_no,
420  const Point<spacedim> & p) const;
421 
436 
437 
447  "Computing the mapping between a real space point and a point in reference "
448  "space failed, typically because the given point lies outside the cell "
449  "where the inverse mapping is not unique.");
450 
460  double,
461  int,
462  << "The image of the mapping applied to cell with center ["
463  << arg1 << "] is distorted. The cell geometry or the "
464  << "mapping are invalid, giving a non-positive volume "
465  << "fraction of " << arg2 << " in quadrature point " << arg3
466  << ".");
467 
477 public:
544  {
545  public:
551 
555  InternalDataBase(const InternalDataBase &) = delete;
556 
560  virtual ~InternalDataBase() = default;
561 
577 
581  virtual std::size_t
582  memory_consumption() const;
583  };
584 
585 
586 protected:
610  virtual UpdateFlags
611  requires_update_flags(const UpdateFlags update_flags) const = 0;
612 
661  virtual std::unique_ptr<InternalDataBase>
662  get_data(const UpdateFlags update_flags,
663  const Quadrature<dim> &quadrature) const = 0;
664 
692  virtual std::unique_ptr<InternalDataBase>
693  get_face_data(const UpdateFlags update_flags,
694  const Quadrature<dim - 1> &quadrature) const = 0;
695 
724  virtual std::unique_ptr<InternalDataBase>
725  get_subface_data(const UpdateFlags update_flags,
726  const Quadrature<dim - 1> &quadrature) const = 0;
727 
813  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
814  const CellSimilarity::Similarity cell_similarity,
815  const Quadrature<dim> & quadrature,
816  const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
818  &output_data) const = 0;
819 
844  virtual void
846  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
847  const unsigned int face_no,
848  const Quadrature<dim - 1> & quadrature,
849  const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
851  &output_data) const = 0;
852 
879  virtual void
881  const typename Triangulation<dim, spacedim>::cell_iterator &cell,
882  const unsigned int face_no,
883  const unsigned int subface_no,
884  const Quadrature<dim - 1> & quadrature,
885  const typename Mapping<dim, spacedim>::InternalDataBase & internal_data,
887  &output_data) const = 0;
888 
893 public:
962  virtual void
963  transform(const ArrayView<const Tensor<1, dim>> & input,
964  const MappingType type,
965  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
966  const ArrayView<Tensor<1, spacedim>> &output) const = 0;
967 
1015  virtual void
1017  const MappingType type,
1018  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1019  const ArrayView<Tensor<2, spacedim>> &output) const = 0;
1020 
1073  virtual void
1074  transform(const ArrayView<const Tensor<2, dim>> & input,
1075  const MappingType type,
1076  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1077  const ArrayView<Tensor<2, spacedim>> &output) const = 0;
1078 
1120  virtual void
1122  const MappingType type,
1123  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1124  const ArrayView<Tensor<3, spacedim>> &output) const = 0;
1125 
1173  virtual void
1174  transform(const ArrayView<const Tensor<3, dim>> & input,
1175  const MappingType type,
1176  const typename Mapping<dim, spacedim>::InternalDataBase &internal,
1177  const ArrayView<Tensor<3, spacedim>> &output) const = 0;
1178 
1188  friend class FEValuesBase<dim, spacedim>;
1189  friend class FEValues<dim, spacedim>;
1190  friend class FEFaceValues<dim, spacedim>;
1191  friend class FESubfaceValues<dim, spacedim>;
1192 };
1193 
1194 
1195 DEAL_II_NAMESPACE_CLOSE
1196 
1197 #endif
static::ExceptionBase & ExcTransformationFailed()
virtual std::array< Point< spacedim >, GeometryInfo< dim >::vertices_per_cell > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
Definition: mapping.cc:26
virtual ~InternalDataBase()=default
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 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
MappingType
Definition: mapping.h:61
virtual ~Mapping() override=default
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
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)
UpdateFlags
Abstract base class for mapping classes.
Definition: dof_tools.h:57
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:397
#define DeclException0(Exception0)
Definition: exceptions.h:385
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
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const =0
Definition: fe.h:36
virtual std::size_t memory_consumption() const
Definition: mapping.cc:86
virtual bool preserves_vertex_locations() const =0
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:432
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 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:576
virtual std::unique_ptr< InternalDataBase > get_data(const UpdateFlags update_flags, const Quadrature< dim > &quadrature) const =0